[clang] [llvm] [HLSL][RootSignature] Add `hlsl-rootsig-ver` option to specify root signature version (PR #144813)
Finn Plummer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 20 16:04:16 PDT 2025
https://github.com/inbelic updated https://github.com/llvm/llvm-project/pull/144813
>From fde2b30c27744d58d0b7f40965324c090cdf1277 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 21:47:31 +0000
Subject: [PATCH 01/13] define root signature versions
---
llvm/include/llvm/Support/DXILABI.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/llvm/include/llvm/Support/DXILABI.h b/llvm/include/llvm/Support/DXILABI.h
index b479f7c73eba3..89bf707c205f3 100644
--- a/llvm/include/llvm/Support/DXILABI.h
+++ b/llvm/include/llvm/Support/DXILABI.h
@@ -99,6 +99,12 @@ enum class SamplerFeedbackType : uint32_t {
const unsigned MinWaveSize = 4;
const unsigned MaxWaveSize = 128;
+// D3D_ROOT_SIGNATURE_VERSION
+enum class RootSignatureVersion {
+ rootsig_1_0 = 0x1,
+ rootsig_1_1 = 0x2,
+};
+
} // namespace dxil
} // namespace llvm
>From 8c2fd9607e66d6f9fd83b333d65804732746503f Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:41:36 +0000
Subject: [PATCH 02/13] define hlsl-rootsig-ver for the clang/cc1/dxc drivers
- allow for fall-through from dxcoptions to cc1 options
- defined as a langopts and only allow when we are compiling HLSL
---
clang/include/clang/Basic/LangOptions.h | 5 +++++
clang/include/clang/Driver/Options.td | 9 +++++++++
clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
clang/lib/Frontend/CompilerInvocation.cpp | 4 ++++
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 491e8bee9fd5c..6442492d104b9 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -24,6 +24,7 @@
#include "clang/Basic/Visibility.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/DXILABI.h"
#include "llvm/TargetParser/Triple.h"
#include <optional>
#include <string>
@@ -623,6 +624,10 @@ class LangOptions : public LangOptionsBase {
// implementation on real-world examples.
std::string OpenACCMacroOverride;
+ /// The HLSL root signature version for dxil.
+ llvm::dxil::RootSignatureVersion HLSLRootSigVer =
+ llvm::dxil::RootSignatureVersion::rootsig_1_1;
+
// Indicates if the wasm-opt binary must be ignored in the case of a
// WebAssembly target.
bool NoWasmOpt = false;
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 0ffd8c40da7da..141d80e786a0c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9288,6 +9288,15 @@ def fcgl : DXCFlag<"fcgl">, Alias<emit_pristine_llvm>;
def enable_16bit_types : DXCFlag<"enable-16bit-types">, Alias<fnative_half_type>,
HelpText<"Enable 16-bit types and disable min precision types."
"Available in HLSL 2018 and shader model 6.2.">;
+def hlsl_rootsig_ver :
+ Option<["-"], "hlsl-rootsig-ver", KIND_SEPARATE>,
+ Group<dxc_Group>,
+ Visibility<[ClangOption, CC1Option, DXCOption]>,
+ HelpText<"Root Signature Version">,
+ Values<"rootsig_1_0,rootsig_1_1">,
+ NormalizedValuesScope<"llvm::dxil::RootSignatureVersion">,
+ NormalizedValues<["rootsig_1_0", "rootsig_1_1"]>,
+ MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "rootsig_1_1">;
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
Group<dxc_Group>,
Visibility<[ClangOption, CC1Option]>,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index a78a1c8978183..b779d5be12941 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3834,7 +3834,8 @@ static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs,
options::OPT_emit_obj,
options::OPT_disable_llvm_passes,
options::OPT_fnative_half_type,
- options::OPT_hlsl_entrypoint};
+ options::OPT_hlsl_entrypoint,
+ options::OPT_hlsl_rootsig_ver};
if (!types::isHLSL(InputType))
return;
for (const auto &Arg : ForwardedArguments)
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 5c52dc33ddf6c..a53a7347be481 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -636,6 +636,10 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
Diags.Report(diag::err_drv_argument_not_allowed_with)
<< "-hlsl-entry" << GetInputKindName(IK);
+ if (Args.hasArg(OPT_hlsl_rootsig_ver) && !LangOpts.HLSL)
+ Diags.Report(diag::err_drv_argument_not_allowed_with)
+ << "-hlsl-rootsig-ver" << GetInputKindName(IK);
+
if (Args.hasArg(OPT_fgpu_allow_device_init) && !LangOpts.HIP)
Diags.Report(diag::warn_ignored_hip_only_option)
<< Args.getLastArg(OPT_fgpu_allow_device_init)->getAsString(Args);
>From 9408f86f8ba958bfd314c6f43401b00b460b2d23 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:41:57 +0000
Subject: [PATCH 03/13] update RootSignatureDecl to store version
---
clang/include/clang/AST/Decl.h | 6 ++++++
clang/lib/AST/Decl.cpp | 18 ++++++++++--------
clang/lib/Sema/SemaHLSL.cpp | 2 +-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 05aac15b30cd6..3e2d39e3a2784 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -5179,6 +5179,8 @@ class HLSLRootSignatureDecl final
llvm::hlsl::rootsig::RootElement> {
friend TrailingObjects;
+ llvm::dxil::RootSignatureVersion RootSigVer;
+
unsigned NumElems;
llvm::hlsl::rootsig::RootElement *getElems() { return getTrailingObjects(); }
@@ -5188,16 +5190,20 @@ class HLSLRootSignatureDecl final
}
HLSLRootSignatureDecl(DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
+ llvm::dxil::RootSignatureVersion RootSigVer,
unsigned NumElems);
public:
static HLSLRootSignatureDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
+ llvm::dxil::RootSignatureVersion RootSigVer,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements);
static HLSLRootSignatureDecl *CreateDeserialized(ASTContext &C,
GlobalDeclID ID);
+ llvm::dxil::RootSignatureVersion getVersion() const { return RootSigVer; }
+
ArrayRef<llvm::hlsl::rootsig::RootElement> getRootElements() const {
return {getElems(), NumElems};
}
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 860968939b4ae..87cd7bc331b22 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5853,21 +5853,21 @@ bool HLSLBufferDecl::buffer_decls_empty() {
// HLSLRootSignatureDecl Implementation
//===----------------------------------------------------------------------===//
-HLSLRootSignatureDecl::HLSLRootSignatureDecl(DeclContext *DC,
- SourceLocation Loc,
- IdentifierInfo *ID,
- unsigned NumElems)
+HLSLRootSignatureDecl::HLSLRootSignatureDecl(
+ DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
+ llvm::dxil::RootSignatureVersion RootSigVer, unsigned NumElems)
: NamedDecl(Decl::Kind::HLSLRootSignature, DC, Loc, DeclarationName(ID)),
- NumElems(NumElems) {}
+ RootSigVer(RootSigVer), NumElems(NumElems) {}
HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
+ llvm::dxil::RootSignatureVersion RootSigVer,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements) {
HLSLRootSignatureDecl *RSDecl =
new (C, DC,
additionalSizeToAlloc<llvm::hlsl::rootsig::RootElement>(
RootElements.size()))
- HLSLRootSignatureDecl(DC, Loc, ID, RootElements.size());
+ HLSLRootSignatureDecl(DC, Loc, ID, RootSigVer, RootElements.size());
auto *StoredElems = RSDecl->getElems();
std::uninitialized_copy(RootElements.begin(), RootElements.end(),
StoredElems);
@@ -5876,8 +5876,10 @@ HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
HLSLRootSignatureDecl *
HLSLRootSignatureDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
- HLSLRootSignatureDecl *Result = new (C, ID)
- HLSLRootSignatureDecl(nullptr, SourceLocation(), nullptr, /*NumElems=*/0);
+ HLSLRootSignatureDecl *Result = new (C, ID) HLSLRootSignatureDecl(
+ nullptr, SourceLocation(), nullptr,
+ /*RootSigVer*/ llvm::dxil::RootSignatureVersion::rootsig_1_0,
+ /*NumElems=*/0);
return Result;
}
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index b55f4fd786b58..03431f3944c4b 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -997,7 +997,7 @@ void SemaHLSL::ActOnFinishRootSignatureDecl(
auto *SignatureDecl = HLSLRootSignatureDecl::Create(
SemaRef.getASTContext(), /*DeclContext=*/SemaRef.CurContext, Loc,
- DeclIdent, Elements);
+ DeclIdent, SemaRef.getLangOpts().HLSLRootSigVer, Elements);
SignatureDecl->setImplicit();
SemaRef.PushOnScopeChains(SignatureDecl, SemaRef.getCurScope());
>From a307907f764a28b8ad08522a1595ef1bd53ee338 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:42:45 +0000
Subject: [PATCH 04/13] update metadata generation to output the retained
version
---
clang/lib/CodeGen/CGHLSLRuntime.cpp | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 585411bc59e16..55f4e7fd4e0ec 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -66,14 +66,22 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) {
DXILValMD->addOperand(Val);
}
-void addRootSignature(ArrayRef<llvm::hlsl::rootsig::RootElement> Elements,
+void addRootSignature(llvm::dxil::RootSignatureVersion RootSigVer,
+ ArrayRef<llvm::hlsl::rootsig::RootElement> Elements,
llvm::Function *Fn, llvm::Module &M) {
auto &Ctx = M.getContext();
+ IRBuilder<> Builder(Ctx);
- llvm::hlsl::rootsig::MetadataBuilder Builder(Ctx, Elements);
- MDNode *RootSignature = Builder.BuildRootSignature();
- MDNode *FnPairing =
- MDNode::get(Ctx, {ValueAsMetadata::get(Fn), RootSignature});
+ llvm::hlsl::rootsig::MetadataBuilder RSBuilder(Ctx, Elements);
+ MDNode *RootSignature = RSBuilder.BuildRootSignature();
+
+ Metadata *Operands[] = {
+ ValueAsMetadata::get(Fn),
+ RootSignature,
+ ConstantAsMetadata::get(
+ Builder.getInt32(llvm::to_underlying(RootSigVer))),
+ };
+ MDNode *FnPairing = MDNode::get(Ctx, Operands);
StringRef RootSignatureValKey = "dx.rootsignatures";
auto *RootSignatureValMD = M.getOrInsertNamedMetadata(RootSignatureValKey);
@@ -465,9 +473,11 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
// Add and identify root signature to function, if applicable
for (const Attr *Attr : FD->getAttrs()) {
- if (const auto *RSAttr = dyn_cast<RootSignatureAttr>(Attr))
- addRootSignature(RSAttr->getSignatureDecl()->getRootElements(), EntryFn,
+ if (const auto *RSAttr = dyn_cast<RootSignatureAttr>(Attr)) {
+ auto *RSDecl = RSAttr->getSignatureDecl();
+ addRootSignature(RSDecl->getVersion(), RSDecl->getRootElements(), EntryFn,
M);
+ }
}
}
>From 4ef6b3a50eca2460a70512f1ae0c8f6a6bf61741 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:43:04 +0000
Subject: [PATCH 05/13] update metadata testcase
---
clang/test/CodeGenHLSL/RootSignature.hlsl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/clang/test/CodeGenHLSL/RootSignature.hlsl b/clang/test/CodeGenHLSL/RootSignature.hlsl
index ca843ffbb1ced..6618ca741aa9d 100644
--- a/clang/test/CodeGenHLSL/RootSignature.hlsl
+++ b/clang/test/CodeGenHLSL/RootSignature.hlsl
@@ -3,14 +3,14 @@
// CHECK: !dx.rootsignatures = !{![[#EMPTY_ENTRY:]], ![[#DT_ENTRY:]],
// CHECK-SAME: ![[#RF_ENTRY:]], ![[#RC_ENTRY:]], ![[#RD_ENTRY:]], ![[#SS_ENTRY:]]}
-// CHECK: ![[#EMPTY_ENTRY]] = !{ptr @EmptyEntry, ![[#EMPTY:]]}
+// CHECK: ![[#EMPTY_ENTRY]] = !{ptr @EmptyEntry, ![[#EMPTY:]], i32 2}
// CHECK: ![[#EMPTY]] = !{}
[shader("compute"), RootSignature("")]
[numthreads(1,1,1)]
void EmptyEntry() {}
-// CHECK: ![[#DT_ENTRY]] = !{ptr @DescriptorTableEntry, ![[#DT_RS:]]}
+// CHECK: ![[#DT_ENTRY]] = !{ptr @DescriptorTableEntry, ![[#DT_RS:]], i32 2}
// CHECK: ![[#DT_RS]] = !{![[#TABLE:]]}
// CHECK: ![[#TABLE]] = !{!"DescriptorTable", i32 0, ![[#CBV:]], ![[#SRV:]]}
// CHECK: ![[#CBV]] = !{!"CBV", i32 1, i32 0, i32 0, i32 -1, i32 4}
@@ -25,7 +25,7 @@ void EmptyEntry() {}
[numthreads(1,1,1)]
void DescriptorTableEntry() {}
-// CHECK: ![[#RF_ENTRY]] = !{ptr @RootFlagsEntry, ![[#RF_RS:]]}
+// CHECK: ![[#RF_ENTRY]] = !{ptr @RootFlagsEntry, ![[#RF_RS:]], i32 2}
// CHECK: ![[#RF_RS]] = !{![[#ROOT_FLAGS:]]}
// CHECK: ![[#ROOT_FLAGS]] = !{!"RootFlags", i32 2114}
@@ -38,7 +38,7 @@ void DescriptorTableEntry() {}
[numthreads(1,1,1)]
void RootFlagsEntry() {}
-// CHECK: ![[#RC_ENTRY]] = !{ptr @RootConstantsEntry, ![[#RC_RS:]]}
+// CHECK: ![[#RC_ENTRY]] = !{ptr @RootConstantsEntry, ![[#RC_RS:]], i32 2}
// CHECK: ![[#RC_RS]] = !{![[#ROOT_CONSTANTS:]]}
// CHECK: ![[#ROOT_CONSTANTS]] = !{!"RootConstants", i32 5, i32 1, i32 2, i32 1}
@@ -52,7 +52,7 @@ void RootFlagsEntry() {}
[numthreads(1,1,1)]
void RootConstantsEntry() {}
-// CHECK: ![[#RD_ENTRY]] = !{ptr @RootDescriptorsEntry, ![[#RD_RS:]]}
+// CHECK: ![[#RD_ENTRY]] = !{ptr @RootDescriptorsEntry, ![[#RD_RS:]], i32 2}
// CHECK: ![[#RD_RS]] = !{![[#ROOT_CBV:]], ![[#ROOT_UAV:]], ![[#ROOT_SRV:]]}
// CHECK: ![[#ROOT_CBV]] = !{!"RootCBV", i32 0, i32 0, i32 0, i32 4}
// CHECK: ![[#ROOT_UAV]] = !{!"RootUAV", i32 0, i32 42, i32 3, i32 2}
@@ -66,7 +66,7 @@ void RootConstantsEntry() {}
[numthreads(1,1,1)]
void RootDescriptorsEntry() {}
-// CHECK: ![[#SS_ENTRY]] = !{ptr @StaticSamplerEntry, ![[#SS_RS:]]}
+// CHECK: ![[#SS_ENTRY]] = !{ptr @StaticSamplerEntry, ![[#SS_RS:]], i32 2}
// CHECK: ![[#SS_RS]] = !{![[#STATIC_SAMPLER:]]}
// checking filter = 0x4
>From 3e795b2db0ff8fcd5fab558d2133ffdb7af9e83a Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:43:20 +0000
Subject: [PATCH 06/13] add test-case for specifying the version at it being
correclty generated
---
clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
diff --git a/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl b/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
new file mode 100644
index 0000000000000..5e65b43c15b51
--- /dev/null
+++ b/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
@@ -0,0 +1,15 @@
+// RUN: %clang_dxc -T cs_6_0 -fcgl %s | FileCheck %s --check-prefix=CHECK-V1_1
+// RUN: %clang_dxc -T cs_6_0 -fcgl -hlsl-rootsig-ver rootsig_1_0 %s | FileCheck %s --check-prefix=CHECK-V1_0
+// RUN: %clang_dxc -T cs_6_0 -fcgl -hlsl-rootsig-ver rootsig_1_1 %s | FileCheck %s --check-prefix=CHECK-V1_1
+
+// Test to demonstrate that we can specify the root-signature versions
+
+// CHECK: !dx.rootsignatures = !{![[#EMPTY_ENTRY:]]}
+// CHECK: ![[#EMPTY_ENTRY]] = !{ptr @EmptyEntry, ![[#EMPTY:]],
+// CHECK-V1_0: i32 1}
+// CHECK-V1_1: i32 2}
+// CHECK: ![[#EMPTY]] = !{}
+
+[shader("compute"), RootSignature("")]
+[numthreads(1,1,1)]
+void EmptyEntry() {}
>From 015936646ce5e17ddb8f2191610784864109ae48 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Wed, 18 Jun 2025 22:48:58 +0000
Subject: [PATCH 07/13] update serialization of root signature to output
version
---
clang/lib/AST/TextNodeDumper.cpp | 10 ++++++++++
clang/test/AST/HLSL/RootSignatures-AST.hlsl | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 1b84b8824047b..cdb6f7b88777d 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -3041,6 +3041,16 @@ void TextNodeDumper::VisitHLSLBufferDecl(const HLSLBufferDecl *D) {
void TextNodeDumper::VisitHLSLRootSignatureDecl(
const HLSLRootSignatureDecl *D) {
dumpName(D);
+ OS << " version: ";
+ switch (D->getVersion()) {
+ case llvm::dxil::RootSignatureVersion::rootsig_1_0:
+ OS << "1.0";
+ break;
+ case llvm::dxil::RootSignatureVersion::rootsig_1_1:
+ OS << "1.1";
+ break;
+ }
+ OS << ", ";
llvm::hlsl::rootsig::dumpRootElements(OS, D->getRootElements());
}
diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl
index c700174da764d..4b78c24683801 100644
--- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl
+++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl
@@ -1,5 +1,11 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
// RUN: -disable-llvm-passes -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
+// RUN: -hlsl-rootsig-ver rootsig_1_0 \
+// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-V1_0
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
+// RUN: -hlsl-rootsig-ver rootsig_1_1 \
+// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-V1_1
// This test ensures that the sample root signature is parsed without error and
// the Attr AST Node is created succesfully. If an invalid root signature was
@@ -16,6 +22,8 @@
"DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))"
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[SAMPLE_RS_DECL:__hlsl_rootsig_decl_\d*]]
+// CHECK-V1_0: version: 1.0,
+// CHECK-V1_1: version: 1.1,
// CHECK-SAME: RootElements{
// CHECK-SAME: CBV(b1, numDescriptors = 1, space = 0,
// CHECK-SAME: offset = DescriptorTableOffsetAppend, flags = DataStaticWhileSetAtExecute),
>From 7113cd1b6b894d4b556b165474539c9c68ade4ab Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 22:23:19 +0000
Subject: [PATCH 08/13] review: move version def from DXILABI to DXContainer
- funny how you can agree to do it one way in a meeting and then you
type out the complete other way in practice. whoops
---
clang/include/clang/AST/Decl.h | 9 +++++----
clang/include/clang/Basic/LangOptions.h | 6 +++---
clang/include/clang/Driver/Options.td | 2 +-
clang/lib/AST/Decl.cpp | 6 +++---
clang/lib/AST/TextNodeDumper.cpp | 4 ++--
clang/lib/CodeGen/CGHLSLRuntime.cpp | 2 +-
llvm/include/llvm/BinaryFormat/DXContainer.h | 6 ++++++
llvm/include/llvm/Support/DXILABI.h | 6 ------
8 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 3e2d39e3a2784..c92944eb26fc6 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -41,6 +41,7 @@
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
@@ -5179,7 +5180,7 @@ class HLSLRootSignatureDecl final
llvm::hlsl::rootsig::RootElement> {
friend TrailingObjects;
- llvm::dxil::RootSignatureVersion RootSigVer;
+ llvm::dxbc::RootSignatureVersion RootSigVer;
unsigned NumElems;
@@ -5190,19 +5191,19 @@ class HLSLRootSignatureDecl final
}
HLSLRootSignatureDecl(DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxil::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion RootSigVer,
unsigned NumElems);
public:
static HLSLRootSignatureDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxil::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion RootSigVer,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements);
static HLSLRootSignatureDecl *CreateDeserialized(ASTContext &C,
GlobalDeclID ID);
- llvm::dxil::RootSignatureVersion getVersion() const { return RootSigVer; }
+ llvm::dxbc::RootSignatureVersion getVersion() const { return RootSigVer; }
ArrayRef<llvm::hlsl::rootsig::RootElement> getRootElements() const {
return {getElems(), NumElems};
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 6442492d104b9..828ed49bd49b5 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -24,7 +24,7 @@
#include "clang/Basic/Visibility.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DXILABI.h"
+#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/TargetParser/Triple.h"
#include <optional>
#include <string>
@@ -625,8 +625,8 @@ class LangOptions : public LangOptionsBase {
std::string OpenACCMacroOverride;
/// The HLSL root signature version for dxil.
- llvm::dxil::RootSignatureVersion HLSLRootSigVer =
- llvm::dxil::RootSignatureVersion::rootsig_1_1;
+ llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
+ llvm::dxbc::RootSignatureVersion::rootsig_1_1;
// Indicates if the wasm-opt binary must be ignored in the case of a
// WebAssembly target.
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 141d80e786a0c..f2a8d41339903 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9294,7 +9294,7 @@ def hlsl_rootsig_ver :
Visibility<[ClangOption, CC1Option, DXCOption]>,
HelpText<"Root Signature Version">,
Values<"rootsig_1_0,rootsig_1_1">,
- NormalizedValuesScope<"llvm::dxil::RootSignatureVersion">,
+ NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
NormalizedValues<["rootsig_1_0", "rootsig_1_1"]>,
MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "rootsig_1_1">;
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 87cd7bc331b22..e3deef0d45289 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5855,13 +5855,13 @@ bool HLSLBufferDecl::buffer_decls_empty() {
HLSLRootSignatureDecl::HLSLRootSignatureDecl(
DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxil::RootSignatureVersion RootSigVer, unsigned NumElems)
+ llvm::dxbc::RootSignatureVersion RootSigVer, unsigned NumElems)
: NamedDecl(Decl::Kind::HLSLRootSignature, DC, Loc, DeclarationName(ID)),
RootSigVer(RootSigVer), NumElems(NumElems) {}
HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxil::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion RootSigVer,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements) {
HLSLRootSignatureDecl *RSDecl =
new (C, DC,
@@ -5878,7 +5878,7 @@ HLSLRootSignatureDecl *
HLSLRootSignatureDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
HLSLRootSignatureDecl *Result = new (C, ID) HLSLRootSignatureDecl(
nullptr, SourceLocation(), nullptr,
- /*RootSigVer*/ llvm::dxil::RootSignatureVersion::rootsig_1_0,
+ /*RootSigVer*/ llvm::dxbc::RootSignatureVersion::rootsig_1_0,
/*NumElems=*/0);
return Result;
}
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index cdb6f7b88777d..c998ca378eab2 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -3043,10 +3043,10 @@ void TextNodeDumper::VisitHLSLRootSignatureDecl(
dumpName(D);
OS << " version: ";
switch (D->getVersion()) {
- case llvm::dxil::RootSignatureVersion::rootsig_1_0:
+ case llvm::dxbc::RootSignatureVersion::rootsig_1_0:
OS << "1.0";
break;
- case llvm::dxil::RootSignatureVersion::rootsig_1_1:
+ case llvm::dxbc::RootSignatureVersion::rootsig_1_1:
OS << "1.1";
break;
}
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 55f4e7fd4e0ec..922215b21a94c 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -66,7 +66,7 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) {
DXILValMD->addOperand(Val);
}
-void addRootSignature(llvm::dxil::RootSignatureVersion RootSigVer,
+void addRootSignature(llvm::dxbc::RootSignatureVersion RootSigVer,
ArrayRef<llvm::hlsl::rootsig::RootElement> Elements,
llvm::Function *Fn, llvm::Module &M) {
auto &Ctx = M.getContext();
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 6d625dad5853f..395f046935fe5 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -745,6 +745,12 @@ struct DescriptorRange : public v1::DescriptorRange {
} // namespace v2
} // namespace RTS0
+// D3D_ROOT_SIGNATURE_VERSION
+enum class RootSignatureVersion {
+ rootsig_1_0 = 0x1,
+ rootsig_1_1 = 0x2,
+};
+
} // namespace dxbc
} // namespace llvm
diff --git a/llvm/include/llvm/Support/DXILABI.h b/llvm/include/llvm/Support/DXILABI.h
index 89bf707c205f3..b479f7c73eba3 100644
--- a/llvm/include/llvm/Support/DXILABI.h
+++ b/llvm/include/llvm/Support/DXILABI.h
@@ -99,12 +99,6 @@ enum class SamplerFeedbackType : uint32_t {
const unsigned MinWaveSize = 4;
const unsigned MaxWaveSize = 128;
-// D3D_ROOT_SIGNATURE_VERSION
-enum class RootSignatureVersion {
- rootsig_1_0 = 0x1,
- rootsig_1_1 = 0x2,
-};
-
} // namespace dxil
} // namespace llvm
>From 25e727bdff1a46a158ab3576a41363083a6113d9 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 22:29:38 +0000
Subject: [PATCH 09/13] review: rename enum
---
clang/include/clang/Basic/LangOptions.h | 2 +-
clang/include/clang/Driver/Options.td | 4 ++--
clang/lib/AST/Decl.cpp | 2 +-
clang/lib/AST/TextNodeDumper.cpp | 4 ++--
llvm/include/llvm/BinaryFormat/DXContainer.h | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 828ed49bd49b5..b7c5ed994c992 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -626,7 +626,7 @@ class LangOptions : public LangOptionsBase {
/// The HLSL root signature version for dxil.
llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
- llvm::dxbc::RootSignatureVersion::rootsig_1_1;
+ llvm::dxbc::RootSignatureVersion::V1_1;
// Indicates if the wasm-opt binary must be ignored in the case of a
// WebAssembly target.
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index f2a8d41339903..34edeeb830638 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9295,8 +9295,8 @@ def hlsl_rootsig_ver :
HelpText<"Root Signature Version">,
Values<"rootsig_1_0,rootsig_1_1">,
NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
- NormalizedValues<["rootsig_1_0", "rootsig_1_1"]>,
- MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "rootsig_1_1">;
+ NormalizedValues<["V1_0", "V1_1"]>,
+ MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "V1_1">;
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
Group<dxc_Group>,
Visibility<[ClangOption, CC1Option]>,
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index e3deef0d45289..27a4ce5279e71 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5878,7 +5878,7 @@ HLSLRootSignatureDecl *
HLSLRootSignatureDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
HLSLRootSignatureDecl *Result = new (C, ID) HLSLRootSignatureDecl(
nullptr, SourceLocation(), nullptr,
- /*RootSigVer*/ llvm::dxbc::RootSignatureVersion::rootsig_1_0,
+ /*RootSigVer*/ llvm::dxbc::RootSignatureVersion::V1_1,
/*NumElems=*/0);
return Result;
}
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index c998ca378eab2..bb860a8f76742 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -3043,10 +3043,10 @@ void TextNodeDumper::VisitHLSLRootSignatureDecl(
dumpName(D);
OS << " version: ";
switch (D->getVersion()) {
- case llvm::dxbc::RootSignatureVersion::rootsig_1_0:
+ case llvm::dxbc::RootSignatureVersion::V1_0:
OS << "1.0";
break;
- case llvm::dxbc::RootSignatureVersion::rootsig_1_1:
+ case llvm::dxbc::RootSignatureVersion::V1_1:
OS << "1.1";
break;
}
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 395f046935fe5..5f935a3f2b5a2 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -747,8 +747,8 @@ struct DescriptorRange : public v1::DescriptorRange {
// D3D_ROOT_SIGNATURE_VERSION
enum class RootSignatureVersion {
- rootsig_1_0 = 0x1,
- rootsig_1_1 = 0x2,
+ V1_0 = 0x1,
+ V1_1 = 0x2,
};
} // namespace dxbc
>From 36783a445985ee83598cdf7ff10cc3df5d1fbf8f Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 22:32:01 +0000
Subject: [PATCH 10/13] review: rename RootSigVer to Version
---
clang/include/clang/AST/Decl.h | 8 ++++----
clang/lib/AST/Decl.cpp | 16 ++++++++--------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index c92944eb26fc6..dd1876f4ae73b 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -5180,7 +5180,7 @@ class HLSLRootSignatureDecl final
llvm::hlsl::rootsig::RootElement> {
friend TrailingObjects;
- llvm::dxbc::RootSignatureVersion RootSigVer;
+ llvm::dxbc::RootSignatureVersion Version;
unsigned NumElems;
@@ -5191,19 +5191,19 @@ class HLSLRootSignatureDecl final
}
HLSLRootSignatureDecl(DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxbc::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion Verison,
unsigned NumElems);
public:
static HLSLRootSignatureDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxbc::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion Version,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements);
static HLSLRootSignatureDecl *CreateDeserialized(ASTContext &C,
GlobalDeclID ID);
- llvm::dxbc::RootSignatureVersion getVersion() const { return RootSigVer; }
+ llvm::dxbc::RootSignatureVersion getVersion() const { return Version; }
ArrayRef<llvm::hlsl::rootsig::RootElement> getRootElements() const {
return {getElems(), NumElems};
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 27a4ce5279e71..1c09bed96d48c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -5855,19 +5855,19 @@ bool HLSLBufferDecl::buffer_decls_empty() {
HLSLRootSignatureDecl::HLSLRootSignatureDecl(
DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxbc::RootSignatureVersion RootSigVer, unsigned NumElems)
+ llvm::dxbc::RootSignatureVersion Version, unsigned NumElems)
: NamedDecl(Decl::Kind::HLSLRootSignature, DC, Loc, DeclarationName(ID)),
- RootSigVer(RootSigVer), NumElems(NumElems) {}
+ Version(Version), NumElems(NumElems) {}
HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
- llvm::dxbc::RootSignatureVersion RootSigVer,
+ llvm::dxbc::RootSignatureVersion Version,
ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements) {
HLSLRootSignatureDecl *RSDecl =
new (C, DC,
additionalSizeToAlloc<llvm::hlsl::rootsig::RootElement>(
RootElements.size()))
- HLSLRootSignatureDecl(DC, Loc, ID, RootSigVer, RootElements.size());
+ HLSLRootSignatureDecl(DC, Loc, ID, Version, RootElements.size());
auto *StoredElems = RSDecl->getElems();
std::uninitialized_copy(RootElements.begin(), RootElements.end(),
StoredElems);
@@ -5876,10 +5876,10 @@ HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
HLSLRootSignatureDecl *
HLSLRootSignatureDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
- HLSLRootSignatureDecl *Result = new (C, ID) HLSLRootSignatureDecl(
- nullptr, SourceLocation(), nullptr,
- /*RootSigVer*/ llvm::dxbc::RootSignatureVersion::V1_1,
- /*NumElems=*/0);
+ HLSLRootSignatureDecl *Result = new (C, ID)
+ HLSLRootSignatureDecl(nullptr, SourceLocation(), nullptr,
+ /*Version*/ llvm::dxbc::RootSignatureVersion::V1_1,
+ /*NumElems=*/0);
return Result;
}
>From 4d1d99c67b02ac27042c15b584afaf6157a66b10 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 22:52:39 +0000
Subject: [PATCH 11/13] review: use -force-rootsig-ver for clang-dxc
---
clang/include/clang/Driver/Options.td | 10 +++++++++-
clang/lib/Driver/ToolChains/HLSL.cpp | 6 ++++++
clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl | 4 ++--
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 34edeeb830638..5486d8dd6adf3 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9291,12 +9291,20 @@ def enable_16bit_types : DXCFlag<"enable-16bit-types">, Alias<fnative_half_type>
def hlsl_rootsig_ver :
Option<["-"], "hlsl-rootsig-ver", KIND_SEPARATE>,
Group<dxc_Group>,
- Visibility<[ClangOption, CC1Option, DXCOption]>,
+ Visibility<[ClangOption, CC1Option]>,
HelpText<"Root Signature Version">,
Values<"rootsig_1_0,rootsig_1_1">,
NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
NormalizedValues<["V1_0", "V1_1"]>,
MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "V1_1">;
+def dxc_rootsig_ver :
+ Option<["-"], "force-rootsig-ver", KIND_SEPARATE>,
+ Group<dxc_Group>,
+ Visibility<[ClangOption, CC1Option, DXCOption]>,
+ HelpText<"Root Signature Version">,
+ Values<"rootsig_1_0,rootsig_1_1">,
+ NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
+ NormalizedValues<["V1_0", "V1_1"]>;
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
Group<dxc_Group>,
Visibility<[ClangOption, CC1Option]>,
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index dcc51e182924c..c1e4f599b224f 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -295,6 +295,12 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
A->claim();
continue;
}
+ if (A->getOption().getID() == options::OPT_dxc_rootsig_ver) {
+ DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_hlsl_rootsig_ver),
+ A->getValue());
+ A->claim();
+ continue;
+ }
if (A->getOption().getID() == options::OPT__SLASH_O) {
StringRef OStr = A->getValue();
if (OStr == "d") {
diff --git a/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl b/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
index 5e65b43c15b51..8025a60dba06d 100644
--- a/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
+++ b/clang/test/Driver/dxc_hlsl-rootsig-ver.hlsl
@@ -1,6 +1,6 @@
// RUN: %clang_dxc -T cs_6_0 -fcgl %s | FileCheck %s --check-prefix=CHECK-V1_1
-// RUN: %clang_dxc -T cs_6_0 -fcgl -hlsl-rootsig-ver rootsig_1_0 %s | FileCheck %s --check-prefix=CHECK-V1_0
-// RUN: %clang_dxc -T cs_6_0 -fcgl -hlsl-rootsig-ver rootsig_1_1 %s | FileCheck %s --check-prefix=CHECK-V1_1
+// RUN: %clang_dxc -T cs_6_0 -fcgl -force-rootsig-ver rootsig_1_0 %s | FileCheck %s --check-prefix=CHECK-V1_0
+// RUN: %clang_dxc -T cs_6_0 -fcgl -force-rootsig-ver rootsig_1_1 %s | FileCheck %s --check-prefix=CHECK-V1_1
// Test to demonstrate that we can specify the root-signature versions
>From 26478debcba5753d32db4535e6579a41fc7fc5fc Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 23:00:41 +0000
Subject: [PATCH 12/13] clang format
---
clang/lib/Driver/ToolChains/HLSL.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index c1e4f599b224f..33850676a3b44 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -296,7 +296,8 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
continue;
}
if (A->getOption().getID() == options::OPT_dxc_rootsig_ver) {
- DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_hlsl_rootsig_ver),
+ DAL->AddSeparateArg(nullptr,
+ Opts.getOption(options::OPT_hlsl_rootsig_ver),
A->getValue());
A->claim();
continue;
>From 03b9fa34ab52065458b91259bc4f051feb78dd58 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 20 Jun 2025 23:04:00 +0000
Subject: [PATCH 13/13] self-review: remove overlapping visibility
---
clang/include/clang/Driver/Options.td | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5486d8dd6adf3..2900b01882500 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9300,7 +9300,7 @@ def hlsl_rootsig_ver :
def dxc_rootsig_ver :
Option<["-"], "force-rootsig-ver", KIND_SEPARATE>,
Group<dxc_Group>,
- Visibility<[ClangOption, CC1Option, DXCOption]>,
+ Visibility<[DXCOption]>,
HelpText<"Root Signature Version">,
Values<"rootsig_1_0,rootsig_1_1">,
NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
More information about the llvm-commits
mailing list