Skip to content

🚨 Unify MoE expert offloading through shared framework resources - #1280

Merged
0xShug0 merged 2 commits into
mainfrom
refactor/moe-offload-review
Nov 14, 2026
Merged

0xShug0 merged 2 commits into
mainfrom
refactor/moe-offload-review

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Consolidate expert-weight placement and staged execution for Drama3, Ming3 Audio, and Nemotron Transcribe into shared framework resources. Model code retains routing mathematics, shared-expert/residual composition, tensor bindings, and model-specific defaults.

Changes

  • Add session-owned MoeResources and MoeExecutionPolicy, reusing BackendWeightStore, DiskExpertWeightStore, PreparedGraph, and StagedMoeRuntime for resident, CPU-expert, staged, and hybrid execution.
  • Consolidate CPU-context ownership, expert registration, cache setup, scheduler configuration, and staged execution resources while retaining the direct resident graph path.
  • Expose shared moe_* session options and CLI flags. Existing family-prefixed options remain accepted; supplying both spellings is rejected. Active CLI recipe options require role scoping; unscoped moe_cpu_share=0 retains its previous compatibility.
  • Make CUDA/Vulkan buffer construction exception-safe so failed wrapper allocations release device/pinned memory. No backend kernels or mathematical operations are changed by these GGML edits.
  • Extend allocation-failure, retry, placement, concurrency, lifecycle, and boundary fixtures; migrate the Ming3 parity harness to the current options API.

Validation

See the validation report for the consolidated RTF, peak-VRAM and output-parity table, including its selection policy and measurement limitations.

  • Matched Debug A/B builds against main 353bf8c3b24168e0760bacd14e4caf250ed8f5e5, using CUDA/Vulkan and GPU sessions with CPU expert offloading. Selected comparisons retain exact output parity. Full-CPU checks are completion smoke only.
  • All 18 original framework fixture runs passed. All 85 matched logged allocation-size sequences agreed.
  • Drama3's fixed 32-row staged configuration passed explicit 31/32/33/65 assignments-per-expert fixtures on CPU, CUDA, Vulkan, and CUDA/Vulkan hybrid execution with F32/Q4_K weights: 160 reference checks, maximum absolute error 1.08266e-5 against a 1e-4 tolerance.
  • Reconciled graph/store teardown, worker joining, synchronization, allocation-failure recovery, shape reuse, continuation state, and saved repeat-phase memory observations.
  • Restored recipe-zero compatibility: the original CLI recipe produces a WAV byte-identical to main; eight parser checks passed. Real browser upload, model selection, recipe generation, result display and playback passed with zero configured on both model sessions, HTTP 200 and no browser errors.
  • Ming3 parity-test target compiles and links successfully. Teacher-forced replay was not run.

Timing differences vary between repetitions; Ming3 CUDA hybrid results do not establish a consistent intrinsic slowdown or a unique code-level cause. Sampled request peaks do not prove indefinite leak freedom or post-unload reclamation. Metal/HIP execution was not validated on this machine.

@0xShug0 0xShug0 added the ggml label Nov 14, 2026
@0xShug0 0xShug0 changed the title Unify MoE expert offloading through shared framework resources 🚨 Unify MoE expert offloading through shared framework resources Nov 14, 2026
@0xShug0
0xShug0 merged commit 78c8d2b into main Nov 14, 2026
7 checks passed
@0xShug0
0xShug0 deleted the refactor/moe-offload-review branch November 14, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant