summaryrefslogtreecommitdiffstats
path: root/tests/cooperative-matrix/return.slang
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-04-15 15:57:45 -0600
committerGitHub <noreply@github.com>2025-04-15 14:57:45 -0700
commitd0b6a0b1ab49b5958015f31364c5ad73d9cd03eb (patch)
treee419bb3c89fa8c389eb0ccbbe8aaa29a1dcd515f /tests/cooperative-matrix/return.slang
parenta6174ff9443507dece534aa193f8c45e8f0ce7db (diff)
Add cooperative matrix 1 support (#6565)
* initial wip for spirv * working tiled example * clean up store and load * minor fixes * fix loadAny name * add initial tests, including broken/unimplemented intrinsics * fix subscript * run tests at 16x16, remove not supported arithmetic tests * minor fixups on implementation * rename CoopMatMatrixUse * Update tests to pass validation layers locally * Add mat-mul-add test and minor fixes * Add more tests * Remove dead code * Add coopMatLoad function and tests, enforce constexpr for matrix layout * Use getVectorOrCoopMatrixElementType in place of getVectorElementType
Diffstat (limited to 'tests/cooperative-matrix/return.slang')
-rw-r--r--tests/cooperative-matrix/return.slang32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/cooperative-matrix/return.slang b/tests/cooperative-matrix/return.slang
new file mode 100644
index 000000000..339c9d04d
--- /dev/null
+++ b/tests/cooperative-matrix/return.slang
@@ -0,0 +1,32 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type
+
+// CHECK: type: float
+// CHECK-NEXT: 3.000000
+// CHECK-NEXT: 6.000000
+// CHECK-NEXT: 9.000000
+// CHECK-NEXT: 12.000000
+
+//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4, count=256):name=inputBuffer
+StructuredBuffer<float> inputBuffer;
+
+//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+typealias CoopMatType = CoopMat<float, CoopMatScope::Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>;
+
+CoopMatType doubleCoopmat(CoopMatType mat)
+{
+ return mat * 3.0;
+}
+
+[numthreads(32, 1, 1)]
+void computeMain()
+{
+ let stride = 16;
+ let matrixLayout = CoopMatMatrixLayout::RowMajor;
+
+ let mat = CoopMatType.load(inputBuffer, 0, stride, matrixLayout);
+
+ let result = doubleCoopmat(mat);
+ result.store(outputBuffer, 0, 4, matrixLayout);
+}