Skip to content

ICE when interface implementation contains Atomic<T> field #10419

@jvepsalainen-nv

Description

@jvepsalainen-nv

Issue Description

When a struct implementing an interface contains an Atomic<int> field, the compiler crashes with "Unimplemented type packing" (error 99999) instead of producing a user-facing diagnostic. Other unsupported field types (opaque resources, CoopVec, CoopMat, String, class instances) correctly emit error 41014 ("type cannot be packed for dynamic dispatch").

Reproducer Code

interface IFoo { int get(); }
export struct Impl : IFoo {
    Atomic<int> counter;
    int get() { return 1; }
}
export struct GoodImpl : IFoo {
    int v;
    int get() { return v; }
}
RWStructuredBuffer<int> out;
[numthreads(1,1,1)]
void computeMain() {
    IFoo f = createDynamicObject<IFoo>(0, 0);
    out[0] = f.get();
}

Command:

slangc -target spirv test.slang

Expected Behavior

Error 41014: "type 'Impl' contains fields that cannot be packed into ordinary bytes for dynamic dispatch."

Actual Behavior

error[E99999]: Slang compilation aborted due to an exception of N5Slang13InternalErrorE unimplemented: Unimplemented type packing

Test to Enable

When fixed, enable the DISABLED test tests/language-feature/dynamic-dispatch/diagnose-atomic-in-impl.slang.

Metadata

Metadata

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions