Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
344b9e9
[None][feat] Add DeepSeek-V4 model support
heyuhhh Apr 30, 2026
085e2e1
[TRTLLM-12338][feat] Lift TOKENIZER_ALIASES to module level in llmapi…
nv-yna Apr 29, 2026
3303f1c
[None][fix] Fix fused mHC RMS normalization (#13587)
mingyangHao Apr 29, 2026
7a7935c
[None][fix] Cherry pick KV Cache Manager V2 fixes (#13597)
jiaganc Apr 29, 2026
b3f45bb
[None][fix] Remove MHC fused hidden-size guard (#13611)
mingyangHao Apr 29, 2026
eb85528
[None][feat] Enable EPLB for DeepSeek-V4 (#13595)
Barry-Delaney Apr 29, 2026
eb97997
[None][feat] tool template and parser for dsv4 (#13608)
Tracin Apr 29, 2026
d956bc8
[TRTLLM-12111][feat] Add V2 KV cache event support (#13589)
yizhang-nv Apr 30, 2026
8d2aec9
[None][fix] Fix V2 KV cache event cherry-pick regressions
heyuhhh Apr 30, 2026
096f86e
[None][feat] Fuse FP8 1x128 quantize + UE8M0 scale pack on SM100 (#13…
lishicheng1996-nv Apr 30, 2026
7a8c7c9
[None][feat] Add MLA dependency-aware overlap on DSv4 (compressor || …
lishicheng1996-nv Apr 30, 2026
7f0224b
[None][fix] Change compressor linear dtype (#13605)
mingyangHao Apr 30, 2026
e43a9c8
[None][fix] Remove duplicate V2 KV cache allocation revert
heyuhhh Apr 30, 2026
416d854
For review only
yizhang-nv Apr 30, 2026
9ceb421
[None][infra] Update CI for DS v4 (#13604)
EmmaQiaoCh Apr 30, 2026
8e8f37d
[TRTLLM-12374][fix] Tighten DSv4 cache constraint floor to match warm…
lancelly Apr 30, 2026
fa1e55e
[None][test] Add DeepSeek-V4 CI coverage (#13653)
Barry-Delaney Apr 30, 2026
d2ea57d
[TRTLLM-12383][fix] limit MHC TF32 pmap GEMM to SM100 (#13660)
mingyangHao Apr 30, 2026
29f1d29
[None][fix] Clean up V2 KV cache teardown event handling
heyuhhh Apr 30, 2026
2c5fe78
[None][feat] KV cache manager v2 + python transceiver bug fix (#12928)
chuangz0 Apr 30, 2026
d21e796
[TRTLLM-12228][fix] ADP dummy type mismatch in disagg
Shixiaowei02 Apr 26, 2026
246913f
Discard ADP dummy results in GenerationExecutorProxy
Apr 28, 2026
92e1467
[None][fix] fix disagg draft token (#13599)
chuangz0 Apr 29, 2026
95245c9
[TRTLLM-12403][fix] Fix deepseekv4 stall
chuangz0 Apr 30, 2026
de98afe
[None][test] Sync V2 disagg KV cache config
heyuhhh Apr 30, 2026
07adb42
[TRTLLM-12317][feat] Match V1 KV event hashes for V2 cache events (#1…
peihu-nv Apr 30, 2026
0a5837c
[TRTLLM-12317][test] Adapt KV cache event test
heyuhhh May 5, 2026
3f1313b
[None][chore] Apply pre-commit fixes
heyuhhh May 5, 2026
7a9b0ca
[None][fix] Plumb swiglu_limit through DeepGEMM and TRTLLMGen FP8 fus…
Barry-Delaney May 7, 2026
aa67e3e
[None][perf] Use bf16 custom router GEMM kernel for DeepSeek-V4 (#13646)
hyukn May 7, 2026
0956712
[None][perf] Optimize DeepSeek-V4 compressor BF16 input (#13761)
mingyangHao May 7, 2026
044c13c
[TRTLLM-12478][fix] Fix IMA about KVCacheManagerV2's overlap schedule…
heyuhhh May 7, 2026
e62b6c2
[None][fix] Fix fused MHC for DeepSeek-V4-Pro hidden size (#13771)
pcastonguay May 5, 2026
4a42788
[None][fix] Use compressed lengths for DeepSeek-V4 indexer (#13802)
mingyangHao May 7, 2026
a2a2e36
[None][test] Add DeepSeek-V4 dis-agg CI coverage (#13803)
Shixiaowei02 May 7, 2026
542538d
[None][fix] Avoid pre-window SWA over-allocation on disagg gen server…
Shixiaowei02 May 7, 2026
5da90ad
[None][fix] rm unrelated tests in waives.txt (#13878)
lfr-0531 May 8, 2026
189e659
[None][feat] Indexer topk opt (#13811)
pcastonguay May 8, 2026
c3ab2fe
[None][fix] Apply NUMA binding to LLM API launcher (#13848)
yizhang-nv May 8, 2026
44d8102
[None][test] Add DeepSeek-V4 dis-agg CI coverage (b200/b300) (#13874)
Shixiaowei02 May 8, 2026
6504890
[None][fix] Gate DeepSeek V4 rotate activation (#13889)
lfr-0531 May 8, 2026
c4fbc24
[None][fix] Cherry-pick PR13488 to fix ima issue (#13903)
heyuhhh May 9, 2026
7b52ec7
[None][fix] Avoid TP collective deadlock in ADP disagg error path (#1…
Shixiaowei02 May 9, 2026
e41dccb
[None][fix] Run DeepSeek V4 gate test on CUDA (#13932)
lfr-0531 May 9, 2026
8e146b1
chore: update v4 fmha cubins and libs
heyuhhh May 12, 2026
f1ebebb
fix: route token sparse fmha to cubins
heyuhhh May 12, 2026
0778c48
test: add v4 sparse mla debug coverage
heyuhhh May 12, 2026
8355a6f
Revert "[None][fix] Cherry-pick PR13488 to fix ima issue (#13903)"
heyuhhh May 12, 2026
45db905
[None][feat] Keep DSv4 o_a_proj as FP8, and port vLLM's fused_inv_rop…
lishicheng1996-nv May 10, 2026
d190a91
[None][fix] Restore overlap headroom in seq slot pool sizing (#13966)
Shixiaowei02 May 11, 2026
3b45676
[None][chore] waive TestDeepSeekV4Flash::test_auto_dtype (#14024)
tburt-nv May 12, 2026
50aa581
[None][perf] mHC fused_hc kernel optimizations + DS-V4 entry-boundary…
mingyangHao May 12, 2026
2b43894
[None][fix] Raise server_waiting_timeout to 3600s for DSv4 disagg tes…
Shixiaowei02 May 12, 2026
8eccf23
[None][test] Add DeepSeek V4 CI coverage (#13988)
lfr-0531 May 12, 2026
c417e4b
[None][fix] Resolve DeepSeek-V4 rebase validation regressions
heyuhhh May 12, 2026
c5226ec
[None][perf] Skip transceiver tp_allgather when no sessions ever open…
Shixiaowei02 May 13, 2026
d604afc
[None][test] Add dsv4 dis-agg module-level unit tests (#13936)
Shixiaowei02 May 13, 2026
13888d2
[None][feat] Support NVFP4 dsv4 (#14026)
Tracin May 13, 2026
7290c64
Fix SWA assertion regression on ctx side of _create_kv_slice
Shixiaowei02 May 13, 2026
118e7a5
Fix disagg test regressions: SWA clamp, router session, URL assertion
Tabrizian May 13, 2026
a6822ed
[None][fix] Fail loudly on asymmetric warmup batch under attention-DP…
hyukn May 14, 2026
7964767
[None][feat] Enable MEGAMOE_DEEPGEMM backend for DeepSeek V4 (#14129)
Barry-Delaney May 14, 2026
15ac239
[None][perf] DSV4 multistream improvement for attention (#14142)
liji-nv May 15, 2026
d178370
[None][fix] Support DeepSeekV4 routing in perfect-router planner (#14…
qiaoxj07 May 15, 2026
6a0548f
[https://nvbugs/6179426][test] Waive a dis-agg flaky test (#14174)
Shixiaowei02 May 15, 2026
5cf6e6a
[TRTLLM-12478][fix] Synchronize prepare inputs H2D copy (#14128)
jiaganc May 15, 2026
82ebfc7
[None][perf] DSV4 compressor: enable 4-warp Phase 3 reduction for MTP…
mingyangHao May 15, 2026
4aad70b
[None][fix] Make indexer top-K launch policy device-aware (#13886)
mingyangHao May 15, 2026
e6339b5
[None][fix] Update DeepGEMM revision (#14150)
lfr-0531 May 15, 2026
e6c2c95
[https://nvbugs/6180247][test] Waive DGX B200 disagg transceiver test…
lfr-0531 May 15, 2026
12b8105
[TRTLLM-12589][fix] Reset MoE A2A dispatch state on warmup OOM (#14000)
Barry-Delaney May 15, 2026
37c2e05
[https://nvbugs/6183549][test] Waive DeepSeek V4 Flash MEGAMOE accura…
lfr-0531 May 17, 2026
4ecb22e
[None][fix] NIXL agent transfer and shutdown race (#14137)
Shixiaowei02 May 18, 2026
7fbe349
[TRTLLM-12316][feat] Integrate FP4 indexer for DSv4 (#13575)
mikeiovine May 18, 2026
f833ad7
[None][perf] Add CUDA q_b norm for DeepSeek V4 (#13975)
mingyangHao May 18, 2026
d7d9036
[None][feat] Enable 2 DSv4 perf optimizations by default (#14120)
lishicheng1996-nv May 18, 2026
5af1511
[None][fix] Handle DeepSeek-V4 fused A scale shape (#14149)
lfr-0531 May 18, 2026
cb97c96
[None][fix] Handle None kv_cache in add_dummy_requests (#14255)
Shixiaowei02 May 19, 2026
552de9e
[None][fix] Restore DSV4 routed-expert swiglu_limit on TRTLLM-Gen (#1…
Barry-Delaney May 19, 2026
5a72fb3
[None][fix] Avoid dp_size x ep_size double-count in MegaMoEDeepGemm S…
qiaoxj07 May 19, 2026
ddd96e6
[None][fix] Return 3-tuple from check_gen_transfer_status fast path (…
qiaoxj07 May 19, 2026
c7e9e5e
[None][chore] Update flashinfer-python from 0.6.10 to 0.6.11 (#14247)
lfr-0531 May 19, 2026
bef645d
[None][feat] DSv4: enable GVR Heuristic Top-K for compress_ratio=4 (#…
longcheng-nv May 19, 2026
f4d5e59
[https://nvbugs/6179426][fix] Centralize UCX env setup for disagg uni…
Shixiaowei02 May 19, 2026
00c51c7
[None][fix] fix token_range_end add extra_kv_num_tokens (#14258)
chuangz0 May 19, 2026
f513742
[None][fix] Pass is_disagg through KvCacheCreator and harden ADP dumm…
Shixiaowei02 May 19, 2026
349f087
[None][fix] DSv4: drop duplicate indexer_k_dtype kwarg on V4 sparse a…
Tabrizian May 20, 2026
46a9471
[None][infra] Update blossom-ci allowlist: fix Mingyang, add brnguyen…
mingyangHao May 20, 2026
5d0a30e
[None][fix] Warn on experimental DeepSeek-V4 base checkpoints (#14299)
lfr-0531 May 20, 2026
9b832f4
[None][chore] Use CUDA 13 CUTLASS DSL package (#14296)
lfr-0531 May 20, 2026
14c51a4
[TRTLLM-12112][feat] Support v2 KV cache stats (#13953)
yizhang-nv May 20, 2026
325152c
[None][perf] Enable PDL for DeepGEMM and related kernels (#14311)
liji-nv May 20, 2026
53c4151
[None][fix] disagg-gen-init: pass context_current_position as history…
Tabrizian May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .github/workflows/blossom-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
"bobboli",
"Boreas618",
"brb-nv",
"brnguyen2",
"byshiue",
"CarstyYou",
"cascade812",
Expand Down Expand Up @@ -215,6 +216,7 @@ jobs:
"milesial",
"MinaHuai",
"ming-wei",
"Mingyang",
"mk-nvidia",
"mlefeb01",
"moraxu",
Expand Down Expand Up @@ -363,6 +365,7 @@ jobs:
"yingguo-trt",
"yiqingy0",
"yizhang-nv",
"yongzhiz",
"yuanjings-nvda",
"yuanjingx87",
"yuantailing",
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2726,8 +2726,8 @@ static-analysis-files: &static_analysis_files |
tests/unittest/_torch/sampler/test_beam_search_util.py |
)$

# Global exclude: vendored code + trtllm-gen FMHA artifacts (cubin pointers, export headers, cuda_ptx)
exclude: '(^triton_kernels/|trtllmGenKernels/fmha/cubin/kernelMetaInfo\.h$|cubin\.cpp$|cubin\.h$|trtllmGenKernels/fmha/trtllmGen_fmha_export/|trtllmGenKernels/fmha/cuda_ptx/)'
# Global exclude: vendored code + trtllm-gen generated artifacts (cubin pointers, export headers, cuda_ptx)
exclude: '(^triton_kernels/|trtllmGenKernels/fmha/cubin/kernelMetaInfo\.h$|trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/KernelMetaInfo\.h$|cubin\.cpp$|cubin\.h$|trtllmGenKernels/fmha/trtllmGen_fmha_export/|trtllmGenKernels/fmha/cuda_ptx/)'

default_install_hook_types: [pre-commit, commit-msg]
repos:
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/fetch_content.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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
4 changes: 2 additions & 2 deletions ATTRIBUTIONS-Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -5261,7 +5261,7 @@ For more information, please refer to <http://unlicense.org>
- `Tracker`: https://github.com/tox-dev/py-filelock/issues


## flashinfer-python (0.6.10)
## flashinfer-python (0.6.11)

### Licenses
License: `Apache-2.0`
Expand Down Expand Up @@ -33239,7 +33239,7 @@ License: `NVIDIA Proprietary Software`
- `Homepage`: https://developer.nvidia.com/cusparselt


## nvidia-cutlass-dsl (4.4.2)
## nvidia-cutlass-dsl (4.5.0)

### Licenses
License: `None`
Expand Down
11 changes: 10 additions & 1 deletion cpp/include/tensorrt_llm/batch_manager/llmRequest.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2022-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.
Expand Down Expand Up @@ -1835,6 +1835,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
68 changes: 68 additions & 0 deletions cpp/include/tensorrt_llm/executor/transferAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "tensorrt_llm/common/assert.h"
#include <fcntl.h>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
Expand Down Expand Up @@ -194,8 +195,57 @@ using RegisterDescs = MemoryDescs;
using SyncMessage = std::string;
using ConnectionInfoType = std::string;

/// Per-region VMM chunk info used for splitting descriptors at chunk boundaries.
struct VramRegionInfo
{
size_t totalLen;
size_t chunkSize; ///< 0 = cudaMalloc (no split), >0 = VMM chunk size
};

/// Region map: virtual base address → region info.
using VramRegionMap = std::map<uintptr_t, VramRegionInfo>;

/// Backend-agnostic VMM descriptor split utilities (no NIXL dependency).
struct VmmDescSplitter
{
/// @brief Look up VMM chunk info for an address from a region map.
/// @return {chunkSize, regionBase}. Returns {0, 0} if address is not in any region.
[[nodiscard]] static std::pair<size_t, uintptr_t> lookupChunkInfo(uintptr_t addr, VramRegionMap const& regionMap);

/// @brief Split VRAM descs at chunk boundaries using a pre-built region map.
/// For non-VRAM or addresses not in the map, descs pass through unchanged.
[[nodiscard]] static MemoryDescs splitDescsWithRegionMap(MemoryDescs const& descs, VramRegionMap const& regionMap);

/// @brief Split paired src/dst descs using local and remote region maps.
/// src is split by localRegionMap, dst is split by remoteRegionMap.
/// The final piece size is min(srcPiece, dstPiece, remaining).
[[nodiscard]] static std::pair<MemoryDescs, MemoryDescs> splitTransferDescsWithRegionMaps(
MemoryDescs const& srcDescs, MemoryDescs const& dstDescs, VramRegionMap const& localRegionMap,
VramRegionMap const& remoteRegionMap);

/// @brief Split VRAM descs at VMM chunk boundaries detected via cuMemGetAddressRange.
/// For cudaMalloc memory (single allocation), descs pass through unchanged.
/// @param[out] detectedChunkSize Set to the VMM chunk size if detected, 0 otherwise.
[[nodiscard]] static MemoryDescs splitVmmDescs(MemoryDescs const& descs, size_t& detectedChunkSize);

/// @brief Build a VramRegionMap by probing each VRAM descriptor with cuMemGetAddressRange.
/// For each descriptor, detects whether it spans multiple VMM chunks and records {totalLen, chunkSize}.
/// @param descs VRAM memory descriptors to probe.
/// @return Region map with per-descriptor VMM info (chunkSize=0 for cudaMalloc memory).
[[nodiscard]] static VramRegionMap detectVramRegionMap(MemoryDescs const& descs);
};

/// VMM region metadata exchanged between agents for chunk boundary calculations.
struct VramRegionMeta
{
uintptr_t baseAddr;
size_t totalLen;
size_t chunkSize; ///< 0 = cudaMalloc (no split), >0 = VMM chunk size
};

// `AgentDesc` represents the unique identifier for reading and writing to the agent.
// By accessing this identifier, the backend can establish the correct connection.
// It also carries VMM region metadata so that remote agents can split at chunk boundaries.
class AgentDesc final
{
public:
Expand All @@ -204,13 +254,31 @@ class AgentDesc final
{
}

AgentDesc(std::string backendAgentDesc, std::vector<VramRegionMeta> vramRegions)
: mBackendAgentDesc{std::move(backendAgentDesc)}
, mVramRegions{std::move(vramRegions)}
{
}

[[nodiscard]] std::string const& getBackendAgentDesc() const noexcept
{
return mBackendAgentDesc;
}

[[nodiscard]] std::vector<VramRegionMeta> const& getVramRegions() const noexcept
{
return mVramRegions;
}

/// Serialize the entire AgentDesc (backend blob + VMM regions) into an opaque string.
[[nodiscard]] std::string serialize() const;

/// Deserialize an opaque string back into an AgentDesc.
[[nodiscard]] static AgentDesc deserialize(std::string const& data);

private:
std::string mBackendAgentDesc;
std::vector<VramRegionMeta> mVramRegions;
};

// `TransferOp` is an enumeration that represents the types of transfer operations.
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
12 changes: 12 additions & 0 deletions cpp/tensorrt_llm/batch_manager/kvCacheManagerV2Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ class IndexMapper
at::Tensor getCopyIndex(
std::vector<LlmRequest::RequestIdType> const& requestIds, SizeType32 numContext, SizeType32 beamWidth);

/// Number of sequences currently tracked (i.e. active IndexMapper slots).
[[nodiscard]] SizeType32 size() const noexcept
{
return static_cast<SizeType32>(indexMap_.size());
}

/// Number of free IndexMapper slots available for new sequences.
[[nodiscard]] SizeType32 numFreeSlots() const noexcept
{
return static_cast<SizeType32>(freeIndices_.size());
}

private:
std::unordered_map<LlmRequest::RequestIdType, SizeType32> indexMap_;
std::set<SizeType32> freeIndices_;
Expand Down
10 changes: 7 additions & 3 deletions cpp/tensorrt_llm/common/attentionOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ size_t AttentionOp::getFmhaMultiCtasKvScratchSize() const noexcept
}

size_t AttentionOp::getWorkspaceSizeForContext(nvinfer1::DataType type, int32_t max_num_seq, int32_t input_seq_length,
int32_t cross_kv_length, int32_t max_num_tokens) const noexcept
int32_t cross_kv_length, int32_t max_num_tokens, int32_t total_kv_len) const noexcept
{
if (max_num_tokens == 0)
{
Expand Down Expand Up @@ -829,8 +829,12 @@ size_t AttentionOp::getWorkspaceSizeForContext(nvinfer1::DataType type, int32_t
}
else
{
fp8_k_buf_size = mChunkPrefillBufferBatchSize * max_num_tokens * static_cast<size_t>(total_k_dim_all_heads);
fp8_v_buf_size = mChunkPrefillBufferBatchSize * max_num_tokens * static_cast<size_t>(total_v_dim_all_heads);
// Use total_kv_len when available (KV cache reuse causes total_kv_len >> max_num_tokens).
// enqueueContext sizes these buffers by total_kv_len, so workspace must match.
size_t const kv_buf_tokens = std::max(
static_cast<size_t>(total_kv_len), static_cast<size_t>(mChunkPrefillBufferBatchSize) * max_num_tokens);
fp8_k_buf_size = kv_buf_tokens * static_cast<size_t>(total_k_dim_all_heads);
fp8_v_buf_size = kv_buf_tokens * static_cast<size_t>(total_v_dim_all_heads);
}
}
else if (useSageAttnSeparateQkv)
Expand Down
2 changes: 1 addition & 1 deletion cpp/tensorrt_llm/common/attentionOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AttentionOp
[[nodiscard]] int getHeadSize(bool checkInit = true) const;
[[nodiscard]] int getMaxNumSeqLenTile(int batch_beam_size = 1) const;
[[nodiscard]] size_t getWorkspaceSizeForContext(nvinfer1::DataType type, int32_t nbReq, int32_t max_input_length,
int32_t cross_kv_length = 0, int32_t max_num_tokens = 0) const noexcept;
int32_t cross_kv_length = 0, int32_t max_num_tokens = 0, int32_t total_kv_len = 0) const noexcept;
// total_num_seq is the sum of beam_width for multiple requests
[[nodiscard]] size_t getWorkspaceSizeForGeneration(nvinfer1::DataType type, int32_t total_num_seq,
int32_t max_attention_window_size, int32_t max_num_tokens, int32_t max_blocks_per_sequence) const noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ if(NIXL_ROOT)
# Link against all NIXL libraries
target_link_libraries(${NIXL_WRAPPER_TARGET} PRIVATE NIXL::nixl)

# Link against CUDA
# Link against CUDA runtime (for cudaMemcpy in posix fallback)
target_link_libraries(${NIXL_WRAPPER_TARGET} PRIVATE CUDA::cudart)
target_link_libraries(${NIXL_WRAPPER_TARGET} PRIVATE CUDA::cuda_driver)

set(NIXL_ENABLED TRUE)
else()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,21 @@ NB_MODULE(tensorrt_llm_transfer_agent_binding, m)
{
auto const& desc = self.getBackendAgentDesc();
return nb::bytes(desc.data(), desc.size());
});
})
.def("serialize",
[](kvc::AgentDesc const& self)
{
auto s = self.serialize();
return nb::bytes(s.data(), s.size());
})
.def_static(
"deserialize",
[](nb::bytes data)
{
std::string str(data.c_str(), data.size());
return kvc::AgentDesc::deserialize(str);
},
nb::arg("data"));

// TransferRequest class
//
Expand Down Expand Up @@ -200,39 +214,52 @@ NB_MODULE(tensorrt_llm_transfer_agent_binding, m)
.def_rw("backend_params", &kvc::BaseAgentConfig::backendParams);

// BaseTransferAgent class (abstract base)
// All transfer-engine operations release the GIL: they may block on NIXL /
// UCX / network / GPU memory pinning, and holding the GIL across them
// starves Python listener / progress threads in the same process.
nb::class_<kvc::BaseTransferAgent>(m, "BaseTransferAgent")
.def("register_memory", &kvc::BaseTransferAgent::registerMemory, nb::arg("descs"))
.def("deregister_memory", &kvc::BaseTransferAgent::deregisterMemory, nb::arg("descs"))
.def("register_memory", &kvc::BaseTransferAgent::registerMemory, nb::arg("descs"),
nb::call_guard<nb::gil_scoped_release>())
.def("deregister_memory", &kvc::BaseTransferAgent::deregisterMemory, nb::arg("descs"),
nb::call_guard<nb::gil_scoped_release>())
.def("load_remote_agent",
nb::overload_cast<std::string const&, kvc::AgentDesc const&>(&kvc::BaseTransferAgent::loadRemoteAgent),
nb::arg("name"), nb::arg("agent_desc"))
nb::arg("name"), nb::arg("agent_desc"), nb::call_guard<nb::gil_scoped_release>())
.def("load_remote_agent_by_connection",
nb::overload_cast<std::string const&, kvc::ConnectionInfoType const&>(
&kvc::BaseTransferAgent::loadRemoteAgent),
nb::arg("name"), nb::arg("connection_info"))
.def("get_local_agent_desc", &kvc::BaseTransferAgent::getLocalAgentDesc)
.def("invalidate_remote_agent", &kvc::BaseTransferAgent::invalidateRemoteAgent, nb::arg("name"))
nb::arg("name"), nb::arg("connection_info"), nb::call_guard<nb::gil_scoped_release>())
.def("get_local_agent_desc", &kvc::BaseTransferAgent::getLocalAgentDesc,
nb::call_guard<nb::gil_scoped_release>())
.def("invalidate_remote_agent", &kvc::BaseTransferAgent::invalidateRemoteAgent, nb::arg("name"),
nb::call_guard<nb::gil_scoped_release>())
.def(
"submit_transfer_requests",
[](kvc::BaseTransferAgent& self, kvc::TransferRequest const& request)
{ return self.submitTransferRequests(request).release(); },
nb::arg("request"), nb::rv_policy::take_ownership)
.def(
"notify_sync_message", &kvc::BaseTransferAgent::notifySyncMessage, nb::arg("name"), nb::arg("sync_message"))
.def("get_notified_sync_messages", &kvc::BaseTransferAgent::getNotifiedSyncMessages)
.def("get_local_connection_info", &kvc::BaseTransferAgent::getLocalConnectionInfo)
.def("check_remote_descs", &kvc::BaseTransferAgent::checkRemoteDescs, nb::arg("name"), nb::arg("memory_descs"));
nb::arg("request"), nb::rv_policy::take_ownership, nb::call_guard<nb::gil_scoped_release>())
.def("notify_sync_message", &kvc::BaseTransferAgent::notifySyncMessage, nb::arg("name"),
nb::arg("sync_message"), nb::call_guard<nb::gil_scoped_release>())
.def("get_notified_sync_messages", &kvc::BaseTransferAgent::getNotifiedSyncMessages,
nb::call_guard<nb::gil_scoped_release>())
.def("get_local_connection_info", &kvc::BaseTransferAgent::getLocalConnectionInfo,
nb::call_guard<nb::gil_scoped_release>())
.def("check_remote_descs", &kvc::BaseTransferAgent::checkRemoteDescs, nb::arg("name"), nb::arg("memory_descs"),
nb::call_guard<nb::gil_scoped_release>());

#ifdef ENABLE_NIXL
// NixlTransferStatus class - release GIL for blocking operations
nb::class_<kvc::NixlTransferStatus, kvc::TransferStatus>(m, "NixlTransferStatus")
.def("is_completed", &kvc::NixlTransferStatus::isCompleted, nb::call_guard<nb::gil_scoped_release>())
.def("wait", &kvc::NixlTransferStatus::wait, nb::arg("timeout_ms") = -1,
nb::call_guard<nb::gil_scoped_release>());
nb::call_guard<nb::gil_scoped_release>())
.def("get_last_status", &kvc::NixlTransferStatus::getLastStatus)
.def("get_last_status_str", &kvc::NixlTransferStatus::getLastStatusStr);

// NixlTransferAgent class
nb::class_<kvc::NixlTransferAgent, kvc::BaseTransferAgent>(m, "NixlTransferAgent")
.def(nb::init<kvc::BaseAgentConfig const&>(), nb::arg("config"))
.def(nb::init<kvc::BaseAgentConfig const&>(), nb::arg("config"), nb::call_guard<nb::gil_scoped_release>())
.def("shutdown", &kvc::NixlTransferAgent::shutdown, nb::call_guard<nb::gil_scoped_release>())
.def("register_memory", &kvc::NixlTransferAgent::registerMemory, nb::arg("descs"))
.def("deregister_memory", &kvc::NixlTransferAgent::deregisterMemory, nb::arg("descs"))
.def("load_remote_agent",
Expand Down
Loading
Loading