summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2023-05-05 14:11:13 -0400
committerGitHub <noreply@github.com>2023-05-05 11:11:13 -0700
commit0602eaaba32bdbaf3f99ab8987e97419cba395aa (patch)
treea876e0eb0b3729f67a85a4f6eec1305feac2621d /source/slang/slang-ir-autodiff.cpp
parente69c23e596baf082d928bd18dc364ea6f846c457 (diff)
Fix checkpoint hints for higher-order autodiff (#2869)
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index 3b3224e2f..f6a977994 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -749,6 +749,19 @@ IRInst* DifferentiableTypeConformanceContext::getExtractExistensialTypeWitness(I
SLANG_UNIMPLEMENTED_X("TODO: Implement");
}
+
+void copyCheckpointHints(IRBuilder* builder, IRGlobalValueWithCode* oldInst, IRGlobalValueWithCode* newInst)
+{
+ for (auto decor = oldInst->getFirstDecoration(); decor; decor = decor->getNextDecoration())
+ {
+ if (auto chkHint = as<IRCheckpointHintDecoration>(decor))
+ {
+ SLANG_ASSERT(chkHint->getOperandCount() == 0);
+ builder->addDecoration(newInst, chkHint->getOp());
+ }
+ }
+}
+
void stripDerivativeDecorations(IRInst* inst)
{
for (auto decor = inst->getFirstDecoration(); decor; )