summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-25 18:32:45 -0700
committerGitHub <noreply@github.com>2023-04-25 18:32:45 -0700
commit1717c6c507043a5cc960c2344dd556524804ce59 (patch)
tree4fd2cda4eb5553352dc6074ce86af5b00539150d /source/slang/slang-ir.cpp
parent5abee6a0a30c7c965138ec7286b7f1b21b201731 (diff)
Support recomputing phi params in bwd prop func. (#2841)
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 9225faf6b..e74a57424 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -7478,7 +7478,7 @@ namespace Slang
return nullptr;
}
- IRInst* getResolvedInstForDecorations(IRInst* inst)
+ IRInst* getResolvedInstForDecorations(IRInst* inst, bool resolveThroughDifferentiation)
{
IRInst* candidate = inst;
for(;;)
@@ -7488,6 +7488,20 @@ namespace Slang
candidate = specInst->getBase();
continue;
}
+ if (resolveThroughDifferentiation)
+ {
+ switch (candidate->getOp())
+ {
+ case kIROp_ForwardDifferentiate:
+ case kIROp_BackwardDifferentiate:
+ case kIROp_BackwardDifferentiatePrimal:
+ case kIROp_BackwardDifferentiatePropagate:
+ candidate = candidate->getOperand(0);
+ continue;
+ default:
+ break;
+ }
+ }
if( auto genericInst = as<IRGeneric>(candidate) )
{
if( auto returnVal = findGenericReturnVal(genericInst) )