Skip to content

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
copybara-service[bot] merged 1 commit into
mainfrom
test_999559864
Nov 2, 2026

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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}.

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).

@copybara-service
copybara-service Bot force-pushed the test_999559864 branch 2 times, most recently from cb6950a to b9f9760 Compare November 2, 2026 19:43
…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
copybara-service Bot merged commit 0bc13ad into main Nov 2, 2026
5 checks passed
@copybara-service
copybara-service Bot deleted the test_999559864 branch November 2, 2026 20:13
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.

0 participants