aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucie Choi <clucie@google.com>2025-10-21 10:33:24 -0700
committerGitHub <noreply@github.com>2025-10-21 10:33:24 -0700
commit321a419960175ce2fc4c35d9513065e6e717259c (patch)
tree2afa62b99322f782a8e5a6004cca6bf1253271b9
parent513f9c50e74e55b7f8dedf65105bdc1083d4f83d (diff)
downloadllvm-321a419960175ce2fc4c35d9513065e6e717259c.zip
llvm-321a419960175ce2fc4c35d9513065e6e717259c.tar.gz
llvm-321a419960175ce2fc4c35d9513065e6e717259c.tar.bz2
[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 https://github.com/llvm/llvm-project/issues/161852
-rw-r--r--llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll8
-rw-r--r--llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll5
2 files changed, 11 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll b/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll
index cce1eda..1aee688 100644
--- a/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll
+++ b/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWBufferDynamicIdx.ll
@@ -1,4 +1,5 @@
; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
%"__cblayout_$Globals" = type <{ i32 }>
@@ -9,7 +10,6 @@
; CHECK: OpCapability Shader
; CHECK: OpCapability StorageTexelBufferArrayDynamicIndexingEXT
-
define void @main() local_unnamed_addr #0 {
entry:
%"$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:
%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)
store i32 99, ptr addrspace(11) %2, align 4
ret void
-} \ No newline at end of file
+}
+
+!hlsl.cbs = !{!0}
+
+!0 = !{ptr @"$Globals.cb", ptr addrspace(12) @i}
diff --git a/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll b/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll
index da69a2f..163fc9d 100644
--- a/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll
+++ b/llvm/test/CodeGen/SPIRV/hlsl-resources/DynamicIdx/RWStructuredBufferDynamicIdx.ll
@@ -1,4 +1,5 @@
; RUN: llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
%"__cblayout_$Globals" = type <{ i32 }>
@@ -19,3 +20,7 @@ entry:
store i32 98, ptr addrspace(11) %2, align 4
ret void
}
+
+!hlsl.cbs = !{!0}
+
+!0 = !{ptr @"$Globals.cb", ptr addrspace(12) @i}