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
920 B25 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly
2
3// CHECK: type: float
4// CHECK-COUNT-256: 241.0
5
6//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer
7RWStructuredBuffer<float> outputBuffer;
8
9using namespace linalg;
10
11typealias CoopMatAType = CoopMat<float16_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixA>;
12typealias CoopMatBType = CoopMat<float16_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixB>;
13typealias CoopMatCType = CoopMat<float32_t, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>;
14
15[numthreads(32, 1, 1)]
16void computeMain()
17{
18    // ( 3.0 * 5.0 ) * 16 + 1.0 = 241.0
19    let matA = CoopMatAType(3.0);
20    let matB = CoopMatBType(5.0);
21    let matC = CoopMatCType(1.0);
22
23    let result = coopMatMulAdd<float, false>(matA, matB, matC);
24    result.Store<CoopMatMatrixLayout::RowMajor>(outputBuffer, 0, 16);
25}