Module op_cache

Module op_cache 

Source
Expand description

2026-09-25: OpCache: per-backend memo of kernel handles, grow-only device scratch, and the once / first-N gates of diagnostics.

A kernel handle points into a module owned by the backend’s registry, and a scratch pointer is a device allocation of the backend. Keeping both on the backend, not in a process-wide static, stops a later model from reaching handles or scratch of a model that is gone.

Owner: gpu-runtime. Invariants:

  • One OpCache per backend: MetraleCudaBackend, MetalGpuBackend and MockGpuBackend each construct their own.
  • A scratch tag’s buffer only grows: a request that fits returns the stored pointer.

Structs§

OpCache
2026-09-25: Memoized kernel handles and scratch allocations for one backend.