diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ir/derivative-op-ir-test.slang | 21 | ||||
| -rw-r--r-- | tests/ir/derivative-op-ir-test.slang.expected.txt | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ir/derivative-op-ir-test.slang b/tests/ir/derivative-op-ir-test.slang new file mode 100644 index 000000000..209446765 --- /dev/null +++ b/tests/ir/derivative-op-ir-test.slang @@ -0,0 +1,21 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +__differentiate_jvp float f(float x) +{ + return x; +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + { + float a = 1.0; + float b = -2.0; + outputBuffer[0] = __jvp(f)(a); + outputBuffer[1] = __jvp(f)(b); + } +} diff --git a/tests/ir/derivative-op-ir-test.slang.expected.txt b/tests/ir/derivative-op-ir-test.slang.expected.txt new file mode 100644 index 000000000..f095a0071 --- /dev/null +++ b/tests/ir/derivative-op-ir-test.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +0.0 +0.0 +0.0 +0.0
\ No newline at end of file |
