[Mlir-commits] [mlir] [MLIR][GPUToLLVMSPV] Fix subgroup ops mangling (PR #126111)

Vyacheslav Levytskyy llvmlistbot at llvm.org
Mon Feb 17 04:37:35 PST 2025


VyacheslavLevytskyy wrote:

@akroviakov I understand a rationale behind using an exact mangled name of a bultin in the version that a target environment recognizes. You wouldn't rely on a middleware SPIR-V encoding layer then, and the function call is passing over the SPIR-V backend business logic. However, the root cause of this PR's problem is not mangling but the fact that this builtin was not known to the SPIR-V backend. Please have a look to https://github.com/llvm/llvm-project/pull/127242 -- it add support for this and more OpenCL builtins, so that your lowering should work properly now in either of 3 forms:
 %r = tail call spir_func i32 @get_sub_group_local_id()
or
 %r = tail call spir_func i32 @_Z22get_sub_group_local_id()
or
 %r = tail call spir_func i32 @_Z22get_sub_group_local_idv()

In other words, after https://github.com/llvm/llvm-project/pull/127242 you no longer need to rely on the exact mangled name, the SPIR-V backend will now correctly recognize and map such OpenCL builtins (https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#_built_in_variables) to SPIR-V builtin variables (https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_builtin).

https://github.com/llvm/llvm-project/pull/126111


More information about the Mlir-commits mailing list