Skip to content

feat(gpt-oss): expert offloading Phase 3 — wire dispatch + device_memory_ratio tunable - #153

Merged
drunkcoding merged 5 commits into
devfrom
feat/gpt-oss-offload-phase3
Aug 14, 2026
Merged

feat(gpt-oss): expert offloading Phase 3 — wire dispatch + device_memory_ratio tunable#153
drunkcoding merged 5 commits into
devfrom
feat/gpt-oss-offload-phase3

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

Implements Phase 3 of RFC #137 — makes gpt-oss expert offloading actually usable + tunable. Stacked on Phase 2 (#152).

Changes:

  • _gpt_oss_offload_enabled() selects resident vs offload from device_memory_ratio (< _GPT_OSS_RESIDENT_RATIO ⇒ offload). Resident stays the default and is byte-identical when offload is off.
  • Inject expert_executor/expert_prefetcher into SyncGptOssMLP and route through the Archer dispatcher when offload is enabled; _load_resident_gpt_oss retained as fallback.
  • Oracle follow-ups closed: native end-to-end ForwardHelper parity test (exercises the C++ path, not just the Python proxy) + cudaMemcpyAsync dtype guard in expert_module.cpp.

Validation: Phase 1/2 + native regression 18 passed; Phase 3 policy/wiring 14 passed; extension builds (SM120); ruff + LSP clean; fp32-golden envelope intact.

⚠️ Known blocker (real-model use)

The cached gpt-oss-20b smoke is blocked before inference by a Phase 1 limitation: per-expert expansion assumes all 6 packed components (gate_up/down blocks+scales+bias) are co-located in one checkpoint shard, but gate_up_proj_bias for layer 6 lives in a different safetensors shard ⇒ missing gate_up_proj_bias while expanding layer 6. Offload is unit/synthetic-validated but NOT yet runnable on real sharded checkpoints until shard-boundary bias handling is fixed (follow-up). Resident path is unaffected.

Completes the wiring for RFC #137; the shard fix is the remaining item for real-model offload. Plan: docs/superpowers/plans/2026-08-14-gpt-oss-expert-offloading.md.

drunkcoding and others added 3 commits August 14, 2026 11:10
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
drunkcoding added 2 commits August 14, 2026 19:44
…o feat/gpt-oss-offload-phase3

# Conflicts:
#	core/parallel/expert_module.cpp
#	moe_infinity/runtime/model_offload.py
@drunkcoding
drunkcoding changed the base branch from feat/gpt-oss-offload-phase2 to dev August 14, 2026 20:06
@drunkcoding
drunkcoding merged commit f4cb694 into dev Aug 14, 2026
2 checks passed
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