Repository navigation
D120 merge-gate measurement against the pre-CoW compiler: the last-use view-edge regression (1.093 → 1.032), corpus A/B tool, parser hang - #2448
Merged
Conversation
added 7 commits
October 18, 2026 04:42
…of re-reading the token forever
`match o: { Some(x) => x, None => 0 }` opens a struct pattern after the
colon, and `(` is not a field name; expect_ident reported it and consumed
nothing, and the field loop asked again, forever. The loop now leaves on
a failed name and the diagnostic comes out (the inline form is
`match o { ... }`). Fixture: err_parse_brace_after_match_colon_terminates.
…w, so the list's last-use handoff is taken (D120 §2.3) The last-use pass drew a view edge for every unheld copy, including an integer read out of a list (`out[l] = state[l]`), which made `out` a "view" of `state` and kept every later handoff of `state` a retained copy. In the compiler that was its own stage 4 dataflow: the state vector was copied at every statement, 239,743 copies over 4 KB in one `check src/main.w` (WITH_TRACE_COW_COPIES=4096; every backtrace through cow_transfer_stmt/cow_transfer_term), all of the 3.4 s mir.lower delta in the 9.3% self-host regression against the pre-D120 compiler. An edge now needs an operand whose own type can carry a view. WITH_TRACE_COW=1 now also prints the pass's verdict per held site ([cow-last-use] ... taken / kept, <why>), which is what located this. Pin: behav_d120_element_copy_is_not_a_view (the buffer address stays the same across the handoffs; fails on main).
… of reading a second holder The four entry points read `*sema_ptr` into a local and handed it to the evaluator while the pointer still held the original: under D120 two holders of every table. comptime_take_sema reads, blanks the pointer's Sema, and returns the one holder; comptime_eval_finish writes the evaluator's Sema back as before. (At stage 3 this was 1,908 copies over 64 KB per self-check; stage 4's last-use take already removes them on main, so this is the stated ownership, not a measured saving.)
…suites (D120's second merge gate) Builds lib/std/re/pcre2test.w or lib/std/zl/minigzip.w with each compiler once, then times the suite alone, interleaved A B A B, with ab_bench's report (median, ratio, spread; a regression counts only when every round exceeds 1.05). pcre2 runs upstream RunTest -8 0-29 as the pcre2-test lane does; zlib round-trips a 16 MB text through minigzip (the lane's 14-byte round trip times process start, not zlib).
rt_value_is_zero, the guard codegen emits on a value's drop when its size is not 8 or 16, compared one byte at a time. With structs of values dropping through it (D120 stage 3) it was 0.5 s of a self-check (sample: 64 ms before D120, 590 ms after). Now a word at a time, then the tail bytes, as rt_memcmp reads.
…date), not per (block, local) cow_compute_unique_dataflow sized unique_in/unique_out at block-count x local-count words per body and initialized every entry; in the compiler's big bodies that is megabytes per body, which showed as the allocator's large-range bookkeeping (rt_range_store, rt_record_large_range, rt_forget_large_range, +0.6 s of a self-check against the pre-D120 compiler). The arrays are now block-count x candidate-count, indexed by candidate, in the driver and both consumers (the hoist and the elision); the per-statement state vector stays per local.
… its cause Status text only (the decision record's "Status of the work" and the plan's header): the per-stage A/Bs compounded unseen to 1.093 on the self-host; after the last-use view-edge fix 1.032, pcre2 0.966, zlib 0.992, three interleaved rounds each.
ehartford
force-pushed
the
d120-take-sema
branch
from
October 18, 2026 12:54
27c216c to
1e087af
Compare
Contributor
Author
Battery and measurement (1e087af)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to D120 stages 1–6 (#2304): the merge-gate measurement the plan owes, taken against the pre-CoW compiler, and the regression it found.
Each stage's A/B had been taken against the main before it, so the ratios compounded unseen. Against the last pre-CoW compiler (6069361, release built under the pinned seed),
check src/main.wmeasured 1.088–1.104 (median 1.093), a counted regression; the corpus suites had never been measured.Cause, at the line.
WITH_PROFILE=1put the whole delta inmir.lower(+3.4 s of 4 s).WITH_TRACE_COW_COPIES=4096reported 239,743 list copies over 4 KB in one self-check, every backtrace through stage 4's owncow_transfer_stmt/cow_transfer_term: the dataflow's state vector was a retained copy at every statement.with analyze src/main.w cownamed the sites; a 24-line repro and a new per-verdict trace in the last-use pass (WITH_TRACE_COW=1→[cow-last-use] … kept, view _3 live after) showedlast_use_build_view_edgesdrawing a view edge for an integer copied out of the list (out[l] = state[l]), which madeouta "view" ofstateand kept the handoff a retain.behav_d120_element_copy_is_not_a_view(buffer address stable across handoffs; fails on main).rt_value_is_zero(the drop guard for sizes other than 8/16) reads a word at a time (64 → 590 ms of a self-check once structs of values dropped through it).match o: { Some(x) => x, None => 0 }spun forever in the struct-pattern field loop (found while writing the tooling; pre-existing, hangs the pre-D120 compiler too). Fixtureerr_parse_brace_after_match_colon_terminates.tools/corpus_ab.w: the corpus-suite half of the gate (pcre2 RunTest -8 0-29 over the pinned 10.47 reference; a 16 MB minigzip round trip).Measurement (three interleaved rounds each, baseline = pre-CoW 6069361):
check src/main.wWhat remains of the 3%: the uniqueness check at mutation sites the proof does not cover (
with_vec_is_unique, ~0.9 s of 45 s) and the proof's own dataflow (~0.4 s). The ruling's "what would reopen it" is a cost over 2% that is not removable; those two are the next targets and are Eric's call.Gate green (
d120-take-sema-gate3.log),:deep-debug-tool-tests,:debug-alloc-tests,:drop-auditgreen, census diff clean. Battery: pending.