Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
397bb90
encoder-decoder models migration plan
cascade812 Apr 21, 2026
eda8b71
fix verify error
cascade812 Apr 21, 2026
6787ffd
update
cascade812 Apr 22, 2026
66ce32f
update
cascade812 Apr 22, 2026
854b17f
update
cascade812 Apr 22, 2026
4887555
add config is_encoder_decoder
cascade812 Apr 23, 2026
b0bc711
update design doc and model definitions
cascade812 Apr 23, 2026
b7bbec8
weight loading
cascade812 Apr 24, 2026
24cbaac
precision conversion
cascade812 Apr 24, 2026
4f0c048
update design doc
cascade812 Apr 24, 2026
1ca5227
dual-pool construction
cascade812 Apr 24, 2026
9deff75
trtllm attention backend on blackwell
cascade812 Apr 25, 2026
44d213c
pre-blackwell attention
cascade812 Apr 27, 2026
9fde06c
v1 cache support
cascade812 Apr 27, 2026
4d03a6b
request admission an schedule
cascade812 Apr 30, 2026
9687059
request plumb and test t5-small
cascade812 May 4, 2026
aab4514
fix beam search and batch size > 1
cascade812 May 7, 2026
485754c
clean up unnecessary comment
cascade812 May 7, 2026
b88d0a6
address rebase issues
cascade812 May 12, 2026
7311ad7
delete md
cascade812 May 12, 2026
a7b29d2
update user interface
cascade812 May 14, 2026
5498912
fix pre-commit
cascade812 May 14, 2026
ac25b43
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 May 14, 2026
9b13f07
revert api change
cascade812 May 14, 2026
7a035bf
Merge remote-tracking branch 'origin' into guiju/en_de3
cascade812 May 15, 2026
e741c6f
address comment
cascade812 May 15, 2026
102d009
test: update encoder metadata fixture
cascade812 May 16, 2026
4054f84
rename
cascade812 May 16, 2026
12cb0cd
address comment
cascade812 May 20, 2026
d33c256
address comments
cascade812 May 20, 2026
69c1d06
Merge remote-tracking branch 'origin' into guiju/en_de3
cascade812 May 20, 2026
61448ba
fix tests
cascade812 May 20, 2026
721cf19
pre-commit
cascade812 May 20, 2026
95476b9
address comments
cascade812 Jun 4, 2026
a497282
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 Jun 4, 2026
56fe82c
add bart test
cascade812 Jun 5, 2026
127708f
address comment
cascade812 Jun 5, 2026
c61712e
address ci error
cascade812 Jun 7, 2026
997f277
add pytest node id
cascade812 Jun 8, 2026
649586d
remove non-exist pytest node IDs
cascade812 Jun 8, 2026
1483064
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 Jun 8, 2026
f1fd611
fix ci error
cascade812 Jun 9, 2026
2641898
merge main and resolve conflicts
cascade812 Jun 9, 2026
d3d176c
Merge branch 'main' into guiju/en_de3
cascade812 Jun 10, 2026
cbe3834
[TRTLLM-12339][chore] Early-dispatch cross-KV path in KVCacheManager
eopXD Jun 11, 2026
c229881
Merge pull request #1 from eopXD/eopxd/kvcm-cross-early-dispatch
cascade812 Jun 11, 2026
f38033e
address comments
cascade812 Jun 11, 2026
5c16050
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 Jun 11, 2026
7c2d137
Merge branch 'main' into guiju/en_de3
cascade812 Jun 11, 2026
82f829f
add b200 test
cascade812 Jun 12, 2026
8953df8
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 Jun 12, 2026
e75a9ab
address merge error
cascade812 Jun 13, 2026
3601a96
Merge remote-tracking branch 'origin/main' into guiju/en_de3
cascade812 Jun 13, 2026
d44cf91
Merge branch 'main' into guiju/en_de3
cascade812 Jun 13, 2026
8eeb2f5
fix merge error
cascade812 Jun 14, 2026
dd6adc9
Merge branch 'main' into guiju/en_de3
cascade812 Jun 15, 2026
8edb703
Merge remote-tracking branch 'origin' into guiju/en_de3
cascade812 Jun 16, 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
23 changes: 18 additions & 5 deletions cpp/include/tensorrt_llm/batch_manager/capacityScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ class MaxRequestsScheduler : public BaseCapacityScheduler

/// @brief Schedule requests using the MAX_UTILIZATION policy
/// @details Try reserving resources to advance requests by one step,
/// may pause previously started requests.
/// may pause previously started requests. When a
/// ``crossKvCacheManager`` is supplied, requests in the
/// ``ENCODER_INIT`` state may be admitted for encoder compute
/// without consuming self- or cross-KV blocks; the later
/// ``CONTEXT_INIT`` decoder admission owns cross-pool budgeting.
class MaxUtilizationScheduler : public BaseCapacityScheduler
{
public:
Expand All @@ -96,8 +100,9 @@ class MaxUtilizationScheduler : public BaseCapacityScheduler
LlmRequestState noScheduleAfterState = LlmRequestState::kGENERATION_COMPLETE);

[[nodiscard]] std::tuple<RequestVector, RequestVector> operator()(
kv_cache_manager::BaseKVCacheManager& kvCacheManager, OptionalRef<BasePeftCacheManager const> peftCacheManager,
RequestList const& activeRequests) const;
kv_cache_manager::BaseKVCacheManager& kvCacheManager,
OptionalRef<kv_cache_manager::BaseKVCacheManager> crossKvCacheManager,
OptionalRef<BasePeftCacheManager const> peftCacheManager, RequestList const& activeRequests) const;

private:
SizeType32 mMaxNumRequests;
Expand All @@ -106,6 +111,10 @@ class MaxUtilizationScheduler : public BaseCapacityScheduler
};

/// @brief Schedule requests using the GUARANTEED_NO_EVICT policy
/// @details When a ``crossKvCacheManager`` is supplied, requests in the
/// ``ENCODER_INIT`` state may be admitted for encoder compute
/// without consuming self- or cross-KV blocks. The later
/// ``CONTEXT_INIT`` decoder admission owns cross-pool budgeting.
class GuaranteedNoEvictScheduler : public BaseCapacityScheduler
{
public:
Expand Down Expand Up @@ -158,7 +167,11 @@ class CapacityScheduler : public Algorithm
*
* @param kvCacheManager Required in MaxUtilizationScheduler (as a ref) and in GuaranteedNoEvictScheduler and
* StaticBatchScheduler (as a const ref).
* @param crossKvCacheManager Optional used in GuaranteedNoEvictScheduler and StaticBatchScheduler.
* @param crossKvCacheManager Optional cross-attention KV cache manager. Used by
* MaxUtilizationScheduler (mutates: ``startScheduling`` / ``schedulingRemoveSequence``)
* and GuaranteedNoEvictScheduler / StaticBatchScheduler (read-only). Required for
* encoder-decoder admission. Encoder-init requests only require this pool
* to be configured; decoder context admission budgets blocks from it.
* @param peftCacheManager Optional used in MaxUtilizationScheduler, GuaranteedNoEvictScheduler and
* StaticBatchScheduler.
* @param activeRequests
Expand All @@ -168,7 +181,7 @@ class CapacityScheduler : public Algorithm
[[nodiscard]] std::tuple<RequestVector, RequestVector, RequestVector> operator()(RequestList const& activeRequests,
OptionalRef<kv_cache_manager::BaseKVCacheManager> kvCacheManager = std::nullopt,
OptionalRef<BasePeftCacheManager const> peftCacheManager = std::nullopt,
OptionalRef<kv_cache_manager::BaseKVCacheManager const> crossKvCacheManager = std::nullopt) const;
OptionalRef<kv_cache_manager::BaseKVCacheManager> crossKvCacheManager = std::nullopt) const;

/// @brief Sets the reorder policy to use AgentTreePolicy with the given configuration.
/// @param agentPercentage The ratio of agent requests to schedule (0.0-1.0, -1.0 for random).
Expand Down
40 changes: 33 additions & 7 deletions cpp/include/tensorrt_llm/batch_manager/llmRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,9 @@ class GenericLlmRequest
return mEncoderUniqueTokens;
}

/// @brief Get length of encoder input (could be tokens or features length)
/// @return An integer.
[[nodiscard]] SizeType32 getEncoderInputLen() const
/// @brief Get length of encoder input when present, without throwing for decoder-only requests.
/// @return Encoder input length, or nullopt when this request has no encoder side.
[[nodiscard]] std::optional<SizeType32> tryGetEncoderInputLen() const
{
if (mEncoderInputFeatures.has_value())
{
Expand All @@ -678,19 +678,45 @@ class GenericLlmRequest
return getEncoderTokens().value()->size();
}

TLLM_THROW("GenericLlmRequest::getEncoderInputLen - Do not have encoder length!");
return std::nullopt;
}

/// @brief Get length of encoder output. Fall back to encoder input length if not present
/// @brief Get length of encoder input (could be tokens or features length)
/// @return An integer.
[[nodiscard]] SizeType32 getEncoderOutputLen() const
[[nodiscard]] SizeType32 getEncoderInputLen() const
{
auto const encoderInputLen = tryGetEncoderInputLen();
if (encoderInputLen.has_value())
{
return encoderInputLen.value();
}

TLLM_THROW("GenericLlmRequest::getEncoderInputLen - Do not have encoder length!");
}

/// @brief Get length of encoder output when present, without throwing for decoder-only requests.
/// @return Encoder output length, or nullopt when this request has no encoder side.
[[nodiscard]] std::optional<SizeType32> tryGetEncoderOutputLen() const
{
if (mEncoderOutputLength.has_value())
{
return mEncoderOutputLength.value();
}

return getEncoderInputLen();
return tryGetEncoderInputLen();
}

/// @brief Get length of encoder output, or throw if the request has no encoder side.
/// @return Explicit encoder output length, or encoder input length when the output length is not present.
[[nodiscard]] SizeType32 getEncoderOutputLen() const
{
auto const encoderOutputLen = tryGetEncoderOutputLen();
if (encoderOutputLen.has_value())
{
return encoderOutputLen.value();
}

TLLM_THROW("GenericLlmRequest::getEncoderInputLen - Do not have encoder length!");
}

[[nodiscard]] std::optional<std::shared_ptr<std::vector<SizeType32>>> getPositionIds() const
Expand Down
7 changes: 7 additions & 0 deletions cpp/include/tensorrt_llm/common/optionalRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ class OptionalRef
{
}

// Implicit conversion from OptionalRef<non-const T> to OptionalRef<const T>
template <typename U = T, typename = std::enable_if_t<std::is_const_v<U>>>
OptionalRef(OptionalRef<std::remove_const_t<T>> const& other)
: opt(other ? std::optional<std::reference_wrapper<T>>(std::ref(*other)) : std::nullopt)
{
}

T* operator->() const
{
return opt ? &(opt->get()) : nullptr;
Expand Down
Loading
Loading