[llvm] [DirectX] Replace ResourceFlag enum with struct fields (PR #106617)

Xiang Li via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 06:34:19 PDT 2024


https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/106617

>From c90c8b0b15ca4327524908c029e1c66c206086b1 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Thu, 29 Aug 2024 15:38:13 -0400
Subject: [PATCH 1/3] [NFC][DirectX] Remove ResourceFlag yaml code

Since we keep the resource flag as uint32_t, the yaml code is unused.
---
 llvm/include/llvm/ObjectYAML/DXContainerYAML.h | 1 -
 llvm/lib/ObjectYAML/DXContainerYAML.cpp        | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index e432359b7bbd07..1407f16a3499fc 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -178,7 +178,6 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ComponentType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::InterpolationMode)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceKind)
-LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceFlag)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::D3DSystemValue)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigComponentType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigMinPrecision)
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 21a966d5abd132..b8a0d21c62d6b9 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -266,12 +266,6 @@ void ScalarEnumerationTraits<dxbc::PSV::ResourceKind>::enumeration(
     IO.enumCase(Value, E.Name.str().c_str(), E.Value);
 }
 
-void ScalarEnumerationTraits<dxbc::PSV::ResourceFlag>::enumeration(
-    IO &IO, dxbc::PSV::ResourceFlag &Value) {
-  for (const auto &E : dxbc::PSV::getResourceFlags())
-    IO.enumCase(Value, E.Name.str().c_str(), E.Value);
-}
-
 void ScalarEnumerationTraits<dxbc::D3DSystemValue>::enumeration(
     IO &IO, dxbc::D3DSystemValue &Value) {
   for (const auto &E : dxbc::getD3DSystemValues())

>From a1af327862e31b3b67da0c17936220ac6bc2db0e Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Fri, 30 Aug 2024 09:29:23 -0400
Subject: [PATCH 2/3] Replace the enum with bits.

---
 llvm/include/llvm/BinaryFormat/DXContainer.h  | 20 ++++++++++++-------
 .../BinaryFormat/DXContainerConstants.def     |  3 +--
 .../include/llvm/ObjectYAML/DXContainerYAML.h |  5 +++++
 llvm/lib/BinaryFormat/DXContainer.cpp         | 10 ----------
 llvm/lib/ObjectYAML/DXContainerYAML.cpp       |  7 +++++++
 .../DXContainer/DomainMaskVectors.yaml        |  3 ++-
 .../DXContainer/PSVv2-amplification.yaml      | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-compute.yaml | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-domain.yaml  | 12 +++++++----
 .../DXContainer/PSVv2-geometry.yaml           | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-hull.yaml    | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-mesh.yaml    | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-pixel.yaml   | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv2-vertex.yaml  | 12 +++++++----
 .../DXContainer/PSVv3-amplification.yaml      | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-compute.yaml | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-domain.yaml  | 12 +++++++----
 .../DXContainer/PSVv3-geometry.yaml           | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-hull.yaml    | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-mesh.yaml    | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-pixel.yaml   | 12 +++++++----
 .../ObjectYAML/DXContainer/PSVv3-vertex.yaml  | 12 +++++++----
 22 files changed, 156 insertions(+), 84 deletions(-)

diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index a4cc814549c95b..21e28d546286ee 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -313,13 +313,19 @@ enum class ResourceKind : uint32_t {
 
 ArrayRef<EnumEntry<ResourceKind>> getResourceKinds();
 
-#define RESOURCE_FLAG(Val, Enum) Enum = Val,
-enum class ResourceFlag : uint32_t {
-#include "DXContainerConstants.def"
+#define RESOURCE_FLAG(Index, Enum) bool Enum = false;
+struct ResourceFlags {
+  ResourceFlags() {};
+  struct FlagsBits {
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+  };
+  union {
+    uint32_t Flags;
+    FlagsBits Bits;
+  };
+  bool operator==(const uint32_t RFlags) const { return Flags == RFlags; }
 };
 
-ArrayRef<EnumEntry<ResourceFlag>> getResourceFlags();
-
 namespace v0 {
 struct RuntimeInfo {
   PipelinePSVInfo StageInfo;
@@ -439,12 +445,12 @@ struct RuntimeInfo : public v1::RuntimeInfo {
 
 struct ResourceBindInfo : public v0::ResourceBindInfo {
   ResourceKind Kind;
-  uint32_t Flags;
+  ResourceFlags Flags;
 
   void swapBytes() {
     v0::ResourceBindInfo::swapBytes();
     sys::swapByteOrder(Kind);
-    sys::swapByteOrder(Flags);
+    sys::swapByteOrder(Flags.Flags);
   }
 };
 
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 4111cecb018bb3..1aacbb2f65b27f 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -190,8 +190,7 @@ RESOURCE_KIND(18, FeedbackTexture2DArray)
 #endif // RESOURCE_KIND
 
 #ifdef RESOURCE_FLAG
-RESOURCE_FLAG(0, None)
-RESOURCE_FLAG(1, UsedByAtomic64)
+RESOURCE_FLAG(0, UsedByAtomic64)
 
 #undef RESOURCE_FLAG
 #endif // RESOURCE_FLAG
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 1407f16a3499fc..66ad057ab0e30f 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -72,6 +72,7 @@ struct ShaderHash {
   std::vector<llvm::yaml::Hex8> Digest;
 };
 
+using ResourceFlags = dxbc::PSV::ResourceFlags;
 using ResourceBindInfo = dxbc::PSV::v2::ResourceBindInfo;
 
 struct SignatureElement {
@@ -220,6 +221,10 @@ template <> struct MappingTraits<DXContainerYAML::Object> {
   static void mapping(IO &IO, DXContainerYAML::Object &Obj);
 };
 
+template <> struct MappingTraits<DXContainerYAML::ResourceFlags> {
+  static void mapping(IO &IO, DXContainerYAML::ResourceFlags &Flags);
+};
+
 template <> struct MappingTraits<DXContainerYAML::ResourceBindInfo> {
   static void mapping(IO &IO, DXContainerYAML::ResourceBindInfo &Res);
 };
diff --git a/llvm/lib/BinaryFormat/DXContainer.cpp b/llvm/lib/BinaryFormat/DXContainer.cpp
index 790947cc729c0b..97ceb16ccf53f4 100644
--- a/llvm/lib/BinaryFormat/DXContainer.cpp
+++ b/llvm/lib/BinaryFormat/DXContainer.cpp
@@ -109,13 +109,3 @@ static const EnumEntry<PSV::ResourceKind> ResourceKindNames[] = {
 ArrayRef<EnumEntry<PSV::ResourceKind>> PSV::getResourceKinds() {
   return ArrayRef(ResourceKindNames);
 }
-
-#define RESOURCE_FLAG(Val, Enum) {#Enum, PSV::ResourceFlag::Enum},
-
-static const EnumEntry<PSV::ResourceFlag> ResourceFlagNames[] = {
-#include "llvm/BinaryFormat/DXContainerConstants.def"
-};
-
-ArrayRef<EnumEntry<PSV::ResourceFlag>> PSV::getResourceFlags() {
-  return ArrayRef(ResourceFlagNames);
-}
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index b8a0d21c62d6b9..cf94c68ce9af6a 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -206,6 +206,13 @@ void MappingTraits<DXContainerYAML::Object>::mapping(
   IO.mapRequired("Parts", Obj.Parts);
 }
 
+void MappingTraits<DXContainerYAML::ResourceFlags>::mapping(
+    IO &IO, DXContainerYAML::ResourceFlags &Flags) {
+#define RESOURCE_FLAG(FlagIndex, Enum)                      \
+  IO.mapRequired(#Enum, Flags.Bits.Enum);
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+}
+
 void MappingTraits<DXContainerYAML::ResourceBindInfo>::mapping(
     IO &IO, DXContainerYAML::ResourceBindInfo &Res) {
   IO.mapRequired("Type", Res.Type);
diff --git a/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml b/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
index f3cfa90d1cf901..1a2f341f03ef71 100644
--- a/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml
@@ -75,7 +75,8 @@ Parts:
           LowerBound:      0
           UpperBound:      0
           Kind:            CBuffer
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  true
       SigInputElements:
         - Name:            AAA_HSFoo
           Indices:         [ 0 ]
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml
index 8bae742b573919..1e00e604f3e248 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml
@@ -30,13 +30,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -77,13 +79,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml
index 74eb2b86ad01b2..c8bfd9acf68efc 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml
@@ -29,13 +29,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -75,13 +77,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml
index 38f81bd93d67cf..021fb1b5fffb1f 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml
@@ -33,13 +33,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -84,13 +86,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml
index 99fdbbb7c9edaf..74e32efbe2c659 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml
@@ -34,13 +34,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -85,13 +87,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-hull.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-hull.yaml
index de8af95dbcbd89..79d92e2f0c5e6f 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-hull.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-hull.yaml
@@ -34,13 +34,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -86,13 +88,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-mesh.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-mesh.yaml
index 78fc077348f42a..27bf148126005b 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-mesh.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-mesh.yaml
@@ -36,13 +36,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -89,13 +91,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-pixel.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-pixel.yaml
index ebe1e51faff3f8..1a1a74d7f3121d 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-pixel.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-pixel.yaml
@@ -31,13 +31,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -79,13 +81,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
index 2bca2f211136b2..6b0ba5eb3d19f0 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
@@ -30,13 +30,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -77,13 +79,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml
index 9e31d40ec7c1b4..6f7d151b266c9d 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml
@@ -31,13 +31,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -79,13 +81,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml
index 530a8597cb6498..2de3d435af1de9 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml
@@ -30,13 +30,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -77,13 +79,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml
index a71ab67633eb6f..91afb2f11fc7c4 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml
@@ -34,13 +34,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -86,13 +88,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml
index db530253c6a745..f661e81fe869b9 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml
@@ -35,13 +35,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -87,13 +89,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-hull.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-hull.yaml
index 3e3ba493e98450..4140c3180e32ca 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-hull.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-hull.yaml
@@ -35,13 +35,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -88,13 +90,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT:   UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT:   UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-mesh.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-mesh.yaml
index 57bbcecfa1796b..03ce5b583315d0 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-mesh.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-mesh.yaml
@@ -37,13 +37,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -91,13 +93,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-pixel.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-pixel.yaml
index c94c234142a34b..2434567b2a6f5c 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-pixel.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-pixel.yaml
@@ -32,13 +32,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -81,13 +83,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-vertex.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-vertex.yaml
index 697fa870c2257c..b43f6aa6b71d4a 100644
--- a/llvm/test/ObjectYAML/DXContainer/PSVv3-vertex.yaml
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-vertex.yaml
@@ -31,13 +31,15 @@ Parts:
           LowerBound:      3
           UpperBound:      4
           Kind:            TextureCube
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  false
         - Type:            Invalid
           Space:           32768
           LowerBound:      8388608
           UpperBound:      2147483648
           Kind:            Invalid
-          Flags:           0
+          Flags:
+            UsedByAtomic64:  true
       SigInputElements: []
       SigOutputElements: []
       SigPatchOrPrimElements: []
@@ -79,13 +81,15 @@ Parts:
 # CHECK-NEXT: LowerBound:      3
 # CHECK-NEXT: UpperBound:      4
 # CHECK-NEXT: Kind:            TextureCube
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  false
 # CHECK-NEXT: - Type:            Invalid
 # CHECK-NEXT: Space:           32768
 # CHECK-NEXT: LowerBound:      8388608
 # CHECK-NEXT: UpperBound:      2147483648
 # CHECK-NEXT: Kind:            Invalid
-# CHECK-NEXT: Flags:           0
+# CHECK-NEXT: Flags:
+# CHECK-NEXT: UsedByAtomic64:  true
 # CHECK-NEXT: SigInputElements: []
 # CHECK-NEXT: SigOutputElements: []
 # CHECK-NEXT: SigPatchOrPrimElements: []

>From 90ae8a84f3ee9bad3bb5a1c326355f0a4ce78fac Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Fri, 30 Aug 2024 09:34:04 -0400
Subject: [PATCH 3/3] Fix clang-format.

---
 llvm/lib/ObjectYAML/DXContainerYAML.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index cf94c68ce9af6a..5dee1221b27c01 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -208,8 +208,7 @@ void MappingTraits<DXContainerYAML::Object>::mapping(
 
 void MappingTraits<DXContainerYAML::ResourceFlags>::mapping(
     IO &IO, DXContainerYAML::ResourceFlags &Flags) {
-#define RESOURCE_FLAG(FlagIndex, Enum)                      \
-  IO.mapRequired(#Enum, Flags.Bits.Enum);
+#define RESOURCE_FLAG(FlagIndex, Enum) IO.mapRequired(#Enum, Flags.Bits.Enum);
 #include "llvm/BinaryFormat/DXContainerConstants.def"
 }
 



More information about the llvm-commits mailing list