[llvm] [SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. (PR #129689)
Alexey Bader via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 13:40:48 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(); }
----------------
bader wrote:
Can it be done in less intrusive way e.g. by requiring vulkan OS in the target triple?
If OS target triple is not Vulkan, the environment is set to OpenCL.
This way, we won't break the existing interface for FEs using "unknown" OS type to target OpenCL environment.
https://github.com/llvm/llvm-project/pull/129689
More information about the llvm-commits
mailing list