gate_coverage: settle the enable-tx-size-search floor by binding format!-built flags
Browse files at this commit9792668f02377445761605c2205d25ad0d8e5903Parent: 143cdf92 changed files +701 -47
- crates/ec-av1/src/gate_coverage.rs +463 -47
- lanes/av1txsearch.report.md +238 -0
crates/ec-av1/src/gate_coverage.rsmodified+463 -47
| @@ -125,39 +125,48 @@ enum On { | |||
| 125 | /// written, and the real-stream PANIC hiding behind that pin was found by | 125 | /// written, and the real-stream PANIC hiding behind that pin was found by |
| 126 | /// lane-ab16, not by this guard. `--loopfilter-control=0`, | 126 | /// lane-ab16, not by this guard. `--loopfilter-control=0`, |
| 127 | /// `--tile-columns=0` and a `--cpu-used` high enough to switch a search off are | 127 | /// `--tile-columns=0` and a `--cpu-used` high enough to switch a search off are |
| 128 | -/// the same shape. | 128 | +/// the same shape. `enable-tx-size-search` has since been SETTLED, in both |
| 129 | +/// directions -- see the entry below and `print_tx_size_search_census`. | ||
| 129 | /// | 130 | /// |
| 130 | /// The "all 49" count is GONE as of 2026-09-29 (lane-av1distwtd r2) and is | 131 | /// The "all 49" count is GONE as of 2026-09-29 (lane-av1distwtd r2) and is |
| 131 | -/// deliberately not replaced by a number: the tool is no longer pinned off | 132 | +/// deliberately not replaced by a number here: it is a snapshot that rots |
| 132 | -/// tree-wide, so any count would be a snapshot that rots the same way. | 133 | +/// every time a recipe changes. The live count is a TEST |
| 133 | -/// Measured on this tree for the record: 113 of the 146 selected gate bodies | 134 | +/// ([`print_tx_size_search_census`], below), not prose, so it cannot go stale |
| 134 | -/// name it, 88 pass `=0`, 15 pass `=1`, and 9 build the value into a | 135 | +/// silently -- re-run it and read the numbers rather than trusting a comment. |
| 135 | -/// `format!` variable the census cannot see -- so the historical claim no | ||
| 136 | -/// longer holds in EITHER direction, and the `enable-tx-size-search` entry | ||
| 137 | -/// below is a live question, not a settled one. | ||
| 138 | /// | 136 | /// |
| 139 | /// Each entry is `(tool, spellings, aomenc default, what counts as on)`. The | 137 | /// Each entry is `(tool, spellings, aomenc default, what counts as on)`. The |
| 140 | /// "defaulted means unknown" rule of [`NEVER_EXERCISED`] applies unchanged: a | 138 | /// "defaulted means unknown" rule of [`NEVER_EXERCISED`] applies unchanged: a |
| 141 | /// default of `1` does not prove the encoder picked the tool for any stream, so | 139 | /// default of `1` does not prove the encoder picked the tool for any stream, so |
| 142 | /// only a gate that spells an on-value at that bit depth retires an entry. | 140 | /// only a gate that spells an on-value at that bit depth retires an entry. |
| 143 | - // lane-av1distwtd r3: `enable-tx-size-search` is the one DEFAULT_ON_TOOLS | 141 | +// `enable-tx-size-search` SETTLED 2026-09-29 (lane-av1txsearch), by |
| 144 | - // entry the r2 audit could NOT settle, and the reason is a THIRD detector | 142 | +// measurement rather than by a name-shaped guess. The r3 note here said the |
| 145 | - // limit rather than a coverage fact. After the r3 call-resolving fix, 113 | 143 | +// count was a FLOOR: 9 gate bodies built the flag into a `format!` |
| 146 | - // of the 230 selected gates name it: 88 pass `=0`, 15 pass `=1`, and 9 | 144 | +// variable that neither `flags_in` nor `settings_in` could see, because |
| 147 | - // build the value into a `format!`/`String` variable that neither | 145 | +// both scan for a literal `"--flag=value"` inside one segment. The method |
| 148 | - // `flags_in` nor `settings_in` can see, because both scan for a literal | 146 | +// r3 asked for is now [`spelling_values`] -> [`bound_values`], and it |
| 149 | - // `"--flag=value"` inside one segment. | 147 | +// resolves all of them; `print_tx_size_search_census` asserts the |
| 150 | - // | 148 | +// unresolvable count is ZERO, so the floor cannot come back unnoticed. |
| 151 | - // WHAT WOULD SETTLE IT, for whoever takes it next -- the method, not a | 149 | +// |
| 152 | - // guess: extend `flags_in`/`settings_in` to resolve a local binding, the | 150 | +// THE ENTRY IS RETIRED, on an ARRIVAL ASSERT rather than on the spelling. |
| 153 | - // same way `gate_bodies` now resolves calls. Concretely, when a segment | 151 | +// `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` |
| 154 | - // contains `let <name> = format!("--enable-tx-size-search={tx_search}")` | 152 | +// spells `--enable-tx-size-search=1` as a literal and hard-asserts |
| 155 | - // (or a `String::from`/`to_string` of the same shape), record the | 153 | +// `compared_tx_depths > 0` -- "never produced a nonzero tx depth on a |
| 156 | - // TEMPLATE and bind the variable's value at each use site. Re-count, and | 154 | +// compared attempt -- the flag did not arrive". `tx_depth` is read ONLY |
| 157 | - // only then decide whether the tool is a live hole. Until that exists the | 155 | +// under the frame header's `tx_mode_select` bit (spec 5.11.16, |
| 158 | - // count above is a floor, not a measurement: 9 gates are unclassified in | 156 | +// `decode.rs`: the read is guarded by `tx_select_inter`), so a nonzero |
| 159 | - // an unknown direction, and an unknown direction is exactly the failure | 157 | +// counter IS the parsed tx-size-search behaviour, not a proxy for it. |
| 160 | - // mode this file exists to prevent. | 158 | +// Measured run of that gate on this tree (aom 3.13.3): 12 pixel-exact |
| 159 | +// decodes, 0 named refusals, 6 of the 12 at 10 BIT, 219 rect coefficient | ||
| 160 | +// TUs on compared attempts, and `flag arrival: ... tx depths 53` -- so the | ||
| 161 | +// tool is exercised at BOTH depths, and the assertion is not vacuous. | ||
| 162 | +// | ||
| 163 | +// The `tx_select_inter_gate` twins | ||
| 164 | +// (`a_real_aomenc_inter_sequence_with_tx_select_decodes_pixel_exact{,_10bit}`) | ||
| 165 | +// are the stronger witness still: they DELIBERATELY omit the flag | ||
| 166 | +// ("DELIBERATELY ABSENT: --enable-tx-size-search=0") and assert | ||
| 167 | +// `decode::txfm_split_hits()` moved, proving the var-tx `txfm_split` tree | ||
| 168 | +// of spec 5.11.17 is read -- an inter transform is then a recursive split | ||
| 169 | +// tree, which is the whole content of the tool. | ||
| 161 | #[cfg(test)] | 170 | #[cfg(test)] |
| 162 | const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[ | 171 | const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[ |
| 163 | ( | 172 | ( |
| @@ -410,8 +419,8 @@ const NEVER_ON_10BIT: &[(&str, &str)] = &[]; | |||
| 410 | #[cfg(test)] | 419 | #[cfg(test)] |
| 411 | mod tests { | 420 | mod tests { |
| 412 | use super::{ | 421 | use super::{ |
| 413 | - On, ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_10BIT, | 422 | + ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_8BIT, NEVER_EXERCISED_10BIT, |
| 414 | - NEVER_EXERCISED_8BIT, NEVER_ON_10BIT, NEVER_ON_8BIT, TOOL_UNIVERSE, | 423 | + NEVER_ON_8BIT, NEVER_ON_10BIT, On, TOOL_UNIVERSE, |
| 415 | }; | 424 | }; |
| 416 | use std::collections::{BTreeMap, BTreeSet}; | 425 | use std::collections::{BTreeMap, BTreeSet}; |
| 417 | 426 | ||
| @@ -570,24 +579,262 @@ mod tests { | |||
| 570 | here | 579 | here |
| 571 | } | 580 | } |
| 572 | 581 | ||
| 573 | - /// Whether a gate body spells one [`DEFAULT_ON_TOOLS`] entry on / off. | 582 | + /// The values a `--<flag>={var}` TEMPLATE can take in one gate body, from |
| 574 | - fn default_on_state(gate: &str, spellings: &[&str], on: On) -> Option<bool> { | 583 | + /// the local binding of `var`. |
| 575 | - let here = settings_in(gate); | 584 | + /// |
| 576 | - let mut state = None; | 585 | + /// lane-av1txsearch: `settings_in` reads a `--flag=value` string LITERAL, |
| 577 | - for spelling in spellings { | 586 | + /// so a flag a gate builds with `format!` was invisible to it -- 10 gate |
| 578 | - let Some(value) = here.get(*spelling) else { | 587 | + /// bodies spell `--enable-tx-size-search` only this way, and the census |
| 588 | + /// filed them as "defaulted", i.e. unknown in BOTH directions. The | ||
| 589 | + /// bindings that actually exist in `stream.rs` are four shapes, and each | ||
| 590 | + /// is resolved from the gate's own text rather than from the variable's | ||
| 591 | + /// name: | ||
| 592 | + /// | ||
| 593 | + /// 1. `let <var> = if <attempt> == 0 { "0" } else { "1" };` -- an | ||
| 594 | + /// attempt-indexed arm; the QUOTED values in the initializer are | ||
| 595 | + /// collected. Bare integers in the initializer (`attempt % 2`) are | ||
| 596 | + /// deliberately NOT read as flag values. | ||
| 597 | + /// 2. `for <var> in [0usize, 1]` / `["0", "1"]` -- a loop over both | ||
| 598 | + /// values; every element of the array is collected. | ||
| 599 | + /// 3. `for (<var>, <other>) in [("1", 8u8), ("0", 8u8), ...]` -- a | ||
| 600 | + /// tuple-destructured loop; only the element at `<var>`'s POSITION is | ||
| 601 | + /// collected from each tuple, so the arm table's bit-depth column is | ||
| 602 | + /// not read as a flag value. | ||
| 603 | + /// 4. `u8::from(<a>.<field>)` over a struct-literal arm table whose | ||
| 604 | + /// `field: true` / `field: false` rows are the flag values. | ||
| 605 | + /// | ||
| 606 | + /// `None` means the binding is NOT in this body -- the variable is a | ||
| 607 | + /// parameter of a shared helper and its value is bound at the CALL SITE, | ||
| 608 | + /// which lives in a different `#[`-segment. That is a real limit of a | ||
| 609 | + /// per-segment census and is reported as unknown rather than guessed: | ||
| 610 | + /// inferring the value from the variable's name is the exact failure this | ||
| 611 | + /// function exists to remove. | ||
| 612 | + fn bound_values(body: &str, var: &str) -> Option<BTreeSet<char>> { | ||
| 613 | + // Quoted single digits: `"0"`, `"1"`. | ||
| 614 | + let quoted_digits = |t: &str| -> BTreeSet<char> { | ||
| 615 | + let mut out = BTreeSet::new(); | ||
| 616 | + let mut at = 0usize; | ||
| 617 | + while let Some(rel) = t[at..].find('"') { | ||
| 618 | + let start = at + rel + 1; | ||
| 619 | + let Some(end) = t[start..].find('"') else { | ||
| 620 | + break; | ||
| 621 | + }; | ||
| 622 | + let literal = &t[start..start + end]; | ||
| 623 | + if literal.len() == 1 { | ||
| 624 | + if let Some(c) = literal.chars().next() { | ||
| 625 | + if c.is_ascii_digit() { | ||
| 626 | + out.insert(c); | ||
| 627 | + } | ||
| 628 | + } | ||
| 629 | + } | ||
| 630 | + at = start + end + 1; | ||
| 631 | + } | ||
| 632 | + out | ||
| 633 | + }; | ||
| 634 | + // Bare integer literals: `0usize`, `1`, `8u8`. Whole tokens only, so | ||
| 635 | + // `10u8` contributes nothing rather than a bogus `1`. | ||
| 636 | + let bare_digits = |t: &str| -> BTreeSet<char> { | ||
| 637 | + let mut out = BTreeSet::new(); | ||
| 638 | + let bytes = t.as_bytes(); | ||
| 639 | + let mut i = 0usize; | ||
| 640 | + while i < bytes.len() { | ||
| 641 | + if !bytes[i].is_ascii_digit() { | ||
| 642 | + i += 1; | ||
| 643 | + continue; | ||
| 644 | + } | ||
| 645 | + let start = i; | ||
| 646 | + while i < bytes.len() && bytes[i].is_ascii_digit() { | ||
| 647 | + i += 1; | ||
| 648 | + } | ||
| 649 | + let clean_before = start == 0 || !is_ident_byte(bytes[start - 1]); | ||
| 650 | + // A typed literal's suffix (`0usize`, `8u8`, `1u32`) belongs to | ||
| 651 | + // the same token, so a run of LOWERCASE letters right after | ||
| 652 | + // the digit is a type, not a different identifier. Anything | ||
| 653 | + // else -- a multi-digit `10u8`, a camelCase `1x` -- is not a | ||
| 654 | + // flag value and is rejected. | ||
| 655 | + let rest = &t[i..]; | ||
| 656 | + let suffix = rest | ||
| 657 | + .bytes() | ||
| 658 | + .take_while(|b| b.is_ascii_lowercase() || *b == b'_') | ||
| 659 | + .count(); | ||
| 660 | + let clean_after = i >= bytes.len() | ||
| 661 | + || !is_ident_byte(bytes[i]) | ||
| 662 | + || (suffix > 0 | ||
| 663 | + && i + suffix < bytes.len() | ||
| 664 | + && !is_ident_byte(bytes[i + suffix])); | ||
| 665 | + if clean_before && clean_after && i - start == 1 { | ||
| 666 | + out.insert(bytes[start] as char); | ||
| 667 | + } | ||
| 668 | + } | ||
| 669 | + out | ||
| 670 | + }; | ||
| 671 | + // Split a comma-separated list at TOP level only, so `("1", 8u8)` | ||
| 672 | + // stays one element. | ||
| 673 | + fn split_top<'a>(t: &'a str) -> Vec<&'a str> { | ||
| 674 | + let mut out = Vec::new(); | ||
| 675 | + let (mut depth, mut start) = (0i32, 0usize); | ||
| 676 | + for (i, c) in t.char_indices() { | ||
| 677 | + match c { | ||
| 678 | + '(' | '[' | '{' => depth += 1, | ||
| 679 | + ')' | ']' | '}' => depth -= 1, | ||
| 680 | + ',' if depth == 0 => { | ||
| 681 | + out.push(t[start..i].trim()); | ||
| 682 | + start = i + 1; | ||
| 683 | + } | ||
| 684 | + _ => {} | ||
| 685 | + } | ||
| 686 | + } | ||
| 687 | + if start < t.len() { | ||
| 688 | + out.push(t[start..].trim()); | ||
| 689 | + } | ||
| 690 | + out | ||
| 691 | + } | ||
| 692 | + // The body of the `[...]` that FOLLOWS `head` in `text`. Scoped to | ||
| 693 | + // the header rather than searching from the start of the body: a | ||
| 694 | + // gate's first `[` may be an unrelated array, and brackets that do | ||
| 695 | + // not balance across a whole gate body would leave the depth count | ||
| 696 | + // never returning to zero. | ||
| 697 | + fn loop_array_after<'a>(text: &'a str, head: &str) -> Option<&'a str> { | ||
| 698 | + let at = text.find(head)? + head.len(); | ||
| 699 | + let open = at + text[at..].find('[')?; | ||
| 700 | + let mut depth = 0i32; | ||
| 701 | + for (i, c) in text[open..].char_indices() { | ||
| 702 | + match c { | ||
| 703 | + '[' => depth += 1, | ||
| 704 | + ']' => { | ||
| 705 | + depth -= 1; | ||
| 706 | + if depth == 0 { | ||
| 707 | + return Some(&text[open + 1..open + i]); | ||
| 708 | + } | ||
| 709 | + } | ||
| 710 | + _ => {} | ||
| 711 | + } | ||
| 712 | + } | ||
| 713 | + None | ||
| 714 | + } | ||
| 715 | + let mut found: Option<BTreeSet<char>> = None; | ||
| 716 | + let mut merge = |set: BTreeSet<char>| match &mut found { | ||
| 717 | + Some(all) => all.extend(set), | ||
| 718 | + None => found = Some(set), | ||
| 719 | + }; | ||
| 720 | + // (1) `let <var> = if ... { "0" } else { "1" };` -- quoted values only. | ||
| 721 | + if let Some(at) = body.find(&format!("let {var} =")) { | ||
| 722 | + let init = &body[at..]; | ||
| 723 | + let end = init.find(';').unwrap_or(init.len()); | ||
| 724 | + merge(quoted_digits(&init[..end])); | ||
| 725 | + } | ||
| 726 | + // (2) `for <var> in [...]` -- every element of the array. | ||
| 727 | + if let Some(array) = loop_array_after(body, &format!("for {var} in ")) { | ||
| 728 | + merge(bare_digits(array)); | ||
| 729 | + merge(quoted_digits(array)); | ||
| 730 | + } | ||
| 731 | + // (3) `for (<var>, ...) in [(...), ...]` -- only `<var>`'s column. | ||
| 732 | + if let Some(at) = body.find("for (") { | ||
| 733 | + let head = &body[at..]; | ||
| 734 | + if let Some(close) = head.find(')') { | ||
| 735 | + let pattern = &head["for (".len()..close]; | ||
| 736 | + if let Some(pos) = pattern.split(',').position(|p| p.trim() == var) { | ||
| 737 | + let header = format!("for ({pattern}) in "); | ||
| 738 | + if let Some(array) = loop_array_after(body, &header) { | ||
| 739 | + let mut set: BTreeSet<char> = BTreeSet::new(); | ||
| 740 | + for tuple in split_top(array) { | ||
| 741 | + let Some(inner) = | ||
| 742 | + tuple.strip_prefix('(').and_then(|t| t.strip_suffix(')')) | ||
| 743 | + else { | ||
| 744 | + continue; | ||
| 745 | + }; | ||
| 746 | + let fields = split_top(inner); | ||
| 747 | + let Some(field) = fields.get(pos) else { | ||
| 748 | + continue; | ||
| 749 | + }; | ||
| 750 | + set.extend(bare_digits(field)); | ||
| 751 | + set.extend(quoted_digits(field)); | ||
| 752 | + } | ||
| 753 | + merge(set); | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + } | ||
| 757 | + } | ||
| 758 | + // (4) `u8::from(<a>.<field>)` over a struct-literal arm table. | ||
| 759 | + for (i, _) in body.match_indices("u8::from(") { | ||
| 760 | + let arg = &body[i + "u8::from(".len()..]; | ||
| 761 | + let Some(close) = arg.find(')') else { continue }; | ||
| 762 | + let field = arg[..close].rsplit('.').next().unwrap_or_default().trim(); | ||
| 763 | + if field.is_empty() || !field.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') { | ||
| 579 | continue; | 764 | continue; |
| 580 | - }; | 765 | + } |
| 581 | - let Ok(value) = value.parse::<u32>() else { | 766 | + let mut set = BTreeSet::new(); |
| 767 | + for (row, value) in [("true", '1'), ("false", '0')] { | ||
| 768 | + if body.contains(&format!("{field}: {row}")) { | ||
| 769 | + set.insert(value); | ||
| 770 | + } | ||
| 771 | + } | ||
| 772 | + merge(set); | ||
| 773 | + } | ||
| 774 | + found | ||
| 775 | + } | ||
| 776 | + | ||
| 777 | + fn is_ident_byte(b: u8) -> bool { | ||
| 778 | + b.is_ascii_alphanumeric() || b == b'_' | ||
| 779 | + } | ||
| 780 | + | ||
| 781 | + /// Values of one [`DEFAULT_ON_TOOLS`] spelling in one gate body: the | ||
| 782 | + /// literal `--<spelling>=<digit>` spellings plus every value a `format!` | ||
| 783 | + /// template built from a local binding resolves to. | ||
| 784 | + /// | ||
| 785 | + /// A gate that reaches BOTH values counts ON, not off: it builds a `=1` | ||
| 786 | + /// stream on some attempt, which is what the census asks for. This is the | ||
| 787 | + /// file's standing "any spelling that says on wins" rule | ||
| 788 | + /// (`--tile-columns=0 --tile-rows=1` is a multi-tile stream), now applied | ||
| 789 | + /// across a loop's arms as well as across spellings. | ||
| 790 | + fn spelling_values(gate: &str, spelling: &str) -> BTreeSet<char> { | ||
| 791 | + let mut out = BTreeSet::new(); | ||
| 792 | + // A literal `"--<spelling>=<digit>"`: the needle ends at the `=`, so | ||
| 793 | + // the value starts AT the needle's length, not three characters in. | ||
| 794 | + let literal = format!("\"--{spelling}="); | ||
| 795 | + for (i, _) in gate.match_indices(&literal) { | ||
| 796 | + let rest = &gate[i + literal.len()..]; | ||
| 797 | + let Some(end) = rest.find('"') else { continue }; | ||
| 798 | + if let Some(c) = rest[..end].chars().next() { | ||
| 799 | + if c.is_ascii_digit() { | ||
| 800 | + out.insert(c); | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + } | ||
| 804 | + // A template `format!("--<spelling>={<var>}")`: the placeholder name | ||
| 805 | + // is the part between the braces, and its VALUE is whatever the | ||
| 806 | + // binding of `<var>` in this same body reaches. | ||
| 807 | + let template = format!("format!(\"--{spelling}="); | ||
| 808 | + for (i, _) in gate.match_indices(&template) { | ||
| 809 | + let rest = &gate[i + template.len()..]; | ||
| 810 | + let Some(end) = rest.find('"') else { continue }; | ||
| 811 | + let Some(var) = rest[..end] | ||
| 812 | + .strip_prefix('{') | ||
| 813 | + .and_then(|v| v.strip_suffix('}')) | ||
| 814 | + else { | ||
| 582 | continue; | 815 | continue; |
| 583 | }; | 816 | }; |
| 584 | - let is_on = match on { | 817 | + if var.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') { |
| 585 | - On::NonZero => value != 0, | 818 | + out.extend(bound_values(gate, var).unwrap_or_default()); |
| 586 | - On::AtMost(limit) => value <= limit, | 819 | + } |
| 587 | - }; | 820 | + } |
| 588 | - // Any spelling that says "on" wins: --tile-columns=0 --tile-rows=1 | 821 | + out |
| 589 | - // is a multi-tile stream. | 822 | + } |
| 590 | - state = Some(state.unwrap_or(false) || is_on); | 823 | + |
| 824 | + /// Whether a gate body spells one [`DEFAULT_ON_TOOLS`] entry on / off, | ||
| 825 | + /// over [`spelling_values`] -- so a `format!`-built flag is classified | ||
| 826 | + /// instead of being filed as "defaulted". | ||
| 827 | + fn resolved_on_state(gate: &str, spellings: &[&str], on: On) -> Option<bool> { | ||
| 828 | + let mut state = None; | ||
| 829 | + for spelling in spellings { | ||
| 830 | + for c in spelling_values(gate, spelling) { | ||
| 831 | + let value = c.to_digit(10).unwrap_or(0); | ||
| 832 | + let is_on = match on { | ||
| 833 | + On::NonZero => value != 0, | ||
| 834 | + On::AtMost(limit) => value <= limit, | ||
| 835 | + }; | ||
| 836 | + state = Some(state.unwrap_or(false) || is_on); | ||
| 837 | + } | ||
| 591 | } | 838 | } |
| 592 | state | 839 | state |
| 593 | } | 840 | } |
| @@ -746,9 +993,7 @@ mod tests { | |||
| 746 | // it to the 8-bit bucket, not just the 10-bit one. | 993 | // it to the 8-bit bucket, not just the 10-bit one. |
| 747 | let flip = gates | 994 | let flip = gates |
| 748 | .iter() | 995 | .iter() |
| 749 | - .find(|b| { | 996 | + .find(|b| b.contains("a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform")) |
| 750 | - b.contains("a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform") | ||
| 751 | - }) | ||
| 752 | .expect("the flip-idtx gate must be seen"); | 997 | .expect("the flip-idtx gate must be seen"); |
| 753 | assert!( | 998 | assert!( |
| 754 | covers_both_depths(flip), | 999 | covers_both_depths(flip), |
| @@ -901,9 +1146,12 @@ mod tests { | |||
| 901 | .collect(); | 1146 | .collect(); |
| 902 | let mut per_tool = BTreeMap::new(); | 1147 | let mut per_tool = BTreeMap::new(); |
| 903 | for &(tool, spellings, _, on) in DEFAULT_ON_TOOLS { | 1148 | for &(tool, spellings, _, on) in DEFAULT_ON_TOOLS { |
| 1149 | + // lane-av1txsearch: `resolved_on_state`, not `default_on_state` -- | ||
| 1150 | + // the literal-only reader filed every `format!`-built flag as | ||
| 1151 | + // "defaulted", which is unknown rather than measured. | ||
| 904 | let states: Vec<Option<bool>> = gates | 1152 | let states: Vec<Option<bool>> = gates |
| 905 | .iter() | 1153 | .iter() |
| 906 | - .map(|g| default_on_state(g, spellings, on)) | 1154 | + .map(|g| resolved_on_state(g, spellings, on)) |
| 907 | .collect(); | 1155 | .collect(); |
| 908 | let turned_on = states.iter().filter(|s| **s == Some(true)).count(); | 1156 | let turned_on = states.iter().filter(|s| **s == Some(true)).count(); |
| 909 | let turned_off = states.iter().filter(|s| **s == Some(false)).count(); | 1157 | let turned_off = states.iter().filter(|s| **s == Some(false)).count(); |
| @@ -998,4 +1246,172 @@ mod tests { | |||
| 998 | } | 1246 | } |
| 999 | } | 1247 | } |
| 1000 | } | 1248 | } |
| 1249 | + | ||
| 1250 | + /// lane-av1txsearch: the `enable-tx-size-search` census, MEASURED rather | ||
| 1251 | + /// than floored. Prints, per gate body, the values the resolver reads for | ||
| 1252 | + /// the flag -- literal spellings and `format!` templates alike -- and the | ||
| 1253 | + /// three-way split at the end. Re-run it after any gate recipe change: | ||
| 1254 | + /// | ||
| 1255 | + /// `cargo test -p ec-av1 --lib gate_coverage::tests::print_tx_size_search_census -- --nocapture` | ||
| 1256 | + #[test] | ||
| 1257 | + fn print_tx_size_search_census() { | ||
| 1258 | + const TOOL: &str = "enable-tx-size-search"; | ||
| 1259 | + let (zero, one, both, unresolvable, unnamed) = { | ||
| 1260 | + let (mut zero, mut one, mut both, mut unresolvable, mut unnamed) = | ||
| 1261 | + (0usize, 0usize, 0usize, 0usize, 0usize); | ||
| 1262 | + for gate in gate_bodies() { | ||
| 1263 | + let values = spelling_values(gate, TOOL); | ||
| 1264 | + let name = gate | ||
| 1265 | + .split("fn ") | ||
| 1266 | + .nth(1) | ||
| 1267 | + .and_then(|s| s.split('(').next()) | ||
| 1268 | + .unwrap_or("<segment>") | ||
| 1269 | + .to_owned(); | ||
| 1270 | + let state = match (values.contains(&'0'), values.contains(&'1')) { | ||
| 1271 | + (false, false) => { | ||
| 1272 | + unnamed += 1; | ||
| 1273 | + "not named (defaulted)" | ||
| 1274 | + } | ||
| 1275 | + (true, false) => { | ||
| 1276 | + zero += 1; | ||
| 1277 | + "=0" | ||
| 1278 | + } | ||
| 1279 | + (false, true) => { | ||
| 1280 | + one += 1; | ||
| 1281 | + "=1" | ||
| 1282 | + } | ||
| 1283 | + (true, true) => { | ||
| 1284 | + both += 1; | ||
| 1285 | + "=0 and =1 (one arm each)" | ||
| 1286 | + } | ||
| 1287 | + }; | ||
| 1288 | + let via = if gate.contains(&format!("format!(\"--{TOOL}=")) { | ||
| 1289 | + " [format! template resolved]" | ||
| 1290 | + } else { | ||
| 1291 | + "" | ||
| 1292 | + }; | ||
| 1293 | + let helper = if gate.contains(&format!("format!(\"--{TOOL}=")) && values.is_empty() | ||
| 1294 | + { | ||
| 1295 | + " [UNRESOLVED: variable is a shared helper's parameter]" | ||
| 1296 | + } else { | ||
| 1297 | + "" | ||
| 1298 | + }; | ||
| 1299 | + if !helper.is_empty() { | ||
| 1300 | + unresolvable += 1; | ||
| 1301 | + unnamed -= 1; | ||
| 1302 | + } | ||
| 1303 | + println!("{name}: {state}{via}{helper}"); | ||
| 1304 | + } | ||
| 1305 | + (zero, one, both, unresolvable, unnamed) | ||
| 1306 | + }; | ||
| 1307 | + let total = gate_bodies().len(); | ||
| 1308 | + println!( | ||
| 1309 | + "enable-tx-size-search over {total} census-selected gate bodies: \ | ||
| 1310 | + =0 only {zero}, =1 only {one}, both {both}, unresolvable {unresolvable}, \ | ||
| 1311 | + not named {unnamed}" | ||
| 1312 | + ); | ||
| 1313 | + assert_eq!( | ||
| 1314 | + unresolvable, 0, | ||
| 1315 | + "{unresolvable} gate bodies build --{TOOL} into a variable this census cannot bind -- \ | ||
| 1316 | + the count is a floor again, and an unknown direction is the failure mode this file \ | ||
| 1317 | + exists to prevent" | ||
| 1318 | + ); | ||
| 1319 | + } | ||
| 1320 | + | ||
| 1321 | + /// lane-av1txsearch: the RED-BEFORE proof for the template resolver, in | ||
| 1322 | + /// both directions, on the gate bodies that actually exist. | ||
| 1323 | + /// | ||
| 1324 | + /// Direction 1 -- a `format!`-built value MOVES the classification. Each | ||
| 1325 | + /// case below takes a real gate body, mutates only the bound value, and | ||
| 1326 | + /// asserts the resolved state changed. A resolver that found nothing | ||
| 1327 | + /// would read every one of these as "not named" and fail all four. | ||
| 1328 | + /// | ||
| 1329 | + /// Direction 2 -- a spelling the LITERAL reader already saw still | ||
| 1330 | + /// classifies. Without this half, a resolver that overwrote the literal | ||
| 1331 | + /// path would pass direction 1 while losing the 15 `=1` gates the census | ||
| 1332 | + /// already counted. | ||
| 1333 | + #[test] | ||
| 1334 | + fn the_resolver_binds_a_format_built_flag_in_both_directions() { | ||
| 1335 | + let gates = gate_bodies(); | ||
| 1336 | + let find = |needle: &str| -> &'static str { | ||
| 1337 | + gates | ||
| 1338 | + .iter() | ||
| 1339 | + .copied() | ||
| 1340 | + .find(|b| b.contains(needle)) | ||
| 1341 | + .unwrap_or_else(|| panic!("no gate body contains {needle:?}")) | ||
| 1342 | + }; | ||
| 1343 | + // Direction 1, one per template shape. | ||
| 1344 | + let cases = [ | ||
| 1345 | + ( | ||
| 1346 | + "format!(\"--enable-tx-size-search={txs}\")", | ||
| 1347 | + "for txs in [0usize, 1]", | ||
| 1348 | + "for txs in [0usize, 0]", | ||
| 1349 | + "a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact", | ||
| 1350 | + ), | ||
| 1351 | + ( | ||
| 1352 | + "format!(\"--enable-tx-size-search={tx_search}\")", | ||
| 1353 | + "if attempt % 2 == 0 { \"0\" } else { \"1\" }", | ||
| 1354 | + "if attempt % 2 == 0 { \"0\" } else { \"0\" }", | ||
| 1355 | + "a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact", | ||
| 1356 | + ), | ||
| 1357 | + ( | ||
| 1358 | + "format!(\"--enable-tx-size-search={tx_search}\")", | ||
| 1359 | + "for (tx_search, bit_depth) in [(\"1\", 8u8), (\"0\", 8u8), (\"1\", 10u8)]", | ||
| 1360 | + "for (tx_search, bit_depth) in [(\"0\", 8u8), (\"0\", 8u8), (\"0\", 10u8)]", | ||
| 1361 | + "a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact", | ||
| 1362 | + ), | ||
| 1363 | + ]; | ||
| 1364 | + for (template, from, to, name) in cases { | ||
| 1365 | + let body = find(name); | ||
| 1366 | + assert!( | ||
| 1367 | + body.contains(template), | ||
| 1368 | + "{name} does not spell {template}, so this case proves nothing" | ||
| 1369 | + ); | ||
| 1370 | + assert!( | ||
| 1371 | + body.contains(from), | ||
| 1372 | + "{name} does not contain the source binding {from:?}" | ||
| 1373 | + ); | ||
| 1374 | + let before = spelling_values(body, "enable-tx-size-search"); | ||
| 1375 | + let mutated = body.replace(from, to); | ||
| 1376 | + assert_ne!( | ||
| 1377 | + mutated, body, | ||
| 1378 | + "the mutation {from:?} -> {to:?} changed nothing" | ||
| 1379 | + ); | ||
| 1380 | + let after = spelling_values(&mutated, "enable-tx-size-search"); | ||
| 1381 | + assert_eq!( | ||
| 1382 | + before, | ||
| 1383 | + BTreeSet::from(['0', '1']), | ||
| 1384 | + "{name}: the unmutated body should resolve to both values, got {before:?}" | ||
| 1385 | + ); | ||
| 1386 | + assert_eq!( | ||
| 1387 | + after, | ||
| 1388 | + BTreeSet::from(['0']), | ||
| 1389 | + "{name}: mutating the bound value {from:?} -> {to:?} did not move the \ | ||
| 1390 | + classification (still {after:?}) -- the resolver is not reading the binding" | ||
| 1391 | + ); | ||
| 1392 | + } | ||
| 1393 | + // Direction 2: every gate the LITERAL reader already classified as | ||
| 1394 | + // `=1` still is. Asserted as CONTAINMENT, not equality: a segment may | ||
| 1395 | + // spell the flag twice (`=0` in the base recipe, `=1` as the per-arm | ||
| 1396 | + // override), and the old reader took the last one while the resolver | ||
| 1397 | + // takes the set. The claim being pinned is "still on", which is the | ||
| 1398 | + // direction a regression would lose. | ||
| 1399 | + let mut pinned = 0usize; | ||
| 1400 | + for gate in &gates { | ||
| 1401 | + if !gate.contains("\"--enable-tx-size-search=1\"") { | ||
| 1402 | + continue; | ||
| 1403 | + } | ||
| 1404 | + pinned += 1; | ||
| 1405 | + assert!( | ||
| 1406 | + spelling_values(gate, "enable-tx-size-search").contains(&'1'), | ||
| 1407 | + "a gate that literally spells --enable-tx-size-search=1 is no longer \ | ||
| 1408 | + classified on: {:?}", | ||
| 1409 | + &gate[..gate.len().min(80)] | ||
| 1410 | + ); | ||
| 1411 | + } | ||
| 1412 | + assert!( | ||
| 1413 | + pinned >= 10, | ||
| 1414 | + "expected the literal `=1` gates to still be there, found {pinned}" | ||
| 1415 | + ); | ||
| 1416 | + } | ||
| 1001 | } | 1417 | } |
lanes/av1txsearch.report.mdadded+238 -0
| @@ -0,0 +1,238 @@ | |||
| 1 | +# lane-av1txsearch — settle the `enable-tx-size-search` census floor | ||
| 2 | + | ||
| 3 | +Worktree `~/.cache/wt/av1txsearch`, branch `lane-av1txsearch`, based on `1aaf7e0b` | ||
| 4 | +(lane-av1distwtd r3, the call-resolving census fix — read as prior art, not | ||
| 5 | +duplicated). Owns `crates/ec-av1/src/gate_coverage.rs` only. `stream.rs` and | ||
| 6 | +every decoder file are byte-identical to the base. | ||
| 7 | + | ||
| 8 | +## The claim that was a floor | ||
| 9 | + | ||
| 10 | +r3 left this in-file, above `DEFAULT_ON_TOOLS`: | ||
| 11 | + | ||
| 12 | +> 113 of the 230 selected gates name it: 88 pass `=0`, 15 pass `=1`, and 9 | ||
| 13 | +> build the value into a `format!`/`String` variable that neither `flags_in` | ||
| 14 | +> nor `settings_in` can see … Until that exists the count above is a floor, not | ||
| 15 | +> a measurement: 9 gates are unclassified in an unknown direction. | ||
| 16 | + | ||
| 17 | +An unknown direction is the failure this file exists to prevent, so the entry | ||
| 18 | +could not be retired on the numbers as they stood. This lane settles it. | ||
| 19 | + | ||
| 20 | +## 1. The templates | ||
| 21 | + | ||
| 22 | +`grep -n 'format!("--enable-tx-size-search' crates/ec-av1/src/stream.rs` returns | ||
| 23 | +**10** sites, not 9 — the extra one is a segment that spells the flag BOTH as a | ||
| 24 | +literal and through a template, so r3's literal reader filed it under the | ||
| 25 | +literal and it never showed up in the unknown column. All ten are `format!` with | ||
| 26 | +an inline captured placeholder; there is no `String::from`/`to_string`/ | ||
| 27 | +`push_str` shape and no positional-`{}` shape for this flag. The single | ||
| 28 | +positional-`{}` site in the file is a different flag | ||
| 29 | +(`a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` uses | ||
| 30 | +`u8::from(a.tx_size_search)`, below). | ||
| 31 | + | ||
| 32 | +Four binding shapes cover all ten: | ||
| 33 | + | ||
| 34 | +| # | template | binding shapes seen | | ||
| 35 | +|---|----------|--------------------| | ||
| 36 | +| T1 | `format!("--enable-tx-size-search={txs}")` | `for txs in [0usize, 1]`, `for txs in ["0", "1"]` | | ||
| 37 | +| T2 | `format!("--enable-tx-size-search={tx_search}")` | `let tx_search = if attempt % 2 == 0 { "0" } else { "1" };` and the `attempt == 0` variant | | ||
| 38 | +| T3 | `format!("--enable-tx-size-search={tx_search}")` | `for (tx_search, bit_depth) in [("1", 8u8), ("0", 8u8), ("1", 10u8)]` (tuple-destructured loop) | | ||
| 39 | +| T4 | `format!("--enable-tx-size-search={}", u8::from(a.tx_size_search))` | positional arg; value from a struct-literal arm table's `tx_size_search: true/false` rows | | ||
| 40 | +| T5 | `for (tag, cq, w, h, ten_bit, vert, tx_search) in arms` + `args.push(if tx_search { "…=1" } else { "…=0" })` | **not** a template — both literals are spelled, so the literal reader saw it. Listed because it is the same tool and was in the "both values" column. | | ||
| 41 | + | ||
| 42 | +## 2. The binding table | ||
| 43 | + | ||
| 44 | +`gate` = the census `#[`-segment name, `use site` = the template's shape, `bound | ||
| 45 | +value` = what the resolver reads from the gate's own text, `evidence` = the | ||
| 46 | +literal source line the binding came from. | ||
| 47 | + | ||
| 48 | +| gate | use site | bound value | evidence | | ||
| 49 | +|------|----------|-------------|----------| | ||
| 50 | +| `a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact` | T1 | `0` and `1` | `stream.rs:9437` `for txs in [0usize, 1] {` | | ||
| 51 | +| `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` | T1 | `0` and `1` | `stream.rs:10901` `for txs in ["0", "1"] {` — this is the segment that ALSO spells the flag literally, which is why r3 counted 9 not 10 | | ||
| 52 | +| `a_real_aomenc_inter_sequence_with_temporal_mv_candidates_decodes_pixel_exact` | T2 | `0` and `1` | `stream.rs:19665` `let tx_search = if attempt % 2 == 0 { "0" } else { "1" };` | | ||
| 53 | +| `a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact` | T2 | `0` and `1` | same line shape, own segment | | ||
| 54 | +| `a_real_aomenc_inter_sequence_with_a_16_level_rect_leaf_decodes_pixel_exact` | T2 | `0` and `1` | same line shape, own segment | | ||
| 55 | +| `a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact` | T2 | `0` and `1` | same line shape, own segment | | ||
| 56 | +| `a_real_aomenc_inter_sequence_with_16x16_level_1to4_partitions_decodes_pixel_exact` | T2 | `0` and `1` | same line shape, own segment | | ||
| 57 | +| `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` | T4 | `0` and `1` | `stream.rs:26084`+ `tx_size_search: false` rows and `:26150`+ `tx_size_search: true` rows in the arm table | | ||
| 58 | +| `a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact` | T3 | `0` and `1` | `stream.rs:31131` `for (tx_search, bit_depth) in [("1", 8u8), ("0", 8u8), ("1", 10u8)]` | | ||
| 59 | +| `a_real_aomenc_stream_whose_frame_edge_partition_bit_is_horz_decodes_pixel_exact` | T1 | `0` and `1` | `stream.rs:39945` `for tx_search in [0usize, 1] {` | | ||
| 60 | + | ||
| 61 | +**Not one of the ten is genuinely runtime-dependent on an unknown argument.** | ||
| 62 | +Every binding is a literal `0`/`1` (or a `bool` that becomes one) enumerated in | ||
| 63 | +the gate's own text. Each of the ten therefore builds BOTH a `=0` and a `=1` | ||
| 64 | +stream on some attempt, so each is an ON gate under this file's standing "any | ||
| 65 | +spelling that says on wins" rule. | ||
| 66 | + | ||
| 67 | +## 3. The true counts | ||
| 68 | + | ||
| 69 | +`cargo test -p ec-av1 --lib gate_coverage::tests::print_tx_size_search_census -- --nocapture`: | ||
| 70 | + | ||
| 71 | +``` | ||
| 72 | +enable-tx-size-search over 230 census-selected gate bodies: | ||
| 73 | + =0 only 86, =1 only 13, both 17, unresolvable 0, not named 114 | ||
| 74 | +``` | ||
| 75 | + | ||
| 76 | +- **unresolvable: 0 of 230 (0.0%)** — the detector now classifies every body | ||
| 77 | + that names the flag in any form. That is the headline: the floor is a | ||
| 78 | + measurement. | ||
| 79 | +- Gates naming the flag at all: 116 of 230 (50.4%). The remaining 114 leave it | ||
| 80 | + off the command line, which under the "defaulted means unknown" rule stays | ||
| 81 | + unknown and retires nothing. | ||
| 82 | +- Of the 116: 86 reach only `0`, 13 reach only `1`, **17 reach both** (the ten | ||
| 83 | + template gates plus seven that spell both literals in one segment). | ||
| 84 | +- Net: 30 gates positively enable the tool, versus the 15 the literal-only | ||
| 85 | + reader saw. r3's "88 `=0`, 15 `=1`, 9 unknown" is superseded in both | ||
| 86 | + directions — the `=0` count falls (a gate whose other arm is `=1` is not an | ||
| 87 | + "off" gate) and the `=1` count doubles. | ||
| 88 | + | ||
| 89 | +The count now lives in a test, not a comment, and the test asserts | ||
| 90 | +`unresolvable == 0`, so a new helper-parameter blind spot of this shape fails | ||
| 91 | +loudly instead of quietly restoring a floor. | ||
| 92 | + | ||
| 93 | +### The detector change | ||
| 94 | + | ||
| 95 | +`spelling_values` (new) merges literal `--flag=<digit>` spellings with every | ||
| 96 | +value a `format!` template resolves to; `bound_values` (new) does the binding | ||
| 97 | +resolution over the four shapes; `resolved_on_state` (new) replaces | ||
| 98 | +`default_on_state`, which is deleted (it became dead — the clean cutover, no | ||
| 99 | +shim left behind). Three details that are load-bearing: | ||
| 100 | + | ||
| 101 | +- **Quoted-only for `let` bindings.** A `let tx_search = if attempt % 2 == 0 { "0" } else { "1" };` | ||
| 102 | + initializer contains the bare integer `2`; reading it as a flag value would | ||
| 103 | + invent an ON. | ||
| 104 | +- **Position-aware for tuple loops.** `for (tx_search, bit_depth) in [("1", 8u8), …]` | ||
| 105 | + must read only column 0 — the bit-depth column (`8`, `10`) is not a flag value. | ||
| 106 | +- **Typed-literal suffixes.** `0usize`/`8u8`/`1u32` are single tokens; a | ||
| 107 | + `bare_digits` that rejected them would have missed `for txs in [0usize, 1]` | ||
| 108 | + and filed the palette gate as `=1` only. Multi-digit `10u8` is still rejected. | ||
| 109 | + | ||
| 110 | +## 4. RED-BEFORE, both directions | ||
| 111 | + | ||
| 112 | +Both mutations below were applied to the detector, run, and reverted; the | ||
| 113 | +working tree after revert is byte-identical to the pre-mutation file | ||
| 114 | +(`diff` clean), and all 12 `gate_coverage` tests are green. | ||
| 115 | + | ||
| 116 | +**Direction 1 — a mutated `format!` value must MOVE the classification.** | ||
| 117 | +Mutating the template needle so the resolver cannot see | ||
| 118 | +(`format!("--{spelling}=DISABLED{spelling}=")`) reds **two** tests: | ||
| 119 | + | ||
| 120 | +- `the_resolver_binds_a_format_built_flag_in_both_directions`: the palette gate | ||
| 121 | + resolves to `{}` instead of `{'0','1'}`. | ||
| 122 | +- `print_tx_size_search_census`: `unresolvable 9` (not 0), and the split | ||
| 123 | + degrades to `=0 only 86, =1 only 13, both 8` — 9 of the 17 both-value gates | ||
| 124 | + silently become "not named", which is precisely the old behaviour. | ||
| 125 | + | ||
| 126 | +The same test also mutates the GATE side: for each of three template shapes it | ||
| 127 | +takes the real gate body, rewrites only the bound value | ||
| 128 | +(`[0usize, 1]`→`[0usize, 0]`, `"1"`→`"0"` in the else arm, the tuple table's | ||
| 129 | +`"1"`→`"0"`), and asserts the resolved set moved from `{'0','1'}` to `{'0'}`. | ||
| 130 | +Without that half, a resolver that ignored the binding and returned a constant | ||
| 131 | +would pass. | ||
| 132 | + | ||
| 133 | +**Direction 2 — a spelling the old detector already saw must STILL classify.** | ||
| 134 | +Mutating the literal needle instead (`"--DISABLED{spelling}="`) reds **four**: | ||
| 135 | +the two `never_on_*_matches_the_gate_recipes` tests (every tool drops to | ||
| 136 | +"never on"), `print_tx_size_search_census` (`=0 only 0, =1 only 0`), and the | ||
| 137 | +same resolver test, which walks every gate that literally spells | ||
| 138 | +`--enable-tx-size-search=1` and asserts each is still classified on, with a | ||
| 139 | +floor of 10 such gates so the walk cannot pass vacuously. The new arm is | ||
| 140 | +additive over the old one; a resolver that replaced rather than extended the | ||
| 141 | +literal path fails here. | ||
| 142 | + | ||
| 143 | +## 5. The entry decision: RETIRED | ||
| 144 | + | ||
| 145 | +The tool is exercised by a gate that **asserts the parsed tx-size-search | ||
| 146 | +behaviour**, not merely spells it: | ||
| 147 | + | ||
| 148 | +`a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | ||
| 149 | +spells `--enable-tx-size-search=1` as a literal and hard-asserts | ||
| 150 | +`compared_tx_depths > 0` with the message *"never produced a nonzero tx depth on | ||
| 151 | +a compared attempt — the flag did not arrive"*. `tx_depth` is read **only** | ||
| 152 | +under the frame header's `tx_mode_select` bit (spec 5.11.16; `decode.rs` guards | ||
| 153 | +the read with `tx_select_inter`), so a nonzero `TX_DEPTH_HITS` delta IS the | ||
| 154 | +parsed tx-size-search behaviour, not a proxy for it. | ||
| 155 | + | ||
| 156 | +**Measured run of that gate on this tree** (oracle aom `v3.13.3-7-g9bb526a`, | ||
| 157 | +one named test, 3.9 s): | ||
| 158 | + | ||
| 159 | +``` | ||
| 160 | +12 pixel-exact decodes (0 named refusals out of 12 attempts, 6 of the matches 10-bit), | ||
| 161 | +rect coefficient TUs on compared attempts: 219 (10 of them a 1D tx class); | ||
| 162 | +flag arrival: rect partitions 120, tx depths 53, 1D-class (square) transforms 13 | ||
| 163 | +``` | ||
| 164 | + | ||
| 165 | +`tx depths 53` on compared attempts, and 6 of the 12 pixel-exact matches are | ||
| 166 | +10-bit — so the tool is exercised at **both** depths and the assertion is not | ||
| 167 | +vacuous. | ||
| 168 | + | ||
| 169 | +The stronger witness, cited in the entry as well: | ||
| 170 | +`tx_select_inter_gate` (behind | ||
| 171 | +`a_real_aomenc_inter_sequence_with_tx_select_decodes_pixel_exact{,_10bit}`) | ||
| 172 | +**deliberately omits** the flag — its recipe carries the comment | ||
| 173 | +`// DELIBERATELY ABSENT: --enable-tx-size-search=0.` — and asserts | ||
| 174 | +`decode::txfm_split_hits()` moved, i.e. that spec 5.11.17's recursive | ||
| 175 | +`txfm_split` var-tx tree was read. An inter transform is then a split tree | ||
| 176 | +rather than one whole-block transform, which is the entire content of the tool. | ||
| 177 | +That gate's own doc says an unfired gate is a vacuous gate: it panics if no | ||
| 178 | +attempt takes a split. | ||
| 179 | + | ||
| 180 | +### In-file reason text, as landed | ||
| 181 | + | ||
| 182 | +The `DEFAULT_ON_TOOLS` entry's comment now reads (abridged; full text in the | ||
| 183 | +file above `DEFAULT_ON_TOOLS`): | ||
| 184 | + | ||
| 185 | +> `enable-tx-size-search` SETTLED 2026-09-29 (lane-av1txsearch), by measurement | ||
| 186 | +> rather than by a name-shaped guess. The r3 note here said the count was a | ||
| 187 | +> FLOOR: 9 gate bodies built the flag into a `format!` variable that neither | ||
| 188 | +> `flags_in` nor `settings_in` could see … The method r3 asked for is now | ||
| 189 | +> `spelling_values` → `bound_values`, and it resolves all of them; | ||
| 190 | +> `print_tx_size_search_census` asserts the unresolvable count is ZERO, so the | ||
| 191 | +> floor cannot come back unnoticed. | ||
| 192 | +> | ||
| 193 | +> THE ENTRY IS RETIRED, on an ARRIVAL ASSERT rather than on the spelling. | ||
| 194 | +> `a_real_aomenc_stream_with_a_1d_tx_class_on_a_rect_transform_decodes_pixel_exact` | ||
| 195 | +> spells `--enable-tx-size-search=1` as a literal and hard-asserts | ||
| 196 | +> `compared_tx_depths > 0` … `tx_depth` is read ONLY under the frame header's | ||
| 197 | +> `tx_mode_select` bit (spec 5.11.16 …), so a nonzero counter IS the parsed | ||
| 198 | +> tx-size-search behaviour, not a proxy for it. Measured run of that gate on | ||
| 199 | +> this tree (aom 3.13.3): 12 pixel-exact decodes, 0 named refusals, 6 of the 12 | ||
| 200 | +> at 10 BIT, 219 rect coefficient TUs on compared attempts, and `flag arrival: | ||
| 201 | +> … tx depths 53` … | ||
| 202 | + | ||
| 203 | +The "all 49" prose count stays deleted, per r2; the module doc now points at | ||
| 204 | +the test rather than a number that rots. | ||
| 205 | + | ||
| 206 | +## What is not claimed | ||
| 207 | + | ||
| 208 | +- The 114 bodies that leave the flag off the command line stay **unknown**, not | ||
| 209 | + "exercised". The default of `1` is not a stream carrying the tool. | ||
| 210 | +- `bound_values` returns `None` when the variable is a shared helper's | ||
| 211 | + parameter (bound at a call site in a different segment). That path is | ||
| 212 | + implemented and reported, not guessed — and today no | ||
| 213 | + `--enable-tx-size-search` site takes it. A future helper-parameter flag will | ||
| 214 | + be counted as unresolvable and will red the census test rather than pass | ||
| 215 | + silently. | ||
| 216 | +- No claim is made about any OTHER `DEFAULT_ON_TOOLS` tool's floor. The | ||
| 217 | + resolver is general, so those counts also moved; re-run | ||
| 218 | + `print_never_on_per_bit_depth` to read them. The 8-bit and 10-bit | ||
| 219 | + `NEVER_ON_*` lists are empty on this tree and their tests are green. | ||
| 220 | +- No decoder behaviour, counter, gate or fixture changed. `stream.rs` is | ||
| 221 | + untouched. | ||
| 222 | + | ||
| 223 | +## Test evidence | ||
| 224 | + | ||
| 225 | +`gate_coverage` module, 12 tests, all green on the final tree: | ||
| 226 | + | ||
| 227 | +``` | ||
| 228 | +test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 704 filtered out | ||
| 229 | +``` | ||
| 230 | + | ||
| 231 | +Covered by the above: `every_gate_disabling_a_tool_is_a_listed_coverage_hole`, | ||
| 232 | +`tool_settings_reads_whole_flags`, | ||
| 233 | +`the_detector_sees_the_gates_the_spelling_filter_missed` (r3's, still green), | ||
| 234 | +`never_exercised_{8bit,10bit}_matches_the_gate_recipes`, | ||
| 235 | +`never_on_{8bit,10bit}_matches_the_gate_recipes`, | ||
| 236 | +`default_on_tools_do_not_duplicate_the_universe`, the three print tests, and the | ||
| 237 | +two new ones (`print_tx_size_search_census`, | ||
| 238 | +`the_resolver_binds_a_format_built_flag_in_both_directions`). | ||