lane-unwritten-dep r6: the SAFETY comment credited the gate with a census it does not perform
Browse files at this commitcaad117714cd82e253c84d50addbca1d99560929Parent: 691273f2 changed files +68 -32
- crates/ec-av1/src/decode.rs +31 -14
- lanes/unwritten-dep.report.md +37 -18
crates/ec-av1/src/decode.rsmodified+31 -14
| @@ -21172,7 +21172,9 @@ fn dump_stage16( | ||
| 21172 | 21172 | // "identical pre-deblock, differs post-deblock" off these dumps is then |
| 21173 | 21173 | // measuring the dump's blind spot, not the pipeline's: the samples it could |
| 21174 | 21174 | // not see are exactly the region where the 4:2:2 witness's output diverges |
| 21175 | - // (chroma rows 30..63, 2048 samples). `round_ss` is the same rounding the | |
| 21175 | + // (chroma rows 32..63 -- the old `fh.div_ceil(2)` crop wrote 32 of 64 rows, | |
| 21176 | + // so everything from row 32 up was invisible; 2048 samples). `round_ss` is | |
| 21177 | + // the same rounding the | |
| 21176 | 21178 | // decoder's own plane extents use, and it matches the oracle's |
| 21177 | 21179 | // `uv_crop_width` / `uv_crop_height` per axis. |
| 21178 | 21180 | // ONE file per frame: `dump_stage_idx` advances on every call, so creating |
| @@ -21744,25 +21746,38 @@ pub(crate) fn census_unwritten_final(y: &[u16], u: &[u16], v: &[u16]) { | ||
| 21744 | 21746 | /// This comment previously claimed the SB-padded surface "is written |
| 21745 | 21747 | /// sample-for-sample by the tile walk's reconstruction before anything reads |
| 21746 | 21748 | /// it", and cited the sentinel gate as proof. **That claim is RETRACTED by |
| 21747 | -/// measurement, in this same file**: on `440_request_is_422` the decode produced | |
| 21748 | -/// TWO different output hashes across five runs with uninitialised planes, one | |
| 21749 | -/// hash under `EC_AV1_PLANE_SENTINEL=1`, and a pre-deblock census of 112 | |
| 21750 | -/// unwritten samples per chroma plane (224 total) -- see | |
| 21751 | -/// `chroma_plane_block_codable`'s "What led here" paragraph and | |
| 21752 | -/// `lanes/av1unwritten.report.md`. Output that varies with the buffer's initial | |
| 21753 | -/// content means an uninitialised sample was READ. A reviewer approving this | |
| 21754 | -/// `unsafe` on the old text was approving it on a withdrawn proof. | |
| 21749 | +/// measurement.** The basis for the retraction is THIS LANE's own, not | |
| 21750 | +/// second-hand: on `440_request_is_422` an exact u16 whole-plane census at the | |
| 21751 | +/// pre-deblock point finds **112 unwritten samples per chroma plane, 224 total** | |
| 21752 | +/// (U and V, 28 whole 4x4 groups each, rows 36..63) in a frame that is SHOWN | |
| 21753 | +/// (`Key show=true`) and whose samples the caller receives. Uninitialised memory | |
| 21754 | +/// that reaches the caller was read, or the read that produced it was. That is | |
| 21755 | +/// the UB, and it needs no hash-variation claim to stand. | |
| 21756 | +/// | |
| 21757 | +/// A hash-variation observation also exists -- five plain runs of the same | |
| 21758 | +/// witness giving two different output hashes (`lanes/av1unwritten.report.md`), | |
| 21759 | +/// which would point the same way -- but it is SECOND-HAND and was NOT | |
| 21760 | +/// reproduced here: five plain runs on `8d6998d7` gave one hash | |
| 21761 | +/// (`a761118c8dd5c8d0`, `lanes/unwritten-dep.report.md` §10). It is not relied | |
| 21762 | +/// on, and the ambient content a run happens to receive is machine-dependent, | |
| 21763 | +/// so a stable value on one host and a varying one on another would be the same | |
| 21764 | +/// defect either way. The 224-sample census is the basis; the hashes are aside. | |
| 21755 | 21765 | /// |
| 21756 | 21766 | /// WHAT IS ACTUALLY ESTABLISHED, and it is weaker: |
| 21757 | 21767 | /// |
| 21758 | 21768 | /// * The sentinel gate ([`census_unwritten_final`], |
| 21759 | 21769 | /// `the_frame_the_caller_receives_carries_no_unwritten_plane_sample`) proves |
| 21760 | 21770 | /// that no sample the tile walk never wrote SURVIVES into the frame the caller |
| 21761 | -/// receives, on the corpus measured. It counts at two points -- pre-deblock and | |
| 21762 | -/// the output point -- so it measures SURVIVAL, not reads. | |
| 21771 | +/// receives, on the corpus measured. **It counts at the OUTPUT POINT ONLY -- | |
| 21772 | +/// one census, one scan.** The pre-deblock census ([`census_unwritten`], | |
| 21773 | +/// `take_unwritten_samples` / `take_census_scanned`) is a DIFFERENT instrument | |
| 21774 | +/// and has NO committed reader anywhere in the crate on `main`, so it backs | |
| 21775 | +/// nothing here; an earlier revision of this comment credited the gate with | |
| 21776 | +/// both, which would have told a reviewer the premise is covered by two scans | |
| 21777 | +/// when only one exists. It is measured SURVIVAL, not reads. | |
| 21763 | 21778 | /// * It does NOT prove "every sample is written before it is read". A sample read |
| 21764 | 21779 | /// as a prediction or filter neighbour and overwritten a moment later is |
| 21765 | -/// invisible to both counts. **No such read has been observed, and no | |
| 21780 | +/// invisible to that count. **No such read has been observed, and no | |
| 21766 | 21781 | /// instrument here measures for one.** |
| 21767 | 21782 | /// * On `main` = `e45cc748` the one path where a read was demonstrated is |
| 21768 | 21783 | /// UNREACHABLE: lane/av1unwritten refuses the subsize before descending. |
| @@ -21792,8 +21807,10 @@ fn fresh_plane(n: usize) -> Vec<u16> { | ||
| 21792 | 21807 | // sample before any read. That premise was RETRACTED by measurement (224 |
| 21793 | 21808 | // unwritten samples, output varying with initial content) on a path that is |
| 21794 | 21809 | // now refused, and is UNMEASURED everywhere else. The sentinel gate measures |
| 21795 | - // survival at two points, not reads. So this `unsafe` is sound under a | |
| 21796 | - // premise no current instrument proves. | |
| 21810 | + // survival at the output point, not reads. The pre-deblock census is a | |
| 21811 | + // separate instrument with no committed reader on main, so it adds nothing | |
| 21812 | + // here. So this `unsafe` is sound under a premise no current instrument | |
| 21813 | + // proves. | |
| 21797 | 21814 | #[allow(unsafe_code)] |
| 21798 | 21815 | unsafe { |
| 21799 | 21816 | v.set_len(n); |
lanes/unwritten-dep.report.mdmodified+37 -18
| @@ -348,22 +348,38 @@ this, so a reviewer can no longer approve the `unsafe` on a withdrawn proof. | ||
| 348 | 348 | **The retracted claim.** `fresh_plane`'s doc asserted the SB-padded surface "is |
| 349 | 349 | written sample-for-sample by the tile walk's reconstruction before anything reads |
| 350 | 350 | it", and cited the sentinel gate as proof ("proven by the sentinel gate above"). |
| 351 | -**The same file retracts it**, at `chroma_plane_block_codable`'s "What led here": | |
| 352 | -on `440_request_is_422`, five runs with uninitialised planes give **two different | |
| 353 | -output hashes**, five sentinel runs give one, and the pre-deblock census finds | |
| 354 | -**112 unwritten samples per chroma plane, 224 total** | |
| 355 | -(`lanes/av1unwritten.report.md:126-128`). Output that varies with the buffer's | |
| 356 | -initial content means an uninitialised sample was **read**. | |
| 357 | - | |
| 358 | -**What the gate actually proves — the weaker claim.** The sentinel census counts | |
| 359 | -at two points, pre-deblock and the output point, so it measures **survival, not | |
| 360 | -reads**: | |
| 351 | +**The same file retracts it.** The basis is **this lane's own measurement**, not | |
| 352 | +second-hand: on `440_request_is_422` an exact u16 whole-plane census at the | |
| 353 | +pre-deblock point finds **112 unwritten samples per chroma plane, 224 total** (U | |
| 354 | +and V, 28 whole 4×4 groups each, rows 36–63) in a frame that is **SHOWN** | |
| 355 | +(`Key show=true`) and whose samples the caller receives (§4, §5). Uninitialised | |
| 356 | +memory that reaches the caller was read, or the read that produced it was. That | |
| 357 | +is the UB, and it stands without any hash-variation claim. | |
| 358 | + | |
| 359 | +A hash-variation observation also exists — five plain runs of the witness giving | |
| 360 | +two different output hashes (`lanes/av1unwritten.report.md:118-124`) — but it is | |
| 361 | +**second-hand and NOT reproduced here**: five plain runs on `8d6998d7` gave one | |
| 362 | +hash, `a761118c8dd5c8d0` (§10). It is therefore not relied on, and it should not | |
| 363 | +have been stated flatly in the `decode.rs` comment, where it did read as this | |
| 364 | +lane's measurement. Ambient content is machine-dependent, so a stable value on one | |
| 365 | +host and a varying one on another would be the same defect either way; the | |
| 366 | +224-sample census is the basis, the hashes are an aside. | |
| 367 | + | |
| 368 | +**What the gate actually proves — the weaker claim.** The gate counts at the | |
| 369 | +**output point only**: one census, one scan. The pre-deblock census | |
| 370 | +(`census_unwritten`, `take_unwritten_samples` / `take_census_scanned`) is a | |
| 371 | +**different instrument with no committed reader anywhere in the crate on `main`** | |
| 372 | +(§13), so it backs nothing here. An earlier revision of this section credited | |
| 373 | +the gate with both, which would have told a reviewer auditing the `unsafe` that | |
| 374 | +the premise is covered by two scans when only one exists — and the missing one is | |
| 375 | +exactly the scan that would catch a hole before the filters. What the gate | |
| 376 | +measures is **survival, not reads**: | |
| 361 | 377 | |
| 362 | 378 | * PROVEN: no sample the tile walk never wrote **survives into the frame the |
| 363 | 379 | caller receives**, on the corpus measured. |
| 364 | 380 | * NOT PROVEN: "every sample is written before it is read". A sample read as a |
| 365 | 381 | prediction or filter neighbour and overwritten a moment later is invisible to |
| 366 | - both counts. **No such read has been observed, and no instrument in this crate | |
| 382 | + that count. **No such read has been observed, and no instrument in this crate | |
| 367 | 383 | measures for one.** |
| 368 | 384 | * On `main` = `e45cc748` the one path where a read was **demonstrated** is now |
| 369 | 385 | unreachable — lane/av1unwritten refuses the subsize before descending. |
| @@ -400,13 +416,16 @@ fixes one without the other will re-derive the error. | ||
| 400 | 416 | can be proved rather than assumed. That is a real instrument, not a comment, |
| 401 | 417 | and it is the only route that keeps the optimisation as-is. |
| 402 | 418 | |
| 403 | -**Reachability evidence** (what makes this fileable rather than theoretical): a | |
| 404 | -demonstrated read on `440_request_is_422` at `8d6998d7` — 224 unwritten samples, | |
| 405 | -output varying with initial content, two distinct plain hashes across five runs | |
| 406 | -— and that path is refused on `main`, so the corpus contains no *currently | |
| 407 | -reachable* instance. The claim that needs proving is universal ("every sample is | |
| 408 | -written before it is read"), and one refused witness cannot establish it for the | |
| 409 | -other 126 fixtures. | |
| 419 | +**Reachability evidence** (what makes this fileable rather than theoretical), | |
| 420 | +**this lane's own measurement**: on `440_request_is_422` at `8d6998d7`, an exact | |
| 421 | +u16 whole-plane census finds **224 unwritten chroma samples** (U 112, V 112, | |
| 422 | +whole 4×4 groups, rows 36–63) in a frame that is **SHOWN** and whose samples the | |
| 423 | +caller receives — uninitialised memory reaching the caller IS the UB, and it | |
| 424 | +needs no hash claim. That path is refused on `main`, so the corpus contains no | |
| 425 | +*currently reachable* instance; the hash-variation observation that also exists is | |
| 426 | +second-hand and was not reproduced here (§10), so it is not part of the basis. | |
| 427 | +The claim that needs proving is universal ("every sample is written before it is | |
| 428 | +read"), and one refused witness cannot establish it for the other 126 fixtures. | |
| 410 | 429 | |
| 411 | 430 | ## 13. Does this lane's gate supply the reader `take_unwritten_samples` lacked? — NO |
| 412 | 431 |