Skip to content

Decouple static-init registration state from JitEngine construction #398

@ZwFink

Description

@ZwFink

During program startup, GPU runtime static constructors trigger Proteus registration hooks (__jit_register_fatbinary, __jit_register_function, __jit_register_var). These immediately access JitDeviceImplT::instance(), which lazily constructs the GPU JitEngine singleton. This lazy construction works fine today, but it means proteus::init() cannot eagerly construct GPU JitEngines, because if no device is visible, GPU runtime calls in the constructor would crash. To avoid this,
ObjectCacheRegistry was introduced as a separate singleton so that proteus::init() can set up caching without triggering JitEngine construction. This adds indirect coupling between ObjectCacheRegistry, JitEngine, and Dispatcher. The fix is to introduce a lightweight JitInfoRegistry that holds all static-init state (fat binaries, kernel registrations, device globals) without making any GPU calls. Device state from the registry would only be accessed in GPU JIT methods, at which
point the user has signaled intent to use a device, so failing on a missing device is appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions