Skip to content

Memory redesign: one device-memory model across every backend - #1709

Open
ingim wants to merge 1 commit into
mainfrom
sc/memory-redesign
Open

ingim wants to merge 1 commit into
mainfrom
sc/memory-redesign

Conversation

@ingim

@ingim ingim commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Every engine (CUDA, ROCm, Metal, Vulkan, wgpu, XLA, Cerebras) now serves from one memory model, with policy moved out of the runtime into the inferlet and PLEX.

Memory and state

  • One chunk pool per device, laid at load from the engine's stated facts, with the host and disk tiers below it. Unified-memory devices evict straight to disk. The default disk tier is free space minus the OS's own stated reserve.
  • Recurrent and windowed layers are state + buffer: folded rows live in the state record (windowed layers as rings), and unfolded rows live in a buffer.
  • Final rows: a pass is final by default and folds at fire, running the plain step. Inferlets that retract opt out with retractable().
  • Beams share pages through group page lists, with parents and the common-ancestor fold handled on the device.

Capture before ready

  • The runtime states the step compositions its builder forms (StepShapes), and each fire carries its stated shape.
  • Engines arm exactly that set before ready, small first, within a measured allowance. Anything past the allowance is stated eager at load and counted. Nothing is compiled, recorded or allocated after ready.
  • Programs register once across prompt lengths.

Device profiles

  • Committed per-device measured profiles, read at load ("measured 0" on a matching home). A stale figure is served and listed by name, and the export refuses to write a stale entry.

Policy out of the runtime

  • The PLEX 1.1 host and SDK are vendored. Default default and default-cluster policies hold what used to be built-in defaults. Victims, restores and placement are ordered by PLEX priority, with FCFS / LRU only breaking ties.
  • Contention: an admitted process that can't progress is suspended to a lower tier. When no tier can take it, it fails by name with the tier counts. A newcomer whose first ask doesn't fit is refused with [admission_refused], which callers retry.

Known limitations

  • XLA keeps generated program code in a device code cache that can exceed HBM on large ladders. Programs past the room left before ready load on first use.
  • Beam steps can be slower than the same-width greedy step on some backends.

@ingim
ingim force-pushed the sc/memory-redesign branch 3 times, most recently from ee3aa75 to ff7e040 Compare November 25, 2026 02:09
@@ -12,7 +12,7 @@ import * as session from '../session.js';
import * as chat from '../chat.js';
import * as reasoning from '../reasoning.js';
import * as inferlet from '../index.js';
import { Channel, ForwardPass, Port, WorkingSet, dtype } from '../eta/index.js';
import { Channel, ForwardPass, Pipeline, Port, WorkingSet, dtype } from '../eta/index.js';
@ingim
ingim force-pushed the sc/memory-redesign branch 20 times, most recently from 0578405 to 724db83 Compare November 27, 2026 01:28
Every engine (CUDA, ROCm, Metal, Vulkan, wgpu, XLA, Cerebras) now serves
from one memory model, with policy moved out of the runtime into the
inferlet and PLEX.

Memory and state
- One chunk pool per device, laid at load from the engine's stated facts,
  with the host and disk tiers below it. Unified-memory devices evict
  straight to disk. The default disk tier is free space minus the OS's
  own stated reserve.
- Recurrent and windowed layers are state + buffer: folded rows live in
  the state record (windowed layers as rings), and unfolded rows live in
  a buffer.
- Final rows: a pass is final by default and folds at fire, running the
  plain step. Inferlets that retract opt out with `retractable()`.
- Beams share pages through group page lists, with parents and the
  common-ancestor fold handled on the device.

Capture before ready
- The runtime states the step compositions its builder forms
  (StepShapes), and each fire carries its stated shape.
- Engines arm exactly that set before ready, small first, within a
  measured allowance. Anything past the allowance is stated eager at load
  and counted. Nothing is compiled, recorded or allocated after ready.
- Programs register once across prompt lengths.

Device profiles
- Committed per-device measured profiles, read at load ("measured 0" on a
  matching home). A stale figure is served and listed by name, and the
  export refuses to write a stale entry.

Policy out of the runtime
- The PLEX 1.1 host and SDK are vendored. Default `default` and
  `default-cluster` policies hold what used to be built-in defaults.
  Victims, restores and placement are ordered by PLEX priority, with
  FCFS / LRU only breaking ties.
- Contention: an admitted process that can't progress is suspended to a
  lower tier. When no tier can take it, it fails by name with the tier
  counts. A newcomer whose first ask doesn't fit is refused with
  `[admission_refused]`, which callers retry.

Removed
- Cluster features with no PLEX 1.1 counterpart: worker launch, adopt and
  stop (autoscaling); cluster-ordered disk persistence and cluster
  retention; cluster priority over launch order; the cache_aware and
  disaggregate policies.
- Operator-declared adapters (`[model.adapters]`, `adapter_dir`). An
  adapter arrives only through a program.

Known limitations
- XLA: a boot with an empty program cache takes about an hour on
  Qwen3.5. Programs the host can't hold stay parked and load on first use.
- XLA keeps generated program code in a device code cache that can
  exceed HBM on large ladders. Programs past the room left before ready
  load on first use.
- Beam steps can be slower than the same-width greedy step on some
  backends.
@ingim
ingim force-pushed the sc/memory-redesign branch from 724db83 to 4273145 Compare November 27, 2026 02:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant