Skip to content

Revert "[DXIL][Analysis] Make alignment on StructuredBuffer optional" #101088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jul 29, 2024

Seeing build failures, reverting to investigate.

Reverts #100697

@bogner bogner merged commit c22171f into main Jul 29, 2024
3 of 5 checks passed
@bogner bogner deleted the revert-100697-users/bogner/sprdxilanalysis-make-alignment-on-structuredbuffer-optional branch July 29, 2024 21:49
@llvmbot
Copy link
Member

llvmbot commented Jul 29, 2024

@llvm/pr-subscribers-backend-directx

@llvm/pr-subscribers-llvm-analysis

Author: Justin Bogner (bogner)

Changes

Seeing build failures, reverting to investigate.

Reverts llvm/llvm-project#100697


Full diff: https://github.com/llvm/llvm-project/pull/101088.diff

3 Files Affected:

  • (modified) llvm/include/llvm/Analysis/DXILResource.h (+6-6)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+3-6)
  • (modified) llvm/unittests/Analysis/DXILResourceTest.cpp (-13)
diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h
index fe79c391ccd9c..2ca0ad9a75319 100644
--- a/llvm/include/llvm/Analysis/DXILResource.h
+++ b/llvm/include/llvm/Analysis/DXILResource.h
@@ -47,7 +47,7 @@ class ResourceInfo {
 
   struct StructInfo {
     uint32_t Stride;
-    MaybeAlign Alignment;
+    Align Alignment;
 
     bool operator==(const StructInfo &RHS) const {
       return std::tie(Stride, Alignment) == std::tie(RHS.Stride, RHS.Alignment);
@@ -138,7 +138,7 @@ class ResourceInfo {
     CBufferSize = Size;
   }
   void setSampler(dxil::SamplerType Ty) { SamplerTy = Ty; }
-  void setStruct(uint32_t Stride, MaybeAlign Alignment) {
+  void setStruct(uint32_t Stride, Align Alignment) {
     assert(isStruct() && "Not a Struct");
     Struct.Stride = Stride;
     Struct.Alignment = Alignment;
@@ -164,7 +164,7 @@ class ResourceInfo {
                           dxil::ResourceKind Kind);
   static ResourceInfo RawBuffer(Value *Symbol, StringRef Name);
   static ResourceInfo StructuredBuffer(Value *Symbol, StringRef Name,
-                                       uint32_t Stride, MaybeAlign Alignment);
+                                       uint32_t Stride, Align Alignment);
   static ResourceInfo Texture2DMS(Value *Symbol, StringRef Name,
                                   dxil::ElementType ElementTy,
                                   uint32_t ElementCount, uint32_t SampleCount);
@@ -180,9 +180,9 @@ class ResourceInfo {
   static ResourceInfo RWRawBuffer(Value *Symbol, StringRef Name,
                                   bool GloballyCoherent, bool IsROV);
   static ResourceInfo RWStructuredBuffer(Value *Symbol, StringRef Name,
-                                         uint32_t Stride, MaybeAlign Alignment,
-                                         bool GloballyCoherent, bool IsROV,
-                                         bool HasCounter);
+                                         uint32_t Stride,
+                                         Align Alignment, bool GloballyCoherent,
+                                         bool IsROV, bool HasCounter);
   static ResourceInfo RWTexture2DMS(Value *Symbol, StringRef Name,
                                     dxil::ElementType ElementTy,
                                     uint32_t ElementCount, uint32_t SampleCount,
diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp
index 3ca5d360fc228..1443fef8fc165 100644
--- a/llvm/lib/Analysis/DXILResource.cpp
+++ b/llvm/lib/Analysis/DXILResource.cpp
@@ -79,8 +79,7 @@ ResourceInfo ResourceInfo::RawBuffer(Value *Symbol, StringRef Name) {
 }
 
 ResourceInfo ResourceInfo::StructuredBuffer(Value *Symbol, StringRef Name,
-                                            uint32_t Stride,
-                                            MaybeAlign Alignment) {
+                                            uint32_t Stride, Align Alignment) {
   ResourceInfo RI(ResourceClass::SRV, ResourceKind::StructuredBuffer, Symbol,
                   Name);
   RI.setStruct(Stride, Alignment);
@@ -128,8 +127,7 @@ ResourceInfo ResourceInfo::RWRawBuffer(Value *Symbol, StringRef Name,
 }
 
 ResourceInfo ResourceInfo::RWStructuredBuffer(Value *Symbol, StringRef Name,
-                                              uint32_t Stride,
-                                              MaybeAlign Alignment,
+                                              uint32_t Stride, Align Alignment,
                                               bool GloballyCoherent, bool IsROV,
                                               bool HasCounter) {
   ResourceInfo RI(ResourceClass::UAV, ResourceKind::StructuredBuffer, Symbol,
@@ -286,8 +284,7 @@ MDTuple *ResourceInfo::getAsMetadata(LLVMContext &Ctx) const {
 
 std::pair<uint32_t, uint32_t> ResourceInfo::getAnnotateProps() const {
   uint32_t ResourceKind = llvm::to_underlying(Kind);
-  uint32_t AlignLog2 =
-      (isStruct() && Struct.Alignment) ? Log2(*Struct.Alignment) : 0;
+  uint32_t AlignLog2 = isStruct() ? Log2(Struct.Alignment) : 0;
   bool IsUAV = isUAV();
   bool IsROV = IsUAV && UAVFlags.IsROV;
   bool IsGloballyCoherent = IsUAV && UAVFlags.GloballyCoherent;
diff --git a/llvm/unittests/Analysis/DXILResourceTest.cpp b/llvm/unittests/Analysis/DXILResourceTest.cpp
index 7bbb417097882..554cbd0d8ded7 100644
--- a/llvm/unittests/Analysis/DXILResourceTest.cpp
+++ b/llvm/unittests/Analysis/DXILResourceTest.cpp
@@ -151,19 +151,6 @@ TEST(DXILResource, AnnotationsAndMetadata) {
   EXPECT_MDEQ(
       MD, TestMD.get(0, Symbol, "Buffer0", 0, 0, 1, 12, 0, TestMD.get(1, 16)));
 
-  // StructuredBuffer<float3> Buffer1 : register(t1);
-  Symbol = UndefValue::get(StructType::create(
-      Context, {Floatx3Ty}, "class.StructuredBuffer<vector<float, 3> >"));
-  Resource = ResourceInfo::StructuredBuffer(Symbol, "Buffer1",
-                                            /*Stride=*/12, {});
-  Resource.bind(1, 0, 1, 1);
-  Props = Resource.getAnnotateProps();
-  EXPECT_EQ(Props.first, 0x0000000cU);
-  EXPECT_EQ(Props.second, 0x0000000cU);
-  MD = Resource.getAsMetadata(Context);
-  EXPECT_MDEQ(
-      MD, TestMD.get(1, Symbol, "Buffer1", 0, 1, 1, 12, 0, TestMD.get(1, 12)));
-
   // Texture2D<float4> ColorMapTexture : register(t2);
   Symbol = UndefValue::get(StructType::create(
       Context, {Floatx4Ty}, "class.Texture2D<vector<float, 4> >"));

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 29, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-libc-amdgpu-runtime running on omp-vega20-1 while building llvm at step 10 "Add check check-offload".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/2849

Here is the relevant piece of the build log for the reference:

Step 10 (Add check check-offload) failure: 1200 seconds without output running [b'ninja', b'-j 32', b'check-offload'], attempting to kill
...
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/bug50022.cpp (785 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/thread_state_1.c (786 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/bug53727.cpp (787 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/bug47654.cpp (788 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/wtime.c (789 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu :: offloading/bug49021.cpp (790 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu :: offloading/std_complex_arithmetic.cpp (791 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/complex_reduction.cpp (792 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/std_complex_arithmetic.cpp (793 of 795)
PASS: libomptarget :: x86_64-pc-linux-gnu-LTO :: offloading/bug49021.cpp (794 of 795)
command timed out: 1200 seconds without output running [b'ninja', b'-j 32', b'check-offload'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1228.338009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants