yum-mirror/slang

Making it easier to work with shaders

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

Harsh Aggarwal (NVIDIA)Fix#8080: Batch-4: Enable cuda tests (#8261)7ae655c2a

master
980 B24 linesraw
1//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry computeMain -stage compute -emit-spirv-directly
2//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry computeMain -stage compute
3//TEST:SIMPLE(filecheck=CHECK_WGSL):-target wgsl -entry computeMain -stage compute
4//TEST:SIMPLE(filecheck=CHECK_CUDA):-target cuda -entry computeMain -stage compute
5//TEST:SIMPLE(filecheck=CHECK_METAL):-target metal -entry computeMain -stage compute
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
8RWStructuredBuffer<int> outputBuffer;
9
10[numthreads(8, 1, 1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    int idx = int(dispatchThreadID.x);
14    
15    half2 v1 = half2(1.0h, half(1 << idx));
16    
17    // CHECK_SPV: OpGroupNonUniformFAdd
18    // CHECK_WGSL: subgroupExclusiveAdd
19    // CHECK_METAL: simd_prefix_exclusive_sum
20    // CHECK_CUDA: _wavePrefixSumMultiple
21    float2 r1 = WavePrefixSum(v1);
22    
23    outputBuffer[idx] = (int)r1.x;
24}