summaryrefslogtreecommitdiff
path: root/tests/cooperative-matrix/load-store-rwstructuredbuffer.slang
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-05-15 03:47:43 +0000
committerGitHub <noreply@github.com>2025-05-14 20:47:43 -0700
commit2580bb02f7a079ab1c0106b5960a21ed1627bca0 (patch)
treec4fe31e6314f514c9bb079d0fa15ee53adf7396f /tests/cooperative-matrix/load-store-rwstructuredbuffer.slang
parentb4d3d3017640581c21b52a12413d3f074ab1c5c1 (diff)
Add new coopmat2 functions: Reduce and Transpose (#7027)
This commit adds three new functions for CoopMat as described in the proposal document, Cooperative matrix 2 proposal spec#12 The new functions are: CoopMat<T,S,M,N,R>::Transpose CoopMat<T,S,M,N,R>::ReduceRow CoopMat<T,S,M,N,R>::ReduceColumn CoopMat<T,S,M,N,R>::ReduceRowAndColumn CoopMat<T,S,M,N,R>::Reduce2x2
Diffstat (limited to 'tests/cooperative-matrix/load-store-rwstructuredbuffer.slang')
-rw-r--r--tests/cooperative-matrix/load-store-rwstructuredbuffer.slang13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/cooperative-matrix/load-store-rwstructuredbuffer.slang b/tests/cooperative-matrix/load-store-rwstructuredbuffer.slang
index e161fb7b2..6a94fd30e 100644
--- a/tests/cooperative-matrix/load-store-rwstructuredbuffer.slang
+++ b/tests/cooperative-matrix/load-store-rwstructuredbuffer.slang
@@ -1,4 +1,5 @@
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -skip-spirv-validation
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -skip-spirv-validation -Xslang -DRWSB
// CHECK: type: int32_t
// CHECK-NEXT: 1
@@ -11,17 +12,21 @@
// CHECK-NEXT: 8
//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4, count=256),name=buf
+#if defined(RWSB)
RWStructuredBuffer<int32_t> inputBuffer;
+#else
+StructuredBuffer<int32_t> inputBuffer;
+#endif
//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
RWStructuredBuffer<int32_t> outputBuffer;
+using namespace linalg;
+
[numthreads(32, 1, 1)]
void computeMain()
{
let stride = 16;
- let matrixLayout = CoopMatMatrixLayout::RowMajor;
-
- let mat = coopMatLoad<int32_t, CoopMatScope::Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>(inputBuffer, 0, stride, matrixLayout);
- mat.store(outputBuffer, 0, stride, matrixLayout);
+ let mat = coopMatLoad<int32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse.MatrixAccumulator, CoopMatMatrixLayout.RowMajor>(inputBuffer, 0, stride);
+ mat.Store<CoopMatMatrixLayout.RowMajor>(outputBuffer, 0, stride);
}