Skip to content

Commit ddfc302

Browse files
borisbatclaude
andcommitted
tune: a must-see line no longer collides with the live display
report()'s "no passing variant" printed straight to stdout while the bar was live, so it landed on the bar's line and the next redraw wrote over it — the one message you must not lose was the one most likely to be destroyed. Routing it through tune_detail (the obvious fix) would be worse: that mutes under normal verbosity, so a hard failure would vanish entirely. Added tune_progress_note instead — it wipes the bar's line, prints the text, and leaves the display armed so the bar redraws underneath. Silent still suppresses. Verified on a pty by replaying the CR/LF stream the way a terminal does: k0: no passing variant [######--------------] 1/3 k1 finalists 2/4 4 live 0s Copilot also flagged the summary block for the same reason; that one is fine — it runs after tune_progress_finish() has already closed the display. Caught by Copilot on #3583. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent d858c70 commit ddfc302

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

modules/dasLLAMA/harness/tune_kernels.das

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def report(kernel : string; names : array<string>; best : array<double>; ok : ar
224224
tune_detail(" {names[i]}: {best[i]} us ({delta}% vs {baseline}){mark}\n")
225225
}
226226
if (winner < 0) {
227-
print(" {kernel}: no passing variant\n")
227+
tune_progress_note(" {kernel}: no passing variant\n")
228228
tune_progress_kernel_end(kernel, "", "rejected")
229229
g_results |> emplace(KernelResult(kernel = kernel, winner = "", fallback = baseline))
230230
return ""

modules/dasLLVM/daslib/llvm_tune.das

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,24 @@ def tune_detail(text : string) {
11981198
print(text)
11991199
}
12001200

1201+
//! Print a line that must be seen even while a display is live — a failure, not chatter. Wipes
1202+
//! the bar's line first so the text is not written over it, and leaves the display armed so the
1203+
//! next event redraws the bar underneath. Use `tune_detail` for anything mutable.
1204+
def tune_progress_note(text : string) {
1205+
if (tune_verbosity() == "silent") return
1206+
if (g_prog.drawn) {
1207+
let cols = terminal_columns()
1208+
let wipe = build_string() $(w) {
1209+
for (_i in range(max(0, cols - 1))) {
1210+
w |> write(" ")
1211+
}
1212+
}
1213+
print("\r{wipe}\r")
1214+
g_prog.drawn = false
1215+
}
1216+
print(text)
1217+
}
1218+
12011219
//! Close a live display, so whatever prints next starts on its own line. A tuner that emitted
12021220
//! progress calls this before it returns; the relay does it automatically when a child exits.
12031221
def tune_progress_finish() {

0 commit comments

Comments
 (0)