summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-08-18 12:30:10 -0400
committerGitHub <noreply@github.com>2025-08-18 09:30:10 -0700
commit2f68f98a3d7d41c1daac07afab622c34f5c1b8d4 (patch)
tree1d51bec5cc9f22f0bf6d2f12fc614cafed0c3d7b /tests
parentcc93e2c3523f558ee85281f7fe98e220f058f5ed (diff)
Fix issue of double lowering issue a differentiable function (#8182)
Close #8054. For detailed root cause is at: https://github.com/shader-slang/slang/issues/8054#issuecomment-3189579508
Diffstat (limited to 'tests')
-rw-r--r--tests/autodiff/avoid-double-lowering.slang26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/autodiff/avoid-double-lowering.slang b/tests/autodiff/avoid-double-lowering.slang
new file mode 100644
index 000000000..354d1d27b
--- /dev/null
+++ b/tests/autodiff/avoid-double-lowering.slang
@@ -0,0 +1,26 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+// CHECK-NOT: an internal error threw
+// CHECK-NOT: error:
+
+interface IFoo<T, int N>: IDifferentiable
+ where T : __BuiltinFloatingPointType
+{
+ This myFunc(This other);
+}
+
+struct Foo<T, int N>
+ where T : __BuiltinFloatingPointType
+{
+ [BackwardDifferentiable]
+ This myFunc(This other)
+ {
+ [MaxIters(N)]
+ for (int i = 0; i < N; i++) {}
+
+ return this;
+ }
+}
+
+extension <T, int N> Foo<T, N> : IFoo<T, N>
+ where T : __BuiltinFloatingPointType {}
+