yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f55f669d1
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type 2 3// These platforms don't support these operations from structured buffers 4//DISABLE_TESTTEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type 5//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -output-using-type -profile cs_6_9 -Xslang... -Xdxc -Vd -X. 6 7// CHECK: type: int32_t 8// CHECK-NEXT: 35 9// CHECK-NEXT: 76 10// CHECK-NEXT: 117 11// CHECK-NEXT: 158 12 13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 14RWStructuredBuffer<int32_t> outputBuffer; 15 16//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input 17//[1 2 3 4] 18StructuredBuffer<uint32_t> input; 19 20//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix 21//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] 22StructuredBuffer<uint8_t> matrix; 23 24//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias 25StructuredBuffer<uint8_t> bias; 26 27[numthreads(1, 1, 1)] 28void computeMain() 29{ 30 // Expected to fail with Vulkan 1.4.313.0 or below due to a bug in the VVL 31 // The VVL incorrectly reports that the result type in the following command is `VK_COMPONENT_TYPE_UINT32_KHR`. 32 // Tracking the issue in github #7715. 33 34 let vec = coopVecLoad<1>(input); 35 let result = coopVecMatMulAddPacked<int32_t, 4>( 36 vec, 37 CoopVecComponentType::SignedInt8Packed, 38 4, 39 matrix, 40 0, 41 CoopVecComponentType::SignedInt8, 42 bias, 43 0, 44 CoopVecComponentType::SignedInt32, 45 CoopVecMatrixLayout::RowMajor, 46 false, 47 4 48 ); 49 50 result.store(outputBuffer); 51}