[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 23 04:11:50 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:
The new approach I just added shouldn'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