@@ -618,17 +618,25 @@ operation_identity(::Val{:max}, dtype, ::Type{T}) where T <: Integer =
618618 IntegerIdentityOp (to_uint128 (typemin (T)), dtype, T)
619619
620620#= ============================================================================#
621- # Reduce Body Operations - dispatch on Val{fn} and elem_type
621+ # Reduce Body Operations
622622#= ============================================================================#
623623
624- encode_reduce_body (cb, type, acc, elem, :: Val{:add} , :: Type{T} ) where T <: AbstractFloat =
625- encode_AddFOp! (cb, type, acc, elem)
626- encode_reduce_body (cb, type, acc, elem, :: Val{:max} , :: Type{T} ) where T <: AbstractFloat =
627- encode_MaxFOp! (cb, type, acc, elem)
628- encode_reduce_body (cb, type, acc, elem, :: Val{:add} , :: Type{T} ) where T <: Integer =
629- encode_AddIOp! (cb, type, acc, elem)
630- encode_reduce_body (cb, type, acc, elem, :: Val{:max} , :: Type{T} ) where T <: Integer =
631- encode_MaxIOp! (cb, type, acc, elem; signedness= T <: Signed ? SignednessSigned : SignednessUnsigned)
624+ function encode_reduce_body (cb, type, acc, elem, op:: Val , :: Type{T} ) where T
625+ if T <: AbstractFloat
626+ if op == Val{:add }
627+ encode_AddFOp! (cb, type, acc, elem)
628+ else # Val{:max}
629+ encode_MaxFOp! (cb, type, acc, elem)
630+ end
631+ else # Integer
632+ signedness = T <: Signed ? SignednessSigned : SignednessUnsigned
633+ if op == Val{:add }
634+ encode_AddIOp! (cb, type, acc, elem)
635+ else # Val{:max}
636+ encode_MaxIOp! (cb, type, acc, elem; signedness)
637+ end
638+ end
639+ end
632640
633641
634642# cuda_tile.reshape
0 commit comments