diff options
| author | Yong He <yonghe@outlook.com> | 2023-03-21 20:03:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-21 20:03:12 -0700 |
| commit | 83876733d69582eec6bad26af64a651d40fa43aa (patch) | |
| tree | 641edb23ee4d656b198e1cc840470702f3ac391d /tests | |
| parent | 5d2c5dd9f748d728abf2a4361fca71a7f9ec65b6 (diff) | |
Fix associated type resolution bug. (#2719)
* Fix associated type resolution bug.
* Fix.
* Fix language server hinting messed up by breadcrumb nodes.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autodiff/diff-assoc-type.slang | 30 | ||||
| -rw-r--r-- | tests/autodiff/diff-assoc-type.slang.expected.txt | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/autodiff/diff-assoc-type.slang b/tests/autodiff/diff-assoc-type.slang new file mode 100644 index 000000000..60a80b32c --- /dev/null +++ b/tests/autodiff/diff-assoc-type.slang @@ -0,0 +1,30 @@ +// Tests automatic synthesis of Differential type and method requirements. + +//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], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +struct B : IDifferentiable +{ + float x; +} + +float myFunc(DifferentialPair<B.Differential> d) +{ + return d.p.x + d.d.x; +} + +float myFunc2(DifferentialPair<B>.Differential d) +{ + return d.p.x + d.d.x; +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + B.Differential bd; + bd.x = 1.0; + outputBuffer[0] = myFunc(diffPair(bd, bd)) + myFunc2(diffPair(bd, bd)); +} diff --git a/tests/autodiff/diff-assoc-type.slang.expected.txt b/tests/autodiff/diff-assoc-type.slang.expected.txt new file mode 100644 index 000000000..bc795a8ba --- /dev/null +++ b/tests/autodiff/diff-assoc-type.slang.expected.txt @@ -0,0 +1,2 @@ +type: float +4.0 |
