Skip to content

Add overwrite-only uninitialized GEMM across all einsum2 backends #188

Description

@shinaoka

Scope and status

Implement overwrite-only uninitialized GEMM/einsum entry points without reading or preinitializing the destination. The safe strided-rs portion is complete in PR #196, with the feature-combination bound fix in PR #197.

Complete in #196/#197

  • naive backend writes directly to MaybeUninit<T>;
  • system BLAS and injected BLAS use the exact-zero-beta contract from cblas-inject 0.1.2;
  • checked destination injectivity, checked traversal/overflow, conservative input/output overlap rejection, non-contiguous temporary/writeback, zero-k handling, and typed errors are covered;
  • strided-opteinsum full-overwrite intermediates remain uninitialized until successful completion;
  • explicit ExecContext and provider-owned threading are preserved;
  • the faer + parallel feature combination is fixed by Fix uninitialized GEMM parallel bounds #197.

Faer boundary

Faer 0.24.4 does not expose a typed API that permits a MatMut<T> overwrite over MaybeUninit<T>. The Faer-only uninitialized entry points therefore return EinsumError::Unsupported and retain the initialized compatibility path. This issue does not use an unsafe cast, early assume_init, or output-sized zero-fill workaround.

The Faer-specific API request is tracked independently in strided-rs #198, which supersedes #195. It is outside this completed safe-backend scope and is not a reason to weaken the contract here.

Verification

Accumulating GEMM remains on initialized destinations. Reduction and indexed replay are tracked separately.

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