Repository navigation
[TRTLLM-17131][chore] Clean up Muse Spark Open before the mergeback to main - #20638
Conversation
…o main - Delete the mega_moe_nvfp4 CuTe DSL package. Nothing in tensorrt_llm/ imports it (main removed it in NVIDIA#17956); drop the three tests that built its kernel. - Delete code that duplicates or shadows existing code: the first zero_planned_split_kv_scratch in flashinfer.py, the re-added GuidedDecoder methods and the uncalled Fmha.validate_metadata stub. Drop the F811 baseline entries that hid the duplicates. - MegaMoE CuTe DSL: fold routing weights into FC1 only for DeepSeek V4 and V4.1 again. The deferred-finalize change enabled the fold for every model on this backend; deferred finalize still takes the post-FC2 route. - Muse Spark Open: remove the five default-on kill switches (MUSESPARK_OPEN_FUSED_RESIDUAL, _ROUTING_MEMO, _FROZEN_GATE_CACHE, _FUSED_FINALIZE_AR, _FUSED_PRE_EXPERT_QUANT). Each path is selected by capability and falls back to the reference composition; the tests reach the fallbacks without environment variables. - Muse Spark Open: replace MUSESPARK_OPEN_ALLREDUCE with the configured allreduce_strategy. AUTO still becomes NCCL on the attention and MoE all-reduces; any other strategy is used as configured. Signed-off-by: Michal Guzek <mguzek@nvidia.com>
|
@yihwang-nv, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
brnguyen2
left a comment
There was a problem hiding this comment.
Approving — the comments below are optional touch-ups, not blockers.
I checked the parts that could break. No references to mega_moe_nvfp4 or the removed MUSESPARK_OPEN_* switches remain in code, docs or examples. The deleted kernel-guard tests had no live counterpart: the cutedsl_megamoe path never forwards skip_topk_reduce, and the backend already rejects deferred finalize with a non-bf16 combine format. Muse Spark Open on MEGAMOE_CUTEDSL has to run with deferred finalize because the scheduler raises otherwise, so apply_topk_in_fc1 stays False for it before and after this change, which matches the description.
The all-reduce change does not affect the documented recipes, because examples/musespark_open/serve_config.yaml, both deployment guides and tests/integration/defs/accuracy/test_musespark_open.py all pin allreduce_strategy: NCCL. For anyone who set a different strategy, though, this is a real behavior change: before, the model silently forced NCCL; now ONESHOT, TWOSHOT, MNNVL, NCCL_SYMMETRIC and the rest reach both all-reduces. When this is re-cut against main, please call that out in the PR description. A line in the deployment guide's allreduce_strategy section saying "AUTO is replaced by NCCL for this model; other values are used as given" would also help.
Two smaller items are inline.
…-reduces An explicit allreduce_strategy=NCCL_SYMMETRIC selects the symmetric-memory path that corrupts the attention output projection's decode-step reduce, which the AUTO-to-NCCL mapping exists to avoid, so model construction now rejects it. The deployment guide states how allreduce_strategy is treated for this model. Signed-off-by: Michal Guzek <mguzek@nvidia.com>
@coderabbitai summary
Description
Cleans up
feat/musespark-openbefore its code is re-cut into PRs againstmain, so those PRs start from codemain's reviewers can accept as is. The default configuration computes the same thing as before, apart from the MegaMoE fix below, which only affects models other than Muse Spark Open.Dead and duplicate code.
tensorrt_llm/_torch/cute_dsl_kernels/mega_moe_nvfp4/(20 files, 16k lines) is deleted. Nothing intensorrt_llm/imports it:mainremoved the package in [None][perf] update MegaMoE kernels for Blackwell and Rubin #17956, after [None][feat] Support the MegaMoE CuteDSL MoE backend for Qwen3.8-Flash-Next #19323 replaced it withcutedsl_megamoe. Only three constructor tests intest_megamoe_deferred_finalize.pystill built its kernel, and they are deleted with it.flashinfer.pydefinedzero_planned_split_kv_scratchtwice. The first definition was shadowed by the second and is removed.guided_decoder.pyre-added methods that already existed, with identical bodies, and is restored to its merge-base state.Fmha.validate_metadatahad no callers, andfmha/interface.pyis restored to its merge-base state.ruff-legacy-baseline.jsonthat hid the two duplicates are removed.MegaMoE routing-weight placement. The deferred-finalize change set
apply_topk_in_fc1 = not deferred_finalize. That folded the routing weights into the FC1 output, before its NVFP4 quantization, for every model onMEGAMOE_CUTEDSL. Before that change, and onmaintoday, only DeepSeek V4 and V4.1 take that route. The gate is now(DeepSeek V4 or V4.1) and not deferred_finalize:main's condition, plus the deferred-finalize exception.Muse Spark Open kill switches. The five default-on switches are removed:
MUSESPARK_OPEN_FUSED_RESIDUAL,_ROUTING_MEMO,_FROZEN_GATE_CACHE,_FUSED_FINALIZE_ARand_FUSED_PRE_EXPERT_QUANT. They existed to keep each fusion's unfused arm reachable for A/B runs on one image.All-reduce strategy.
MUSESPARK_OPEN_ALLREDUCEis removed, and so is the model's silent override of the configuredallreduce_strategy. Before this change, the attention output projection used NCCL unless the variable named another strategy, and the MoE combine always used NCCL, whateverallreduce_strategysaid. Both all-reduces now use the configured strategy, except that AUTO, the default, becomes NCCL, and an explicitNCCL_SYMMETRICis rejected at model construction, because it is the path that corrupts the attention output projection. The deployment guide states this. AUTO fails this model at TP4 in two ways:Test fix.
test_query_combine_quant_region_matches_bf16_tensor_sizefailed on GB300 before this change, withCUDA_ERROR_INVALID_CONTEXT. The kernel probe it calls needs a current CUDA context, and the test never created one. It now creates one, and skips without an SM100-family GPU.Test Coverage
Run on one 4x GB300 node with these changes, and with the deleted package hidden from the installed wheel. The run covered 26 files:
test_megamoe_deferred_finalize.py;test_musespark_serve_extensions.py.617 passed and 1 skipped. The skip needs a local tokenizer.
New or rewritten cases:
test_megamoe_deferred_finalize.py::test_backend_folds_routing_weights_into_fc1_only_for_deepseek_v4covers five architectures. Without a config, Qwen3-MoE and Muse Spark Open keep the weights after FC2; DeepSeek V4 and V4.1 fold them into FC1.test_backend_deferred_finalize_selects_transformers_routenow builds a DeepSeek V4 backend, so it checks that deferred finalize overrides the fold.test_musespark_open_allreduce_strategy.pychecks four things:NCCL_SYMMETRICis rejected;__init__s build theirAllReducefrom the resolver.test_modeling_musespark_open.py,test_musespark_open_pre_expert_quant.py,test_musespark_open_fusion_switches.py,test_musespark_open_preqkv_norm_ordering.pyandtest_musespark_open_cluster_boundary.pykeep their assertions (bit-exact fallbacks, reduction-order bounds, cached-tensor identity), reached without environment variables.pre-commitpasses on the changed files.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.