[clang] [llvm] Make OpenCL an OSType rather than an EnvironmentType. (PR #170297)
Alexey Bader via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 11:15:03 PST 2025
bader wrote:
> > SPIR-V differences between OpenCL and Vulkan execution environments.
>
> In what way are these different program-visible execution environments? I would hope vendors would implement a common ABI. If there are, I would expect the name to be something reflecting that implementation ABI, not the language?
>
> e.g., the mistake we made here was having different kernel argument layouts for OpenCL, and later fixed that
These environments put incompatible restrictions on SPIR-V instructions.
Here is an empty OpenCL kernel compiled to SPIR-V format by clpsv (for Vulkan execution environment) and clang (for OpenCL execution environment) - https://godbolt.org/z/9b49srbWb.
Vulkan environment requires SPIR-V module to declare `OpCapability Shader` whereas OpenCL environment requires SPIR-V to declare `OpCapability Kernel`. There are a lot of other differences like this described in specifications for [SPIR-V format](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html), [Vulkan environment](https://docs.vulkan.org/spec/latest/appendices/spirvenv.html) and [OpenCL environment](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html).
@maarquitos14, @MrSidims and @Keenuts, please, help with clarifying how the difference in SPIR-V validation rules for OpenCL and Vulkan execution environments impacts the SPIR-V backend.
https://github.com/llvm/llvm-project/pull/170297
More information about the llvm-commits
mailing list