summaryrefslogtreecommitdiff
path: root/tests/autodiff
diff options
context:
space:
mode:
authorvenkataram-nv <vedavamadath@nvidia.com>2024-08-12 14:18:02 -0700
committerGitHub <noreply@github.com>2024-08-12 14:18:02 -0700
commit20bd48659d0009de5477380c335e2419f4c66f8b (patch)
tree1b5df96436eaea9adbe5ef524b39fe6da4697387 /tests/autodiff
parent9b580e58417a77109617804362be872f05885f23 (diff)
Warn when inout parameter is never written (#4777)
Addresses #4698 as one approach to diagnose the potential problem. Emit warnings when a user marks a parameter as `inout` but never writes to it in the function. A new intrinsic function `unmodified(out T)` has been added to explicitly indicate that an `inout` variable will not be modified in the function. This is only one way to address the specific validation error in #4698. In general it seems that DXC does some more extensive checks on actual struct fields (as opposed to observing arbitrary struct writes), so that will be the next step.
Diffstat (limited to 'tests/autodiff')
-rw-r--r--tests/autodiff/reverse-inout-param-custom-derivative.slang2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/autodiff/reverse-inout-param-custom-derivative.slang b/tests/autodiff/reverse-inout-param-custom-derivative.slang
index 8769a33c7..c4549e37b 100644
--- a/tests/autodiff/reverse-inout-param-custom-derivative.slang
+++ b/tests/autodiff/reverse-inout-param-custom-derivative.slang
@@ -5,7 +5,7 @@
//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
-float rng(inout int state, float x)
+float rng(int state, float x)
{
return state + x;
}