-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[None][feat] Revise the calculation related to TileN in routing of MOE TRTLLM backend #8148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6662523 to
f4437ee
Compare
|
/bot run |
|
PR_Github #20647 [ run ] triggered by Bot |
|
PR_Github #20647 [ run ] completed with state |
f4437ee to
6dbbe92
Compare
|
/bot run |
|
PR_Github #20700 [ run ] triggered by Bot |
|
PR_Github #20700 [ run ] completed with state |
|
/bot run |
|
PR_Github #20732 [ run ] triggered by Bot |
|
PR_Github #20732 [ run ] completed with state |
|
/bot run |
|
PR_Github #20778 [ run ] triggered by Bot |
|
PR_Github #20778 [ run ] completed with state |
📝 WalkthroughWalkthroughAdds tile-based tiling alongside power-of-two padding across routing kernels. Introduces mTileTokensDim and isPow2 template parameter. Implements tile arithmetic helpers and switches computations (CTA counts, limits, offsets, sizes) between pow2 and tile paths. Updates launch macros, runner propagation, and unit tests to use tileTokensDim and revised parameterization. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Host as Host (runner.cu)
participant KP as KernelParamsBase/Kernels
participant Math as Tile/Pow2 helpers
participant Kern as Routing Kernels
Host->>KP: setBaseParams(data)\n(mTileTokensDim, mPaddingLog2)
Note over KP: KP::isPow2 (template constexpr)
KP->>Kern: launch routing kernels
alt KP::isPow2 == true
Kern->>Math: divUpLog2/mulLog2 for\nnumCta, mnLimit, offsets, sizes
else KP::isPow2 == false
Kern->>Math: divUpTileN/mulTileN for\nnumCta, mnLimit, offsets, sizes
end
Kern-->>Host: results (permutedIdx, sizes)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (12)
🧰 Additional context used📓 Path-based instructions (7)**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{cpp,cxx,cc,cu,h,hpp,hh,hxx,cuh}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{h,hpp,hh,hxx}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{h,hpp,hh,hxx,cpp,cxx,cc}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{h,hpp,hh,hxx,cuh}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Files:
🧠 Learnings (3)📚 Learning: 2025-09-19T21:28:13.751ZApplied to files:
📚 Learning: 2025-08-20T07:43:36.447ZApplied to files:
📚 Learning: 2025-08-08T22:03:40.707ZApplied to files:
🧬 Code graph analysis (5)cpp/tests/unit_tests/kernels/routing/routingTest.cpp (1)
cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingRenormalize.cu (1)
cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingDeepSeek.cu (1)
cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingLlama4.cu (1)
cpp/tests/unit_tests/kernels/routing/routingTest.h (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Christina Zhang <83400082+ChristinaZ@users.noreply.github.com>
6dbbe92 to
8160d74
Compare
|
/bot run |
|
PR_Github #21474 [ run ] triggered by Bot |
|
PR_Github #21474 [ run ] completed with state |
…E TRTLLM backend (NVIDIA#8148) Signed-off-by: Christina Zhang <83400082+ChristinaZ@users.noreply.github.com>
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Description
Before TRTLLM backend use
mPaddingLog2to accelerate related calculation with function likedivUpLog2(),mulLog2()anddivUpMulLog2(). However, now the tileN might be a value like192, which is not a power of 2. So I have to replace them with functions likemulTileN(),divUpTileN(), anddivUpMulTileN().About the performance, I tried to compare the performance. In general, with this modification, its running time extended slightly. For example, with
mPaddingLog2=3 (mTileN=8), kernelroutingRenormalize::routingIndicesClusterKernelcan observe 3% performance regression.So I think it's better to add one more template parameter so that it can still use the previous variable
mPaddingLog2.Test Coverage
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)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
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
/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.
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.