[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 10:27:17 PDT 2024
================
@@ -98,9 +103,47 @@ std::optional<std::string> tryParseProfile(StringRef Profile) {
else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor))
return std::nullopt;
- // dxil-unknown-shadermodel-hull
+ // Determine DXIL version number using the minor version number of Shader
+ // Model version specified in target profile. Prior to decoupling DXIL version
+ // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 6.Y.
+ // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull
llvm::Triple T;
- T.setArch(Triple::ArchType::dxil);
+ Triple::SubArchType SubArch = llvm::Triple::NoSubArch;
+ switch (Minor) {
+ case 0:
+ SubArch = llvm::Triple::DXILSubArch_v1_0;
+ break;
+ case 1:
+ SubArch = llvm::Triple::DXILSubArch_v1_1;
+ break;
+ case 2:
+ SubArch = llvm::Triple::DXILSubArch_v1_2;
+ break;
+ case 3:
+ SubArch = llvm::Triple::DXILSubArch_v1_3;
+ break;
+ case 4:
+ SubArch = llvm::Triple::DXILSubArch_v1_4;
+ break;
+ case 5:
+ SubArch = llvm::Triple::DXILSubArch_v1_5;
+ break;
+ case 6:
+ SubArch = llvm::Triple::DXILSubArch_v1_6;
+ break;
+ case 7:
+ SubArch = llvm::Triple::DXILSubArch_v1_7;
+ break;
+ case 8:
+ case OfflineLibMinor:
+ // Always consider minor version x as the latest supported minor version
+ SubArch = llvm::Triple::DXILSubArch_v1_8;
----------------
bogner wrote:
It might make updates here less error prone if we added `DXILSubArch_v1_x = DXILSubArch_v1_8` or `LastDXILSubArch = DXILSubArch_v1_8` to the enum in Triple.h, depending on which of those makes more logical sense.
https://github.com/llvm/llvm-project/pull/89823
More information about the llvm-commits
mailing list