summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-autodiff.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index 024d31fd8..3257ee102 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -399,6 +399,16 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
else
{
differentiableWitnessDictionary.Add((IRType*)item->getConcreteType(), item->getWitness());
+
+ // Also register the type's differential type with the same witness.
+ IRBuilder subBuilder(item->getConcreteType());
+ if (!as<IRInterfaceType>(item->getConcreteType()))
+ {
+ differentiableWitnessDictionary.AddIfNotExists(
+ (IRType*)_lookupWitness(&subBuilder, item->getWitness(), sharedContext->differentialAssocTypeStructKey),
+ item->getWitness());
+ }
+
if (auto diffPairType = as<IRDifferentialPairTypeBase>(item->getConcreteType()))
{
// For differential pair types, register the differential type as well.