yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

16-Bit-DogAddition of `Load`/`Store` coherent operations (#8395)1e0908bd7

master
1017 B35 linesraw
1//TEST:SIMPLE(filecheck=SPIRV):-stage compute -entry computeMain -target spirv
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly
3
4// Ensure SPIRV does not do coherent operations here
5// SPIRV-NOT: MakePointerAvailable
6// SPIRV-NOT: MakePointerVisible
7
8
9// CHECK: 1
10// CHECK-NEXT: 2
11// CHECK-NEXT: 3
12// CHECK-NEXT: 4
13// CHECK-NEXT: 5
14// CHECK-NEXT: 6
15// CHECK-NEXT: 7
16// CHECK-NEXT: 8
17
18//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4, count=256):name=inputBuffer
19uniform int32_t* inputBuffer;
20
21//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
22uniform int32_t* outputBuffer;
23
24using namespace linalg;
25
26[numthreads(32, 1, 1)]
27void computeMain()
28{
29    int32_t* ptrIn = inputBuffer;
30    int32_t* ptrOut = outputBuffer;
31
32    let stride = 16;
33    let mat = coopMatLoad<int32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse.MatrixAccumulator, CoopMatMatrixLayout.RowMajor>(ptrIn, 0, stride);
34    mat.Store<CoopMatMatrixLayout.RowMajor>(ptrOut, 0, 16);
35}