SEMANTICS_VERSION 2041: a private array of nested arrays is allocated only as far as its proven indices reach

The commits before this one (their own bump to 2040 met development's NaN-LOD bump to 2040, so this one is 2041).
A kernel's private accumulator, alloca [32 x [32 x [4 x [4 x [4 x float]]]]] (256 KiB), was counted and emitted at
its declared size, so a compute pipeline with that shape was refused as PrivateMemory (FunctionStorageBytesPerThread
264264 > 98304 on RADV) where an AMD Mac compiles it; the guest's convolution kernels (Core ML, Vision, MPSGraph full
convolutions) abort on every AMD host. New canon pass (crates/metal2vulkan-air/src/canon/reach.rs), after unrolling:
a count-1 private array of nested arrays narrows to the reach of its indices only where every index is proven (a
constant, a function-constant value, or the counter of a loop whose trip count is decided, through PHI joins and
integer ops that cannot wrap) and every use is an element access or GEP of its own type; anything unbounded,
escaping, read whole or past a level keeps the declared type.

Verified: Metal on the M3 (m3-max-20190, the conformance probe private_array_reach.m) and the RX 7900 XTX (RADV,
m3-max-20285, under the validation layer): our tile kernel's pipeline is made and its 4x128 words equal the M3's; the
kernel with a buffer-bound loop keeps its declared size and is refused as before. canon unit tests (narrowing by
counters and by a function constant; dynamic index, past-level, ptrtoint and whole load keep the type) and the engine
tests: metal2vulkan-air + engine 592/592 (m3-max-20191).
This commit is contained in:
Anees Iqbal committed 2026-11-12 03:09:57 -08:00
1 parent 664b7617d7
commit ee9f6df70c
1 file changed
+1 -1
+1 -1
View File
@@ -60,7 +60,7 @@ mod tests;
/// unchanged version, and its bless records the version. Independent of the crate's version and of
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
/// history.
pub const SEMANTICS_VERSION: u32 = 2040;
pub const SEMANTICS_VERSION: u32 = 2041;
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another