[llvm] [DirectX] Add support for heap resources to `DXILResourceMap` (PR #216454)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 12:55:21 PDT 2026


================
@@ -0,0 +1,181 @@
+; RUN: opt -S -disable-output -passes="print<dxil-resources>" < %s 2>&1 | FileCheck %s
+
+%struct.S = type { <4 x float>, <4 x i32> }
+%P = type <{ float }>
+%Q = type <{ <{ [2 x <{ float, target("dx.Padding", 12) }>], float }> }>
+
+; The resources in this test are created in the same order as they appear after
+; sorting in the ResourceInfo list because FileCheck cannot match multiline sections
+; of text in arbitrary order.
+
+define void @test_typedbuffer() {
+
+  %idx = tail call i32 @llvm.dx.thread.id.in.group(i32 0)
+
+  ; ByteAddressBuffer Buf0 = ResourceDescriptorHeap[5];
+  %srv0 = tail call target("dx.RawBuffer", i8, 0, 0)
+      @llvm.dx.resource.handlefromheap.tdx.RawBuffer_i8_0_0t(i32 5)
+; CHECK: Resource [[SRV0:0]]:
+; CHECK-NEXT:   HeapIndexID: {{[0-9]+}}
+; CHECK-NEXT:   Globally Coherent: 0
+; CHECK-NEXT:   Has Atomic64 Use: 0
+; CHECK-NEXT:   Counter Direction: Unknown
+; CHECK-NEXT:   Class: SRV
+; CHECK-NEXT:   Kind: RawBuffer
+
+  ; struct S { float4 a; uint4 b; };
+  ; StructuredBuffer<S> Buf1 = ResourceDescriptorHeap[ID.x];
+  %srv1 = tail call target("dx.RawBuffer", %struct.S, 0, 0)
+      @llvm.dx.resource.handlefromheap.tdx.RawBuffer_s_struct.Ss_0_0t(i32 %idx)
+; CHECK-DAG: Resource [[SRV1:1]]:
----------------
bogner wrote:

Why `CHECK-DAG` here? Haven't we forced the order as per the comment above?

https://github.com/llvm/llvm-project/pull/216454


More information about the llvm-commits mailing list