fix(musa): take the MUSA arch table and build targets from torchada #326
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #326"
general
weight: 0.35
yeahdongcn
Summary
vllm-musa now takes its MUSA arch handling from torchada's new
torchada.arch(torchada 0.1.107, MooreThreads/torchada#146). That means the native build target, the JIT target and cache root, and the FP8 gate. vllm-musa's own arch parsing and detection is deleted. On S5000 (mp_31) every runtime gate answers as before, and the native compile command lines are unchanged.setup.py: one arch per build.- It comes from
MTGPU_TARGET, thenTORCH_MUSA_ARCH_LIST, then the visible devices, then mp_31.- An arch outside torchada's table (only mp_31 today) stops the build.
- The resolved arch is written back as
TORCH_MUSA_ARCH_LISTfor torch_musa'sMUSAExtension.-
-DENABLE_FP8comes from the table'sfp8column.- There is no device check, so cross-compiling still works.
jit.py): targets come fromVLLM_MUSA_ARCH_LIST, thenMATE_MUSA_ARCH_LIST, then the devices.- Once MUSA is initialized, a load whose targets miss a visible device's arch raises instead of building a module whose kernels would not launch.
- Builds go under
<VLLM_MUSA_JIT_CACHE_DIR>/<cache_tag>/, e.g.mp31_mu50200/, so different archs and MUSA toolkits never share a module.- The rope module name no longer carries the arch.
- Nothing resolves at import.
-D__MUSA_ARCH_LIST__=310is removed from the norm, qk-mrope and custom all-reduce JIT flags. Preprocessing those units with and without it gives identical output on S5000.supports_fp8()matches the device capability against the table's FP8 rows. The Triton fused-MoE FP8 gate callssupports_fp8()instead ofhas_device_capability((3, 1)).- (3,1) answers True as before.
- (3,0), (2,2),
Noneand pymtml's failed-probe(0, 0)answer False as before. So does an MTMLRuntimeError.- An arch without an FP8 row, e.g. (3,2), now answers False instead of passing the
>= (3, 1)check unverified.requirements/common.txt, the stack contract test, the READMEs and the Nemotron cookbook.- The legacy torch 2.9.1 stack row is raised too, because
setup.pyimportstorchada.arch.- The install docs say to upgrade torchada before
pip install -e ..__MUSA_ARCH__ == 310, and a second test keeps that list complete.-
setup.pywrites the arch it built the native extensions for tovllm_musa/_build_info.py. It goes into the source tree for editable installs and intobuild_libfor wheels. The file is ignored by git and kept out of the image build context.-
MTGPUWorkerchecks its device against the record onceinit_device()has selected it, before the model loads.- A device outside the record raises a
RuntimeErrorthat names both archs. The message suggests a rebuild only when the device arch is in torchada's table.- On S5000, a kernel built for another arch fails at launch with
musaErrorInvalidDeviceFunction.musaDeviceSynchronizestill succeeds and the output stays unwritten, so this check is what turns a wrong-arch install into a clear error.- An install without a record skips the check, for example a tree built before this change.
docker/check_musa_arch_env.pyruns right beforepip install -e .. It fails unless every variable below names the same single arch from torchada's table, each in its reader's spelling:-
MTGPU_TARGET, in any torchada spelling;-
TORCH_MUSA_ARCH_LIST, as31;-
MATE_MUSA_ARCH_LIST, as3.1;-
VLLM_MUSA_ARCH_LIST, when set.- A MATE value that MATE cannot parse already fails at
import torchada, with MATE's own error.str(target), and on S5000 the MUSA target reads{"kind":"musa",...,"arch":"mp_31",...}, filled in from the device. A device test pins this.The image already sets
MTGPU_TARGET=mp_31,TORCH_MUSA_ARCH_LIST=31andMATE_MUSA_ARCH_LIST=3.1, so the image env decides as before.MTGPU_TARGET=mp_22builds now stop instead of compiling. torch_musa in the current image is mp_31-only, so this loses no runnable configuration.Test plan
Leased 2x MTT S5000, driver 5.2.0-server, image
vllm:v0.32.0-ph1-5.2.0-torch2.11.0.post2-20261106(digest-pinned), torch / torch_musa 2.11.0.post2+musa5.2.0. Based6ad785bdaand this branch were built in place in the same tree,/workspace/vllm-musa, with the shared ccache. Every build started from the pristine pinnedthird_party/vllm. The branch builds had torchada 0.1.107 (this PR's dependency) installed.env -u MTGPU_TARGET -u TORCH_MUSA_ARCH_LIST -u MATE_MUSA_ARCH_LIST).- Each build issues 52 compile commands. With pip's temp build dir normalized, the command lines are identical across all four builds.
- Every line carries
-DENABLE_FP8and only--offload-arch=mp_31.- ccache: the branch image-env build after the base builds hit 52/52.
tests/test_musa.py,tests/test_inplace_porting_contract.py,tests/jit_kernel/test_csrc_jit_kernels.py; the branch addstests/jit_kernel/test_jit_arch_resolution.pyandtests/test_musa_arch_table.py): base 147 passed, branch 189 passed.pytest tests --deselect tests/test_musa_sync_upstream.py --continue-on-collection-errors): base 56 failed / 2827 passed / 64 skipped / 5 errors; branch 58 / 2867 / 64 / 5.- The whole difference in failing tests is parameters of
test_deep_gemm_three_wrappers::test_grouped_wrapper_full_ticket_boundary_matrix.- That test checks vendor DeepGEMM determinism, and which parameters fail varies from run to run.
-
VLLM_MUSA_ARCH_LIST=mp_22raises aRuntimeErrornaming the targets, the variable and the device arch ([mp_31]); nothing is built.-
310raises aValueError.-
mp_31, theMATE_MUSA_ARCH_LISTfallback and the no-env device case build undermp31_mu50200/<name>/, with the lock atmp31_mu50200/tmp/<name>.lock.- Neither platform load nor
_moe.prewarm()initializes MUSA.-
supports_fp8(),is_device_capability((3, 1))andhas_device_capability((3, 1))are True on both.- The subprocesses started are the same; only the rope module path differs, and no
musaInfocall is added.quantization=fp8). Each answered 3/3 requests with HTTP 200 and correct answers. The JIT modules were built undermp31_mu50200/.- The native build hit ccache 52/52 with unchanged compile lines: every line carries
-DENABLE_FP8and only--offload-arch=mp_31.- The build logs
Recorded MUSA arch mp_31and writesMUSA_ARCHS = ((3, 1),)to the source tree and to the editable build'sbuild_lib.- With the record edited to name mp_22,
vllm serve Qwen3-8Bstops in worker init before the model loads, withRuntimeError: vllm-musa's native extensions were built for [mp_22], but musa:0 is mp_31; their kernels do not launch there (musaErrorInvalidDeviceFunction). Rebuild vllm-musa with MTGPU_TARGET=mp_31.- With the real record, the Qwen3-8B compiled smoke passes 4/4.
- The image env passes.
-
VLLM_MUSA_ARCH_LIST=mp_22fails with the script's message.-
MATE_MUSA_ARCH_LIST=31fails in MATE's parser.musaErrorInvalidDeviceFunctionon S5000, while the mp_31 build is correct.Target("musa")carriesarchmp_31, and the cache-keytargetfield of a compiled kernel holds it. With no visible device, TileLang falls back tomp_22with a warning.tests/test_native_arch.py,tests/test_docker_musa_arch_env.py,tests/test_tilelang_target_arch.py) plustest_inplace_porting_contract.py,test_musa_arch_table.py,test_musa.py,jit_kernel/test_jit_arch_resolution.pyand #327'stest_rope_store_hint_prewarm.py. 201 passed.-D__MUSA_ARCH_LIST__=310:mcc -Eofnorm/rmsnorm.mu,norm/qk_mrope.muanddistributed/custom_all_reduce.muis byte-identical with and without it (plain, device-only and host-only).Merge after the torchada 0.1.107 release is on the index.
AI assistance: Claude Code drafted this change and ran the MUSA validation listed above.