Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4885426
[None][feat] Add DynamicEPLB kernels and runtime integration
JintaoPengCS Oct 13, 2026
83fe1d0
[None][fix] Address per-layer dynamic EPLB review feedback
JintaoPengCS Oct 16, 2026
ac14e36
[None][fix] Accept per-layer dynamic EPLB in the serve config schemas
JintaoPengCS Oct 16, 2026
6eaf373
[None][chore] Update vendored cutedsl_megamoe to bangyus main 7832a330
JintaoPengCS Oct 18, 2026
ac92150
[None][chore] Drop the internal-GitLab MegaMoE vendor lock entries
JintaoPengCS Oct 19, 2026
5df82d8
[None][chore] Follow the cute_dsl_kernels split on main
JintaoPengCS Oct 20, 2026
61d1f64
[None][chore] Sync the in-tree cutedsl_megamoe copy to upstream f0747157
JintaoPengCS Oct 20, 2026
69d863e
[None][fix] Point the live-plane ABI contract test at moe/kernels
JintaoPengCS Oct 20, 2026
27091ce
[None][perf] Cut per-layer host overhead of MoE rebalance and MegaMoE…
JintaoPengCS Oct 20, 2026
3dcafee
[None][feat] Add ENABLE_PERFECT_ROUTER=expert_ids to bound the MoE lo…
JintaoPengCS Oct 20, 2026
71da373
[None][feat] Layer-wise benchmarks: MoE load balancer and mid-model D…
JintaoPengCS Oct 20, 2026
64db5c1
[None][perf] Fuse HALO-Q and the in-switch TMA copy into one kernel
JintaoPengCS Oct 20, 2026
47133bc
[None][perf] Keep helper experts resident across forwards in per-laye…
JintaoPengCS Oct 20, 2026
d961a9e
[None][test] Stub the raw stream switch in the fused-submit contract …
JintaoPengCS Oct 20, 2026
6cdcb21
[None][doc] Describe both helper-slot modes in the per-layer dynamic …
JintaoPengCS Oct 20, 2026
952cbe7
[None][fix] Size the perfect-router expert-id table once and warn whe…
JintaoPengCS Oct 20, 2026
8c56324
[None][fix] Layer-wise benchmarks: reject unsupported load-balancer a…
JintaoPengCS Oct 20, 2026
0d5b88f
[None][fix] Give the HALO-Q scheduler the MoE communication warmup ti…
JintaoPengCS Oct 20, 2026
6ecac4f
[None][chore] Align a copyright header and remove history narration f…
JintaoPengCS Oct 20, 2026
ce9637d
[None][chore] Describe the dynamic EPLB kernels as they stand and dro…
JintaoPengCS Oct 20, 2026
fb51c68
[None][test] Run the HALO-Q spin-bound test without a GPU
JintaoPengCS Oct 20, 2026
1cee958
[None][perf] Keep dynamic EPLB routes alive without an allocator stre…
JintaoPengCS Oct 20, 2026
17b5250
[None][perf] Check the bound EPLB reuse authority by identity per layer
JintaoPengCS Oct 20, 2026
32243eb
[None][perf] Reuse MegaMoE launch buffers and their cute views across…
JintaoPengCS Oct 20, 2026
f3b7a7c
[None][perf] Skip no-op slices, splits and casts in the fused-comm Mo…
JintaoPengCS Oct 20, 2026
7acebe1
[None][perf] Reuse autotune-opted MegaMoE runners outside tuning mode
JintaoPengCS Oct 20, 2026
025a6b9
[None][perf] Refuse new dynamic EPLB plans while launched routes are …
JintaoPengCS Oct 20, 2026
61d4bba
[None][perf] Use the fused shared-expert kernel on the whole SM100 fa…
JintaoPengCS Oct 20, 2026
3473d84
[None][perf] Keep DeepSeek-V4's shared-expert kernel independent of EPLB
JintaoPengCS Oct 20, 2026
f06b91f
[None][fix] Round the fused shared-expert block scales to UE8M0 at lo…
JintaoPengCS Oct 20, 2026
597a8c1
[None][perf] Default per-layer dynamic EPLB to four auxiliary SMs
JintaoPengCS Oct 21, 2026
13628eb
[None][chore] Remove the standalone HALO-Q kernel; keep only the fuse…
JintaoPengCS Oct 21, 2026
12b5125
[None][test] Follow main's executor API changes in the dynamic EPLB c…
JintaoPengCS Oct 23, 2026
ba359f9
[None][refactor] Move per-layer dynamic EPLB into its own package nex…
JintaoPengCS Oct 23, 2026
8a1a5a7
[None][refactor] Drive per-layer dynamic EPLB through the existing lo…
JintaoPengCS Oct 23, 2026
5790ffe
[None][refactor] Keep per-layer dynamic EPLB state out of the MegaMoE…
JintaoPengCS Oct 23, 2026
89b8264
[None][test] Follow main's engine warmup and release API in the dynam…
JintaoPengCS Oct 24, 2026
c5dd527
[None][perf] Submit per-layer dynamic EPLB with one native call per l…
JintaoPengCS Oct 25, 2026
afb616d
[None][perf] Validate shared FC12 weights once per weight set
JintaoPengCS Oct 25, 2026
3654d56
[None][fix] Raise the HALO-Q serving spin bound
JintaoPengCS Oct 26, 2026
c8f1dd2
[None][fix] Limit collective executor shutdown to per-layer dynamic EPLB
JintaoPengCS Oct 26, 2026
e197a85
[None][fix] Keep standard EPLB's finalizer shutdown and check launch …
JintaoPengCS Oct 26, 2026
7cdd82f
[None][fix] Keep MegaMoE per-expert scalar defaults when binding the …
JintaoPengCS Oct 26, 2026
9c13b9d
[None][doc] State which draft MoE layers per-layer dynamic EPLB balances
JintaoPengCS Oct 26, 2026
41fa819
[None][perf] Skip no-op hooks and repeated checks on the per-layer dy…
JintaoPengCS Oct 27, 2026
8157074
[None][perf] Let the next fused launch order COPY after the per-layer…
JintaoPengCS Oct 27, 2026
22de7c1
[None][perf] Return the launched generation from the per-layer EPLB s…
JintaoPengCS Oct 27, 2026
3719ff2
[None][perf] Reuse the lent route view and the MegaMoE tuning op name
JintaoPengCS Oct 27, 2026
c8247b8
[None][perf] Cut per-request host overhead on rank 0
JintaoPengCS Oct 27, 2026
1094f15
[None][test] Follow main's executor changes in the dynamic EPLB contr…
JintaoPengCS Oct 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ legacy-files: &legacy_files |
# list; the hook's own `files:` pattern only gates *when* the hook triggers.

# Global exclude: vendored code + trtllm-gen FMHA artifacts (cubin pointers, export headers, cuda_ptx)
exclude: '(^tensorrt_llm/_torch/attention/kernels/blackwell/kimi_k3_kda/kda_chunked_bt16(_small_bh)?\.py$|^cpp/tensorrt_llm/common/sha256/|^triton_kernels/|^tensorrt_llm/_torch/attention/backends/prims_ts/|^tensorrt_llm/_torch/visual_gen/cute_dsl_kernels/blackwell/sol_attn/|trtllmGenKernels/fmha/cubin/kernelMetaInfo\.h$|cubin\.cpp$|cubin\.h$|trtllmGenKernels/fmha/trtllmGen_fmha_export/|trtllmGenKernels/fmha/cuda_ptx/|trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/KernelMetaInfo\.h$|trtllmGenKernels/gemm/trtllmGen_gemm_export/KernelMetaInfo\.h$|\.cubin\.tar\.zst$)'
exclude: '(^tensorrt_llm/_torch/attention/kernels/blackwell/kimi_k3_kda/kda_chunked_bt16(_small_bh)?\.py$|^cpp/tensorrt_llm/common/sha256/|^triton_kernels/|^tensorrt_llm/_torch/attention/backends/prims_ts/|^tensorrt_llm/_torch/visual_gen/cute_dsl_kernels/blackwell/sol_attn/|^tensorrt_llm/_torch/moe/kernels/cutedsl_megamoe/|^tensorrt_llm/_torch/moe/kernels/megamoe_scheduler/|trtllmGenKernels/fmha/cubin/kernelMetaInfo\.h$|cubin\.cpp$|cubin\.h$|trtllmGenKernels/fmha/trtllmGen_fmha_export/|trtllmGenKernels/fmha/cuda_ptx/|trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/KernelMetaInfo\.h$|trtllmGenKernels/gemm/trtllmGen_gemm_export/KernelMetaInfo\.h$|\.cubin\.tar\.zst$)'

default_install_hook_types: [pre-commit, commit-msg]
repos:
Expand Down
5 changes: 4 additions & 1 deletion cpp/tensorrt_llm/kernels/moe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# into kernels_src, exactly as it did before the move.
add_subdirectory(cuteDsl) # cute_dsl_src
add_subdirectory(trtllmGen) # trtllm_gen_fp8_block_scale_moe{,_routing}
add_subdirectory(loadBalance/dynamicEplb) # moe_dynamic_eplb_src
# cutlass/: moe_gemm_src and its per-arch OBJECT libraries are defined in
# ../cutlass_kernels/CMakeLists.txt, next to the CUTLASS instantiation generator
# they depend on.
Expand All @@ -28,7 +29,9 @@ add_subdirectory(trtllmGen) # trtllm_gen_fp8_block_scale_moe{,_routing}
# kernels_src, so the backend directories are named here, next to the
# add_subdirectory() calls they correspond to, and nowhere else.
file(GLOB_RECURSE MOE_SRC *.cpp *.cu)
list(FILTER MOE_SRC EXCLUDE REGEX "/kernels/moe/(cutlass|trtllmGen|cuteDsl)/.*")
list(FILTER MOE_SRC EXCLUDE REGEX
"/kernels/moe/(cutlass|trtllmGen|cuteDsl|loadBalance/dynamicEplb)/.*")
list(APPEND MOE_SRC $<TARGET_OBJECTS:moe_dynamic_eplb_src>)
set(MOE_KERNELS_SRC
${MOE_SRC}
PARENT_SCOPE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# SPDX-FileCopyrightText: Copyright (c) 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.

set(DYNAMIC_EPLB_ARCHS)
foreach(ARCH 100 103 107)
if("${ARCH}" IN_LIST CMAKE_CUDA_ARCHITECTURES_ORIG)
list(APPEND DYNAMIC_EPLB_ARCHS ${ARCH})
endif()
endforeach()

set(DYNAMIC_EPLB_SOURCES)
set(DYNAMIC_EPLB_DEFINITIONS)

if(DYNAMIC_EPLB_ARCHS)
list(APPEND DYNAMIC_EPLB_SOURCES moeRebalanceHaloQ.cu)
else()
list(APPEND DYNAMIC_EPLB_SOURCES moeRebalancePlaceholder.cpp)
list(APPEND DYNAMIC_EPLB_DEFINITIONS TRTLLM_DYNAMIC_EPLB_PLACEHOLDER_HALO_Q)
message(
STATUS
"Per-layer dynamic EPLB HALO-Q disabled: none of SM100, SM103, or SM107 was requested"
)
endif()

if(DYNAMIC_EPLB_ARCHS AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL
13.1)
list(APPEND DYNAMIC_EPLB_SOURCES moeRebalanceTma.cu)
else()
list(APPEND DYNAMIC_EPLB_SOURCES moeRebalancePlaceholder.cpp)
list(APPEND DYNAMIC_EPLB_DEFINITIONS TRTLLM_DYNAMIC_EPLB_PLACEHOLDER_TMA)
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 13.1)
message(
STATUS
"Per-layer dynamic EPLB TMA disabled: CUDA 13.1 or newer is required (found ${CMAKE_CUDA_COMPILER_VERSION})"
)
else()
message(
STATUS
"Per-layer dynamic EPLB TMA disabled: none of SM100, SM103, or SM107 was requested"
)
endif()
endif()

list(REMOVE_DUPLICATES DYNAMIC_EPLB_SOURCES)
add_library(moe_dynamic_eplb_src OBJECT ${DYNAMIC_EPLB_SOURCES})

if(DYNAMIC_EPLB_ARCHS)
# These kernels use SM100-family PTX. The family target avoids inheriting the
# generic kernels_src SM80/SM90 compilation passes.
set_cuda_architectures(moe_dynamic_eplb_src 100f)
endif()

if(DYNAMIC_EPLB_DEFINITIONS)
target_compile_definitions(moe_dynamic_eplb_src
PRIVATE ${DYNAMIC_EPLB_DEFINITIONS})
endif()

set_property(TARGET moe_dynamic_eplb_src PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET moe_dynamic_eplb_src PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS
ON)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
*
* 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.
*/

#include "tensorrt_llm/common/assert.h"
#include "tensorrt_llm/kernels/moe/loadBalance/dynamicEplb/moeRebalanceHaloQ.h"
#include "tensorrt_llm/kernels/moe/loadBalance/dynamicEplb/moeRebalanceHaloQKernel.cuh"

#include <climits>

TRTLLM_NAMESPACE_BEGIN

namespace kernels
{

void checkMoeRebalanceHaloQParams(MoeRebalanceHaloQParams const& params)
{
TLLM_CHECK_WITH_INFO((params.routes != nullptr || params.validRouteCount == 0) && params.outSlots != nullptr
&& params.outIds != nullptr && params.outLevels != nullptr && params.outOwners != nullptr
&& params.peerBases != nullptr && params.status != nullptr && params.partial != nullptr
&& params.routeAux != nullptr && params.gridSync != nullptr && params.planWorkspace != nullptr
&& params.routePrefix != nullptr && params.ep >= 2 && params.ep <= kMaxEp && params.ep % 2 == 0
&& params.experts > 0 && params.experts <= kMaxExperts && params.experts % params.ep == 0
&& params.helpers > 0 && params.helpers <= INT_MAX / params.ep - params.experts / params.ep
&& params.localRank >= 0 && params.localRank < params.ep && params.validRouteCount >= 0
&& params.validRouteCount <= params.routeCapacity && params.routeCapacity > 0
&& params.routeCapacity <= INT_MAX / params.ep && params.routeCapacity <= INT_MAX - params.ctas
&& params.ctas > 0 && params.ctas <= 128 && params.threads == 512,
"Invalid HALO-Q scheduler launch parameters");
}

} // namespace kernels

TRTLLM_NAMESPACE_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
*
* 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.
*/

#ifndef TRTLLM_KERNELS_MOE_REBALANCE_HALO_Q_H
#define TRTLLM_KERNELS_MOE_REBALANCE_HALO_Q_H

#include "tensorrt_llm/common/config.h"

#include <cstdint>

TRTLLM_NAMESPACE_BEGIN

namespace kernels
{

// The HALO-Q scheduler phase of the fused scheduler + in-switch copy kernel
// (megamoe_tma_copy_submit_fused).
struct MoeRebalanceHaloQParams
{
int const* routes;
int* outSlots;
int* outIds;
int* outLevels;
int* outOwners;
std::uint64_t const* peerBases;
int* status;
int* partial;
int* routeAux;
int* gridSync;
int* planWorkspace;
int* routePrefix;
int ep;
int experts;
int helpers;
int localRank;
int routeCapacity;
int ctas;
int threads;
std::uint64_t spinCycles;
int validRouteCount;
};

// Throws unless params describe a valid scheduler launch.
void checkMoeRebalanceHaloQParams(MoeRebalanceHaloQParams const& params);

} // namespace kernels

TRTLLM_NAMESPACE_END

#endif // TRTLLM_KERNELS_MOE_REBALANCE_HALO_Q_H
Loading
Loading