yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d58243d90
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -emit-spirv-directly 2 3// CHECK: 1 4// CHECK-NEXT: 2 5// CHECK-NEXT: 3 6// CHECK-NEXT: 4 7// CHECK-NEXT: 5 8// CHECK-NEXT: 6 9// CHECK-NEXT: 7 10// CHECK-NEXT: 8 11 12//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4, count=256):name=input 13ByteAddressBuffer input; 14 15//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer 16RWStructuredBuffer<uint32_t> outputBuffer; 17 18using namespace linalg; 19 20groupshared uint32_t[256] tempShared; 21 22[numthreads(32, 1, 1)] 23void computeMain() 24{ 25 let stride = 16; 26 27 let mat = coopMatLoad<uint32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse.MatrixAccumulator, CoopMatMatrixLayout.RowMajor>(input, 0, stride); 28 mat.Store<CoopMatMatrixLayout.RowMajor>(tempShared, 0, stride); 29 30 let result = coopMatLoad<uint32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse.MatrixAccumulator, CoopMatMatrixLayout.RowMajor>(tempShared, 0, stride); 31 result.Store<CoopMatMatrixLayout.RowMajor>(outputBuffer, 0, stride); 32}