Skip to content

Commit 6a2d90c

Browse files
borisbatclaude
andcommitted
tune: a new plan clears the previous scope's kernel state
consume_event's plan branch set the outer counters but left kernel/phase/inner counters/live from the scope before it. One relay sees BOTH dasllama halves, so after the generator half ends, the kernel half's plan left the display showing "0/25 confirm_e2e_prefill" — and that is not a single frame: tune_kernels has ~30 lines of fixture setup between its plan and its first kernel_begin, so the wrong kernel name is on screen for all of it. plan now rebuilds the whole state, which is what a fresh scope means; begin already did the same for per-kernel fields. Test added for the two-plan sequence. Caught by Copilot on #3583. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent b93e064 commit 6a2d90c

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

modules/dasLLVM/daslib/llvm_tune.das

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,11 +1142,12 @@ def private consume_event(line : string; render : bool) {
11421142
}
11431143
let kind = parts[0]
11441144
if (kind == "plan") {
1145-
g_prog.scope = event_field(parts, "scope", "")
1146-
g_prog.outerTotal = to_int(event_field(parts, "total", "0"))
1147-
g_prog.outerDone = 0
1148-
g_prog.startTicks = ref_time_ticks()
1149-
g_prog.active = true
1145+
// a fresh scope: one relay sees both tuner halves, so the previous scope's kernel must go
1146+
g_prog = TuneProgress(
1147+
scope = event_field(parts, "scope", ""),
1148+
outerTotal = to_int(event_field(parts, "total", "0")),
1149+
startTicks = ref_time_ticks(),
1150+
active = true)
11501151
} elif (kind == "begin") {
11511152
g_prog.kernel = event_field(parts, "name", "")
11521153
g_prog.innerTotal = to_int(event_field(parts, "total", "0"))

modules/dasLLVM/tests/llvm_tune_progress.das

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,24 @@ def test_a_spaced_value_truncates_but_does_not_corrupt(t : T?) {
110110
t |> success(line |> find("0/2") >= 0, "the counters are untouched")
111111
}
112112

113+
// One relay sees both dasllama tuner halves, so a second plan must not inherit the first
114+
// scope's kernel — there is fixture setup between a plan and its first begin to show it in.
115+
[test]
116+
def test_a_new_plan_clears_the_previous_scope(t : T?) {
117+
feed_plan(3)
118+
tune_progress_feed("@tune begin name=leftover total=9")
119+
tune_progress_feed("@tune step i=4 phase=finalists live=7")
120+
tune_progress_feed("@tune end name=leftover winner=w verdict=holds")
121+
t |> success(tune_progress_line(100) |> find("leftover") >= 0, "still the first scope here")
122+
// second half starts; nothing from the first may survive into its opening frame
123+
tune_progress_feed("@tune plan scope=second total=7")
124+
let line = tune_progress_line(100)
125+
t |> success(line |> find("leftover") < 0, "the previous scope's kernel is gone")
126+
t |> success(line |> find("finalists") < 0, "and so is its pass")
127+
t |> success(line |> find("live") < 0, "and its live count")
128+
t |> success(line |> find("0/7") >= 0, "the new plan's counters are in place")
129+
}
130+
113131
[test]
114132
def test_verbosity_parses_and_defaults(t : T?) {
115133
tune_set_verbosity("silent")

0 commit comments

Comments
 (0)