yum-mirror/slang

Making it easier to work with shaders

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

Harsh Aggarwal (NVIDIA)Enable CUDA Test Enablement - Batch 1: Autodiff Tests (1-16) (#8139)c3df36043

master
686 B33 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHK): -output-using-type
2//TEST:COMPARE_COMPUTE(filecheck-buffer=CHK): -output-using-type -cuda
3
4interface ITest
5{
6    __generic<I : IInteger>
7    __subscript(I i) -> float
8    {
9        [BackwardDifferentiable] get;
10    }
11}
12struct Test : ITest
13{
14    __generic<I : IInteger>
15    __subscript(I i) -> float
16    {
17        [BackwardDifferentiable] get { return 5.0f * i.toInt(); }
18    }
19}
20[Differentiable]
21float test(ITest arg)
22{
23    return arg[1];
24}
25//TEST_INPUT:set output = out ubuffer(data=[0 0 0 0], stride=4)
26RWStructuredBuffer<float> output;
27[numthreads(1,1,1)]
28void computeMain()
29{
30    Test t = {};
31    output[0] = test(t);
32    // CHK: 5.0
33}