Skip to content

ICE: assert failure on witnessTableVal when dispatching through derived interface existential with autodiff #10775

@jvepsalainen-nv

Description

@jvepsalainen-nv

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.

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions