From 691273fb9d3e380a553889e5d4b3f0d34f6cca8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 1 Oct 2026 19:29:21 +0300 Subject: [PATCH] lane-unwritten-dep r5b: the filed choice in section 12 is three-way, not two-way Report only; no code change, no merge, no push. Adds the middle closure Main identified, which section 12 was missing: a zeroed allocation can come from the ALLOCATOR rather than a loop. alloc_zeroed / anonymous mmap hands back zero pages on first touch, which for plane-sized buffers costs a page fault rather than a per-sample store. It is recorded with the caveat that makes it honest -- an option that needs its own measurement, not a claim that it is free. The 4K cost is unmeasured in this lane, and "a page fault per page" is a mechanism, not a benchmark; whoever takes it must measure it before calling it cheaper than explicit zero-fill. The section now says "Three closures, none taken here" and the decision stays with a chartered lane. Also adds the connection the text implied but did not state: the withdrawn premise was doing DOUBLE duty. It justified the unsafe in fresh_plane AND it was the reason the census's original story -- a pre-deblock scan blind to a hole the loop filter later reads -- looked plausible. The same measurement that withdrew the safety argument is what made the blind-census reading wrong: there was never a blind pre-deblock scan, only a dump_stage16 that could not see half the chroma plane. So section 12 and the corrected stage bisect in section 4 are one fact read twice, and a reader who fixes one without the other will re-derive the error. That is the part worth leaving on the page for whoever picks this up. Verified before commit: no source file changed in this round, no stale "two closures" wording remains anywhere in the report, and the two source comments still carry "NOT FULLY JUSTIFIED" / "SAFETY, PARTIAL" with the unsafe unchanged. Gate remains green on the merged tree (1 passed, 816 filtered, 70.92s, measured in r5 and unaffected by this report-only change). --- lanes/unwritten-dep.report.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lanes/unwritten-dep.report.md b/lanes/unwritten-dep.report.md index d1064a12..12f39c95 100644 --- a/lanes/unwritten-dep.report.md +++ b/lanes/unwritten-dep.report.md @@ -374,14 +374,31 @@ uninitialised memory is not itself UB: `u16` has no invalid bit patterns and no uninitialised `u16`. `set_len` is therefore sound only under the "written before read" premise, and that premise is the one the measurement withdrew. -**Two closures, neither taken here:** - -1. **Zero the allocation** — restore `vec![0u16; n]`. Sound unconditionally, at +**The withdrawn premise was doing double duty, which is why one retraction +untangles two findings.** It justified *this* `unsafe`, AND it was the reason the +census's original story — a pre-deblock scan that is blind to a hole the loop +filter later reads — looked plausible in the first place. The same measurement +that withdrew the safety argument (output varying with initial content) is what +made the blind-census reading wrong: there was never a blind pre-deblock scan, +only a `dump_stage16` that could not see half the chroma plane. So §12 and the +corrected stage bisect in §4 are the same fact read twice, and a later reader who +fixes one without the other will re-derive the error. + +**Three closures, none taken here:** + +1. **Explicit zero-fill** — restore `vec![0u16; n]`. Sound unconditionally, at the ~3% of frame-thread cycles at 4K that lane-picalloc removed. This is the safe default and the honest cost of the optimisation. -2. **Instrument reads-before-write** — a per-sample read/write map, so the premise +2. **Allocator-zeroed allocation** — a zeroed allocation can come from the + allocator rather than a loop: `alloc_zeroed` / anonymous mmap hands back zero + pages on first touch, which for plane-sized buffers costs a page fault rather + than a per-sample store. **This is an option that needs its own measurement, + not a claim that it is free** — the cost at 4K is unmeasured in this lane, and + "a page fault per page" is a mechanism, not a benchmark. Whoever takes it must + measure it before calling it cheaper than (1). +3. **Instrument reads-before-write** — a per-sample read/write map, so the premise can be proved rather than assumed. That is a real instrument, not a comment, - and it is the only route that keeps the optimisation. + and it is the only route that keeps the optimisation as-is. **Reachability evidence** (what makes this fileable rather than theoretical): a demonstrated read on `440_request_is_422` at `8d6998d7` — 224 unwritten samples,