summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2023-02-09 17:40:20 -0500
committerGitHub <noreply@github.com>2023-02-09 17:40:20 -0500
commitdf02f3f50f977112ca1fbb148cd48ee41d560f41 (patch)
tree7732e8fec9f33aff9666b3710c7adb899788c4be /tests
parentd911e1bed9572664b1d0554feb3c7d1a2a880518 (diff)
Reverse-mode Loop Support (#2635)
* Full loop support now working. MaxItersAttr in progress * Lookup table updates? * Fixed the max iters decoration * Minox fixes & remove superfluous code * fixup warnings * Revert "Lookup table updates?" This reverts commit 7d9b0793fb5239f31d1155776e846dcf1892d8d9. * Update 07-autodiff.md * Change maxiters to MaxIters * Added asserts * Update 07-autodiff.md
Diffstat (limited to 'tests')
-rw-r--r--tests/autodiff/reverse-loop.slang8
-rw-r--r--tests/autodiff/reverse-loop.slang.expected.txt6
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/autodiff/reverse-loop.slang b/tests/autodiff/reverse-loop.slang
index 46d707548..f6e951eab 100644
--- a/tests/autodiff/reverse-loop.slang
+++ b/tests/autodiff/reverse-loop.slang
@@ -1,4 +1,3 @@
-//TEST_IGNORE_FILE:
//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
@@ -14,6 +13,7 @@ float test_simple_loop(float y)
{
float t = y;
+ [MaxIters(5)]
for (int i = 0; i < 3; i++)
{
t = t * t;
@@ -29,13 +29,13 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
dpfloat dpa = dpfloat(1.0, 0.0);
__bwd_diff(test_simple_loop)(dpa, 1.0f);
- outputBuffer[0] = dpa.d; // Expect: 2.0
+ outputBuffer[0] = dpa.d; // Expect: 8.0
}
{
dpfloat dpa = dpfloat(0.4, 0.0);
-
+
__bwd_diff(test_simple_loop)(dpa, 1.0f);
- outputBuffer[1] = dpa.d; // Expect: 1.0
+ outputBuffer[1] = dpa.d; // Expect: 0.0131072
}
}
diff --git a/tests/autodiff/reverse-loop.slang.expected.txt b/tests/autodiff/reverse-loop.slang.expected.txt
new file mode 100644
index 000000000..76b7cf779
--- /dev/null
+++ b/tests/autodiff/reverse-loop.slang.expected.txt
@@ -0,0 +1,6 @@
+type: float
+8.000000
+0.013107
+0.000000
+0.000000
+0.000000