[llvm] [SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. (PR #129689)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 05:07:14 PDT 2025
================
@@ -267,14 +267,42 @@ static SPIRVType *getArgSPIRVType(const Function &F, unsigned ArgIdx,
static SPIRV::ExecutionModel::ExecutionModel
getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
+ // FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
+ // `isVulkanEnv()` return true. This is because the Triple is not always
+ // precise enough. For now, we'll rely instead on `isLogicalSPIRV()`, but this
+ // should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
+ // at the same time.
----------------
Keenuts wrote:
```cpp
SPIRVEnvType getEnv() const { return Env; }
bool isOpenCLEnv() const { return getEnv() == OpenCL; }
bool isVulkanEnv() const { return getEnv() == Vulkan; }
```
Env being an enum, not a bitmask, either both return false when `getEnv()` is Unknown or they are exclusive, or am I misreading something?
https://github.com/llvm/llvm-project/pull/129689
More information about the llvm-commits
mailing list