-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[TRTLLM-15316][feat] Rubin trtllmgen batchedGemm MoE #17707
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
Merged
farazkh80
merged 20 commits into
NVIDIA:main
from
farazkh80:rubin_feat/trtllmgen_bmm_sm107
Sep 2, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2dcd07b
[WIP][feat] SM107 batchedGemm host wiring: sm107a/100f dispatch and f…
farazkh80 5c741c4
[WIP][feat] SM107 batchedGemm export config: 107a 2x-mmaK variants an…
farazkh80 8a74988
[WIP][feat] SM107 fine-grained sync: MoE kernel selection and runtime…
farazkh80 e87b854
[WIP][feat] expose use_fine_grained_sync through LlmArgs and disable …
farazkh80 61f719a
[WIP][test] SM107 fine-grained sync MoE tests
farazkh80 2b7af2f
[WIP][fix] drop duplicate parameter keys in batchedGemm export config
farazkh80 03853d1
[WIP][fix] address review: pointer call, env clobber, missing imports…
farazkh80 5063f23
[WIP][feat] SM107 batchedGemm cubin drop: regenerated trtllmGen_bmm_e…
farazkh80 f2527a4
[WIP][chore] apply pre-commit formatting
farazkh80 7859de4
[WIP][chore] clang-format exported headers
farazkh80 ea3f1be
[WIP][fix] address review: SM107 in TRTLLMGenFusedMoE eligibility, SM…
farazkh80 d299808
[WIP][fix] gate autotuner dispatch log behind debug level; filter sm1…
farazkh80 ec5c3af
[WIP][feat] refresh batchedGemm cubin drop: include NVFP4 SiTu kernel…
farazkh80 2cc5c52
[WIP][chore] clang-format refreshed export headers
farazkh80 1f7862b
[WIP][fix] include <atomic> in envUtils.cpp
farazkh80 66fb50f
[WIP][fix] export fineGrained option fields in public batchedGemm int…
farazkh80 3f90f6c
[WIP][fix] address review: drop write-only ModelConfig field, make ba…
farazkh80 fd12955
[WIP][chore] clang-format v6 export headers
farazkh80 5a23f6b
[WIP][fix] export fineGrained constructor parameters in public GemmOp…
farazkh80 5c33e31
[WIP][fix] include envUtils.h in MoE thop ops
farazkh80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/trtllm/gen/CommonUtils.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & | ||
| * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #pragma once | ||
|
|
||
| namespace batchedGemm | ||
| { | ||
|
|
||
| namespace trtllm | ||
| { | ||
| namespace gen | ||
| { | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| // | ||
| // TMA OOB optimization constants. | ||
| // | ||
| // CUDA Programming Guide states that "globalDim must be non-zero and less than or equal to 2^32". | ||
| // In practice, the kernel acts funny with TMA shape of 2^32 so we use 2^31. | ||
| constexpr unsigned long TmaDimMax = 1UL << 31; | ||
| // Chosen so that LargeN * XLargeN * sizeof(dtype) >= 2^64 which causes overflow and effectively | ||
| // becomes 0. As sizeof(dtype) can be as small as 0.5B, we choose LargeN = 2^30 and XLargeN = 2^35 | ||
| // so overflow can happen. | ||
| constexpr unsigned long LargeN = 1UL << 30; | ||
| // Used in TMA stride. Should be less than 2^40. | ||
| constexpr unsigned long XLargeN = 1UL << 35; | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| template <typename T> | ||
| inline T ceilDiv(T m, T n) | ||
| { | ||
| return (m + n - T(1)) / n; | ||
| } | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| template <typename T> | ||
| inline T roundUp(T m, T n) | ||
| { | ||
| return ceilDiv(m, n) * n; | ||
| } | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| } // namespace gen | ||
| } // namespace trtllm | ||
|
|
||
| } // namespace batchedGemm |
136 changes: 136 additions & 0 deletions
136
cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/trtllm/gen/CudaArchDecl.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & | ||
| * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <cassert> | ||
| #include <cstring> | ||
| #include <string> | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Be careful when modifying this file as it is included by the generated kernels. For example, do | ||
| // not add TLLM_CHECK_* constructs in this file. Thanks! | ||
| // | ||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| namespace batchedGemm | ||
| { | ||
|
|
||
| namespace trtllm | ||
| { | ||
| namespace gen | ||
| { | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| enum class CudaArch | ||
| { | ||
| // Hopper | ||
| Sm90a = 0, | ||
| // Blackwell | ||
| Sm100a, | ||
| // Blackwell-family | ||
| Sm100f, | ||
| // Blackwell Ultra | ||
| Sm103a, | ||
| // SM107 | ||
| Sm107a, | ||
| }; | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| inline bool isArchHopper(CudaArch cudaArch) | ||
| { | ||
| return cudaArch == CudaArch::Sm90a; | ||
| } | ||
|
|
||
| inline bool isArchRubin(CudaArch cudaArch) | ||
| { | ||
| // Note: when compiling with a Blackwell target compatible with Rubin such as 100f, | ||
| // no Rubin-specific features shall be used. | ||
| if (cudaArch == CudaArch::Sm107a) | ||
| { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| inline bool isArchBlackwell(CudaArch cudaArch) | ||
| { | ||
| if (cudaArch == CudaArch::Sm107a) | ||
| { | ||
| return true; | ||
| } | ||
| return cudaArch == CudaArch::Sm100a || cudaArch == CudaArch::Sm100f || cudaArch == CudaArch::Sm103a; | ||
| } | ||
|
|
||
| inline bool isArchBlackwellUltra(CudaArch cudaArch) | ||
| { | ||
| return cudaArch == CudaArch::Sm103a; | ||
| } | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| inline std::string cudaArchToString(CudaArch cudaArch, bool isFull = true) | ||
| { | ||
| switch (cudaArch) | ||
| { | ||
| case CudaArch::Sm90a: return isFull ? "90a" : "90"; | ||
| case CudaArch::Sm100a: return isFull ? "100a" : "100"; | ||
| case CudaArch::Sm100f: return isFull ? "100f" : "100"; | ||
| case CudaArch::Sm103a: return isFull ? "103a" : "103"; | ||
| case CudaArch::Sm107a: return isFull ? "107a" : "107"; | ||
| default: assert(false); return ""; | ||
| } | ||
| } | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| inline CudaArch stringToCudaArch(std::string const& str) | ||
| { | ||
| if (str == "90a") | ||
| { | ||
| return CudaArch::Sm90a; | ||
| } | ||
| else if (str == "100a") | ||
| { | ||
| return CudaArch::Sm100a; | ||
| } | ||
| else if (str == "100f") | ||
| { | ||
| return CudaArch::Sm100f; | ||
| } | ||
| else if (str == "103a") | ||
| { | ||
| return CudaArch::Sm103a; | ||
| } | ||
| else if (str == "107a") | ||
| { | ||
| return CudaArch::Sm107a; | ||
| } | ||
| else | ||
| { | ||
| assert(false); | ||
| return CudaArch::Sm100a; | ||
| } | ||
| } | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| } // namespace gen | ||
| } // namespace trtllm | ||
| } // namespace batchedGemm |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.