[llvm] [SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. (PR #129689)
Marcos Maronas via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 03:50:04 PDT 2025
================
@@ -78,14 +78,10 @@ class SPIRVSubtarget : public SPIRVGenSubtargetInfo {
unsigned getPointerSize() const { return PointerSize; }
unsigned getBound() const { return GR->getBound(); }
bool canDirectlyComparePointers() const;
- // TODO: this environment is not implemented in Triple, we need to decide
- // how to standardize its support. For now, let's assume SPIR-V with physical
- // addressing is OpenCL, and Logical addressing is Vulkan.
bool isOpenCLEnv() const {
- return TargetTriple.getArch() == Triple::spirv32 ||
- TargetTriple.getArch() == Triple::spirv64;
+ return TargetTriple.getEnvironment() == Triple::OpenCL;
}
- bool isVulkanEnv() const { return TargetTriple.getArch() == Triple::spirv; }
+ bool isVulkanEnv() const { return !isOpenCLEnv(); }
----------------
maarquitos14 wrote:
One of the things that we would like to fix is the fact that Vulkan/Shader environment can also be for a physical target (spirv32, spirv64). In other words, although _de facto_ every physical SPIRV is Compute, and every logical SPIRV is Shader, that is not a requirement from the spec, so we should be able to support logical SPIRV for Compute and physical SPIRV for Shader.
https://github.com/llvm/llvm-project/pull/129689
More information about the llvm-commits
mailing list