yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
52b91231c
master
1//TEST:SIMPLE(filecheck=CUDA): -target cuda -line-directive-mode none 2//TEST:SIMPLE(filecheck=TORCH): -target torch -line-directive-mode none 3 4[AutoPyBindCUDA] 5[CUDAKernel] 6void plain_copy(float3x3 input, TensorView<float> output) 7{ 8 // CUDA: __global__ void __kernel__plain_copy(_MatrixStorage_float3x3_ColMajor_0 input_0, TensorView output_0) 9 // TORCH: void __kernel__plain_copy(_MatrixStorage_float3x3_ColMajor_0 _0, TensorView _1); 10 11 // Get the 'global' index of this thread. 12 uint3 dispatchIdx = cudaThreadIdx() + cudaBlockIdx() * cudaBlockDim(); 13 14 // If the thread index is beyond the input size, exit early. 15 if (dispatchIdx.x >= 1) 16 return; 17 18 output[0] = input[0][0]; 19 output[1] = input[1][1]; 20 output[2] = input[2][2]; 21}