summaryrefslogtreecommitdiff
path: root/tests/autodiff/auto-differential-type.slang
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2023-07-26 17:15:21 -0400
committerGitHub <noreply@github.com>2023-07-26 17:15:21 -0400
commitba89fc84267bfd09f1c8abf10a5b85d09bbc79de (patch)
tree2c79fc5dafb89a030d22fa86cd6fa3d69a89a785 /tests/autodiff/auto-differential-type.slang
parentb8ade05df10a2774d3da5ef1fb2c7479ff48989a (diff)
Refactor `dmul(This, Differential)` to `dmul<T:Real>(T, Differential)` (#3029)
* Refactor `dmul(This, Differential)` to `dmul<T:Real>(T, Differential)` - Add AST synthesis support for generic containers - Refactor relevant tests * Merge dmul synthesis with dadd and dzero, and disambiguate using an enum * Fix trailing spaces
Diffstat (limited to 'tests/autodiff/auto-differential-type.slang')
-rw-r--r--tests/autodiff/auto-differential-type.slang5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/autodiff/auto-differential-type.slang b/tests/autodiff/auto-differential-type.slang
index efeebb459..a253a25bb 100644
--- a/tests/autodiff/auto-differential-type.slang
+++ b/tests/autodiff/auto-differential-type.slang
@@ -26,9 +26,10 @@ struct A : IDifferentiable
}
[__unsafeForceInlineEarly]
- static Differential dmul(This a, Differential b)
+ __generic<T : __BuiltinRealType>
+ static Differential dmul(T a, Differential b)
{
- Differential o = {a.x * b.x, 0.0};
+ Differential o = { __realCast<float, T>(a * __realCast<T, float>(b.x)), 0.0};
return o;
}
};