From 2b87c00c671b156b8e5926f8967003bf12c65aa7 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Sat, 27 Apr 2024 02:27:28 -0400 Subject: Fix invoke resolution when dealing with overloded type expressions (#4043) --- tests/autodiff/differential-type-constructor.slang | 25 ++++++++++++++++++++++ ...ifferential-type-constructor.slang.expected.txt | 6 ++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/autodiff/differential-type-constructor.slang create mode 100644 tests/autodiff/differential-type-constructor.slang.expected.txt (limited to 'tests/autodiff') diff --git a/tests/autodiff/differential-type-constructor.slang b/tests/autodiff/differential-type-constructor.slang new file mode 100644 index 000000000..9afff878d --- /dev/null +++ b/tests/autodiff/differential-type-constructor.slang @@ -0,0 +1,25 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type + +struct MyStruct: IDifferentiable +{ + float a; + int b; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + { + var dp = diffPair(MyStruct(), MyStruct.Differential()); + + outputBuffer[0] = dp.d.a; + + var dp2 = diffPair(MyStruct(), MyStruct.Differential(1.f)); + + outputBuffer[1] = dp2.d.a; + } +} \ No newline at end of file diff --git a/tests/autodiff/differential-type-constructor.slang.expected.txt b/tests/autodiff/differential-type-constructor.slang.expected.txt new file mode 100644 index 000000000..d9eca87b2 --- /dev/null +++ b/tests/autodiff/differential-type-constructor.slang.expected.txt @@ -0,0 +1,6 @@ +type: float +0.000000 +1.000000 +0.000000 +0.000000 +0.000000 -- cgit v1.2.3