Skip to content

Commit 321a419

Browse files
authored
[SPIR-V] Fix unit tests for dynamic indexing to add validation step. (#164455)
Add attributes to the unit tests required to pass `spirv-val`. Addresses llvm/llvm-project#161852
1 parent 513f9c5 commit 321a419

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
23

34
%"__cblayout_$Globals" = type <{ i32 }>
45

@@ -9,7 +10,6 @@
910

1011
; CHECK: OpCapability Shader
1112
; CHECK: OpCapability StorageTexelBufferArrayDynamicIndexingEXT
12-
1313
define void @main() local_unnamed_addr #0 {
1414
entry:
1515
%"$Globals.cb_h.i.i" = tail call target("spirv.VulkanBuffer", target("spirv.Layout", %"__cblayout_$Globals", 4, 0), 2, 0) @"llvm.spv.resource.handlefromimplicitbinding.tspirv.VulkanBuffer_tspirv.Layout_s___cblayout_$Globalss_4_0t_2_0t"(i32 1, i32 0, i32 1, i32 0, ptr nonnull @"$Globals.str")
@@ -19,4 +19,8 @@ entry:
1919
%2 = tail call noundef align 4 dereferenceable(4) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.Image_i32_5_2_0_0_2_33t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 33) %1, i32 98)
2020
store i32 99, ptr addrspace(11) %2, align 4
2121
ret void
22-
}
22+
}
23+
24+
!hlsl.cbs = !{!0}
25+
26+
!0 = !{ptr @"$Globals.cb", ptr addrspace(12) @i}

llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
23

34
%"__cblayout_$Globals" = type <{ i32 }>
45

@@ -19,3 +20,7 @@ entry:
1920
store i32 98, ptr addrspace(11) %2, align 4
2021
ret void
2122
}
23+
24+
!hlsl.cbs = !{!0}
25+
26+
!0 = !{ptr @"$Globals.cb", ptr addrspace(12) @i}

0 commit comments

Comments
 (0)