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 -emit-spirv-directly 2//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. 3//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type 4 5// CHECK: type: int32_t 6// CHECK-NEXT: 35 7// CHECK-NEXT: 76 8// CHECK-NEXT: 117 9// CHECK-NEXT: 158 10 11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 12RWStructuredBuffer<int32_t> outputBuffer; 13 14//TEST_INPUT:ubuffer(data=[67305985], stride=4),name=input 15//[1 2 3 4] 16ByteAddressBuffer input; 17 18//TEST_INPUT:ubuffer(data=[67305985 134678021 202050057 269422093], stride=4),name=matrix 19//[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] 20ByteAddressBuffer matrix; 21 22//TEST_INPUT:ubuffer(data=[5 6 7 8], stride=4),name=bias 23ByteAddressBuffer bias; 24 25[numthreads(1, 1, 1)] 26void computeMain() 27{ 28 // Expected to fail with Vulkan 1.4.313.0 or below due to a bug in the VVL 29 // The VVL incorrectly reports that the result type in the following command is `VK_COMPONENT_TYPE_UINT32_KHR`. 30 // Tracking the issue in github #7715. 31 32 let vec = coopVecLoad<1, uint32_t>(input); 33 let result = coopVecMatMulAddPacked<int32_t, 4>( 34 vec, 35 CoopVecComponentType::SignedInt8Packed, 36 4, 37 matrix, 38 0, 39 CoopVecComponentType::SignedInt8, 40 bias, 41 0, 42 CoopVecComponentType::SignedInt32, 43 CoopVecMatrixLayout::RowMajor, 44 false, 45 4 46 ); 47 48 for(int i = 0; i < result.getCount(); ++i) 49 outputBuffer[i] = result[i]; 50}