[clang] [llvm] Make OpenCL an OSType rather than an EnvironmentType. (PR #170297)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 9 02:09:38 PST 2026
Keenuts wrote:
> > SPIR-V modules targeting Kernel/OpenCL can have arbitrary control flows, and generic pointers.
>
> This sounds more like a top level target difference. As for naming, would kernel be more appropriate than OpenCL?
- SPIR-V spec: OpCapability Shader requires structured CFG
- Vulkan spec: Shader capability is allowed, Kernel is not.
So VK requires Shader, Shader requires Logical & structured CFG
- BUT: VK forbids static recursion while SPIR-V spec makes no mention of it.
So at least for this part, Vulkan is not strictly equivalent to Shader.
- SPIR-V spec: Kernel means unstructured CFG, but requires unsigned integers.
- OpenCL spec: execution must be Kernel
So OpenCL requires Kernel, Kernel allows unstructured CFG and requires unsigned int.
- SPIR-V spec doesn't tie Kernel to a specific addressing model
- BUT: OpenCL validation rules require Physical32 or Physical64
So it seems similarly to Vulkan, OpenCL != Kernel.
Given OpenCL implies Kernel, and Vulkan implies Shader, it seems to me we should be exposing OpenCL and Vulkan in the triple, but not necessarily Kernel/Shader as those are incomplete to generate usable SPIR-V module (even if valid in the SPIR-V spec world)
https://github.com/llvm/llvm-project/pull/170297
More information about the cfe-commits
mailing list