[TRTLLM-14843][chore] Establish _torch/moe/ and relocate MoE modules, custom ops, and communication - #17952
Conversation
…les, custom ops and communication Signed-off-by: Lori Ren <lorir@nvidia.com>
…e references at _torch/moe/ Signed-off-by: Lori Ren <lorir@nvidia.com>
…hey cover Signed-off-by: Lori Ren <lorir@nvidia.com>
|
PR_Github #70095 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #70116 [ run ] triggered by Bot. Commit: |
|
PR_Github #70116 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #70143 [ run ] triggered by Bot. Commit: |
|
PR_Github #70143 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #70151 [ run ] triggered by Bot. Commit: |
|
PR_Github #70151 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #70160 [ run ] triggered by Bot. Commit: |
|
PR_Github #70160 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #70173 [ run ] triggered by Bot. Commit: |
|
/bot run --disable-fail-fast |
|
PR_Github #70174 [ run ] triggered by Bot. Commit: |
|
PR_Github #70173 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #70175 [ run ] triggered by Bot. Commit: |
|
PR_Github #70174 [ run ] completed with state |
|
PR_Github #70175 [ run ] completed with state |
Resolves the conflict introduced by NVIDIA#17952, which relocated tensorrt_llm/_torch/modules/fused_moe/ to tensorrt_llm/_torch/moe/fused_moe/. That turns this branch's quantization.py hunks into modify-vs-delete. Git resolves it locally via directory-rename detection, but the merge-base..main diff spans 10217 files, past the default diff.renameLimit, so GitHub skips rename detection and reports the PR as unmergeable. Merged rather than rebased so the branch needs no force-push. Signed-off-by: xxi <xxi@nvidia.com>
Resolves the MoE tree relocation from NVIDIA#17952: quantization.py and fused_moe_cutlass.py now live under tensorrt_llm/_torch/moe/fused_moe/, and the MoE unit tests under tests/unittest/_torch/moe/. The three standalone W4A16 test-list entries are re-added at the new path in l0_h100.yml and l0_b200.yml. Signed-off-by: Dorian Magasic <dorian.magasic@turintech.ai>
Dev Engineer Review
_torch/moe/.MoeAlltoAlland custom-operation re-exports.Mapannotation indeep_ep_utils.py.thopfiles remain in place.QA Engineer Review
tests/unittest/_torch/moe/.TestAllgatherEScoreCorrectionBias,TestAllgatherExpertScales,TestScatterShardsToFull, andTestAllgatherExpertScalesNonUniform.tests/integration/test_lists/test-db/entries.test-db/orqa/files.Description
Pure relocation into a new
_torch/moe/package — no production code changed, only importpaths and the rules that follow them. 84 renames across three commits: 54 source, 30 test.
_torch/modules/fused_moe/(whole tree)_torch/moe/fused_moe/_torch/modules/fused_shared_expert.py_torch/moe/fused_shared_expert.py_torch/expert_statistic.py_torch/moe/expert_statistic.py_torch/distributed/moe_alltoall.py_torch/moe/communication/moe_alltoall.py_torch/custom_ops/cute_dsl_megamoe_custom_op.py_torch/moe/custom_ops/cute_dsl_megamoe_custom_op.pyTwo re-exports are deliberately kept and only re-pointed:
custom_ops/__init__.py's importof
cute_dsl_megamoe_custom_op(it is what registerstrtllm::cute_dsl_megamoe_nvfp4_blackwell) anddistributed/__init__.py'sMoeAlltoAll.The third commit moves the 30 MoE unit tests to
tests/unittest/_torch/moe/, mirroring thesource layout (the non-blocked part of TRTLLM-14848; its five
thop/files stay there,their destination depends on TRTLLM-14844). Test node IDs change, so 214 entries across
test-db/*.yml,waives.txtand.test_durationsmove with them. Two directory-levelentries are load-bearing and are reproduced verbatim for the new location —
test_moe_a2a.pyis named by no list and reaches the 2-GPU stage only through
unittest/_torch/multi_gpu, and threecpu_onlyfiles reach the CPU stage only throughunittest/_torch/modules.CODEOWNERS: five source rules and seven test rules each collapse into one directory rule
(
/tensorrt_llm/_torch/moe,/tests/unittest/_torch/moe); no file changes owner.Test Coverage
tests/unittest/_torch/moe/— the whole relocated tree, includingfused_moe/andmulti_gpu/test_moe_a2a.pytests/unittest/_torch/thop/serial/test_moe_alltoall.py(not moved)tests/unittest/_torch/test_mnnvl_utils.py(rewrittenmock.patchstring targets)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.