diff options
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/autodiff-data-flow-2.slang | 6 | ||||
| -rw-r--r-- | tests/diagnostics/autodiff-data-flow-2.slang.expected | 5 | ||||
| -rw-r--r-- | tests/diagnostics/autodiff.slang | 5 | ||||
| -rw-r--r-- | tests/diagnostics/autodiff.slang.expected | 3 |
4 files changed, 10 insertions, 9 deletions
diff --git a/tests/diagnostics/autodiff-data-flow-2.slang b/tests/diagnostics/autodiff-data-flow-2.slang index aa923c5d6..3148c6a41 100644 --- a/tests/diagnostics/autodiff-data-flow-2.slang +++ b/tests/diagnostics/autodiff-data-flow-2.slang @@ -24,5 +24,11 @@ float h(float x) float val = 0; // no diagnostic by clarifying intention. val = no_diff(f(x + 1)); + + // error: dynamic loop without [MaxIters] or [ForceUnroll] + for (int i = 0; i < (int)x; i++) + { + } + return val; } diff --git a/tests/diagnostics/autodiff-data-flow-2.slang.expected b/tests/diagnostics/autodiff-data-flow-2.slang.expected index 9026c0748..725a27c9c 100644 --- a/tests/diagnostics/autodiff-data-flow-2.slang.expected +++ b/tests/diagnostics/autodiff-data-flow-2.slang.expected @@ -1,8 +1,11 @@ result code = -1 standard error = { -tests/diagnostics/autodiff-data-flow-2.slang(18): error 41020: derivative cannot be propagated through call to non-backward-differentiable function `f`, use 'no_diff' to clarify intention. +tests/diagnostics/autodiff-data-flow-2.slang(17): error 41020: derivative cannot be propagated through call to non-backward-differentiable function `f`, use 'no_diff' to clarify intention. float val = f(x + 1); // Error: f must also be backward-differentiable ^ +tests/diagnostics/autodiff-data-flow-2.slang(29): error 30510: loops inside a differentiable function need to provide either '[MaxIters(n)]' or '[ForceUnroll]' attribute. + for (int i = 0; i < (int)x; i++) + ^~~ } standard output = { } diff --git a/tests/diagnostics/autodiff.slang b/tests/diagnostics/autodiff.slang index 935ef07cb..7905b48b6 100644 --- a/tests/diagnostics/autodiff.slang +++ b/tests/diagnostics/autodiff.slang @@ -12,11 +12,6 @@ float f(float x) if (x > 5) val = x + 1; - // warning: dynamic loop without [MaxIters] or [ForceUnroll] - for (int i = 0; i < (int)x; i++) - { - } - [MaxIters(2)] for (int i = 0; i < (int)x; i++) // OK { diff --git a/tests/diagnostics/autodiff.slang.expected b/tests/diagnostics/autodiff.slang.expected index 952503d1c..d075b9406 100644 --- a/tests/diagnostics/autodiff.slang.expected +++ b/tests/diagnostics/autodiff.slang.expected @@ -1,8 +1,5 @@ result code = -1 standard error = { -tests/diagnostics/autodiff.slang(16): error 30510: loops inside a differentiable function need to provide either '[MaxIters(n)]' or '[ForceUnroll]' attribute. - for (int i = 0; i < (int)x; i++) - ^~~ tests/diagnostics/autodiff.slang(35): error 38031: 'no_diff' can only be used to decorate a call. float x1 = no_diff x; // invalid use of no_diff here. ^~~~~~~ |
