[clang] [llvm] [HLSL] Explicitly set the SPIR-V version with spv-target-env (PR #121961)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 02:49:14 PST 2025
================
@@ -1468,9 +1468,14 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
// Set specific Vulkan version if applicable.
if (const Arg *A = Args.getLastArg(options::OPT_fspv_target_env_EQ)) {
- const llvm::StringSet<> ValidValues = {"vulkan1.2", "vulkan1.3"};
- if (ValidValues.contains(A->getValue())) {
- T.setOSName(A->getValue());
+ const llvm::StringMap<llvm::Triple::SubArchType> ValidTargets = {
+ {"vulkan1.2", llvm::Triple::SPIRVSubArch_v15},
+ {"vulkan1.3", llvm::Triple::SPIRVSubArch_v16}};
+
+ auto TargetInfo = ValidTargets.find(A->getValue());
+ if (TargetInfo != ValidTargets.end()) {
----------------
Keenuts wrote:
Does this means we won't be able to do something like `spirv1.4-unknown-vulkan1.2-compute'? (Or the opposite)
https://github.com/llvm/llvm-project/pull/121961
More information about the llvm-commits
mailing list