Skip to content

feat(gpt-oss): expert offloading Phase 2 — MXFP4 dequant-on-copy execution - #152

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

feat(gpt-oss): expert offloading Phase 2 — MXFP4 dequant-on-copy execution#152
drunkcoding merged 8 commits into
devfrom
feat/gpt-oss-offload-phase2

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

Implements Phase 2 of RFC #137 (Option A: dequant-on-copy). Stacked on Phase 1 (#151).

Changes:

  • CUDA MXFP4 dequant primitive (extensions/kernel/v4_fp4/mxfp4_dequant.cu + binding) — dequantizes fetched packed experts to bf16
  • Native Archer MXFP4 execution (core/parallel/expert_module.cpp) reusing the bf16 expert GEMM; dedicated dispatcher expert type
  • Dequant is bit-exact vs mxfp4_dequantize (golden test, rel-err 0.0)

Numerical review (Oracle): the native ForwardHelper is algebraically faithful to the resident path (scales, bias, [N,K//2] layout, gate/up split, clamped-SwiGLU, fp32-accumulate). A prior full-forward parity test was passing only by zeroing gate weights (gutted coverage). Replaced with a rigorous fp32-golden + magnitude-envelope parity test using REAL weights (full scale range), verified non-vacuous (injecting a real defect makes it fail). Suite: 16 passed, ruff + LSP clean.

Follow-ups (Oracle-flagged, not blocking):

  • No test exercises the C++ ForwardHelper end-to-end yet (only the Python dequant+matmul proxy) — add a native-dispatch GPU parity test.
  • expert_module.cpp copies inputs via raw cudaMemcpyAsync into a dtype_ buffer — correct for bf16 gpt-oss, but add a dtype guard.

Phase 3 (wire SyncGptOssMLP + device_memory_ratio tunable) remains. Plan: docs/superpowers/plans/2026-08-14-gpt-oss-expert-offloading.md.

drunkcoding and others added 6 commits August 14, 2026 10:16
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>
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-phase2

# Conflicts:
#	core/parallel/expert_module.cpp
#	core/parallel/expert_module.h
#	setup.py
@drunkcoding
drunkcoding changed the base branch from feat/gpt-oss-offload-phase1 to dev August 14, 2026 20:05
@drunkcoding
drunkcoding merged commit 1df8d66 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