yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f94b2f7a3
master
1//DIAGNOSTIC_TEST:SIMPLE: 2 3float nonDiff(float x) 4{ 5 return x; 6} 7 8[ForwardDifferentiable] 9float f(float x) 10{ 11 return x * x; 12} 13 14[BackwardDifferentiable] 15float g(float x) 16{ 17 float val = f(x + 1); // Error: f must also be backward-differentiable 18 return val; 19} 20 21[BackwardDifferentiable] 22float h(float x) 23{ 24 float val = 0; 25 // no diagnostic by clarifying intention. 26 val = no_diff(f(x + 1)); 27 28 // error: dynamic loop without [MaxIters] or [ForceUnroll] 29 for (int i = 0; i < (int)x; i++) 30 { 31 no_diff debugBreak(); 32 } 33 34 return val; 35}