Skip to content

feat(umbp): BatchTouch, so callers can report KV hits served by an upper tier - #779

Merged
isytwu merged 6 commits into
mainfrom
feat/umbp-touch-eviction-class
Nov 10, 2026
Merged

isytwu merged 6 commits into
mainfrom
feat/umbp-touch-eviction-class

Conversation

@isytwu

@isytwu isytwu commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Implements items 1–3 of #879: a cache in front of UMBP (sglang's device radix tree, vLLM's GPU prefix cache) reports the hits it serves itself, so UMBP's eviction sees that reuse.

  • IUMBPClient::BatchTouch(keys) (Python batch_touch) is batched and data-free: the caller's node renews each key in every medium that holds it, as a read would. DRAM and HBM move it to the recent end of their eviction order, in the order given, so the last key ends up the most recent; the SSD tier renews it as a lookup does. It reads nothing, takes no lease or pin and skips keys that are not stored. It goes IUMBPClient -> PoolClient -> PeerPool in the distributed client, and through a BatchTouch RPC in standalone mode.
  • Built on fix(umbp): a lookup renews the keys it finds, so eviction spares them until the load #791: fix(umbp): a lookup renews the keys it finds, so eviction spares them until the load #791 gave every medium a MediumBackend::Touch, so that a lookup (BatchContains) renews the keys it finds until the load. BatchTouch uses the same Touch for the keys a caller never looks up, because its own cache serves them. Touch now returns how many of the keys a medium holds, so BatchTouch reports the copies it touched in DRAM and HBM; the SSD tier's copies are renewed but not counted here.
  • Watermark offload: a tier that offloads at a watermark picks what to move from the pool's own access order; the touch moves that order too, as a read and a lookup do.
  • Master eviction modes (master, master_ranked): the touched keys also join the local reads a node reports on its heartbeats, so the master's ranking sees them wherever the pool placed them.
  • Local eviction (the default): only the caller's node sees the touch; keys a multi-node pool placed on another node are not refreshed.
  • Returns the copies touched in the caller's DRAM and HBM, one per medium that holds the key, a duplicate key counted each time; DRAM counts 0 in the master mode, where it keeps no order of its own.

Commits:

  1. BatchTouch on every medium through MediumBackend::Touch, which now returns a count (the SSD tier renews but counts none), and the standalone RPC.
  2. Touched keys reach the master's ranking in the master eviction modes.
  3. The touch also moves the pool's access order, which watermark offload picks from.
  4. Docs: the order within a batch, what the master hears and when, what the count is.
  5. Tests check what they claim: a read lease long enough to catch a touch that takes one, the order within a batch, and the master mode.
  6. A standalone client logs a warning, once, when its server predates BatchTouch.

#882, stacked on this PR, counts the SSD tier's copies and hands the tier only the keys it holds, skipping keys mid-eviction, with the SSD tests. Not in this PR: hit counts or source tier for a frequency-aware policy (item 4 of #879). The eviction classes of an earlier revision are dropped: #879 does not need them, and on their own they had no measurable effect.

Compatibility

  • A caller that does not call BatchTouch sees no change.
  • Callers probe before use: the vLLM UMBP connector and the sglang integration check for batch_touch and skip it on an older mori (upstream sglang does not call it). A newer client against an older standalone server gets UNIMPLEMENTED, reported as 0, with a warning logged once.
  • The master side reuses the local-read report, so the master protocol is unchanged; a master that predates peer-driven eviction gets no reports, as with local reads.
  • IUMBPClient gains one virtual with a default implementation: subclasses outside mori build unchanged, but the vtable changes, so C++ code built against an older mori must be rebuilt. MediumBackend::Touch returns size_t instead of void.

Why

Without the touch, a prefix the caller keeps serving from its own cache is never read from UMBP, so its copy there ages from its first store and is evicted first; once the caller's cache drops it too, it is gone from both. Kimi-K3 (KDA + MLA), AgentX trace, one hour of profiling per run, MI355X (smci355):

Engine and setup Compared Throughput Latency
vLLM 1P1D DCP8, c70, standalone UMBP server on the prefill node, 1799 GB DRAM (band 0.97/0.93), no SSD, BF16 SSM state touch on every GPU prefix hit plus the KDA low-priority class of an earlier revision / neither; same nodes back to back +2.7% tok/s/GPU TTFT p50 −32%, p90 −22%
Same, plus a 1.2 TB SSD tier behind the DRAM BatchTouch on / off (same build; a connector overlay turns it off); two node pairs, opposite orders +2.1% / +3.9% tok/s/GPU TTFT p90 −15% / −15%, E2E p90 −10% / −17%
vLLM 1P1D, c56, embedded connector, 1799 GB DRAM, FP32 SSM state touch on / off +1.0% tok/s/GPU TTFT p90 −24%
sglang, TP8, c12, UMBP 580 GiB BatchTouch on / off +5.9% tok/s/GPU (output +9.1%) E2E p90 −29%, TTFT p90 −14%
  • The gain follows how much of the prompt the external store serves. In the vLLM c70 runs the GPU prefix cache serves about 90% of the prompt. Without the SSD tier, the prompt tokens the prefill engine computes fell from 4.90% to 4.42%; with it, from 4.20% to 4.05% and from 4.32% to 4.12%, and SSD reads fell from 52 to 23 and from 62 to 25 GB/h: without the touch, prefixes the GPU keeps using age in DRAM, are demoted and are read back from the SSD. In these builds BatchTouch moved DRAM copies only. Touching the SSD tier's copies as well, as it does now, measured no difference on one node pair back to back: 14,001 against 14,072 tok/s/GPU, TTFT p90 17.02 against 16.28 s, SSD reads 25 against 27 GB/h, within the run-to-run noise of one configuration (0.3–0.45% in throughput, 2–5% in TTFT p50). In the sglang run the device cache served 91.7% and touch raised the external share from 0.9% to 2.4%; each rank touched 2.52M keys in the hour, 88–89% of them held by the store, with no failures.

Testing

  • All UMBP C++ test binaries of this build pass on a host with RDMA (8 ionic RoCE NICs): 56 binaries and 736 gtest cases on this branch (main 7c27c146); commit 1 alone builds and passes the six binaries it touches. New tests: PageBackend and standalone-RPC touch tests (commit 1); PeerDrivenEvictionTest.TouchedKeysReachTheMastersRanking (commit 2, run in the master_ranked and master modes since commit 5); PeerPool.WatermarkOffloadMovesATouchedKeyLast, PeerPoolLocalEviction.TouchedKeysOutliveColderOnesInTheOrderGiven and PeerPool.ATouchReachesEveryCopyInAMediumThatKeepsAnOrder (commit 3); PageBackendTouch.MovesKeysInTheOrderGiven (commit 5). With commit 2's report and commit 3's order update taken out, exactly two cases fail: TouchedKeysReachTheMastersRanking and WatermarkOffloadMovesATouchedKeyLast. Repeated with no failure: PageBackendTouch.* 50 times, the pool's touch and watermark tests 20 times, PeerDrivenEvictionTest.* and the standalone touch test 10 times. One case skips on its own condition (DisablingKeyHandlesAlsoStopsTheServerRemembering runs only with UMBP_KEY_HANDLE_SLOTS=0). Not run: the SPDK tests (built without SPDK), and the Redis metadata store and sharded-read tests, which this configuration does not build. mori_umbp_pybinds builds; clang-format 20.1.8 is clean.
  • The CI's Python steps, run locally on this branch: pytest tests/python/umbp 108 passed; umbp_prim_ci.py PASS with and without a master.
  • End to end, all vLLM runs on test/umbp-e2e-v15 (main e6ddd2a7 plus feat(umbp): a local ranged GET off SSD reads only its extent #781, fix(umbp): an SSD Clear keeps the staging spans local readers still hold #788, fix(umbp): commit to the backend outside the pool lock #804, fix(umbp): count SSD keys without snapshotting them #808, feat(umbp): an SSD backend can keep small objects off it (min_object_size) #824): the no-SSD pair compared it with and without commit 1 and the eviction classes; the SSD-tier pairs ran it with commit 1, the eviction classes and two SSD-tier changes outside this PR in both arms, with BatchTouch turned off in one by a connector overlay; the SSD-touch pair ran that build with an SSD-tier Touch (the first revision of feat(umbp): BatchTouch counts SSD copies and hands the tier only keys it holds #882) in one arm. All of these used local eviction and demoted DRAM copies to the SSD on eviction, not at a watermark, so commits 2 and 3 did not take part; their unit tests cover them. The sglang pair ran commit 1 on 324d1058.

@isytwu isytwu self-assigned this Oct 15, 2026
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch 2 times, most recently from 7b1a94a to ccd55b6 Compare October 22, 2026 06:47
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch from ccd55b6 to e3fe7fe Compare October 23, 2026 03:50
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch from e3fe7fe to 37e4c12 Compare October 30, 2026 10:08
@isytwu isytwu changed the title feat(umbp): BatchTouch recency hints and eviction classes for local eviction feat(umbp): BatchTouch, so callers can report KV hits served by an upper tier Oct 30, 2026
@isytwu
isytwu marked this pull request as ready for review October 30, 2026 10:17
@isytwu
isytwu marked this pull request as draft October 31, 2026 13:01
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch from 0c4f294 to 7e23557 Compare October 31, 2026 15:12
@isytwu
isytwu marked this pull request as ready for review November 6, 2026 09:54
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch from 0e790f1 to b0fea45 Compare November 9, 2026 07:35
… its own cache

A cache in front of UMBP -- sglang's device radix tree with the direct
linker, or vLLM's GPU prefix cache with the UMBP connector -- serves its
hottest prefixes itself and never reads them back or looks them up again,
so a local eviction ordered by commit, read and lookup recency ranks
exactly those objects coldest and frees them first.  BatchTouch lets such a
caller report the use: IUMBPClient passes it through PoolClient and PeerPool
to every medium holding the keys (a BatchTouch RPC in standalone mode),
which renews them with the MediumBackend::Touch a lookup uses.  It reads
nothing and grants no lease.  Touch now returns how many of the keys a
medium holds, so BatchTouch can report the copies it touched in DRAM and
HBM; the SSD tier renews its copies as a lookup does and counts none.  A
server without the RPC answers UNIMPLEMENTED, which the client reports as 0
keys touched.
…modes

In master and master_ranked eviction the victims follow the master's
recency, which hears of a node's uses only through the local reads it
reports on its heartbeats, so a BatchTouch that moved only the node's own
LRU did not change them.  PoolClient::BatchTouch now adds the keys to
those reports, and the master bumps them wherever the pool placed them.
Under local eviction, the default, nothing is reported and only the
caller's node's media see the touch.
A tier whose offload trigger is a watermark demotes keys in the pool's own
access order, which commits and reads move but BatchTouch did not, so a
touched key was still the first to leave its tier.  PeerPool::BatchTouch now
moves that order too, for the keys the pool has placed, as a read does.

Pool tests cover the offload case, local eviction keeping touched keys with
a batch's last key going last, and the copies counted per ordered medium.
PageBackend::Touch skips the LRU lock when it holds none of the keys, as
BatchResolve does, and PoolClient leaves the report check to NoteLocalReads.
The IUMBPClient comment did not say that a node's paged media move the keys
in the order given, which a caller touching a prefix tail first relies on,
that the master hears of them unordered, a heartbeat at a time, or that the
count is 0 for DRAM in the master mode, which keeps no order there, and
counts a duplicate key each time.  MediumBackend::Touch now says the same of
one medium, and the proto and the Python binding defer to the IUMBPClient
comment.
MovesRecencyWithoutALease ran with a 1 ms read lease, which lapses before
the order is read, so a touch that took a lease would still have passed; it
now runs with the default lease, and only the test that reads keeps 1 ms.
A new case checks the order within a batch.  The master-ranked touch test
repeated the read test's setup line for line; both now use two fixture
helpers, and it also runs in the master mode, where the node moves nothing
and returns 0 while the master still ranks the keys hottest.
…atchTouch

Such a server answers UNIMPLEMENTED, which the client reports as 0 keys
touched, so a mixed-version deployment touched nothing without a trace.  The
first such answer now logs a warning.
@isytwu
isytwu force-pushed the feat/umbp-touch-eviction-class branch from b0fea45 to 62046b7 Compare November 9, 2026 09:44
@TianDi101
TianDi101 self-requested a review November 9, 2026 13:32

@TianDi101 TianDi101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@isytwu
isytwu merged commit 5dc1f36 into main Nov 10, 2026
15 checks passed
yangyuhuiling pushed a commit that referenced this pull request Nov 11, 2026
One conflict, in src/umbp/doc/runtime-env-vars.md, three rows of the
pool-client table:

- UMBP_EVICTION_MODE: main's row (#779 adds the keys passed to
  BatchTouch to what a node reports on its heartbeats).
- UMBP_DRAM_READ_LEASE_MS, UMBP_SSD_READ_LEASE_MS: this branch's rows.
  main did not change them, and its code still matches them: both are
  read once per process through a function-local static in
  pool_platform.cpp, and UMBP_SSD_PREPARE_TIMEOUT_MS and lease_ttl_ms,
  which the old rows mention, appear nowhere in the code.

tools/check_docs_links.py and docs.yml merged on their own: #968's
--markdown README check sits next to this branch's image check.

Co-Authored-By: Claude <[email protected]>
isytwu added a commit to isytwu/sglang that referenced this pull request Nov 19, 2026
The DRAM tier evicts by last write or read, and device hits read nothing from
it, so a long session's earliest prefix pages, hottest on the device, look
oldest in the store and go first. With touch_interval_s in the UMBP linker
config (and a mori with batch_touch), each device-hit node's prefix and each
running request's prefix are touched there at most once per node and interval,
from a background thread. This is the touch of AMD-yanfeiwang's UMBP linker v4,
after the sglang side of mori's batch_touch (ROCm/mori#779).

Experimental: on top of keep_states_per_path and the probe memo it changed
cache hits by about 1% at Kimi-K3.1 c96; its effect at c48 with output states
is being measured.

Co-authored-by: AMD-yanfeiwang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants