yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakSupport Vulkan memory model (#7057)d58243d90

master
1.2 KiB38 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly
2
3// CHECK: type: float
4// CHECK: 1.000000
5// CHECK-NEXT: 2.000000
6// CHECK-NEXT: 3.000000
7// CHECK-NEXT: 4.000000
8// CHECK-NEXT: 5.000000
9// CHECK-NEXT: 6.000000
10// CHECK-NEXT: 7.000000
11// CHECK-NEXT: 8.000000
12
13//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=256),name=input1
14ByteAddressBuffer input1;
15
16//TEST_INPUT:ubuffer(data=[5.0 6.0 7.0 8.0], stride=256),name=input1
17ByteAddressBuffer input2;
18
19//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
20RWStructuredBuffer<float> outputBuffer;
21
22using namespace linalg;
23
24typealias CoopMatType = CoopMat<float, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>;
25
26[numthreads(32, 1, 1)]
27void computeMain()
28{
29    let stride = 16;
30    let matrixLayout = CoopMatMatrixLayout::RowMajor;
31
32    CoopMatType coopMatArray[2];
33    coopMatArray[0] = CoopMatType.Load<CoopMatMatrixLayout::RowMajor>(input1, 0, stride);
34    coopMatArray[1] = CoopMatType.Load<CoopMatMatrixLayout::RowMajor>(input2, 0, stride);
35
36    coopMatArray[0].Store<CoopMatMatrixLayout::RowMajor>(outputBuffer, 0, stride);
37    coopMatArray[1].Store<CoopMatMatrixLayout::RowMajor>(outputBuffer, 4, stride);
38}