From 2f68f98a3d7d41c1daac07afab622c34f5c1b8d4 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Mon, 18 Aug 2025 12:30:10 -0400 Subject: 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 --- tests/autodiff/avoid-double-lowering.slang | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/autodiff/avoid-double-lowering.slang (limited to 'tests') 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: IDifferentiable + where T : __BuiltinFloatingPointType +{ + This myFunc(This other); +} + +struct Foo + where T : __BuiltinFloatingPointType +{ + [BackwardDifferentiable] + This myFunc(This other) + { + [MaxIters(N)] + for (int i = 0; i < N; i++) {} + + return this; + } +} + +extension Foo : IFoo + where T : __BuiltinFloatingPointType {} + -- cgit v1.2.3