yum-mirror/slang

Making it easier to work with shaders

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

Mukund KeshavaAdd debug information for slang inling (#6621)083eecee3

master
1.3 KiB39 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv -O0 -g3
2RWStructuredBuffer<int> outputBuffer;
3
4// Test where outer function is inlined before the inner function.
5
6[ForceInline]
7int inlineSingleBasicBlock1(int value1, int value2)
8{
9    // Simple operation that should be inlined
10    return value1 * 2 + value2;
11}
12
13[__unsafeForceInlineEarly]
14int inlineSingleBasicBlock2(int value1, int value2)
15{
16    int result1 = inlineSingleBasicBlock1(10, 20);
17    // Simple operation that should be inlined
18    return value1 * 2 + value2 + result1;
19}
20
21
22[numthreads(4, 1, 1)]
23void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
24{
25    int i = dispatchThreadID.x;
26    
27    // Call the forceinline function
28    int result = inlineSingleBasicBlock2(16, 10);
29    
30    outputBuffer[i] = result;
31}
32
33
34// CHECK-COUNT-2: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
35// CHECK-NOT:  %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
36// CHECK-COUNT-3: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
37// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
38// CHECK-COUNT-1: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope
39// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope