summaryrefslogtreecommitdiffstats
path: root/tests/cooperative-matrix/inout.slang
blob: 5502a52bd6ff699b6f7aeeddfd23186385304c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly

// CHECK: type: float
// CHECK-NEXT: 2.000000
// CHECK-NEXT: 4.000000
// CHECK-NEXT: 6.000000
// CHECK-NEXT: 8.000000

//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4, count=256),name=input1
ByteAddressBuffer input;

//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;

using namespace linalg;

typealias CoopMatType = CoopMat<float, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>;

void doubleCoopMat(inout CoopMatType mat)
{
    mat = mat * 2.0;
}

[numthreads(32, 1, 1)]
void computeMain()
{
    let stride = 16;
    let matrixLayout = CoopMatMatrixLayout::RowMajor;

    var mat = CoopMatType.Load<CoopMatMatrixLayout::RowMajor>(input, 0, stride);
    doubleCoopMat(mat);
    mat.Store<CoopMatMatrixLayout::RowMajor>(outputBuffer, 0, stride);
}