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
1.0 KiB34 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 emits coherent operations here
5// SPIRV: MakePointerVisible
6// SPIRV: MakePointerAvailable
7
8// CHECK: 1
9// CHECK-NEXT: 2
10// CHECK-NEXT: 3
11// CHECK-NEXT: 4
12// CHECK-NEXT: 5
13// CHECK-NEXT: 6
14// CHECK-NEXT: 7
15// CHECK-NEXT: 8
16
17//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4, count=256):name=inputBuffer
18uniform int32_t* inputBuffer;
19
20//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
21uniform int32_t* outputBuffer;
22
23using namespace linalg;
24
25[numthreads(32, 1, 1)]
26void computeMain()
27{
28    int32_t* ptrIn = inputBuffer;
29    int32_t* ptrOut = outputBuffer;
30
31    let stride = 16;
32    let mat = coopMatLoadCoherent<int32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse.MatrixAccumulator, CoopMatMatrixLayout.RowMajor>(ptrIn, 0, stride, MemoryScope::Device);
33    mat.StoreCoherent<CoopMatMatrixLayout.RowMajor>(ptrOut, 0, 16, MemoryScope::Device);
34}