From 0602eaaba32bdbaf3f99ab8987e97419cba395aa Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Fri, 5 May 2023 14:11:13 -0400 Subject: Fix checkpoint hints for higher-order autodiff (#2869) --- source/slang/slang-ir-autodiff.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/slang/slang-ir-autodiff.cpp') 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(decor)) + { + SLANG_ASSERT(chkHint->getOperandCount() == 0); + builder->addDecoration(newInst, chkHint->getOp()); + } + } +} + void stripDerivativeDecorations(IRInst* inst) { for (auto decor = inst->getFirstDecoration(); decor; ) -- cgit v1.2.3