Integrate DS4 execution parity in Rust

This commit is contained in:
Georg Bauer
2026-07-26 17:58:05 +02:00
parent c9f0c3661c
commit 4420b81117
20 changed files with 11643 additions and 358 deletions

View File

@@ -198,6 +198,55 @@ impl App {
.spacing(7)
.into(),
);
let ssd_activity = stats_panel(
"SSD STREAMING ACTIVITY · LAST 24 SECONDS",
column![
mini_chart(
&self.metrics_history,
|point| point.ssd_requests_per_second,
Color::from_rgb8(240, 180, 70),
),
row![
text("Selected loads")
.size(12)
.color(Color::from_rgb8(240, 180, 70)),
Space::with_width(Length::Fill),
text(format!("{:.1}/s", latest.ssd_requests_per_second))
.size(12)
.color(muted_text()),
],
mini_chart(
&self.metrics_history,
|point| point.ssd_bytes_per_second,
Color::from_rgb8(67, 194, 203),
),
row![
text("Requested expert data")
.size(12)
.color(Color::from_rgb8(67, 194, 203)),
Space::with_width(Length::Fill),
text(format_rate(latest.ssd_bytes_per_second))
.size(12)
.color(muted_text()),
],
mini_chart(
&self.metrics_history,
|point| point.ssd_wait_ms_per_second,
Color::from_rgb8(220, 80, 86),
),
row![
text("Inference wait")
.size(12)
.color(Color::from_rgb8(220, 80, 86)),
Space::with_width(Length::Fill),
text(format!("{:.0} ms/s", latest.ssd_wait_ms_per_second))
.size(12)
.color(muted_text()),
],
]
.spacing(7)
.into(),
);
let model = stats_panel(
"MODEL CORE",
@@ -249,6 +298,86 @@ impl App {
.spacing(9)
.into(),
);
let acceptance = if stats.drafted_tokens == 0 {
0.0
} else {
stats.accepted_draft_tokens as f64 / stats.drafted_tokens as f64
};
let target_passes = stats
.speculative_cycles
.saturating_add(stats.verifier_passes);
let effective_speedup = if target_passes == 0 {
1.0
} else {
stats
.speculative_cycles
.saturating_add(stats.accepted_draft_tokens) as f64
/ target_passes as f64
};
let speculative = stats_panel(
"SPECULATIVE DECODING",
column![
metric_row(
"Mode",
match stats.speculative_mode {
1 => "Legacy MTP",
2 => "DSpark",
_ => "Off",
},
),
metric_row("Cycles", format_count(stats.speculative_cycles)),
metric_row("Drafted", format_count(stats.drafted_tokens)),
metric_row("Accepted", format_count(stats.accepted_draft_tokens)),
metric_row("Acceptance", format!("{:.1}%", acceptance * 100.0)),
metric_row(
"Target verifier passes",
format_count(stats.verifier_passes)
),
metric_row("Verifier wall time", format_milliseconds(stats.verifier_ms)),
metric_row(
"Effective target-pass speedup",
format!("{effective_speedup:.2}×")
),
]
.spacing(9)
.into(),
);
let ssd = stats_panel(
"SSD EXPERT STREAMING",
column![
metric_row("State", if stats.ssd_enabled { "Enabled" } else { "Off" }),
metric_row("Resident weights", format_bytes(stats.ssd_resident_bytes)),
metric_row("Expert cache", format_bytes(stats.ssd_cache_bytes)),
metric_row(
"Cache capacity",
format!("{} experts", stats.ssd_cache_experts)
),
metric_row(
"Preloaded",
format!("{} experts", stats.ssd_preloaded_experts)
),
metric_row(
"Selected-load requests",
format_count(stats.ssd_selected_requests)
),
metric_row(
"Requested expert bytes",
format_bytes(stats.ssd_requested_bytes)
),
metric_row("Selected-load wait", format_milliseconds(stats.ssd_wait_ms)),
metric_row(
"Average load wait",
format_milliseconds(
stats
.ssd_wait_ms
.checked_div(stats.ssd_selected_requests)
.unwrap_or(0)
)
),
]
.spacing(9)
.into(),
);
let cache = stats_panel(
"KV CACHE",
column![
@@ -352,10 +481,12 @@ impl App {
heading,
headline,
throughput,
ssd_activity,
kv_io,
requests,
disc,
row![model, runtime].spacing(10),
row![speculative, ssd].spacing(10),
row![cache, server].spacing(10),
text("Counters are published by the runtime with relaxed atomics and sampled by the UI every 200 ms.")
.size(11)