Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6bfdba1
[None][feat] Locality domain two-stream attention and runtime wiring
farazkh80 Oct 12, 2026
fd9e424
[None][feat] Locality domain plumbing in the C++ KV cache manager v2
farazkh80 Oct 12, 2026
9f3bb61
[None][feat] Per-locality-domain KV cache storage in the C++ KV cache…
farazkh80 Oct 12, 2026
ae7ccc7
[None][feat] Locality-domain-aware allocation, eviction, migration an…
farazkh80 Oct 12, 2026
ff95a1c
[None][test] Cover locality domains in the C++ KV cache manager v2
farazkh80 Oct 12, 2026
122d4dd
[None][fix] Register only mapped KV pool ranges for disaggregated tra…
farazkh80 Oct 12, 2026
4c73114
[None][fix] Size localized KV pools per domain and pin the creation c…
farazkh80 Oct 12, 2026
b51b1ca
[None][fix] Take the per-domain KV quota share from the raw quota on …
farazkh80 Oct 13, 2026
fc7bddd
[None][fix] Keep the locality domain when a Page rebuilds its Slot
farazkh80 Oct 13, 2026
6873343
[None][fix] Tolerate impl-less KVCacheManagerV2 stand-ins in num_loca…
farazkh80 Oct 13, 2026
b4401c4
[None][fix] Resize, utilization and quota accounting per locality dom…
farazkh80 Oct 15, 2026
5108f51
[None][fix] Honor the locality domain opt-out and keep partitioned at…
farazkh80 Oct 15, 2026
e17ce5a
[None][fix] Carry the request's locality domain through every KV cach…
farazkh80 Oct 15, 2026
2048194
[None][fix] Address review findings on locality domain eviction and p…
farazkh80 Oct 16, 2026
690598f
[None][fix] Order HostInputs fields, split unsorted context rows by p…
farazkh80 Oct 19, 2026
d929a33
[None][test] Use string cache salts in the locality domain scope tests
farazkh80 Oct 20, 2026
5463416
[None][fix] Order-check domain splits, clear per-domain tree masks, s…
farazkh80 Oct 20, 2026
e0163c2
[None][chore] Apply clang-format and ruff-format after the string-sal…
farazkh80 Oct 20, 2026
093fdb2
[None][fix] Keep the single-longest warmup seam and the CPU test fake…
farazkh80 Oct 21, 2026
cdf1cb7
[None][test] Match the typed-index signature asserts and the fetch st…
farazkh80 Oct 22, 2026
0b62157
[None][fix] Reject sparse attention at KV cache manager creation when…
farazkh80 Oct 22, 2026
8d70c27
[None][perf] Build per-domain MLA decode state with one counter alloc…
farazkh80 Oct 22, 2026
ab81d1c
[None][test] Check that decode attention with locality domains matche…
farazkh80 Oct 22, 2026
f0e4db0
[None][perf] Size the MLA decode kernel's KV split for the SMs of its…
farazkh80 Oct 22, 2026
09c3803
[None][fix] Keep host-token generation rows first when grouping them …
farazkh80 Oct 23, 2026
82c15f5
[None][fix] Place new requests on locality domains round-robin instea…
farazkh80 Oct 23, 2026
1abfb3f
[None][test] Record the prefetch scope in the locality wrapper test a…
farazkh80 Oct 23, 2026
813f27e
[None][chore] Type locality domain ids, move the free-slot query to i…
farazkh80 Oct 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(KV_CACHE_MANAGER_V2_SRCS
kv_cache_manager_v2/utils/staticHostMem.cpp
kv_cache_manager_v2/utils/poison.cpp
kv_cache_manager_v2/cudaVirtMem.cpp
kv_cache_manager_v2/localityDomain.cpp
kv_cache_manager_v2/storage/config.cpp
kv_cache_manager_v2/storage/core.cpp
kv_cache_manager_v2/evictionController.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ static void emitReuseScopeBytes(ReuseScope const& scope, Emit&& emit)
{
mask |= 1U << 1;
}
if (scope.localityDomainId.has_value())
{
mask |= 1U << 2;
}
emit(&mask, sizeof(mask));
if (scope.loraId.has_value())
{
Expand All @@ -74,6 +78,11 @@ static void emitReuseScopeBytes(ReuseScope const& scope, Emit&& emit)
emit(reinterpret_cast<uint8_t const*>(&length), sizeof(length));
emit(reinterpret_cast<uint8_t const*>(scope.salt->data()), scope.salt->size());
}
if (scope.localityDomainId.has_value())
{
std::uint64_t const value = static_cast<std::uint64_t>(scope.localityDomainId->value());
emit(reinterpret_cast<uint8_t const*>(&value), sizeof(value));
}
}

// ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ struct Block;

// ---------------------------------------------------------------------------
// ReuseScope — per-request namespace for prefix reuse.
// Mirrors Python's ReuseScope(lora_id, salt).
// Mirrors Python's ReuseScope(lora_id, salt, locality_domain_id).
// ---------------------------------------------------------------------------
struct ReuseScope
{
std::optional<LoraTaskIdType> loraId;
std::optional<std::string> salt;
// The locality domain is part of the reuse key: pages are backed by one domain's memory,
// so prefixes are only shared between requests on the same domain.
std::optional<LocalityDomainId> localityDomainId;

bool operator==(ReuseScope const& other) const noexcept
{
return loraId == other.loraId && salt == other.salt;
return loraId == other.loraId && salt == other.salt && localityDomainId == other.localityDomainId;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <cstdint>
#include <memory>
#include <type_traits>
#include <utility>
#include <vector>

namespace tensorrt_llm::batch_manager::kv_cache_manager_v2
{
Expand All @@ -35,6 +37,8 @@ struct PoolDesc
PoolIndex poolIndex{0};
MemAddress baseAddress = 0;
size_t slotBytes = 0;
// Mapped byte ranges [begin, end) relative to baseAddress; a localized pool has holes between them.
std::vector<std::pair<size_t, size_t>> mappedRanges;
};

//! Describes one hot pool group and the lifecycles that share its physical layout.
Expand Down
3 changes: 3 additions & 0 deletions cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ inline constexpr FileDescriptor kBadFileDescriptor = -1;
using PageIndex = StrongIndex<int, struct PageIndexTag, -1>;
inline constexpr PageIndex kBadPageIndex{-1};

// Index of a GPU locality domain.
using LocalityDomainId = StrongIndex<int, struct LocalityDomainIdTag>;

// Eviction priority (0 = highest priority to evict, 100 = lowest).
using Priority = int;
inline constexpr Priority kPriorityMin = 0;
Expand Down
2 changes: 2 additions & 0 deletions cpp/tensorrt_llm/batch_manager/kv_cache_manager_v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace tensorrt_llm::batch_manager::kv_cache_manager_v2
struct GpuCacheTierConfig
{
size_t quota = 0; // bytes
// Place KV pages in per-locality-domain physical memory when the device exposes locality domains.
bool enableLocalityDomains = false;

[[nodiscard]] CacheTier tier() const noexcept
{
Expand Down
Loading