summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-autodiff-transcriber-base.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff-transcriber-base.cpp b/source/slang/slang-ir-autodiff-transcriber-base.cpp
index 24e26f943..53bb30f54 100644
--- a/source/slang/slang-ir-autodiff-transcriber-base.cpp
+++ b/source/slang/slang-ir-autodiff-transcriber-base.cpp
@@ -1161,6 +1161,12 @@ InstPair AutoDiffTranscriberBase::transcribeInst(IRBuilder* builder, IRInst* ori
return transcribeGeneric(builder, as<IRGeneric>(origInst));
}
+ // At this point we should not see any global insts that are differentiable.
+ // If the inst's parent is IRModule, return (inst, null).
+ //
+ if (as<IRModuleInst>(origInst->getParent()) && !as<IRType>(origInst))
+ return InstPair(origInst, nullptr);
+
auto result = transcribeInstImpl(builder, origInst);
if (result.primal == nullptr && result.differential == nullptr)