Files
metal2vulkan/crates
Anees Iqbal 2e4a9965cd 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.
2026-11-13 03:46:15 -08:00
..