yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakFix intermittent debug failures with Debug build (#7369)7dad68f86

master
904 B43 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -target hlsl -profile cs_6_5
2
3
4RWStructuredBuffer<float> outputBuffer;
5
6typedef DifferentialPair<float> dpfloat;
7typedef float.Differential dfloat;
8
9// CHECK: function 'test_loop_with_continue' never returns
10[BackwardDifferentiable]
11float test_loop_with_continue(float y)
12{
13    float t = y;
14    
15    // OOPS! No `++i`! 
16    for (int i = 0; i < 3;)
17    {
18        if (t > 4.0)
19            continue;
20
21        t = t * t;
22    }
23
24    return t;
25}
26
27[numthreads(1, 1, 1)]
28void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
29{
30    {
31        dpfloat dpa = dpfloat(2.0, 0.0);
32
33        __bwd_diff(test_loop_with_continue)(dpa, 1.0f);
34        outputBuffer[0] = dpa.d; // Expect: 32.0
35    }
36
37    {
38        dpfloat dpa = dpfloat(0.4, 0.0);
39
40        __bwd_diff(test_loop_with_continue)(dpa, 1.0f);
41        outputBuffer[1] = dpa.d; // Expect: 0.0131072
42    }
43}