compute-runtime icon indicating copy to clipboard operation
compute-runtime copied to clipboard

__opencl_c_integer_dot_product_input_4x8bit / __opencl_c_integer_dot_product_input_4x8bit_packed feature macros are always enabled, even on unsupported devices

Open ProjectPhysX opened this issue 9 months ago • 6 comments

isDotIntegerProductExtensionSupported() always returns true, which is incorrect. It leads to the __opencl_c_integer_dot_product_input_4x8bit / __opencl_c_integer_dot_product_input_4x8bit_packed feature macros always being present, even on unsupported devices.

This means: If any OpenCL application implements dp4a with checks for __opencl_c_integer_dot_product_input_4x8bit / __opencl_c_integer_dot_product_input_4x8bit_packed feature macros to see of dot()/dot_acc_sat() functions are available, the application will instantly be broken on all older unsupported Intel platforms - compiling will just fail because dot()/dot_acc_sat() functions will be exposed by false feature macros but are not actually supported by compiler.

This is especially important to fix on legacy driver too.

Please fix!

ProjectPhysX avatar Mar 12 '25 09:03 ProjectPhysX

@ProjectPhysX

This is especially important to fix on legacy driver too.

For legacy platforms (pre-gen12) the function returns false: https://github.com/intel/compute-runtime/blob/releases/24.35/shared/source/helpers/compiler_product_helper_bdw_to_icllp.inl#L14

JablonskiMateusz avatar Apr 16 '25 08:04 JablonskiMateusz

Hi @JablonskiMateusz,

I am observing that on Intel UHD 630 (i7-8700K) with driver 31.0.101.2134 (Windows), the __opencl_c_integer_dot_product_input_4x8bit and __opencl_c_integer_dot_product_input_4x8bit_packed feature macros are both present, despite lack of dp4a support. How is this possible? Error message is error: undefined reference to '__builtin_spirv_OpDot_v4i8_v4i8' in function: '__builtin_spirv_OpDot_v4i8_v4i8' called by kernel: 'dp4a_kernel' error: backend compiler failed build.

Regards, Moritz

ProjectPhysX avatar Apr 26 '25 08:04 ProjectPhysX

@ProjectPhysX could you please share output from clinfo?

pwilma avatar Oct 01 '25 09:10 pwilma

@pwilma https://opencl.gpuinfo.org/displayreport.php?id=4591

ProjectPhysX avatar Oct 01 '25 14:10 ProjectPhysX

@ProjectPhysX where do you see the __opencl_c_integer_dot_product_input_4x8bit / __opencl_c_integer_dot_product_input_4x8bit_packed extensions exposed? Image

clinfo reports all the OCL C extensions exposed by driver

JablonskiMateusz avatar Oct 02 '25 09:10 JablonskiMateusz

@JablonskiMateusz in the OpenCL C code, put a

#if defined(__opencl_c_integer_dot_product_input_4x8bit)
...
#endif

and the code inside will be executed on UHD 630. The __opencl_c_integer_dot_product_input_4x8bit / __opencl_c_integer_dot_product_input_4x8bit_packed feature macros are present but should not be present.

As a reproducer:

  1. Clone https://github.com/ProjectPhysX/OpenCL-Benchmark
  2. Comment out my workaround for the Intel bug here.
  3. Run on UHD 630. This line will try to execute, and you will see the compiler error error: undefined reference to '__builtin_spirv_OpDot_v4i8_v4i8' in function: '__builtin_spirv_OpDot_v4i8_v4i8' called by kernel: 'dp4a_kernel' error: backend compiler failed build..

ProjectPhysX avatar Oct 02 '25 11:10 ProjectPhysX