diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-04-15 15:57:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-15 14:57:45 -0700 |
| commit | d0b6a0b1ab49b5958015f31364c5ad73d9cd03eb (patch) | |
| tree | e419bb3c89fa8c389eb0ccbbe8aaa29a1dcd515f /tests/cooperative-matrix/load-store-arbitrary-array-vec.slang | |
| parent | a6174ff9443507dece534aa193f8c45e8f0ce7db (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/load-store-arbitrary-array-vec.slang')
| -rw-r--r-- | tests/cooperative-matrix/load-store-arbitrary-array-vec.slang | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/cooperative-matrix/load-store-arbitrary-array-vec.slang b/tests/cooperative-matrix/load-store-arbitrary-array-vec.slang new file mode 100644 index 000000000..0afad3284 --- /dev/null +++ b/tests/cooperative-matrix/load-store-arbitrary-array-vec.slang @@ -0,0 +1,41 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -emit-spirv-directly + +// CHECK: 1 +// CHECK-NEXT: 2 +// CHECK-NEXT: 3 +// CHECK-NEXT: 4 +// CHECK-NEXT: 5 +// CHECK-NEXT: 6 +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 +// CHECK-NEXT: 9 +// CHECK-NEXT: A +// CHECK-NEXT: B +// CHECK-NEXT: C +// CHECK-NEXT: D +// CHECK-NEXT: E +// CHECK-NEXT: F +// CHECK-NEXT: 10 + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], stride=4, count=256):name=input +RWByteAddressBuffer input; + +//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer +RWStructuredBuffer<uint32_t> outputBuffer; + +typealias CoopMatType = CoopMat<uint32_t, CoopMatScope::Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>; + +groupshared float3[128] tempShared; + +[numthreads(32, 1, 1)] +void computeMain() +{ + let stride = 16; + let matrixLayout = CoopMatMatrixLayout::RowMajor; + + let mat = coopMatLoad<uint32_t, CoopMatScope::Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>(input, 0, stride, matrixLayout); + mat.storeAny(tempShared, 0, stride, matrixLayout); + + let result = CoopMatType.loadAny(tempShared, 0, stride, matrixLayout); + result.store(outputBuffer, 0, stride, matrixLayout); +} |
