summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-09-19 03:10:28 -0400
committerGitHub <noreply@github.com>2024-09-19 00:10:28 -0700
commitccc310fa4e8096cda8a6c127aacc1a1fa9d8503a (patch)
tree435e9c462a78fb848ab3b36c23287543d1a859de /source/slang/slang-check-decl.cpp
parent1781c2969eb65fb7ade01d3f0d7d9b8973bcd4d3 (diff)
Support `IDifferentiablePtrType` (#5031)
* initial diff-ref-type interface * Initial support for `IDifferentiablePtrType` * Fix unused vars * More tests + fix switch case fallthrough. * Update slang-ir-autodiff.cpp * Update diff-ptr-type-loop.slang * Add optimization to allow more complex pair types * Update slang-ir-autodiff-primal-hoist.cpp * Update diff-ptr-type-loop.slang * Update slang-ir-autodiff-primal-hoist.cpp * More fixes to address reviews * Update slang-check-expr.cpp * Optimizations + rename `differentiableRefInterfaceType` -> `differentiablePtrInterfaceType` * Move pair logic to ir-builder, unify the type dictionaries. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index deb8c55eb..8e78ff084 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -10204,7 +10204,8 @@ namespace Slang
bool isDiffParam = (!param->findModifier<NoDiffModifier>());
if (isDiffParam)
{
- if (auto pairType = as<DifferentialPairType>(visitor->getDifferentialPairType(param->getType())))
+ auto diffPair = visitor->getDifferentialPairType(param->getType());
+ if (auto pairType = as<DifferentialPairType>(diffPair))
{
arg->type.type = pairType;
arg->type.isLeftValue = true;
@@ -10225,6 +10226,11 @@ namespace Slang
direction = ParameterDirection::kParameterDirection_InOut;
}
}
+ else if (auto refPairType = as<DifferentialPtrPairType>(diffPair))
+ {
+ // no need to change direction of ref-pairs.
+ arg->type.type = refPairType;
+ }
else
{
isDiffParam = false;