Open asudarsa opened 4 months ago
A well-rounded solution is available in https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/2525
The root cause in this issue is that the OCLIsBuiltin identifies any function name that ‘might’ be a OCL builtin name. In his case, the demangled name was ‘atomic_fetch_and_add_uint32_explicit’ and this name was not found in the OCLSPIRVBuiltinMap. If we directly call OCLSPIRVBuiltinMap::map, it does the following:
Thanks
Existing checks in OCLIsBuiltin(...) function are not sufficient to identify OpenCL builtins correctly. There is a possibility that user can define/declare functions with names that could cause them to be identified as OpenCL builtins.
An LLVM IR test that showcases this issue has been added as part of an ongoing PR: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/2512/files#diff-7bb994ec5258f2246431ab51bfff2ff1643b801fefdd7a498c666ba5c1480ac4
Without the fix in this PR (https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/2512), this test will fail.
The above PR addresses user-defined functions. However, we do not currently have a resolution for user-declared functions.
Thanks