summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/autodiff/reverse-while-loop-3.slang19
-rw-r--r--tests/autodiff/reverse-while-loop-3.slang.expected.txt6
2 files changed, 12 insertions, 13 deletions
diff --git a/tests/autodiff/reverse-while-loop-3.slang b/tests/autodiff/reverse-while-loop-3.slang
index 67f030030..0a27437e9 100644
--- a/tests/autodiff/reverse-while-loop-3.slang
+++ b/tests/autodiff/reverse-while-loop-3.slang
@@ -1,12 +1,12 @@
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
-//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
-//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -shaderobj -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -output-using-type
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -output-using-type -shaderobj
-//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
+//TEST_INPUT:ubuffer(data=[1], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
// This test isn't actually testing the output, but rather that the compiler doesn't crash upon
-// encountering a specific loop pattern. ('Data' is non-differentiable here, so the expected output is 0)s
+// encountering a specific loop pattern. ('Data' is non-differentiable here, so the expected output is 0)
//
typedef DifferentialPair<float> dpfloat;
@@ -21,6 +21,10 @@ struct P
struct Data
{
+ __init(float dataIn)
+ {
+ this.t = dataIn;
+ }
float t;
};
@@ -32,7 +36,7 @@ void updateData(Data data)
[BackwardDifferentiable]
float test_simple_while(float y, uint n)
{
- Data d = { y };
+ Data d = Data(y);
P p;
p.terminated = false;
int i = n;
@@ -61,6 +65,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
dpfloat dpa = dpfloat(1.0, 0.0);
__bwd_diff(test_simple_while)(dpa, 2, 1.0f);
- outputBuffer[0] = dpa.d; // Expect: 8.0
+ outputBuffer[0] = dpa.d;
+ //BUF: 0
}
}
diff --git a/tests/autodiff/reverse-while-loop-3.slang.expected.txt b/tests/autodiff/reverse-while-loop-3.slang.expected.txt
deleted file mode 100644
index ca54c9afe..000000000
--- a/tests/autodiff/reverse-while-loop-3.slang.expected.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-type: float
-1.000000
-0.000000
-0.000000
-0.000000
-0.000000