Skip to content

Commit f427025

Browse files
committed
Fix DifferentialPtr type.
1 parent 3cdb443 commit f427025

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

source/slang/core.meta.slang

+1
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ interface IDifferentiable
646646
/// @remarks Support for this interface is still experimental and subject to change.
647647
///
648648
__magic_type(DifferentiablePtrType)
649+
[KnownBuiltin("IDifferentiablePtr")]
649650
interface IDifferentiablePtrType
650651
{
651652
__builtin_requirement($( (int)BuiltinRequirementKind::DifferentialPtrType) )

source/slang/slang-ir-link.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,12 @@ bool shouldDeepCloneWitnessTable(IRSpecContextBase* context, IRWitnessTable* tab
703703
case kIROp_ComInterfaceDecoration:
704704
return true;
705705
case kIROp_KnownBuiltinDecoration:
706-
if (as<IRKnownBuiltinDecoration>(decor)->getName() == toSlice("IDifferentiable"))
707-
return context->getShared()->useAutodiff;
708-
break;
706+
{
707+
auto name = as<IRKnownBuiltinDecoration>(decor)->getName();
708+
if (name == toSlice("IDifferentiable") || name == toSlice("IDifferentiablePtr"))
709+
return context->getShared()->useAutodiff;
710+
break;
711+
}
709712
default:
710713
break;
711714
}
@@ -1927,6 +1930,9 @@ bool doesModuleUseAutodiff(IRInst* inst)
19271930
case kIROp_DifferentialPairGetDifferentialUserCode:
19281931
case kIROp_DifferentialPairGetPrimalUserCode:
19291932
case kIROp_DifferentialPairUserCodeType:
1933+
case kIROp_DifferentialPtrPairType:
1934+
case kIROp_DifferentialPtrPairGetPrimal:
1935+
case kIROp_DifferentialPtrPairGetDifferential:
19301936
return true;
19311937
default:
19321938
for (auto child : inst->getChildren())

0 commit comments

Comments
 (0)