Skip to content

[TRTLLM-14848][chore] Move the MoE-owned thop unit tests into tests/unittest/_torch/moe/kernels/ - #20658

Merged
lori-ren merged 1 commit into
NVIDIA:mainfrom
lori-ren:chore/move-moe-thop-tests
Oct 22, 2026
Merged

lori-ren merged 1 commit into
NVIDIA:mainfrom
lori-ren:chore/move-moe-thop-tests

Conversation

@lori-ren

@lori-ren lori-ren commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Dev Engineer Review

  • The change relocates MoE kernel tests from tests/unittest/_torch/thop/ to tests/unittest/_torch/moe/kernels/ without reported test-body changes.
  • CI test lists, duration keys, Ruff configuration, pre-commit lists, CODEOWNERS, and documentation references use the new paths.
  • The JUnit prefix and Jenkins ingestion behavior changed for unittest/_torch/moe/. MoE owners should confirm that outer-case reporting is sufficient.
  • No source-code or public API changes were identified. Review-finding counts are unavailable from the supplied evidence.

QA Engineer Review

  • The moved tests preserve the serial/ and parallel/ layout. The old thop/ directory is removed.
  • Updated CI lists cover B200, B300, GB300, H100, and GB300 multi-GPU configurations.
  • The duration entry for test_cute_dsl_moe.py::test_count_native_cutedsl_matches_legacy_sort_bitwise uses the new path.
  • Reported validation used pytest --collect-only and confirmed identical node IDs. test_moe_gate.py and test_moe_densegemm.py were run from their new locations.
  • The reported coverage includes DGX_H100, DGX_B200, B300, GB300 pre-merge, and GB300 four-GPU post-merge stages.
  • Coverage verdict: needs follow-up until MoE owners confirm the Jenkins JUnit reporting behavior.

Per-File QA Perspective

  • .github/CODEOWNERS: Removes obsolete thop ownership rules. Verify that the relocated MoE tests still resolve to the intended owners.
  • .pre-commit-config.yaml: Replaces thop/serial paths with moe/kernels/serial paths in generated file lists. Verify pre-commit discovery.
  • legacy-files.txt: Updates legacy test paths. Verify the relocated serial tests remain included.
  • pyproject.toml: Updates Ruff legacy exclusions for the new serial-test paths. Verify lint behavior.
  • ruff-legacy.toml: Updates Ruff legacy includes for the new serial-test paths. Verify lint coverage.
  • tests/integration/defs/.test_durations: Renames one duration key. Verify CI duration lookup.
  • tests/integration/test_lists/test-db/l0_b200.yml: Updates B200 MoE parallel and serial entries. Verify CI selection.
  • tests/integration/test_lists/test-db/l0_b300.yml: Updates B300 MoE parallel and serial entries. Verify CI selection.
  • tests/integration/test_lists/test-db/l0_gb300.yml: Updates the GB300 MoE parallel entry. Verify CI selection.
  • tests/integration/test_lists/test-db/l0_gb300_multi_gpus.yml: Updates GB300 multi-GPU MoE entries. Verify post-merge selection.
  • tests/integration/test_lists/test-db/l0_h100.yml: Updates H100 MoE parallel and serial entries. Verify CI selection.
  • tests/unittest/_torch/modeling_v2/comm/test_modeling_v2_allgather_op_matrix.py: Updates the no-xdist marker reference to the relocated test_moe_alltoall.py. Verify marker-based serialization.
  • tests/unittest/_torch/modeling_v2/comm/test_modeling_v2_reducescatter_op_matrix.py: Updates the corresponding serialization reference. Verify marker-based serialization.
  • tests/unittest/_torch/moe/test_kimi_k3_situ_moe.py: Updates documentation references to the relocated serial MoE test. No test behavior changes are reported.
  • tests/unittest/_torch/moe/test_moe_backend.py: Updates documentation references for backend and shared-expert coverage. No test behavior changes are reported.
  • Relocated files under tests/unittest/_torch/moe/kernels/: Preserve the existing MoE kernel test bodies and serial//parallel/ structure. Verify collection, selectors, CI listing, and Jenkins reporting at the new prefix.

Description

Moves the MoE-owned kernel tests left in tests/unittest/_torch/thop/ into tests/unittest/_torch/moe/kernels/, the test-side counterpart of tensorrt_llm/_torch/moe/kernels/ introduced by #19275. After #19275 these were the only files left in thop/, so that directory is gone.

The serial/ and parallel/ subdirectories are kept because CI configures xdist parallelism per directory in agg_unit_mem_df.csv. Each thop/{serial,parallel} test-list entry and CSV row is renamed in place, so every stage runs the same tests with the same worker count. The two serial files stay on the legacy lint list under their new paths. In CODEOWNERS the two thop/*moe* rules and the now-empty /tests/unittest/_torch/thop rule are dropped; the existing /tests/unittest/_torch/moe rule already assigns the new location to the MoE team.

Because the renamed test-list entries now start with unittest/_torch/moe/, tests/integration/defs/test_unittests.py writes their sub-run JUnit files with the moe-results- prefix, which Jenkins does not ingest. After the move these files report only the outer case's pass/fail in Jenkins, like the other MoE unit tests, rather than one result per parametrisation as they did under thop/. Stage failures and the culprit names in the failure message are unaffected. MoE owners: please confirm this is acceptable. If you want per-test results kept for moe/kernels/, I'll exempt that prefix in test_unittests.py.

Test Coverage

Renames only; no test body changes.

  • tests/unittest/_torch/moe/kernels/serial/ and tests/unittest/_torch/moe/kernels/parallel/, through the DGX_H100, DGX_B200, B300 and GB300 pre-merge stages and the GB300 4-GPU post-merge stage that ran them from thop/.
  • Local: pytest --collect-only on each file gives identical node IDs at the old and new paths; test_moe_gate.py and test_moe_densegemm.py run from the new paths.

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-compatible or api-breaking. For api-breaking, include BREAKING in 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.

…nittest/_torch/moe/kernels/

The CI test-list entries, parallelism rows, lint configs and CODEOWNERS follow the move; tests/unittest/_torch/thop/ no longer exists.

Signed-off-by: Lori Ren <lorir@nvidia.com>
@lori-ren
lori-ren marked this pull request as ready for review October 20, 2026 05:57
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/TensorRT-LLM/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 6fc2f015-0730-4075-bc00-3b88b30d13d9
📥 Commits

Reviewing files that changed from the base of the PR and between c146094 and 2e6a4e6.

⛔ Files ignored due to path filters: 1
  • tests/integration/defs/agg_unit_mem_df.csv is excluded by !**/*.csv
📒 Files selected for processing: 20
  • .github/CODEOWNERS
  • .pre-commit-config.yaml
  • legacy-files.txt
  • pyproject.toml
  • ruff-legacy.toml
  • tests/integration/defs/.test_durations
  • tests/integration/test_lists/test-db/l0_b200.yml
  • tests/integration/test_lists/test-db/l0_b300.yml
  • tests/integration/test_lists/test-db/l0_gb300.yml
  • tests/integration/test_lists/test-db/l0_gb300_multi_gpus.yml
  • tests/integration/test_lists/test-db/l0_h100.yml
  • tests/unittest/_torch/modeling_v2/comm/test_modeling_v2_allgather_op_matrix.py
  • tests/unittest/_torch/modeling_v2/comm/test_modeling_v2_reducescatter_op_matrix.py
  • tests/unittest/_torch/moe/kernels/parallel/test_cute_dsl_moe.py
  • tests/unittest/_torch/moe/kernels/parallel/test_moe_densegemm.py
  • tests/unittest/_torch/moe/kernels/serial/test_moe.py
  • tests/unittest/_torch/moe/kernels/serial/test_moe_alltoall.py
  • tests/unittest/_torch/moe/kernels/serial/test_moe_gate.py
  • tests/unittest/_torch/moe/test_kimi_k3_situ_moe.py
  • tests/unittest/_torch/moe/test_moe_backend.py
💤 Files with no reviewable changes: 1
  • .github/CODEOWNERS

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

Test lists and repository references now use the MoE kernel test paths instead of the former ThOP paths. The recorded integration-test duration remains unchanged.

Changes

MoE test path updates

Layer / File(s) Summary
Update integration test selections
tests/integration/test_lists/test-db/*, tests/integration/defs/.test_durations
Integration test lists and the duration record now reference the MoE kernel parallel and serial paths.
Align repository path references
.github/CODEOWNERS, .pre-commit-config.yaml, legacy-files.txt, pyproject.toml, ruff-legacy.toml, tests/unittest/_torch/modeling_v2/comm/*, tests/unittest/_torch/moe/*
Ownership rules, formatting lists, legacy paths, and test comments now reference the MoE kernel paths or remove the former ThOP ownership rules.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: juney-nvidia, wanli-jiang

Merge Risk: ⚪ Minimal · up to 2e6a4

The relocated test selections remain schedulable and retain MoE ownership. No identified issue prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (10 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: moving the MoE-owned thop unit tests into the MoE kernels directory. It includes a valid ticket and change type.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description includes a clear problem statement, solution, affected CI and ownership configuration, JUnit reporting impact, test coverage, and a completed checklist. It also identifies…
Full details: Description check

Explanation

The pull request description includes a clear problem statement, solution, affected CI and ownership configuration, JUnit reporting impact, test coverage, and a completed checklist. It also identifies the pending MoE-owner confirmation about per-test Jenkins results. The pull request title is not provided, so title-template compliance cannot be verified.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (10 skipped: 10 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@lori-ren

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79167 [ run ] triggered by Bot. Commit: 2e6a4e6 Link to invocation

@yiqingy0 yiqingy0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve for infra part.

@github-actions

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@lori-ren
lori-ren enabled auto-merge (squash) October 20, 2026 08:58
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79167 [ run ] completed with state SUCCESS. Commit: 2e6a4e6
/LLM/main/L0_MergeRequest_PR pipeline #65212 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

1 similar comment
@lori-ren

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79445 [ run ] triggered by Bot. Commit: 2e6a4e6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79445 [ run ] completed with state SUCCESS. Commit: 2e6a4e6
/LLM/main/L0_MergeRequest_PR pipeline #65431 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79559 [ run ] triggered by Bot. Commit: 2e6a4e6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79559 [ run ] completed with state SUCCESS. Commit: 2e6a4e6
/LLM/main/L0_MergeRequest_PR pipeline #65512 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79693 [ run ] triggered by Bot. Commit: 2e6a4e6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79693 [ run ] completed with state SUCCESS. Commit: 2e6a4e6
/LLM/main/L0_MergeRequest_PR pipeline #65614 completed with status: 'SUCCESS'

CI Report

Link to invocation

@lori-ren
lori-ren merged commit d1c54cb into NVIDIA:main Oct 22, 2026
leslie-fang25 added a commit to leslie-fang25/TensorRT-LLM that referenced this pull request Oct 22, 2026
…ct-fusion relu2 test

The kernel computes the activation and per-block amax in fp32, while the
reference rounds the GEMM output and the Relu2 output to bf16 before
fp4_quantize. Blocks whose scale factor sits near an E4M3 rounding
midpoint then round to the adjacent code, which affects 2-5% of the
blocks for Relu2, so the 95% exact-match threshold failed intermittently
(~2.6% of runs for 8192-8-1-128-relu2). Lower it to 90%.

Also remove the stale unittest/_torch/thop/parallel waiver: nvbugs
6966263 and 6971596 report the same relu2 SF mismatch, and the test has
moved to unittest/_torch/moe/kernels/parallel (NVIDIA#20658), so the entry no
longer matches anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: leslie-fang25 <leslief@nvidia.com>
vsabavat added a commit to vsabavat/TensorRT-LLM that referenced this pull request Oct 22, 2026
…tions into the K3 kernels branch

Propagate k3-cons/b-runtime a43e651 (main NVIDIA#20658, the thop -> moe/kernels unit-test move) into the K3 kernels branch. No conflicts.

Signed-off-by: Vasanth Sabavat <vsabavat@nvidia.com>
vsabavat added a commit to vsabavat/TensorRT-LLM that referenced this pull request Oct 22, 2026
Merge the K3 kernels branch after it absorbed k3-cons/b-runtime a43e651 (main NVIDIA#20658). Resolve l0_b200.yml: keep this branch's DSpark drafter and decode-kernel entries and take the move of thop/parallel to moe/kernels/parallel.

Signed-off-by: Vasanth Sabavat <vsabavat@nvidia.com>
leslie-fang25 added a commit to leslie-fang25/TensorRT-LLM that referenced this pull request Oct 22, 2026
…ct-fusion relu2 test

The kernel computes the activation and per-block amax in fp32, while the
reference rounds the GEMM output and the Relu2 output to bf16 before
fp4_quantize. Blocks whose scale factor sits near an E4M3 rounding
midpoint then round to the adjacent code, which affects 2-5% of the
blocks for Relu2, so the 95% exact-match threshold failed intermittently
(~2.6% of runs for 8192-8-1-128-relu2). Lower it to 90%.

Also remove the stale unittest/_torch/thop/parallel waiver: nvbugs
6966263 and 6971596 report the same relu2 SF mismatch, and the test has
moved to unittest/_torch/moe/kernels/parallel (NVIDIA#20658), so the entry no
longer matches anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: leslie-fang25 <leslief@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants