fix(engine): resolve moe-strategy auto to fused on unified-memory GPUs (GB10) - #445
Open
iamanishx wants to merge 1 commit into
Open
fix(engine): resolve moe-strategy auto to fused on unified-memory GPUs (GB10)#445iamanishx wants to merge 1 commit into
iamanishx wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cudaDevAttrIntegrated(_is_unified_memory_gpu()),with a
FREETOKEN_UNIFIED_MEMORY=0/1override for platforms where the attribute lies.--moe-strategy autotofusedinstead of the offloadfamily when the model's expert format supports residency (
_fused_resident_ok()),and skip the benchbw hybrid upgrade since CPU execution adds no bandwidth when CPU
and GPU share one memory.
--moe-strategy offloadis explicitly requested on a unified-memory GPU.Problem
The auto resolution always picks the offload family because on discrete GPUs a wrong
"it fits" guess is a load-time OOM. On unified-memory parts (GB10/DGX Spark, sm_121)
that rationale inverts: there is no host/device boundary, so the offload path's pinned
staging and slot gather are DRAM-to-DRAM copies, and the slot cache double-allocates
memory the GPU could read directly. Measured on GB10 in #22: offload (the default)
added a fixed 126-141 s stall to every request with ~360 s boot, while fused booted in
~50 s and served normally. Discrete-GPU behavior is unchanged: the new branch only
fires when
is_integratedis set, which discrete cards never report.Validation
Tested on a rented DGX Spark (GB10, sm_121, aarch64, driver 610.57.04, CUDA 13.0):
torch.cuda.get_device_properties(0).is_integrated == 1on GB10.pytest tests/engine tests/moe tests/kernels: 455 passed, 4 skipped.tests/engine/test_moe_strategy_uma.py: 10 passed.Qwen/Qwen3.6-35B-A3B-FP8with no--moe-strategyflag: log shows"Unified-memory GPU detected; auto-selecting 'fused'", 31.4 GB experts loaded
resident, CUDA graphs captured at bs 1-2, API ready in 54 s.
in 0.357 s; two concurrent requests in 1.86 s.
Refs: #369, #22, roadmap #79 (DGX Spark row).