Archived
engine: the KV plan split, the host mirror, and --kv-resident bring-up
This commit is contained in:
1 parent
cce687bf2c
commit
a9e627b7ca
44 files changed
+3118
-51
No files matched your search
@@ -87,6 +87,12 @@ inline SchedMetrics bridge_metrics(const rad::SchedMetrics& m) {
|
||||
if (o.kv_tokens_max == 0 || t < o.kv_tokens_max) o.kv_tokens_max = t;
|
||||
}
|
||||
|
||||
/* KV streaming's totals pass through unchanged: none of them is a per-group figure the
|
||||
* binding rule above applies to. */
|
||||
o.kv_resident_blocks = m.kv_resident_blocks;
|
||||
o.kv_stream_misses = m.kv_stream_misses;
|
||||
o.kv_stream_bytes_in = m.kv_stream_bytes_in;
|
||||
|
||||
/* vLLM's gpu_prefix_cache_hit_rate means attention caching. The linear-checkpoint hit
|
||||
* rate has a different granularity (spec §7.3) and is reported separately, not averaged
|
||||
* in. */
|
||||
|
||||
@@ -60,6 +60,12 @@ struct SchedMetrics {
|
||||
* expert slab (`kv_bytes_carved` in bytes). The smallest over the paged groups, which share
|
||||
* one token axis; windowed groups are excluded, since their carve bounds lookback, not fit. */
|
||||
int64_t kv_tokens_max = 0;
|
||||
/* KV streaming (docs/KV-STREAMING.md §4.2): the ring's depth over every streamed group, and
|
||||
* the resolve's cumulative misses and bytes copied in from the host mirror. All zero unless a
|
||||
* group's pool is a resident window rather than its whole context. */
|
||||
int64_t kv_resident_blocks = 0;
|
||||
int64_t kv_stream_misses = 0;
|
||||
int64_t kv_stream_bytes_in = 0;
|
||||
|
||||
double prefix_hit_rate = 0.0; /* 0..1 */
|
||||
/* Cumulative prefix-cache evictions. They rise as reusable prefixes are dropped, while
|
||||
|
||||
@@ -136,6 +136,7 @@ void Metrics::sample(const SchedMetrics& m) {
|
||||
g_kv_util_.set(m.kv_util);
|
||||
g_kv_max_tokens_.set((double)m.kv_tokens_max);
|
||||
g_kv_max_bytes_.set((double)m.kv_bytes_carved);
|
||||
g_kv_resident_blocks_.set((double)m.kv_resident_blocks);
|
||||
g_prefix_hit_.set(m.prefix_hit_rate);
|
||||
g_prefill_tps_.set(m.prefill_tps);
|
||||
g_decode_tps_.set(m.decode_tps);
|
||||
@@ -200,6 +201,8 @@ void Metrics::sample(const SchedMetrics& m) {
|
||||
c_cut_resumed_below_.advance_to(m.hit_cut_resumed_below);
|
||||
c_restore_cuts_.advance_to(m.prefix_restore_cuts);
|
||||
c_cut_tokens_.advance_to(m.hit_cut_tokens);
|
||||
c_kv_stream_misses_.advance_to((double)m.kv_stream_misses);
|
||||
c_kv_stream_bytes_.advance_to((double)m.kv_stream_bytes_in);
|
||||
g_linear_hit_.set(m.linear_hit_rate);
|
||||
}
|
||||
|
||||
@@ -281,6 +284,24 @@ std::string Metrics::render() const {
|
||||
w.gauge("radiance:kv_cache_max_bytes",
|
||||
"VRAM the KV cache holds with every block it lends the experts taken back, one card.",
|
||||
L, g_kv_max_bytes_.get());
|
||||
/* KV streaming (docs/KV-STREAMING.md §4.2): the ring's depth over every streamed group, and
|
||||
* what the resolve has moved into it. All zero on a server whose groups are fully resident. */
|
||||
w.gauge("radiance:kv_resident_blocks",
|
||||
"Blocks of every streamed KV group the device ring holds; 0 when no group streams.",
|
||||
L, g_kv_resident_blocks_.get());
|
||||
w.counter("radiance:kv_stream_misses_total",
|
||||
"Blocks copied into a streamed KV group's ring from the host mirror.",
|
||||
L, c_kv_stream_misses_.get());
|
||||
/* Split by direction, as the host tier may later gain a write-back: only `in` exists today,
|
||||
* the misses' copy from the mirror into the ring. The label is spelled the way the design
|
||||
* note does so a dashboard can ask for both from the start. */
|
||||
w.help("radiance:kv_stream_bytes_total",
|
||||
"Bytes a streamed KV group's resolve moved, by direction.", "counter");
|
||||
w.out += "radiance:kv_stream_bytes_total";
|
||||
w.out += L.substr(0, L.size() - 1);
|
||||
w.out += ",dir=\"in\"} ";
|
||||
w.out += num(c_kv_stream_bytes_.get());
|
||||
w.out += '\n';
|
||||
w.gauge("vllm:gpu_prefix_cache_hit_rate",
|
||||
"GPU prefix cache block hit rate.", L, g_prefix_hit_.get());
|
||||
|
||||
|
||||
@@ -111,7 +111,10 @@ private:
|
||||
std::string labels_; /* {model_name="...",engine="0"} */
|
||||
|
||||
Gauge g_running_, g_waiting_, g_kv_util_, g_prefix_hit_;
|
||||
Gauge g_kv_max_tokens_, g_kv_max_bytes_;
|
||||
Gauge g_kv_max_tokens_, g_kv_max_bytes_, g_kv_resident_blocks_;
|
||||
/* KV streaming: blocks copied into a streamed group's ring, and the bytes they carried, both
|
||||
* cumulative and both zero unless a group's pool is a resident window. */
|
||||
Counter c_kv_stream_misses_, c_kv_stream_bytes_;
|
||||
Gauge g_prefill_tps_, g_decode_tps_, g_draft_accept_, g_preempted_;
|
||||
/* The decode floor in seconds: the fastest and the most recent single-sequence window. 0
|
||||
* until a window completes, and render() omits a 0. */
|
||||
|
||||
Reference in new issue
Block a user