[llvm] [DXIL] Adding support to RootSignatureFlags in obj2yaml (PR #122396)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 23:28:29 PST 2025
https://github.com/joaosaffran updated https://github.com/llvm/llvm-project/pull/122396
>From 8adb678cbb5effc1a578a41a9490fdbc9e22cd0a Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Mon, 13 Jan 2025 21:57:03 +0000
Subject: [PATCH 01/12] adding rootsignature to obj2yaml
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 9 +++++++
.../BinaryFormat/DXContainerConstants.def | 1 +
llvm/include/llvm/Object/DXContainer.h | 7 +++++
.../include/llvm/ObjectYAML/DXContainerYAML.h | 16 +++++++++++
llvm/lib/Object/DXContainer.cpp | 14 ++++++++++
llvm/lib/ObjectYAML/DXContainerEmitter.cpp | 8 ++++++
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 11 ++++++++
.../RootSignatures/FlagsElement.ll | 27 +++++++++++++++++++
llvm/tools/obj2yaml/dxcontainer2yaml.cpp | 8 ++++++
9 files changed, 101 insertions(+)
create mode 100644 llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 21e28d546286ee..3907d88df43b07 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -63,6 +63,15 @@ struct ShaderHash {
void swapBytes() { sys::swapByteOrder(Flags); }
};
+struct RootSignatureDesc {
+ uint32_t Version;
+ uint32_t Flags;
+ void swapBytes() {
+ sys::swapByteOrder(Version);
+ sys::swapByteOrder(Flags);
+ }
+};
+
struct ContainerVersion {
uint16_t Major;
uint16_t Minor;
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 1aacbb2f65b27f..38b69228cd3975 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -4,6 +4,7 @@ CONTAINER_PART(DXIL)
CONTAINER_PART(SFI0)
CONTAINER_PART(HASH)
CONTAINER_PART(PSV0)
+CONTAINER_PART(RTS0)
CONTAINER_PART(ISG1)
CONTAINER_PART(OSG1)
CONTAINER_PART(PSG1)
diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h
index 19c83ba6c6e85d..9159b9083b6185 100644
--- a/llvm/include/llvm/Object/DXContainer.h
+++ b/llvm/include/llvm/Object/DXContainer.h
@@ -287,6 +287,7 @@ class DXContainer {
std::optional<uint64_t> ShaderFeatureFlags;
std::optional<dxbc::ShaderHash> Hash;
std::optional<DirectX::PSVRuntimeInfo> PSVInfo;
+ std::optional<dxbc::RootSignatureDesc> RootSignature;
DirectX::Signature InputSignature;
DirectX::Signature OutputSignature;
DirectX::Signature PatchConstantSignature;
@@ -296,6 +297,7 @@ class DXContainer {
Error parseDXILHeader(StringRef Part);
Error parseShaderFeatureFlags(StringRef Part);
Error parseHash(StringRef Part);
+ Error parseRootSignature(StringRef Part);
Error parsePSVInfo(StringRef Part);
Error parseSignature(StringRef Part, DirectX::Signature &Array);
friend class PartIterator;
@@ -382,6 +384,11 @@ class DXContainer {
std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
+ std::optional<dxbc::RootSignatureDesc>
+ getRootSignature() const {
+ return RootSignature;
+ }
+
const std::optional<DirectX::PSVRuntimeInfo> &getPSVInfo() const {
return PSVInfo;
};
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 66ad057ab0e30f..c4bf6bc4920cf7 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -72,6 +72,16 @@ struct ShaderHash {
std::vector<llvm::yaml::Hex8> Digest;
};
+
+
+struct RootSignatureDesc {
+ RootSignatureDesc() = default;
+ RootSignatureDesc(const dxbc::RootSignatureDesc &Data);
+
+ uint32_t Version;
+ uint32_t Flags;
+};
+
using ResourceFlags = dxbc::PSV::ResourceFlags;
using ResourceBindInfo = dxbc::PSV::v2::ResourceBindInfo;
@@ -159,6 +169,7 @@ struct Part {
std::optional<ShaderHash> Hash;
std::optional<PSVInfo> Info;
std::optional<DXContainerYAML::Signature> Signature;
+ std::optional<DXContainerYAML::RootSignatureDesc> RootSignature;
};
struct Object {
@@ -241,6 +252,11 @@ template <> struct MappingTraits<DXContainerYAML::Signature> {
static void mapping(IO &IO, llvm::DXContainerYAML::Signature &El);
};
+template <> struct MappingTraits<DXContainerYAML::RootSignatureDesc> {
+ static void mapping(IO &IO,
+ DXContainerYAML::RootSignatureDesc &RootSignature);
+};
+
} // namespace yaml
} // namespace llvm
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index 3b1a6203a1f8fc..e6577192a92c74 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -10,6 +10,7 @@
#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
using namespace llvm;
@@ -92,6 +93,14 @@ Error DXContainer::parseHash(StringRef Part) {
return Error::success();
}
+Error DXContainer::parseRootSignature(StringRef Part) {
+ dxbc::RootSignatureDesc Desc;
+ if (Error Err = readStruct(Part, Part.begin(), Desc))
+ return Err;
+ RootSignature = Desc;
+ return Error::success();
+}
+
Error DXContainer::parsePSVInfo(StringRef Part) {
if (PSVInfo)
return parseFailed("More than one PSV0 part is present in the file");
@@ -192,6 +201,11 @@ Error DXContainer::parsePartOffsets() {
return Err;
break;
case dxbc::PartType::Unknown:
+ break;
+ case dxbc::PartType::RTS0:
+ if (Error Err = parseRootSignature(PartData))
+ return Err;
+
break;
}
}
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index 175f1a12f93145..22ac2b223ea53c 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -261,6 +261,14 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
}
case dxbc::PartType::Unknown:
break; // Skip any handling for unrecognized parts.
+ case dxbc::PartType::RTS0:
+ if (!P.RootSignature.has_value())
+ continue;
+ dxbc::RootSignatureDesc RS = {P.RootSignature->Version, P.RootSignature->Flags};
+ if (sys::IsBigEndianHost)
+ RS.swapBytes();
+ OS.write(reinterpret_cast<char *>(&RS), sizeof(dxbc::RootSignatureDesc));
+ break;
}
uint64_t BytesWritten = OS.tell() - DataStart;
RollingOffset += BytesWritten;
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 5dee1221b27c01..7bfd77acaecfbe 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -45,6 +45,10 @@ DXContainerYAML::ShaderHash::ShaderHash(const dxbc::ShaderHash &Data)
memcpy(Digest.data(), &Data.Digest[0], 16);
}
+DXContainerYAML::RootSignatureDesc::RootSignatureDesc(const dxbc::RootSignatureDesc &Data)
+ : Version(Data.Version), Flags(Data.Flags) {
+}
+
DXContainerYAML::PSVInfo::PSVInfo() : Version(0) {
memset(&Info, 0, sizeof(Info));
}
@@ -188,6 +192,12 @@ void MappingTraits<DXContainerYAML::Signature>::mapping(
IO.mapRequired("Parameters", S.Parameters);
}
+void MappingTraits<DXContainerYAML::RootSignatureDesc>::mapping(
+ IO &IO, DXContainerYAML::RootSignatureDesc &S) {
+ IO.mapRequired("Version", S.Version);
+ IO.mapRequired("Flags", S.Flags);
+}
+
void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
DXContainerYAML::Part &P) {
IO.mapRequired("Name", P.Name);
@@ -197,6 +207,7 @@ void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
IO.mapOptional("Hash", P.Hash);
IO.mapOptional("PSVInfo", P.Info);
IO.mapOptional("Signature", P.Signature);
+ IO.mapOptional("RootSignature", P.RootSignature);
}
void MappingTraits<DXContainerYAML::Object>::mapping(
diff --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
new file mode 100644
index 00000000000000..402f03a4dd589b
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
@@ -0,0 +1,27 @@
+; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
+; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
+
+target triple = "dxil-unknown-shadermodel6.0-compute"
+
+; CHECK: @dx.rts0 = private constant [8 x i8] c"{{.*}}", section "RTS0", align 4
+
+
+define void @main() #0 {
+entry:
+ ret void
+}
+
+attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
+
+
+!dx.rootsignatures = !{!2} ; list of function/root signature pairs
+!2 = !{ ptr @main, !3 } ; function, root signature
+!3 = !{ !4 } ; list of root signature elements
+!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
+
+
+; DXC: - Name: RTS0
+; DXC-NEXT: Size: 8
+; DXC-NEXT: RootSignature:
+; DXC-NEXT: Version: 1.0
+; DXC-NEXT: Flags: AllowInputAssemblerInputLayout
diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
index 06966b1883586c..90ee47cd469949 100644
--- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
+++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
@@ -7,9 +7,11 @@
//===----------------------------------------------------------------------===//
#include "obj2yaml.h"
+#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Object/DXContainer.h"
#include "llvm/ObjectYAML/DXContainerYAML.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
@@ -153,6 +155,12 @@ dumpDXContainer(MemoryBufferRef Source) {
break;
case dxbc::PartType::Unknown:
break;
+ case dxbc::PartType::RTS0:
+ std::optional<dxbc::RootSignatureDesc> RS = Container.getRootSignature();
+ if (RS && RS.has_value())
+ NewPart.RootSignature = DXContainerYAML::RootSignatureDesc(*RS);
+ break;
+ break;
}
}
>From ba78f21112999d704bef4e0605a51de8f2add813 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Mon, 13 Jan 2025 22:31:14 +0000
Subject: [PATCH 02/12] adding test
---
.../RootSignature-FlagsRootElement.yaml | 242 ++++++++++++++++++
1 file changed, 242 insertions(+)
create mode 100644 llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
diff --git a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
new file mode 100644
index 00000000000000..5435c432a073ec
--- /dev/null
+++ b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
@@ -0,0 +1,242 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+--- !dxcontainer
+Header:
+ Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+ Version:
+ Major: 1
+ Minor: 0
+ FileSize: 1672
+ PartCount: 7
+ PartOffsets: [ 60, 1496, 1512, 1540, 1556, 1572, 1588 ]
+Parts:
+ - Name: DXIL
+ Size: 1428
+ Program:
+ MajorVersion: 6
+ MinorVersion: 0
+ ShaderKind: 5
+ Size: 357
+ DXILMajorVersion: 1
+ DXILMinorVersion: 0
+ DXILSize: 1404
+ DXIL: [ 0x42, 0x43, 0xC0, 0xDE, 0x21, 0xC, 0x0, 0x0, 0x5C,
+ 0x1, 0x0, 0x0, 0xB, 0x82, 0x20, 0x0, 0x2, 0x0,
+ 0x0, 0x0, 0x13, 0x0, 0x0, 0x0, 0x7, 0x81, 0x23,
+ 0x91, 0x41, 0xC8, 0x4, 0x49, 0x6, 0x10, 0x32,
+ 0x39, 0x92, 0x1, 0x84, 0xC, 0x25, 0x5, 0x8, 0x19,
+ 0x1E, 0x4, 0x8B, 0x62, 0x80, 0x10, 0x45, 0x2,
+ 0x42, 0x92, 0xB, 0x42, 0x84, 0x10, 0x32, 0x14,
+ 0x38, 0x8, 0x18, 0x4B, 0xA, 0x32, 0x42, 0x88,
+ 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xA5,
+ 0x0, 0x19, 0x32, 0x42, 0xE4, 0x48, 0xE, 0x90,
+ 0x11, 0x22, 0xC4, 0x50, 0x41, 0x51, 0x81, 0x8C,
+ 0xE1, 0x83, 0xE5, 0x8A, 0x4, 0x21, 0x46, 0x6,
+ 0x89, 0x20, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x32,
+ 0x22, 0x8, 0x9, 0x20, 0x64, 0x85, 0x4, 0x13, 0x22,
+ 0xA4, 0x84, 0x4, 0x13, 0x22, 0xE3, 0x84, 0xA1,
+ 0x90, 0x14, 0x12, 0x4C, 0x88, 0x8C, 0xB, 0x84,
+ 0x84, 0x4C, 0x10, 0x20, 0x73, 0x4, 0x8, 0xC1,
+ 0x65, 0xC3, 0x85, 0x2C, 0xE8, 0x3, 0x40, 0x14,
+ 0x91, 0x4E, 0xD1, 0x4A, 0x48, 0x44, 0x54, 0x11,
+ 0xC3, 0x9, 0x30, 0xC4, 0x18, 0x1, 0x30, 0x2, 0x50,
+ 0x82, 0x21, 0x1A, 0x8, 0x98, 0x23, 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, 0xC5, 0x96, 0x78, 0x49, 0x89, 0x5C, 0x6B ]
+ - Name: ISG1
+ Size: 8
+ Signature:
+ Parameters: []
+ - Name: OSG1
+ Size: 8
+ Signature:
+ Parameters: []
+ - Name: RTS0
+ Size: 8
+ RootSignature:
+ Version: 1
+ Flags: 8
+ - Name: PSV0
+ Size: 76
+ PSVInfo:
+ Version: 3
+ ShaderStage: 5
+ MinimumWaveLaneCount: 0
+ MaximumWaveLaneCount: 4294967295
+ UsesViewID: 0
+ SigInputVectors: 0
+ SigOutputVectors: [ 0, 0, 0, 0 ]
+ NumThreadsX: 1
+ NumThreadsY: 1
+ NumThreadsZ: 1
+ EntryName: main
+ ResourceStride: 24
+ Resources: []
+ SigInputElements: []
+ SigOutputElements: []
+ SigPatchOrPrimElements: []
+ InputOutputMap:
+ - [ ]
+ - [ ]
+ - [ ]
+ - [ ]
+
+# CHECK: - Name: RTS0
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: RootSignature:
+# CHECK-NEXT: Version: 1
+# CHECK-NEXT: Flags: 8
>From 0a54559969f272f574ca1be557157c8c9f5f1c06 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Mon, 13 Jan 2025 22:35:01 +0000
Subject: [PATCH 03/12] removing old test
---
.../RootSignatures/FlagsElement.ll | 27 -------------------
1 file changed, 27 deletions(-)
delete mode 100644 llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
diff --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
deleted file mode 100644
index 402f03a4dd589b..00000000000000
--- a/llvm/test/CodeGen/DirectX/ContainerData/RootSignatures/FlagsElement.ll
+++ /dev/null
@@ -1,27 +0,0 @@
-; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
-; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
-
-target triple = "dxil-unknown-shadermodel6.0-compute"
-
-; CHECK: @dx.rts0 = private constant [8 x i8] c"{{.*}}", section "RTS0", align 4
-
-
-define void @main() #0 {
-entry:
- ret void
-}
-
-attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
-
-
-!dx.rootsignatures = !{!2} ; list of function/root signature pairs
-!2 = !{ ptr @main, !3 } ; function, root signature
-!3 = !{ !4 } ; list of root signature elements
-!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
-
-
-; DXC: - Name: RTS0
-; DXC-NEXT: Size: 8
-; DXC-NEXT: RootSignature:
-; DXC-NEXT: Version: 1.0
-; DXC-NEXT: Flags: AllowInputAssemblerInputLayout
>From 557075fd17edfd8bfb40266bd70299cb27ee9632 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Mon, 13 Jan 2025 22:43:27 +0000
Subject: [PATCH 04/12] remove useless includes
---
llvm/lib/Object/DXContainer.cpp | 1 -
llvm/tools/obj2yaml/dxcontainer2yaml.cpp | 2 --
2 files changed, 3 deletions(-)
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index e6577192a92c74..4ffa00f70bdb75 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -10,7 +10,6 @@
#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/Alignment.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
using namespace llvm;
diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
index 90ee47cd469949..6ae0a0859b48e1 100644
--- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
+++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
@@ -7,11 +7,9 @@
//===----------------------------------------------------------------------===//
#include "obj2yaml.h"
-#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Object/DXContainer.h"
#include "llvm/ObjectYAML/DXContainerYAML.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
>From e0d3dcd9d60a9955bb1cb0fd23dbd78bf0deddd3 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Tue, 14 Jan 2025 23:42:24 +0000
Subject: [PATCH 05/12] addressing comments
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 5 +
.../BinaryFormat/DXContainerConstants.def | 19 ++
.../include/llvm/ObjectYAML/DXContainerYAML.h | 5 +-
llvm/lib/Object/DXContainer.cpp | 3 +
llvm/lib/ObjectYAML/DXContainerEmitter.cpp | 5 +-
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 26 +-
.../RootSignature-FlagsRootElement.yaml | 259 ++----------------
7 files changed, 85 insertions(+), 237 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 3907d88df43b07..0ada2125119378 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -161,6 +161,11 @@ enum class FeatureFlags : uint64_t {
static_assert((uint64_t)FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
+#define ROOT_ELEMENT_FLAG(Num, Val) Val = 1ull << Num,
+enum class RootElementFlag : uint32_t {
+#include "DXContainerConstants.def"
+};
+
PartType parsePartType(StringRef S);
struct VertexPSVInfo {
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 38b69228cd3975..b351b9a01773c8 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -53,6 +53,25 @@ SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a
#undef SHADER_FEATURE_FLAG
#endif // SHADER_FEATURE_FLAG
+#ifdef ROOT_ELEMENT_FLAG
+
+
+ROOT_ELEMENT_FLAG(0, AllowInputAssemblerInputLayout)
+ROOT_ELEMENT_FLAG(1, DenyVertexShaderRootAccess)
+ROOT_ELEMENT_FLAG(2, DenyHullShaderRootAccess)
+ROOT_ELEMENT_FLAG(3, DenyDomainShaderRootAccess)
+ROOT_ELEMENT_FLAG(4, DenyGeometryShaderRootAccess)
+ROOT_ELEMENT_FLAG(5, DenyPixelShaderRootAccess)
+ROOT_ELEMENT_FLAG(6, AllowStreamOutput)
+ROOT_ELEMENT_FLAG(7, LocalRootSignature)
+ROOT_ELEMENT_FLAG(8, DenyAmplificationShaderRootAccess)
+ROOT_ELEMENT_FLAG(9, DenyMeshShaderRootAccess)
+ROOT_ELEMENT_FLAG(10, CBVSRVUAVHeapDirectlyIndexed)
+ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed)
+#undef ROOT_ELEMENT_FLAG
+#endif // ROOT_ELEMENT_FLAG
+
+
#ifdef DXIL_MODULE_FLAG
// Only save DXIL module flags which not map to feature flags here.
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index c4bf6bc4920cf7..9b25c5c33e7ef8 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -73,13 +73,14 @@ struct ShaderHash {
};
-
+#define ROOT_ELEMENT_FLAG(Num, Val) bool Val = false;
struct RootSignatureDesc {
RootSignatureDesc() = default;
RootSignatureDesc(const dxbc::RootSignatureDesc &Data);
+ uint32_t getEncodedFlags();
uint32_t Version;
- uint32_t Flags;
+#include "llvm/BinaryFormat/DXContainerConstants.def"
};
using ResourceFlags = dxbc::PSV::ResourceFlags;
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index 4ffa00f70bdb75..92956c580f9b23 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -8,6 +8,7 @@
#include "llvm/Object/DXContainer.h"
#include "llvm/BinaryFormat/DXContainer.h"
+#include "llvm/MC/DXContainerRootSignature.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/FormatVariadic.h"
@@ -93,6 +94,8 @@ Error DXContainer::parseHash(StringRef Part) {
}
Error DXContainer::parseRootSignature(StringRef Part) {
+ if (RootSignature)
+ return parseFailed("More than one RTS0 part is present in the file");
dxbc::RootSignatureDesc Desc;
if (Error Err = readStruct(Part, Part.begin(), Desc))
return Err;
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index 22ac2b223ea53c..e5561fe44375d7 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -264,7 +264,10 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
case dxbc::PartType::RTS0:
if (!P.RootSignature.has_value())
continue;
- dxbc::RootSignatureDesc RS = {P.RootSignature->Version, P.RootSignature->Flags};
+ uint32_t Flags = P.RootSignature->getEncodedFlags();
+ if (sys::IsBigEndianHost)
+ sys::swapByteOrder(Flags);
+ dxbc::RootSignatureDesc RS = {P.RootSignature->Version, Flags};
if (sys::IsBigEndianHost)
RS.swapBytes();
OS.write(reinterpret_cast<char *>(&RS), sizeof(dxbc::RootSignatureDesc));
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 7bfd77acaecfbe..d226a5b2e5942b 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -15,6 +15,7 @@
#include "llvm/ADT/ScopeExit.h"
#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Support/ScopedPrinter.h"
+#include <cstdint>
namespace llvm {
@@ -29,6 +30,23 @@ DXContainerYAML::ShaderFeatureFlags::ShaderFeatureFlags(uint64_t FlagData) {
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
+
+DXContainerYAML::RootSignatureDesc::RootSignatureDesc(const dxbc::RootSignatureDesc &Data): Version(Data.Version) {
+#define ROOT_ELEMENT_FLAG(Num, Val) \
+ Val = (Data.Flags & (uint32_t)dxbc::RootElementFlag::Val) > 0;
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+}
+
+
+uint32_t DXContainerYAML::RootSignatureDesc::getEncodedFlags() {
+ uint64_t Flag = 0;
+#define ROOT_ELEMENT_FLAG(Num, Val) \
+ if (Val) \
+ Flag |= (uint32_t)dxbc::RootElementFlag::Val;
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+ return Flag;
+}
+
uint64_t DXContainerYAML::ShaderFeatureFlags::getEncodedFlags() {
uint64_t Flag = 0;
#define SHADER_FEATURE_FLAG(Num, DxilModuleNum, Val, Str) \
@@ -45,10 +63,6 @@ DXContainerYAML::ShaderHash::ShaderHash(const dxbc::ShaderHash &Data)
memcpy(Digest.data(), &Data.Digest[0], 16);
}
-DXContainerYAML::RootSignatureDesc::RootSignatureDesc(const dxbc::RootSignatureDesc &Data)
- : Version(Data.Version), Flags(Data.Flags) {
-}
-
DXContainerYAML::PSVInfo::PSVInfo() : Version(0) {
memset(&Info, 0, sizeof(Info));
}
@@ -195,7 +209,9 @@ void MappingTraits<DXContainerYAML::Signature>::mapping(
void MappingTraits<DXContainerYAML::RootSignatureDesc>::mapping(
IO &IO, DXContainerYAML::RootSignatureDesc &S) {
IO.mapRequired("Version", S.Version);
- IO.mapRequired("Flags", S.Flags);
+ #define ROOT_ELEMENT_FLAG(Num, Val) \
+ IO.mapRequired(#Val, S.Val);
+ #include "llvm/BinaryFormat/DXContainerConstants.def"
}
void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
diff --git a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
index 5435c432a073ec..2ed71091cacd45 100644
--- a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
@@ -6,237 +6,38 @@ Header:
Version:
Major: 1
Minor: 0
- FileSize: 1672
- PartCount: 7
- PartOffsets: [ 60, 1496, 1512, 1540, 1556, 1572, 1588 ]
+ PartCount: 1
+ PartOffsets: [ 60 ]
Parts:
- - Name: DXIL
- Size: 1428
- Program:
- MajorVersion: 6
- MinorVersion: 0
- ShaderKind: 5
- Size: 357
- DXILMajorVersion: 1
- DXILMinorVersion: 0
- DXILSize: 1404
- DXIL: [ 0x42, 0x43, 0xC0, 0xDE, 0x21, 0xC, 0x0, 0x0, 0x5C,
- 0x1, 0x0, 0x0, 0xB, 0x82, 0x20, 0x0, 0x2, 0x0,
- 0x0, 0x0, 0x13, 0x0, 0x0, 0x0, 0x7, 0x81, 0x23,
- 0x91, 0x41, 0xC8, 0x4, 0x49, 0x6, 0x10, 0x32,
- 0x39, 0x92, 0x1, 0x84, 0xC, 0x25, 0x5, 0x8, 0x19,
- 0x1E, 0x4, 0x8B, 0x62, 0x80, 0x10, 0x45, 0x2,
- 0x42, 0x92, 0xB, 0x42, 0x84, 0x10, 0x32, 0x14,
- 0x38, 0x8, 0x18, 0x4B, 0xA, 0x32, 0x42, 0x88,
- 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xA5,
- 0x0, 0x19, 0x32, 0x42, 0xE4, 0x48, 0xE, 0x90,
- 0x11, 0x22, 0xC4, 0x50, 0x41, 0x51, 0x81, 0x8C,
- 0xE1, 0x83, 0xE5, 0x8A, 0x4, 0x21, 0x46, 0x6,
- 0x89, 0x20, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x32,
- 0x22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7, 0x50, 0x10, 0xCD, 0x14, 0x61, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
- - Name: SFI0
- Size: 8
- - Name: HASH
- Size: 20
- Hash:
- IncludesSource: false
- Digest: [ 0xCE, 0xA, 0x5B, 0x9C, 0xBF, 0x9A, 0xBB, 0x5,
- 0x19, 0xC5, 0x96, 0x78, 0x49, 0x89, 0x5C, 0x6B ]
- - Name: ISG1
- Size: 8
- Signature:
- Parameters: []
- - Name: OSG1
- Size: 8
- Signature:
- Parameters: []
- Name: RTS0
Size: 8
RootSignature:
Version: 1
- Flags: 8
- - Name: PSV0
- Size: 76
- PSVInfo:
- Version: 3
- ShaderStage: 5
- MinimumWaveLaneCount: 0
- MaximumWaveLaneCount: 4294967295
- UsesViewID: 0
- SigInputVectors: 0
- SigOutputVectors: [ 0, 0, 0, 0 ]
- NumThreadsX: 1
- NumThreadsY: 1
- NumThreadsZ: 1
- EntryName: main
- ResourceStride: 24
- Resources: []
- SigInputElements: []
- SigOutputElements: []
- SigPatchOrPrimElements: []
- InputOutputMap:
- - [ ]
- - [ ]
- - [ ]
- - [ ]
-
-# CHECK: - Name: RTS0
-# CHECK-NEXT: Size: 8
-# CHECK-NEXT: RootSignature:
-# CHECK-NEXT: Version: 1
-# CHECK-NEXT: Flags: 8
+ AllowInputAssemblerInputLayout: true
+ DenyVertexShaderRootAccess: false
+ DenyHullShaderRootAccess: false
+ DenyDomainShaderRootAccess: false
+ DenyGeometryShaderRootAccess: false
+ DenyPixelShaderRootAccess: false
+ AllowStreamOutput: false
+ LocalRootSignature: false
+ DenyAmplificationShaderRootAccess: false
+ DenyMeshShaderRootAccess: false
+ CBVSRVUAVHeapDirectlyIndexed: false
+ SamplerHeapDirectlyIndexed: false
+#CHECK: - Name: RTS0
+#CHECK-NEXT: Size: 8
+#CHECK-NEXT: RootSignature:
+#CHECK-NEXT: Version: 1
+#CHECK-NEXT: AllowInputAssemblerInputLayout: true
+#CHECK-NEXT: DenyVertexShaderRootAccess: false
+#CHECK-NEXT: DenyHullShaderRootAccess: false
+#CHECK-NEXT: DenyDomainShaderRootAccess: false
+#CHECK-NEXT: DenyGeometryShaderRootAccess: false
+#CHECK-NEXT: DenyPixelShaderRootAccess: false
+#CHECK-NEXT: AllowStreamOutput: false
+#CHECK-NEXT: LocalRootSignature: false
+#CHECK-NEXT: DenyAmplificationShaderRootAccess: false
+#CHECK-NEXT: DenyMeshShaderRootAccess: false
+#CHECK-NEXT: CBVSRVUAVHeapDirectlyIndexed: false
+#CHECK-NEXT: SamplerHeapDirectlyIndexed: false
>From 80587ddd3736472bfd3e089db35880762a2035b7 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Tue, 14 Jan 2025 23:47:46 +0000
Subject: [PATCH 06/12] updating test
---
.../ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
index 2ed71091cacd45..8ce18d8e1aa4cb 100644
--- a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
@@ -25,6 +25,7 @@ Parts:
DenyMeshShaderRootAccess: false
CBVSRVUAVHeapDirectlyIndexed: false
SamplerHeapDirectlyIndexed: false
+
#CHECK: - Name: RTS0
#CHECK-NEXT: Size: 8
#CHECK-NEXT: RootSignature:
>From be3764d8748cf55c781cd3b98a5f616c9a09e5f0 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Wed, 15 Jan 2025 00:42:39 +0000
Subject: [PATCH 07/12] removing useless header
---
llvm/lib/Object/DXContainer.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index 92956c580f9b23..b7eff25ed7b33b 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -8,7 +8,6 @@
#include "llvm/Object/DXContainer.h"
#include "llvm/BinaryFormat/DXContainer.h"
-#include "llvm/MC/DXContainerRootSignature.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/FormatVariadic.h"
>From 7582ca61409969ae247c116374bacbbdb4909fca Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Wed, 15 Jan 2025 17:30:00 +0000
Subject: [PATCH 08/12] fix formating
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 4 ++--
llvm/include/llvm/Object/DXContainer.h | 3 +--
llvm/include/llvm/ObjectYAML/DXContainerYAML.h | 1 -
llvm/lib/ObjectYAML/DXContainerEmitter.cpp | 2 +-
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 15 +++++++--------
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 0ada2125119378..74003387a249ef 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -66,9 +66,9 @@ struct ShaderHash {
struct RootSignatureDesc {
uint32_t Version;
uint32_t Flags;
- void swapBytes() {
+ void swapBytes() {
sys::swapByteOrder(Version);
- sys::swapByteOrder(Flags);
+ sys::swapByteOrder(Flags);
}
};
diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h
index 9159b9083b6185..8574a04027ce46 100644
--- a/llvm/include/llvm/Object/DXContainer.h
+++ b/llvm/include/llvm/Object/DXContainer.h
@@ -384,8 +384,7 @@ class DXContainer {
std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
- std::optional<dxbc::RootSignatureDesc>
- getRootSignature() const {
+ std::optional<dxbc::RootSignatureDesc> getRootSignature() const {
return RootSignature;
}
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 9b25c5c33e7ef8..bb232543cd3b07 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -72,7 +72,6 @@ struct ShaderHash {
std::vector<llvm::yaml::Hex8> Digest;
};
-
#define ROOT_ELEMENT_FLAG(Num, Val) bool Val = false;
struct RootSignatureDesc {
RootSignatureDesc() = default;
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index e5561fe44375d7..3ac539c8e0853c 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -267,7 +267,7 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
uint32_t Flags = P.RootSignature->getEncodedFlags();
if (sys::IsBigEndianHost)
sys::swapByteOrder(Flags);
- dxbc::RootSignatureDesc RS = {P.RootSignature->Version, Flags};
+ dxbc::RootSignatureDesc RS = {P.RootSignature->Version, Flags};
if (sys::IsBigEndianHost)
RS.swapBytes();
OS.write(reinterpret_cast<char *>(&RS), sizeof(dxbc::RootSignatureDesc));
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index d226a5b2e5942b..80f4587a06ff5e 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -30,17 +30,17 @@ DXContainerYAML::ShaderFeatureFlags::ShaderFeatureFlags(uint64_t FlagData) {
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
-
-DXContainerYAML::RootSignatureDesc::RootSignatureDesc(const dxbc::RootSignatureDesc &Data): Version(Data.Version) {
-#define ROOT_ELEMENT_FLAG(Num, Val) \
+DXContainerYAML::RootSignatureDesc::RootSignatureDesc(
+ const dxbc::RootSignatureDesc &Data)
+ : Version(Data.Version) {
+#define ROOT_ELEMENT_FLAG(Num, Val) \
Val = (Data.Flags & (uint32_t)dxbc::RootElementFlag::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
-
uint32_t DXContainerYAML::RootSignatureDesc::getEncodedFlags() {
uint64_t Flag = 0;
-#define ROOT_ELEMENT_FLAG(Num, Val) \
+#define ROOT_ELEMENT_FLAG(Num, Val) \
if (Val) \
Flag |= (uint32_t)dxbc::RootElementFlag::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
@@ -209,9 +209,8 @@ void MappingTraits<DXContainerYAML::Signature>::mapping(
void MappingTraits<DXContainerYAML::RootSignatureDesc>::mapping(
IO &IO, DXContainerYAML::RootSignatureDesc &S) {
IO.mapRequired("Version", S.Version);
- #define ROOT_ELEMENT_FLAG(Num, Val) \
- IO.mapRequired(#Val, S.Val);
- #include "llvm/BinaryFormat/DXContainerConstants.def"
+#define ROOT_ELEMENT_FLAG(Num, Val) IO.mapRequired(#Val, S.Val);
+#include "llvm/BinaryFormat/DXContainerConstants.def"
}
void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
>From 6aaa0a5a0d8a9bf7bf6514ed4960ec9ef8bae9a4 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Wed, 15 Jan 2025 18:21:06 +0000
Subject: [PATCH 09/12] renaming test
---
...otSignature-FlagsRootElement.yaml => RootSignature-Flags.yaml} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename llvm/test/ObjectYAML/DXContainer/{RootSignature-FlagsRootElement.yaml => RootSignature-Flags.yaml} (100%)
diff --git a/llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml b/llvm/test/ObjectYAML/DXContainer/RootSignature-Flags.yaml
similarity index 100%
rename from llvm/test/ObjectYAML/DXContainer/RootSignature-FlagsRootElement.yaml
rename to llvm/test/ObjectYAML/DXContainer/RootSignature-Flags.yaml
>From 916b2f17afef4e7b79818596551df44c75a55016 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Thu, 16 Jan 2025 22:16:45 +0000
Subject: [PATCH 10/12] addressing pr comments
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 2 +-
.../BinaryFormat/DXContainerConstants.def | 24 +++++++++----------
.../include/llvm/ObjectYAML/DXContainerYAML.h | 2 +-
llvm/lib/Object/DXContainer.cpp | 1 -
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 6 ++---
llvm/tools/obj2yaml/dxcontainer2yaml.cpp | 3 +--
6 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index 74003387a249ef..605281df31ed46 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -161,7 +161,7 @@ enum class FeatureFlags : uint64_t {
static_assert((uint64_t)FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
-#define ROOT_ELEMENT_FLAG(Num, Val) Val = 1ull << Num,
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) Val = 1ull << Num,
enum class RootElementFlag : uint32_t {
#include "DXContainerConstants.def"
};
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index b351b9a01773c8..a382cd714ce7f3 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -56,18 +56,18 @@ SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a
#ifdef ROOT_ELEMENT_FLAG
-ROOT_ELEMENT_FLAG(0, AllowInputAssemblerInputLayout)
-ROOT_ELEMENT_FLAG(1, DenyVertexShaderRootAccess)
-ROOT_ELEMENT_FLAG(2, DenyHullShaderRootAccess)
-ROOT_ELEMENT_FLAG(3, DenyDomainShaderRootAccess)
-ROOT_ELEMENT_FLAG(4, DenyGeometryShaderRootAccess)
-ROOT_ELEMENT_FLAG(5, DenyPixelShaderRootAccess)
-ROOT_ELEMENT_FLAG(6, AllowStreamOutput)
-ROOT_ELEMENT_FLAG(7, LocalRootSignature)
-ROOT_ELEMENT_FLAG(8, DenyAmplificationShaderRootAccess)
-ROOT_ELEMENT_FLAG(9, DenyMeshShaderRootAccess)
-ROOT_ELEMENT_FLAG(10, CBVSRVUAVHeapDirectlyIndexed)
-ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed)
+ROOT_ELEMENT_FLAG(0, AllowInputAssemblerInputLayout, "")
+ROOT_ELEMENT_FLAG(1, DenyVertexShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(2, DenyHullShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(3, DenyDomainShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(4, DenyGeometryShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(5, DenyPixelShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(6, AllowStreamOutput, "")
+ROOT_ELEMENT_FLAG(7, LocalRootSignature, "")
+ROOT_ELEMENT_FLAG(8, DenyAmplificationShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(9, DenyMeshShaderRootAccess, "")
+ROOT_ELEMENT_FLAG(10, CBVSRVUAVHeapDirectlyIndexed, "")
+ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed, "")
#undef ROOT_ELEMENT_FLAG
#endif // ROOT_ELEMENT_FLAG
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index bb232543cd3b07..755c81541e5db0 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -72,7 +72,7 @@ struct ShaderHash {
std::vector<llvm::yaml::Hex8> Digest;
};
-#define ROOT_ELEMENT_FLAG(Num, Val) bool Val = false;
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) bool Val = false;
struct RootSignatureDesc {
RootSignatureDesc() = default;
RootSignatureDesc(const dxbc::RootSignatureDesc &Data);
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index b7eff25ed7b33b..160844f73669ac 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -206,7 +206,6 @@ Error DXContainer::parsePartOffsets() {
case dxbc::PartType::RTS0:
if (Error Err = parseRootSignature(PartData))
return Err;
-
break;
}
}
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 80f4587a06ff5e..682216e5febec0 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -33,14 +33,14 @@ DXContainerYAML::ShaderFeatureFlags::ShaderFeatureFlags(uint64_t FlagData) {
DXContainerYAML::RootSignatureDesc::RootSignatureDesc(
const dxbc::RootSignatureDesc &Data)
: Version(Data.Version) {
-#define ROOT_ELEMENT_FLAG(Num, Val) \
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
Val = (Data.Flags & (uint32_t)dxbc::RootElementFlag::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
uint32_t DXContainerYAML::RootSignatureDesc::getEncodedFlags() {
uint64_t Flag = 0;
-#define ROOT_ELEMENT_FLAG(Num, Val) \
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
if (Val) \
Flag |= (uint32_t)dxbc::RootElementFlag::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
@@ -209,7 +209,7 @@ void MappingTraits<DXContainerYAML::Signature>::mapping(
void MappingTraits<DXContainerYAML::RootSignatureDesc>::mapping(
IO &IO, DXContainerYAML::RootSignatureDesc &S) {
IO.mapRequired("Version", S.Version);
-#define ROOT_ELEMENT_FLAG(Num, Val) IO.mapRequired(#Val, S.Val);
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) IO.mapRequired(#Val, S.Val);
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
index 6ae0a0859b48e1..9588a8277dad7b 100644
--- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
+++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
@@ -155,10 +155,9 @@ dumpDXContainer(MemoryBufferRef Source) {
break;
case dxbc::PartType::RTS0:
std::optional<dxbc::RootSignatureDesc> RS = Container.getRootSignature();
- if (RS && RS.has_value())
+ if (RS.has_value())
NewPart.RootSignature = DXContainerYAML::RootSignatureDesc(*RS);
break;
- break;
}
}
>From d9bce0a1d80155b342726189e929dabb4ec3fb90 Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Thu, 16 Jan 2025 22:20:18 +0000
Subject: [PATCH 11/12] adding str to ROOT_ELEMENT_FLAG
---
.../BinaryFormat/DXContainerConstants.def | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index a382cd714ce7f3..300d0dd2797c9a 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -56,18 +56,18 @@ SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a
#ifdef ROOT_ELEMENT_FLAG
-ROOT_ELEMENT_FLAG(0, AllowInputAssemblerInputLayout, "")
-ROOT_ELEMENT_FLAG(1, DenyVertexShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(2, DenyHullShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(3, DenyDomainShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(4, DenyGeometryShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(5, DenyPixelShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(6, AllowStreamOutput, "")
-ROOT_ELEMENT_FLAG(7, LocalRootSignature, "")
-ROOT_ELEMENT_FLAG(8, DenyAmplificationShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(9, DenyMeshShaderRootAccess, "")
-ROOT_ELEMENT_FLAG(10, CBVSRVUAVHeapDirectlyIndexed, "")
-ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed, "")
+ROOT_ELEMENT_FLAG(0, AllowInputAssemblerInputLayout, "The app is opting in to using the Input Assembler")
+ROOT_ELEMENT_FLAG(1, DenyVertexShaderRootAccess, "Denies the vertex shader access to the root signature.")
+ROOT_ELEMENT_FLAG(2, DenyHullShaderRootAccess, "Denies the hull shader access to the root signature.")
+ROOT_ELEMENT_FLAG(3, DenyDomainShaderRootAccess, "Denies the domain shader access to the root signature.")
+ROOT_ELEMENT_FLAG(4, DenyGeometryShaderRootAccess, "Denies the geometry shader access to the root signature.")
+ROOT_ELEMENT_FLAG(5, DenyPixelShaderRootAccess, "Denies the pixel shader access to the root signature.")
+ROOT_ELEMENT_FLAG(6, AllowStreamOutput, "The app is opting in to using Stream Output.")
+ROOT_ELEMENT_FLAG(7, LocalRootSignature, "The root signature is to be used with raytracing shaders to define resource bindings sourced from shader records in shader tables.")
+ROOT_ELEMENT_FLAG(8, DenyAmplificationShaderRootAccess, "Denies the amplification shader access to the root signature.")
+ROOT_ELEMENT_FLAG(9, DenyMeshShaderRootAccess, "Denies the mesh shader access to the root signature.")
+ROOT_ELEMENT_FLAG(10, CBVSRVUAVHeapDirectlyIndexed, "The shaders are allowed to index the CBV/SRV/UAV descriptor heap directly, using the ResourceDescriptorHeap built-in variable.")
+ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed, "The shaders are allowed to index the sampler descriptor heap directly, using the SamplerDescriptorHeap built-in variable.")
#undef ROOT_ELEMENT_FLAG
#endif // ROOT_ELEMENT_FLAG
>From e7676ed42376dea921f74a0f9c5f3d422235a08f Mon Sep 17 00:00:00 2001
From: joaosaffran <joao.saffran at microsoft.com>
Date: Fri, 17 Jan 2025 07:28:09 +0000
Subject: [PATCH 12/12] formating
---
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 682216e5febec0..0351239cac2c12 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -33,14 +33,14 @@ DXContainerYAML::ShaderFeatureFlags::ShaderFeatureFlags(uint64_t FlagData) {
DXContainerYAML::RootSignatureDesc::RootSignatureDesc(
const dxbc::RootSignatureDesc &Data)
: Version(Data.Version) {
-#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
Val = (Data.Flags & (uint32_t)dxbc::RootElementFlag::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
uint32_t DXContainerYAML::RootSignatureDesc::getEncodedFlags() {
uint64_t Flag = 0;
-#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
+#define ROOT_ELEMENT_FLAG(Num, Val, Str) \
if (Val) \
Flag |= (uint32_t)dxbc::RootElementFlag::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
More information about the llvm-commits
mailing list