Skip to content

Conversation

yunruis
Copy link
Contributor

@yunruis yunruis commented Jun 9, 2025

pytest -s tests/unittest/_torch/modules/test_fused_moe.py# refactoring: port customized kernels with public cutlass version

In this PR we have open-sourced some internal Cutlass kernels. Meanwhile, to ensure stability and provide an even more optimized performance experience, we have retained the previous method of calling these kernels via static libraries, as another choice.
The purpose of this document is to introduce how to use these newly open-sourced Cutlass kernels, while also supporting the option to switch back to the previously supported internal Cutlass kernels via static libraries.

Compilation
These open-sourced cutlass kernels are low_latency_gemm, moe-gemm, fp4_gemm and allreduce_gemm. The switch between using open-sourced Cutlass kernels and static library Cutlass kernels can be made using the macro USING_OSS_CUTLASS_* achieving kernel-level control. By default, the open-source Cutlass kernels are used. For example:

python3 ./scripts/build_wheel.py --skip_building_wheel --linking_install_binary --use_ccache  --cuda_architectures "90-real;100-real" --python_bindings --install --micro_benchmarks

This will using open-sourced cutlass kernels.

If users prefer to use the internal Cutlass kernels from the static library, they can control this during compilation by setting marco USING_OSS_CUTLASS_* to OFF. For instance, if a user wants to use the static library implementation for low_latency_gemm and fused_moe_gemm, the following compilation command can be used:

python3 ./scripts/build_wheel.py --skip_building_wheel --linking_install_binary --use_ccache  --cuda_architectures "90-real;100-real" -D "USING_OSS_CUTLASS_MOE_GEMM=OFF;USING_OSS_CUTLASS_LOW_LATENCY_GEMM=OFF" --python_bindings --install --micro_benchmarks

@yunruis yunruis requested a review from a team as a code owner June 9, 2025 08:13
@yunruis yunruis requested review from dongxuy04 and yuxianq June 9, 2025 08:13
@juney-nvidia juney-nvidia changed the title User/yunruis/opened internal cutlass rebased refactoring: port customized kernels with public cutlass version Jun 9, 2025
@yunruis yunruis force-pushed the user/yunruis/opened_internal_cutlass_rebased branch from fd44de3 to 7bcd459 Compare June 10, 2025 09:38
@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8271 [ run ] triggered by Bot

yunruis added 2 commits June 10, 2025 03:22
… kernels

Signed-off-by: yunruis <[email protected]>

moe_gemm passed

Signed-off-by: yunruis <[email protected]>

fix license bug

Signed-off-by: yunruis <[email protected]>

waive debug mode

Signed-off-by: yunruis <[email protected]>

fix debug mode compile bug

Signed-off-by: yunruis <[email protected]>

open source GEMM+AR kernels

contains blackwell fixes

support all reduce_gemm cutlass kernel

Signed-off-by: yunruis <[email protected]>

fix bug

Signed-off-by: yunruis <[email protected]>

fix credential symbol

Signed-off-by: yunruis <[email protected]>

drop credential symbol

Signed-off-by: yunruis <[email protected]>

add debug info and test ok

Signed-off-by: yunruis <[email protected]>

fix loraparams namespace bug

Signed-off-by: yunruis <[email protected]>

fix rebase bug

Signed-off-by: yunruis <[email protected]>

fix moe gemm bug on sm90

Signed-off-by: yunruis <[email protected]>

fix low_latency_gemm internal error

Signed-off-by: yunruis <[email protected]>
…upport FP8xMXFP4. And add open-sourced moe_gemm micro-benchmark and unittest

Signed-off-by: yunruis <[email protected]>
@yunruis yunruis force-pushed the user/yunruis/opened_internal_cutlass_rebased branch from 7bcd459 to d0da265 Compare June 10, 2025 10:27
@tensorrt-cicd
Copy link
Collaborator

PR_Github #8271 [ run ] completed with state ABORTED

@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8280 [ run ] triggered by Bot

@yunruis yunruis force-pushed the user/yunruis/opened_internal_cutlass_rebased branch from d0da265 to 6d27e20 Compare June 10, 2025 10:41
@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8282 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8280 [ run ] completed with state ABORTED

Copy link
Collaborator

@juney-nvidia juney-nvidia left a comment

Choose a reason for hiding this comment

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

Thanks for the hard working, Yunrui.
Let's merge this PR ASAP to unblock the dependency and keep refining it in the subsequent PRs.

@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8317 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8282 [ run ] completed with state ABORTED
/LLM/main/L0_MergeRequest_PR pipeline #5995 completed with status: 'FAILURE'

@yunruis yunruis force-pushed the user/yunruis/opened_internal_cutlass_rebased branch from 0bcd83d to 06f28ae Compare June 10, 2025 15:58
@tensorrt-cicd
Copy link
Collaborator

PR_Github #8317 [ run ] completed with state ABORTED

@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8324 [ run ] triggered by Bot

@yunruis
Copy link
Contributor Author

yunruis commented Jun 10, 2025

/bot kill

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8324 [ run ] completed with state ABORTED

@yunruis yunruis requested review from a team as code owners June 12, 2025 03:26
@yunruis yunruis requested review from suyoggupta and HuiGao-NV June 12, 2025 03:26
@yunruis yunruis force-pushed the user/yunruis/opened_internal_cutlass_rebased branch from 79ec409 to 53fb6b6 Compare June 12, 2025 03:30
@yunruis
Copy link
Contributor Author

yunruis commented Jun 12, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8594 [ run ] triggered by Bot

@juney-nvidia juney-nvidia enabled auto-merge (squash) June 12, 2025 12:46
@tensorrt-cicd
Copy link
Collaborator

PR_Github #8594 [ run ] completed with state ABORTED

@juney-nvidia
Copy link
Collaborator

/bot help

Copy link

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 [--disable-fail-fast --skip-test --stage-list "A10-1, xxx" --gpu-type "A30, H100_PCIe" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-[Post-Merge]-1, xxx"]

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

--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-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-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.

--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. Will also run 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-[Post-Merge]-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-[Post-Merge]-1, xxx".

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.

@juney-nvidia
Copy link
Collaborator

/bot run --stage-list "DGX_H100-4_GPUs-PyTorch-Others-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8730 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #8730 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #6333 (Partly Tested) completed with status: 'SUCCESS'

@ZhanruiSunCh
Copy link
Collaborator

/bot skip --comment "PR_Github #8730 and PR_Github #8594 run a full pre-merge CI Pipeline with multi GPU test"

@ZhanruiSunCh ZhanruiSunCh disabled auto-merge June 13, 2025 08:06
@tensorrt-cicd
Copy link
Collaborator

PR_Github #8768 [ skip ] triggered by Bot

@juney-nvidia juney-nvidia merged commit 30c5b41 into NVIDIA:main Jun 13, 2025
2 of 3 checks passed
@tensorrt-cicd
Copy link
Collaborator

PR_Github #8768 [ skip ] completed with state SUCCESS
Skipping testing for commit 758490d

yuantailing added a commit to yuantailing/TensorRT-LLM that referenced this pull request Jun 14, 2025
@yunruis yunruis deleted the user/yunruis/opened_internal_cutlass_rebased branch June 27, 2025 02:44
@yunruis yunruis restored the user/yunruis/opened_internal_cutlass_rebased branch June 27, 2025 02:44
@yunruis yunruis deleted the user/yunruis/opened_internal_cutlass_rebased branch August 15, 2025 08:25
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.

9 participants