Skip to content

[#4403][refactor] Move match_moe, sharding, load_weights to modular inference optimizer - #124

Merged
h-guo18 merged 7 commits into
user/fridah/merge-0801from
haoguo/move_moe_sharding_loadweights
Aug 10, 2025
Merged

[#4403][refactor] Move match_moe, sharding, load_weights to modular inference optimizer#124
h-guo18 merged 7 commits into
user/fridah/merge-0801from
haoguo/move_moe_sharding_loadweights

Conversation

@h-guo18

@h-guo18 h-guo18 commented Aug 7, 2025

Copy link
Copy Markdown

@coderabbitai summary

Description

  • Refactor: added shared configs in Inference Optimizer for configs shared by multiple transforms

    • Now include: sharding config, rank, world_size (shared by multiple sharding transforms)
    • TODO later: also put these in shared config:
      • attn_op
      • cm
      • factory
  • Move transforms: match_moe, sharding, laod_weights to new inf optimizer

Test Coverage

  • Unit tests

    • pytest tests/unittest/_torch/auto_deploy/unit/
      • 852 passed, 37 skipped, 49 xfailed, 4 xpassed, 31 warnings in 715.34s (0:11:55)
  • TRT-bench

with modifications, tp=1:

Request Throughput (req/sec):                     39.1180
Total Output Throughput (tokens/sec):             5007.1090
Total Token Throughput (tokens/sec):              10014.2179
Total Latency (ms):                               25563.6537
Average request latency (ms):                     19995.0429
Per User Output Throughput [w/ ctx] (tps/user):   6.9075
Per GPU Output Throughput (tps/gpu):              5007.1090

target branch, tp=1:

Request Throughput (req/sec):                     39.2947
Total Output Throughput (tokens/sec):             5029.7223
Total Token Throughput (tokens/sec):              10059.4446
Total Latency (ms):                               25448.7211
Average request latency (ms):                     19921.6154
Per User Output Throughput [w/ ctx] (tps/user):   6.9288
Per GPU Output Throughput (tps/gpu):              5029.7223

with modifications, tp=2:

Request Throughput (req/sec):                     26.2721
Total Output Throughput (tokens/sec):             3362.8269
Total Token Throughput (tokens/sec):              6725.6538
Total Latency (ms):                               38063.2142
Average request latency (ms):                     29671.5393
Per User Output Throughput [w/ ctx] (tps/user):   4.6738
Per GPU Output Throughput (tps/gpu):              1681.4134

target branch, tp=2:

Request Throughput (req/sec):                     26.2887
Total Output Throughput (tokens/sec):             3364.9543
Total Token Throughput (tokens/sec):              6729.9085
Total Latency (ms):                               38039.1502
Average request latency (ms):                     29636.2802
Per User Output Throughput [w/ ctx] (tps/user):   4.6821
Per GPU Output Throughput (tps/gpu):              1682.4771

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@h-guo18
h-guo18 requested a review from Fridah-nv August 7, 2025 01:16
@h-guo18 h-guo18 self-assigned this Aug 7, 2025
@h-guo18
h-guo18 marked this pull request as ready for review August 7, 2025 01:33
@Fridah-nv

Copy link
Copy Markdown

Could you also run the full unit tests pytest tests/unittest/_torch/auto_deploy/unit? Tests like test_ad_build_small_single and test_ad_build_small_multi are helpful for our case. Thank you!

Comment thread tensorrt_llm/_torch/auto_deploy/transform/interface.py
Comment thread tensorrt_llm/_torch/auto_deploy/config/default.yaml
Comment thread tensorrt_llm/_torch/auto_deploy/transform/library/load_weights.py Outdated

@Fridah-nv Fridah-nv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, Just a few minor comments.

@Fridah-nv

Copy link
Copy Markdown

@greg-kwasniewski1 could you also take a look at changes for sharding transformations?

@h-guo18
h-guo18 changed the base branch from feat/ad-arch-2025-08-01 to user/fridah/merge-0801 August 8, 2025 23:36
@h-guo18
h-guo18 force-pushed the haoguo/move_moe_sharding_loadweights branch from b220110 to e90aadb Compare August 9, 2025 01:10
@Fridah-nv
Fridah-nv force-pushed the user/fridah/merge-0801 branch 2 times, most recently from 50199c5 to 30cd46e Compare August 9, 2025 02:30
…nf optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
… optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
…mports;

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
@h-guo18
h-guo18 force-pushed the haoguo/move_moe_sharding_loadweights branch from e90aadb to de5d0aa Compare August 10, 2025 01:27
@h-guo18
h-guo18 merged commit 4320e20 into user/fridah/merge-0801 Aug 10, 2025
2 checks passed
Fridah-nv pushed a commit that referenced this pull request Aug 11, 2025
…ular inference optimizer (#124)

* refactor: move match_moe_pattern, sharding, load_weights to modular inf optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* refactor: move match_moe, sharding, load_weights to modular inference optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: fix typo; remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* polish: keep moe skip test; move sharding configs to avoid circular imports;

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: rename class name

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* fix quant_graph inputs; add type hints for shared_config

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

---------

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Fridah-nv pushed a commit that referenced this pull request Aug 11, 2025
…ular inference optimizer (#124)

* refactor: move match_moe_pattern, sharding, load_weights to modular inf optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* refactor: move match_moe, sharding, load_weights to modular inference optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: fix typo; remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* polish: keep moe skip test; move sharding configs to avoid circular imports;

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: rename class name

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* fix quant_graph inputs; add type hints for shared_config

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

---------

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Fridah-nv pushed a commit that referenced this pull request Aug 11, 2025
…ular inference optimizer (#124)

* refactor: move match_moe_pattern, sharding, load_weights to modular inf optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* refactor: move match_moe, sharding, load_weights to modular inference optimizer

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: fix typo; remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* polish: keep moe skip test; move sharding configs to avoid circular imports;

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* remove redundant comments

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* style: rename class name

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

* fix quant_graph inputs; add type hints for shared_config

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>

---------

Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants