Skip to content

Commit dbbd41a

Browse files
committed
[GPU] Fix ambiguous fmin/fmax calls for unsigned integer types in eltwise kernel
Fixes #33618 When MIN/MAX eltwise operations are used with UINT8/UINT16/UINT32 inputs, the generated OpenCL kernel incorrectly used fmin/fmax functions which are only defined for floating-point types, causing compilation errors: 'call to fmin/fmax is ambiguous'. This fix adds UINT8, UINT16, UINT32, and INT16 to the integer type checks, ensuring that OpenCL's min/max functions (which support integer types) are used instead of fmin/fmax. This bug affects ONNX Clip operations (opset 11+) which are lowered to Maximum + Minimum operations in OpenVINO.
1 parent 608e396 commit dbbd41a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_base.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,20 @@ JitConstants EltwiseKernelBase::GetOperationsJitConstants(const eltwise_params&
241241
auto input_0_type = params.inputs[0].GetDType();
242242
auto input_1_type = params.inputs[1].GetDType();
243243

244+
auto is_integer_type = [](kernel_selector::Datatype dt) {
245+
return dt == kernel_selector::Datatype::INT8 ||
246+
dt == kernel_selector::Datatype::UINT8 ||
247+
dt == kernel_selector::Datatype::INT16 ||
248+
dt == kernel_selector::Datatype::UINT16 ||
249+
dt == kernel_selector::Datatype::INT32 ||
250+
dt == kernel_selector::Datatype::UINT32 ||
251+
dt == kernel_selector::Datatype::INT64;
252+
};
253+
244254
// input_0 == int
245-
if (input_0_type == kernel_selector::Datatype::INT8 ||
246-
input_0_type == kernel_selector::Datatype::INT32 ||
247-
input_0_type == kernel_selector::Datatype::INT64) {
255+
if (is_integer_type(input_0_type)) {
248256
// input_0 == int && input_1 == int
249-
if (input_1_type == kernel_selector::Datatype::INT8 ||
250-
input_1_type == kernel_selector::Datatype::INT32 ||
251-
input_1_type == kernel_selector::Datatype::INT64) {
257+
if (is_integer_type(input_1_type)) {
252258
if (ew.mode == EltwiseMode::MODULU)
253259
op += input0_str + " % " + input1_str;
254260
else
@@ -257,9 +263,7 @@ JitConstants EltwiseKernelBase::GetOperationsJitConstants(const eltwise_params&
257263
// input_0 == int && input_1 != int
258264
op += cast_type + "f" + mode + "(convert_float(" + input0_str + "), " + input1_str + ")";
259265
}
260-
} else if (input_1_type == kernel_selector::Datatype::INT8 ||
261-
input_1_type == kernel_selector::Datatype::INT32 ||
262-
input_1_type == kernel_selector::Datatype::INT64) {
266+
} else if (is_integer_type(input_1_type)) {
263267
// input_0 != int && input_1 == int
264268
op += cast_type + "f" + mode + "(" + input0_str + ", convert_float(" + input1_str + "))";
265269
} else {

0 commit comments

Comments
 (0)