Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/launchbound-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ fn cmd_tune(
)?;
let dev = device(cc)?;
println!(
"{} — ESTIMATED tuning (analytical model, cc {cc}); the gate is full, the timings are NOT measurements:",
"{} — ESTIMATED tuning (analytical model, cc {cc}); the gate is full, the timings are NOT measurements:",
spec.name
);
let mut admitted: Vec<_> = verdicts
Expand Down
41 changes: 37 additions & 4 deletions crates/launchbound-tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ fn draw_header(frame: &mut Frame<'_>, app: &App, area: Rect) {
frame.render_widget(Paragraph::new(lines), area);
}

/// The banner above the field when refused configurations measured faster.
///
/// A function rather than an inline `format!` so both arities can be tested.
/// The count comes from measured timings, and the one fixture the golden
/// frames are built on yields exactly one — so the plural branch is not
/// reachable from a rendered frame without rebuilding that fixture, which
/// would move every golden in the suite to cover two words.
fn refused_faster_banner(count: usize) -> String {
let noun = if count == 1 {
"configuration"
} else {
"configurations"
};
format!("{count} REFUSED {noun} measured FASTER than the chosen one — view 3")
}

fn draw_overview(frame: &mut Frame<'_>, app: &App, area: Rect) {
let r = &app.report;
let mut lines = Vec::new();
Expand All @@ -133,10 +149,7 @@ fn draw_overview(frame: &mut Frame<'_>, app: &App, area: Rect) {
if !r.rejected_faster.is_empty() {
lines.push(Line::from(""));
lines.push(Line::from(Span::styled(
format!(
"{} REFUSED configuration(s) measured FASTER than the chosen one — view 3",
r.rejected_faster.len()
),
refused_faster_banner(r.rejected_faster.len()),
Style::default().add_modifier(Modifier::BOLD),
)));
}
Expand Down Expand Up @@ -363,3 +376,23 @@ fn bar(done: usize, total: usize, width: usize) -> String {
}
s
}

#[cfg(test)]
mod tests {
use super::refused_faster_banner;

#[test]
fn the_refused_faster_banner_agrees_with_its_own_count() {
assert_eq!(
refused_faster_banner(1),
"1 REFUSED configuration measured FASTER than the chosen one — view 3"
);
assert_eq!(
refused_faster_banner(2),
"2 REFUSED configurations measured FASTER than the chosen one — view 3"
);
// Not reachable through the view — the banner is drawn only when the
// list is non-empty — but the function is total, so it is pinned.
assert!(refused_faster_banner(0).starts_with("0 REFUSED configurations"));
}
}
2 changes: 1 addition & 1 deletion crates/launchbound-tui/tests/golden/overview-110x32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ launchbound — reduce-flip · gate cc 8.6 · measured · NVIDIA A10G
┌overview────────────────────────────────────────────────────────────────────────────────────────────────────┐
│CHOSEN c1-0000000000000009 block_x=32 tile=512 unroll=4 0.0400 ms [0.0398, 0.0402] │
│ │
│1 REFUSED configuration(s) measured FASTER than the chosen one — view 3 │
│1 REFUSED configuration measured FASTER than the chosen one — view 3
│ │
│GPU-seconds consumed: 25.5 │
│ │
Expand Down
2 changes: 1 addition & 1 deletion crates/launchbound-tui/tests/golden/overview-80x24.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ launchbound — reduce-flip · gate cc 8.6 · measured · NVIDIA A10G
┌overview──────────────────────────────────────────────────────────────────────┐
│CHOSEN c1-0000000000000009 block_x=32 tile=512 unroll=4 0.0400 ms [0.0398, │
│ │
│1 REFUSED configuration(s) measured FASTER than the chosen one — view 3 │
│1 REFUSED configuration measured FASTER than the chosen one — view 3
│ │
│GPU-seconds consumed: 25.5 │
│ │
Expand Down
Loading