Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5859760
[None][feat] Add DeepSeek-V4 model support
heyuhhh Apr 30, 2026
60ccd52
[TRTLLM-12338][feat] Lift TOKENIZER_ALIASES to module level in llmapi…
nv-yna Apr 29, 2026
fe2f384
[None][fix] Fix fused mHC RMS normalization (#13587)
mingyangHao Apr 29, 2026
4d76cce
[None][fix] Cherry pick KV Cache Manager V2 fixes (#13597)
jiaganc Apr 29, 2026
ab27f49
[None][fix] Remove MHC fused hidden-size guard (#13611)
mingyangHao Apr 29, 2026
2991309
[None][feat] Enable EPLB for DeepSeek-V4 (#13595)
Barry-Delaney Apr 29, 2026
0f0afd3
[None][feat] tool template and parser for dsv4 (#13608)
Tracin Apr 29, 2026
7e763a6
[TRTLLM-12111][feat] Add V2 KV cache event support (#13589)
yizhang-nv May 21, 2026
7f4c270
[None][feat] Fuse FP8 1x128 quantize + UE8M0 scale pack on SM100 (#13…
lishicheng1996-nv Apr 30, 2026
47f46c5
[None][feat] Add MLA dependency-aware overlap on DSv4 (compressor || …
lishicheng1996-nv Apr 30, 2026
eb63812
[None][fix] Change compressor linear dtype (#13605)
mingyangHao Apr 30, 2026
a8cd76c
[None][fix] Remove duplicate V2 KV cache allocation revert
heyuhhh Apr 30, 2026
8ff8e42
[None][infra] Update CI for DS v4 (#13604)
EmmaQiaoCh Apr 30, 2026
6151697
[TRTLLM-12374][fix] Tighten DSv4 cache constraint floor to match warm…
lancelly Apr 30, 2026
e9ecf1c
[None][test] Add DeepSeek-V4 CI coverage (#13653)
Barry-Delaney Apr 30, 2026
c5b467e
[TRTLLM-12383][fix] limit MHC TF32 pmap GEMM to SM100 (#13660)
mingyangHao Apr 30, 2026
2294024
[None][chore] Apply pre-commit fixes
heyuhhh May 5, 2026
d7beb0b
[None][fix] Plumb swiglu_limit through DeepGEMM and TRTLLMGen FP8 fus…
Barry-Delaney May 7, 2026
f450e16
[None][perf] Use bf16 custom router GEMM kernel for DeepSeek-V4 (#13646)
hyukn May 7, 2026
921f994
[None][perf] Optimize DeepSeek-V4 compressor BF16 input (#13761)
mingyangHao May 7, 2026
f7d4c5f
[TRTLLM-12478][fix] Fix IMA about KVCacheManagerV2's overlap schedule…
heyuhhh May 7, 2026
d1c27f5
[None][fix] Fix fused MHC for DeepSeek-V4-Pro hidden size (#13771)
pcastonguay May 5, 2026
e3ad8e3
[None][fix] Use compressed lengths for DeepSeek-V4 indexer (#13802)
mingyangHao May 7, 2026
a41359a
[None][feat] Indexer topk opt (#13811)
pcastonguay May 8, 2026
20f674c
[None][fix] Gate DeepSeek V4 rotate activation (#13889)
lfr-0531 May 8, 2026
9062069
[None][fix] Run DeepSeek V4 gate test on CUDA (#13932)
lfr-0531 May 9, 2026
455cbab
fix: route token sparse fmha to cubins
heyuhhh May 12, 2026
47bb2cf
test: add v4 sparse mla debug coverage
heyuhhh May 12, 2026
ee3d083
[None][feat] Keep DSv4 o_a_proj as FP8, and port vLLM's fused_inv_rop…
lishicheng1996-nv May 10, 2026
0b9a8f3
[None][fix] Restore overlap headroom in seq slot pool sizing (#13966)
Shixiaowei02 May 11, 2026
b11044e
[None][perf] mHC fused_hc kernel optimizations + DS-V4 entry-boundary…
mingyangHao May 12, 2026
7fd9914
[None][test] Add DeepSeek V4 CI coverage (#13988)
lfr-0531 May 12, 2026
8faaeb4
[None][feat] Support NVFP4 dsv4 (#14026)
Tracin May 13, 2026
b6484bf
[None][feat] Enable MEGAMOE_DEEPGEMM backend for DeepSeek V4 (#14129)
Barry-Delaney May 14, 2026
6b79771
[None][perf] DSV4 multistream improvement for attention (#14142)
liji-nv May 15, 2026
be77c7d
[None][fix] Support DeepSeekV4 routing in perfect-router planner (#14…
qiaoxj07 May 15, 2026
2f76aa2
[TRTLLM-12478][fix] Synchronize prepare inputs H2D copy (#14128)
jiaganc May 15, 2026
22bd174
[None][perf] DSV4 compressor: enable 4-warp Phase 3 reduction for MTP…
mingyangHao May 15, 2026
f402797
[None][fix] Make indexer top-K launch policy device-aware (#13886)
mingyangHao May 15, 2026
04d4a76
[None][fix] Update DeepGEMM revision (#14150)
lfr-0531 May 15, 2026
ad0f153
[TRTLLM-12589][fix] Reset MoE A2A dispatch state on warmup OOM (#14000)
Barry-Delaney May 15, 2026
9b16ec9
[TRTLLM-12316][feat] Integrate FP4 indexer for DSv4 (#13575)
mikeiovine May 18, 2026
bbb0271
[None][perf] Add CUDA q_b norm for DeepSeek V4 (#13975)
mingyangHao May 18, 2026
6991c02
[None][feat] Enable 2 DSv4 perf optimizations by default (#14120)
lishicheng1996-nv May 18, 2026
ab8ad21
[None][fix] Handle DeepSeek-V4 fused A scale shape (#14149)
lfr-0531 May 18, 2026
d93363d
[None][fix] Restore DSV4 routed-expert swiglu_limit on TRTLLM-Gen (#1…
Barry-Delaney May 19, 2026
bfac884
[None][fix] Avoid dp_size x ep_size double-count in MegaMoEDeepGemm S…
qiaoxj07 May 19, 2026
82cc159
[None][feat] DSv4: enable GVR Heuristic Top-K for compress_ratio=4 (#…
longcheng-nv May 19, 2026
ecb7fdb
[None][fix] DSv4: drop duplicate indexer_k_dtype kwarg on V4 sparse a…
Tabrizian May 20, 2026
dd9865e
[None][fix] Warn on experimental DeepSeek-V4 base checkpoints (#14299)
lfr-0531 May 20, 2026
141a5e7
[TRTLLM-12112][feat] Support v2 KV cache stats (#13953)
yizhang-nv May 21, 2026
5ddc357
[None][perf] Enable PDL for DeepGEMM and related kernels (#14311)
liji-nv May 20, 2026
305e467
[TRTLLM-12732][fix] Fence V2 `_batched_migrate` behind `execution_str…
Barry-Delaney May 20, 2026
ab1023c
[None][chore] cap RoPE cos/sin table to runtime max_seq_len (#14241)
lancelly May 21, 2026
2f02674
[None][fix] DSv4 indexer: stable radix aux scratch for CUDA Graph saf…
longcheng-nv May 21, 2026
3a5591f
[None][fix] Resolve DSv4 rebase fallout
lfr-0531 May 21, 2026
d822d1d
[None][fix] Resolve DSv4 CI 43359 failures
lfr-0531 Jun 16, 2026
948ee55
[None][fix] Stabilize MegaMoE MPI bootstrap
lfr-0531 Jun 17, 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 3rdparty/fetch_content.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{
"name": "deepgemm",
"git_repository": "https://github.com/deepseek-ai/DeepGEMM",
"git_tag": "c491439ed5966833d56883ca302b6f72e74f8105",
"git_tag": "67fc64863d43521080bf2005e6528d0fceee9510",
"git_submodules_recurse": true,
"source_subdir": "dont-add-this-project-with-add-subdirectory"
},
Expand Down
9 changes: 9 additions & 0 deletions cpp/include/tensorrt_llm/batch_manager/llmRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,15 @@ class GenericLlmRequest
return mPerfMetrics.kvCacheMetrics.numNewAllocatedBlocks;
}

void updateKvCachePerfMetrics(
SizeType32 allocTotalBlocks, SizeType32 allocNewBlocks, SizeType32 reusedBlocks, SizeType32 missedBlocks)
{
updateAllocTotalBlocksPerRequest(allocTotalBlocks);
updateAllocNewBlocksPerRequest(allocNewBlocks);
updateReusedBlocksPerRequest(reusedBlocks);
updateMissedBlocksPerRequest(missedBlocks);
}

void updateReusedBlocksPerRequest(SizeType32 reusedBlocksPerRequest)
{
mPerfMetrics.kvCacheMetrics.numReusedBlocks += reusedBlocksPerRequest;
Expand Down
2 changes: 2 additions & 0 deletions cpp/tensorrt_llm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ set(TRTLLM_LINK_LIBS
layers_src
runtime_src
testing_src
mhcKernels_src
compressorKernels_src
userbuffers_src
${DECODER_SHARED_TARGET_0}
${DECODER_SHARED_TARGET_1})
Expand Down
6 changes: 6 additions & 0 deletions cpp/tensorrt_llm/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ add_subdirectory(dsv3MinLatencyKernels)
add_subdirectory(causalConv1d)
add_subdirectory(fusedGatedRMSNormQuant)
add_subdirectory(mamba2MTPSSMCache)
add_subdirectory(mhcKernels)
add_subdirectory(compressorKernels)

file(GLOB_RECURSE SRC_CPP *.cpp)
file(GLOB_RECURSE SRC_CU *.cu)
Expand All @@ -55,6 +57,10 @@ list(FILTER SRC_CU EXCLUDE REGEX "userbuffers/.*")
list(FILTER SRC_CU EXCLUDE REGEX "fusedLayernormKernels/.*")
list(FILTER SRC_CU EXCLUDE REGEX "fusedGatedRMSNormQuant/.*")
list(FILTER SRC_CU EXCLUDE REGEX "mamba2MTPSSMCache/.*")
list(FILTER SRC_CPP EXCLUDE REGEX "mhcKernels/.*")
list(FILTER SRC_CU EXCLUDE REGEX "mhcKernels/.*")
list(FILTER SRC_CPP EXCLUDE REGEX "compressorKernels/.*")
list(FILTER SRC_CU EXCLUDE REGEX "compressorKernels/.*")

if(NOT ENABLE_MULTI_DEVICE)
list(FILTER SRC_CU EXCLUDE REGEX "customAllReduceKernels*.*cu$")
Expand Down
70 changes: 43 additions & 27 deletions cpp/tensorrt_llm/kernels/IndexerTopK.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,63 @@ TRTLLM_NAMESPACE_BEGIN

namespace kernels
{
/// Indexer TopK decode. Three tiers:
/// - GVR Heuristic (preIdx provided, K in {512,1024,2048}, numColumns in
/// [kSeqSmall, splitWorkThreshold), numRows below the
/// architecture-derived wave/L2 bound).
/// - Single-block (numColumns < split-work threshold)
/// - Multi-pass radix (numColumns >= split-work threshold; requires
/// `scratch` sized via indexerTopKDecodeScratchBytes,
/// zero-init on first call and may be reused).
///
/// `is_prefill = true` forces single-block (split-work suppressed).
void invokeIndexerTopKDecode(float const* logits, int const* seqLens, int* indices, int const splitWorkThreshold,
int const numRows, int const numColumns, int const stride0, int const stride1, int const next_n,
int const topK = 2048, int const* preIdx = nullptr, int const preIdxStride = 0, int const preIdxCount = 0,
float* heuristicScratch = nullptr, cudaStream_t const stream = 0, void* scratch = nullptr, size_t scratchBytes = 0,
bool is_prefill = false);
// Number of blocks-per-row used by the multi-block split + merge dispatch path of
// invokeIndexerTopKDecode. Returns 1 when the single-block path is preferred.
// Callers that allocate aux buffers must use this same helper to size them, and
// must pass the same splitWorkThreshold they will pass to invokeIndexerTopKDecode
// (a value <= 0 selects the internal default).
int computeIndexerTopKDecodeBlocksPerRow(int numRows, int numColumns, int splitWorkThreshold = 0);

/// Size of the multi-pass radix `scratch` buffer for these shapes.
size_t indexerTopKDecodeScratchBytes(int numRows, int numColumns, int topK);
/// fp32 indexer TopK decode — L2-aware BS-threshold dispatcher with four
/// fallback tiers:
/// - GVR Heuristic (preIdx provided, kSeqSmall ≤ N < splitWork, BS < kBsLarge, K ∈ {512,1024,2048})
/// - Insertion sort (N < kSortingAlgorithmThreshold)
/// - Radix sort (kSortingAlgorithmThreshold ≤ N < splitWork)
/// - Radix split-work (N ≥ splitWork — uses outLogitsAux / outIndicesAux)
void invokeIndexerTopKDecode(float const* logits, int const* seqLens, int* indices, float* outLogitsAux,
int* outIndicesAux, int const splitWorkThreshold, int const numRows, int const numColumns, int const stride0,
int const stride1, int const next_n, int const topK = 2048, int const* preIdx = nullptr, int const preIdxStride = 0,
int const preIdxCount = 0, float* heuristicScratch = nullptr, int const compressRatio = 1,
cudaStream_t const stream = 0);

/// bf16 overload; same contract.
/// bf16 indexer TopK decode — same dispatch axes as the fp32 entry, except
/// kBsL2 uses sizeof(__nv_bfloat16) bytes/elem (L2 footprint is half) and
/// the split-work tier is unsupported (the bf16/fp16 entry does not expose
/// the float aux buffers required for split-work). Insertion + radix tiers
/// share topKPerRowDecode with fp32 — histogram and sort run on float keys
/// after a static_cast<float>(InputT) at HBM-read sites.
///
/// Aborts with TLLM_CHECK if numColumns ≥ splitWorkThreshold; callers in
/// that regime must use the fp32 entry.
void invokeIndexerTopKDecode(__nv_bfloat16 const* logits, int const* seqLens, int* indices,
int const splitWorkThreshold, int const numRows, int const numColumns, int const stride0, int const stride1,
int const next_n, int const topK = 2048, int const* preIdx = nullptr, int const preIdxStride = 0,
int const preIdxCount = 0, __nv_bfloat16* heuristicScratch = nullptr, cudaStream_t const stream = 0,
void* scratch = nullptr, size_t scratchBytes = 0, bool is_prefill = false);
int const preIdxCount = 0, __nv_bfloat16* heuristicScratch = nullptr, int const compressRatio = 1,
cudaStream_t const stream = 0);

/// fp16 overload; same contract.
/// fp16 indexer TopK decode — see bf16 overload for dispatcher contract.
void invokeIndexerTopKDecode(__half const* logits, int const* seqLens, int* indices, int const splitWorkThreshold,
int const numRows, int const numColumns, int const stride0, int const stride1, int const next_n,
int const topK = 2048, int const* preIdx = nullptr, int const preIdxStride = 0, int const preIdxCount = 0,
__half* heuristicScratch = nullptr, cudaStream_t const stream = 0, void* scratch = nullptr, size_t scratchBytes = 0,
bool is_prefill = false);
__half* heuristicScratch = nullptr, int const compressRatio = 1, cudaStream_t const stream = 0);

void invokeIndexerTopKPrefill(float const* logits, int const* rowStarts, int const* rowEnds, int* indices,
int const numRows, int const numColumns, int const stride0, int const stride1, int const topK = 2048,
cudaStream_t const stream = 0);

/// True iff invokeIndexerTopKDecode would pick the GVR tier for this shape:
/// K in {512,1024,2048}, numColumns in [kSeqSmall, splitWorkThreshold), and
/// numRows below the architecture-derived wave/L2 bound. Lets callers
/// provision preIdx / heuristicScratch only when needed.
/// Returns true iff invokeIndexerTopKDecode would route to the GVR Heuristic
/// kernel for this (numRows, numColumns, topK) triple, assuming valid preIdx
/// is provided and stride1 == 1. Useful for callers that need to provision a
/// preIdx tensor or heuristicScratch buffer only when GVR will be selected.
///
/// Mirrors the gating logic of the dispatcher: K ∈ {512, 1024, 2048},
/// numColumns ∈ [kSeqSmall, splitWorkThreshold), numRows < kBsLarge, where
/// kBsLarge = min(kBsWave, kBsL2) and kBsL2 scales with bytesPerElem.
///
/// @param numRows logits rows (batch · next_n)
/// @param numColumns logits columns (max sequence length)
/// @param topK requested output size
/// @param bytesPerElem element size of logits (4 for fp32, 2 for bf16/fp16)
bool canIndexerTopKDecodeUseGvr(int numRows, int numColumns, int topK, int bytesPerElem = 4);

} // namespace kernels
Expand Down
25 changes: 25 additions & 0 deletions cpp/tensorrt_llm/kernels/compressorKernels/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2024 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(SRC_CU compressorKernels.cu)

add_library(compressorKernels_src OBJECT ${SRC_CU})
set_property(TARGET compressorKernels_src PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET compressorKernels_src PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS
ON)
target_compile_options(compressorKernels_src
PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--use_fast_math>)
Loading