Summary
Dispatching through a derived interface existential (e.g., IDerived that extends IBase) in a differentiable context triggers an internal compiler error: assert failure: witnessTableVal.
Repro
Define an interface hierarchy and attempt backward differentiation through the derived interface:
[anyValueSize(16)]
interface IBase : IDifferentiable
{
[Differentiable]
float baseCalc(float x);
}
[anyValueSize(16)]
interface IDerived : IBase
{
[Differentiable]
float derivedCalc(float x);
}
struct A : IDerived
{
float a;
__init(float a) { this.a = a; }
[Differentiable]
[NoDiffThis]
float baseCalc(float x) { return a * x * x; }
[Differentiable]
[NoDiffThis]
float derivedCalc(float x) { return a * x * x * x; }
}
[Differentiable]
float useDerived(IDerived obj, float x)
{
return obj.derivedCalc(x);
}
[Differentiable]
float dispatchDerived(uint id, float x, no_diff float param)
{
IDerived obj;
if (id == 0)
obj = no_diff(A(param));
else
obj = no_diff(A(param)); // simplified
return useDerived(obj, x);
}
Calling bwd_diff(dispatchDerived)(...) triggers the ICE.
Expected Behavior
Differentiation through derived interface existentials should work the same as through base interface existentials.
Discovered In
PR #10734 — test autodiff-dynamic-dispatch-interface-inherit.slang documents this as a known limitation.
Summary
Dispatching through a derived interface existential (e.g.,
IDerivedthat extendsIBase) in a differentiable context triggers an internal compiler error:assert failure: witnessTableVal.Repro
Define an interface hierarchy and attempt backward differentiation through the derived interface:
Calling
bwd_diff(dispatchDerived)(...)triggers the ICE.Expected Behavior
Differentiation through derived interface existentials should work the same as through base interface existentials.
Discovered In
PR #10734 — test
autodiff-dynamic-dispatch-interface-inherit.slangdocuments this as a known limitation.