[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
Tue May 27 05:54:25 PDT 2025
================
@@ -83,6 +83,14 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
}
OpenCLVersion = VersionTuple(2, 2);
+ // Set the environment based on the target triple.
+ if (TargetTriple.getOS() == Triple::Vulkan)
+ Env = Shader;
+ else if (TargetTriple.getEnvironment() == Triple::OpenCL)
+ Env = Kernel;
+ else
+ Env = Unknown;
----------------
Keenuts wrote:
Since most of the code is `if Kerne/Shader else`, then I'd say leaving unknown as a selected value would be very uncertain.
I'd also be in favor of a louder error, like an `report_fatal_error`
https://github.com/llvm/llvm-project/pull/129689
More information about the llvm-commits
mailing list