From 98f2025df8aadfe1abe0d53c389b10b594135657 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 23:31:56 -0800 Subject: [PATCH] Spill test: follow only the tail's fold of the parameter block's address 64cb2002f0 let the spill test's disassembly trace step through any OpSelect of a ulong whose false hand is a push load. The bounds checks' selects of a slot's address against the zero range's pushed address have that form too, so the trace also counted the 24 slot reads through them: amd-780m-hawkpoint-radv read (36, 36, 12) where 12 lines were spilled. The trace now steps only through the fold's own form, a select whose true hand is the ulong null (lower::push::fold_never_pushed). Verified: m3-max-70095 (msi-laptop) showed the (36, 36, 12) failure at 64cb2002f0, with workspace clippy and the other 3591 tests of the gate's first suite line passing (golden hashes aside, re-blessed on development); this commit's run follows. --- .../src/tests/engine_identity_spill.rs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/crates/metal2vulkan/src/tests/engine_identity_spill.rs b/crates/metal2vulkan/src/tests/engine_identity_spill.rs index c8710b242..a8c1d0ee8 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_spill.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_spill.rs @@ -245,16 +245,16 @@ fn a_vertex_function_past_its_share_spills_the_checks_fields_into_its_block() { } /// The loads through a parameter block's address in disassembly `text`: a `ulong` loaded from the -/// push block (selected against null by the floor's tail's test where the function has the tail, -/// `lower::push::fold_never_pushed`), plus a constant (none for the block's first line, where the -/// sum may fold), made a -/// pointer to a one-member block (`OpConvertUToPtr`), whose member is loaded. Their number, how -/// many of them lie in a function's first block, and how many read a 16-byte line: a `uvec4`, -/// `Aligned 16`, through a block whose member is `NonWritable`. +/// push block (or that load selected against the `ulong` null by the floor's tail's test, the form +/// `lower::push::fold_never_pushed` folds it in), plus a constant (none for the block's first +/// line, where the sum may fold), made a pointer to a one-member block (`OpConvertUToPtr`), whose +/// member is loaded. Their number, how many of them lie in a function's first block, and how many +/// read a 16-byte line: a `uvec4`, `Aligned 16`, through a block whose member is `NonWritable`. fn block_loads(text: &str) -> (usize, usize, usize) { use std::collections::{BTreeMap, BTreeSet}; let (mut push, mut chains, mut bases) = (BTreeSet::new(), BTreeSet::new(), BTreeSet::new()); - let (mut constants, mut blocks) = (BTreeSet::new(), BTreeSet::new()); + let (mut constants, mut blocks, mut nulls) = + (BTreeSet::new(), BTreeSet::new(), BTreeSet::new()); let (mut pointees, mut read_only, mut members) = (BTreeMap::new(), BTreeSet::new(), BTreeMap::new()); let (mut loads, mut first, mut lines) = (0, 0, 0); @@ -279,6 +279,9 @@ fn block_loads(text: &str) -> (usize, usize, usize) { [id, "=", "OpConstant", "%ulong", _] => { constants.insert(id); } + [id, "=", "OpConstantNull", "%ulong"] => { + nulls.insert(id); + } [id, "=", "OpAccessChain" | "OpInBoundsAccessChain", _, var, ..] if push.contains(var) => { @@ -287,7 +290,9 @@ fn block_loads(text: &str) -> (usize, usize, usize) { [id, "=", "OpLoad", "%ulong", chain, ..] if chains.contains(chain) => { bases.insert(id); } - [id, "=", "OpSelect", "%ulong", _, _, base] if bases.contains(base) => { + [id, "=", "OpSelect", "%ulong", _, null, base] + if nulls.contains(null) && bases.contains(base) => + { bases.insert(id); } [id, "=", "OpIAdd", "%ulong", a, b]