Repository navigation
Add the kv_evicted_blocks_total (tpu_raiden_kv_evicted_blocks_total) counter metric to tpu_raiden telemetry and instrument KVCacheStore to record host DRAM LRU evictions labeled by {dp_rank}. - #1396
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_999559864
branch
2 times, most recently
from
November 2, 2026 19:43
cb6950a to
b9f9760
Compare
…l`) counter metric to `tpu_raiden` telemetry and instrument `KVCacheStore` to record host DRAM LRU evictions labeled by `{dp_rank}`.
Key changes:
- Register `kKvEvictedBlocksTotal` (`"kv_evicted_blocks_total"`), description, `kKvEvictedBlocksLabels` (`{kDpRank}`), and `kKvEvictedBlocksTotal` metadata in `metrics_backend.h`.
- Instrument `KVCacheStore::Evict` (via `IncrementKvEvictedBlocks(dp_rank, count)` in `kv_cache_store.cc`) to emit `kv_evicted_blocks_total` with `host_ids_to_deallocate.size()` (the exact count of host-resident blocks removed from the tier-0 LRU index and returned to the host DRAM pool), covering direct `Evict`, `AllocateBlockIds` LRU eviction on pool exhaustion, and `KVCacheStoreMonitor` background sweep evictions (after peer demotion or local drop) without counting non-eviction deallocations.
- Add unit tests in `metrics_api_test.cc`, `telemetry_binding_test.py`, and `kv_cache_store_test.cc` (`KVEvictedBlocksMetricsTest`, `KVEvictedBlocksSweepMetricsTest`).
PiperOrigin-RevId: 1012351608
copybara-service
Bot
force-pushed
the
test_999559864
branch
from
November 2, 2026 20:13
b9f9760 to
0bc13ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
kv_evicted_blocks_total(tpu_raiden_kv_evicted_blocks_total) counter metric totpu_raidentelemetry and instrumentKVCacheStoreto record host DRAM LRU evictions labeled by{dp_rank}.Key changes:
kKvEvictedBlocksTotal("kv_evicted_blocks_total"), description,kKvEvictedBlocksLabels({kDpRank}), andkKvEvictedBlocksTotalmetadata inmetrics_backend.h.KVCacheStore::Evict(viaIncrementKvEvictedBlocks(dp_rank, count)inkv_cache_store.cc) to emitkv_evicted_blocks_totalwithhost_ids_to_deallocate.size()(the exact count of host-resident blocks removed from the tier-0 LRU index and returned to the host DRAM pool), covering directEvict,AllocateBlockIdsLRU eviction on pool exhaustion, andKVCacheStoreMonitorbackground sweep evictions (after peer demotion or local drop) without counting non-eviction deallocations.metrics_api_test.cc,telemetry_binding_test.py, andkv_cache_store_test.cc(KVEvictedBlocksMetricsTest,KVEvictedBlocksSweepMetricsTest).