summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-04-04 15:25:20 +0800
committerGitHub <noreply@github.com>2025-04-04 15:25:20 +0800
commit83a42cb76feb1f702ff730040f359cabc01c571a (patch)
tree442ff945665ace3bbdafaf410f2664825419fd7d /tests
parent4233d69cf88f1623cb573c8edb61456b24dc5339 (diff)
Do no fail on missing no_diff annotation on non-differentiable (inputs and output) function outputs (#6737)
Closes https://github.com/shader-slang/slang/issues/6632
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-6632.slang29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/bugs/gh-6632.slang b/tests/bugs/gh-6632.slang
new file mode 100644
index 000000000..f9240e63b
--- /dev/null
+++ b/tests/bugs/gh-6632.slang
@@ -0,0 +1,29 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu
+
+// CHECK: 40000000
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+
+// Non-differentiable function with no_diff parameters and return type
+no_diff float targetFunc(no_diff float x)
+{
+ return x * 2.0f;
+}
+
+[Differentiable]
+float errorForward(no_diff float x)
+{
+ float result = targetFunc(x);
+ return result;
+}
+
+RWStructuredBuffer<float> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ float input = 1.0f;
+
+ outputBuffer[0] = errorForward(input);
+}
+