summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-05-23 02:22:21 -0400
committerGitHub <noreply@github.com>2025-05-23 06:22:21 +0000
commitd108bfa677c70808b32bd77e93637ed34c19c75d (patch)
treee88b2ac2fc05970d10afd539bd096007cc85fbe7 /tests
parent6209f69f335a604604a5032b0f5c38b4b8bc861a (diff)
Add CoopVec load/store pointer overloads (#6822)
* Add pointer/T* variants for coop vec load/store * fix stride decoration and improved test * fix compile warnings * Improve test * Use `coopVecLoad` function in test
Diffstat (limited to 'tests')
-rw-r--r--tests/cooperative-vector/load-store-pointer.slang32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/cooperative-vector/load-store-pointer.slang b/tests/cooperative-vector/load-store-pointer.slang
new file mode 100644
index 000000000..7d7b2b6c2
--- /dev/null
+++ b/tests/cooperative-vector/load-store-pointer.slang
@@ -0,0 +1,32 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -emit-spirv-directly
+
+//TEST_INPUT: set inputBuffer = ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12], stride=4);
+uniform int32_t* inputBuffer;
+
+//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0 0 0 0 0], stride=4);
+uniform int32_t* outputBuffer;
+
+// CHECK: 9
+// CHECK-NEXT: A
+// CHECK-NEXT: B
+// CHECK-NEXT: C
+// CHECK-NEXT: 1
+// CHECK-NEXT: 2
+// CHECK-NEXT: 3
+// CHECK-NEXT: 4
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ // First half of input.
+ let a = coopVecLoad<4, int32_t>(inputBuffer, 0);
+ // Second half of input.
+ let b = coopVecLoad<4, int32_t>(inputBuffer + 4, 4*4);
+
+ // Store second half of input to first half of output buffer.
+ b.store(outputBuffer, 0);
+ // Store first half of input to second half of output buffer.
+ a.store(outputBuffer, 4*4);
+}
+