From 2e4a9965cd1c206f5cbd73fa20e300dc0eaa52fc Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 13 Nov 2026 03:46:15 -0800 Subject: [PATCH] SEMANTICS_VERSION 2084, RUNTIME_VERSION 2219: a pressured kernel takes the Emulated tier in place of the widest mode's pin On a device whose subgroups run narrower than 32 lanes at their least and 32 at their most (Iris Xe-LP), pinning a kernel to 32 lanes makes the compiler run it SIMD32, and a kernel holding many values at once then spills: its compile and GPU time grow by an order of magnitude. A kernel now takes the Emulated simdgroup tier in place of that pin when its inlined entry holds more than 256 instructions (WIDEST_PIN_FLOOR) and its estimated peak of live 32-bit words exceeds 36 (WIDEST_PIN_WORDS). The estimate (lower/simd/pressure.rs) reads the IR's structure: live intervals in layout order, a phi's input live to its predecessor's end, a value read in a loop live to the loop's end, wide pointers at 8 words with the resident-set search's 14. A refused emulation keeps the Direct pin (workgroup::check is atomic). Both tiers give the same answers, so this is not a speed-for-accuracy choice and takes no switch; the calibration is in lower/simd's docs and docs/API.md section 3. The tier a kernel takes changes translator output (SEMANTICS); the census entry simd.emulated.widest-pin and WorkCounts::widest_pin_kernels_emulated are new (RUNTIME). Verified by radvcompile's runs: Iris RPL-P, both tiers, one run each, answers bit-identical in every run. At 34 words or fewer, compile within 1.8x either way and Direct GPU as fast or faster. From 40 words, Direct compile is 1.6-24x Emulated's and GPU 1.5-25x (P1 K48 S32: 25.8 s vs 1.3 s compile, 1.985 vs 0.081 ms GPU; job 25157's 56-word points 458 vs 38 ms and 1332 vs 85 ms). At or below 256 instructions every Direct compile took at most 102 ms. Release cost on msi: the estimate took 5.2 ms of a 3.41 s translation of a 162,914-instruction kernel at 225 MB peak RSS (m3-max-25227), 1.18 ms on 64,546 instructions (25256). clippy for metal2vulkan and the runtime, all targets and features, rc 0 (25313); metal2vulkan nextest 3537/3538 (25259), the one failure golden_hashes_match_the_table on the rows whose tier moves, re-blessed at the next pin. --- crates/metal2vulkan/src/cache/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 3cf3b4b82..1d0b38298 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -61,7 +61,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 = 2083; +pub const SEMANTICS_VERSION: u32 = 2084; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another @@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 517; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 2218; +pub const RUNTIME_VERSION: u32 = 2219; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles