Commit Graph
5367 Commits
Author SHA1 Message Date
Anees Iqbal 3969e96010 RUNTIME 2228 / ARTIFACT_FORMAT 518: a dispatch of an inert kernel records no Vulkan dispatch
The translator records, from the final SPIR-V (ModuleStats::inert, spirv/verify/effects.rs),
whether a kernel can affect anything outside its invocation: inert means no loop, and no store,
atomic or image write to any storage class but Function, Private or Workgroup, in the entry or
anything it calls. Anything not classified counts as writing. A module with a loop is never
inert, since a kernel that never terminates is the one case where skipping would change the
outcome. The runtime's compute record path (compute::record, shared by direct, threads, indirect
and the host-encoded ICB path) records no vkCmdDispatch for an inert pipeline and counts it in
WorkCounts::dispatches_skipped_inert. The encoder's fences, events, barriers and the command
buffer's completion are unchanged, and a skipped dispatch's reads take no hazard tracking. Metal's
answer is the same: nothing an inert kernel does is observable, and counter sampling is a
RuntimeGap. GPU-encoded ICBs don't go through record and still dispatch. API.md documents it.

Why: on the RTX 2080 (gbt-2080, m3-max-25739, pin 69) the guest's upload_uchar_buffer kernel is
empty (`ret void`, its one buffer argument unused) and is dispatched as 1-thread threadgroups:
3,661 command buffers of it alone, 6,853 dispatches, 11.7 s of GPU time over the walk (p50
0.11 ms, p90 1.0 ms, max 111 ms a dispatch).

Verified (ftconv, at 80a7769421 on 80ff4aafa7, step codes read inside the jobs):
- 25890 engine_inert (4 profiles x 7 kernels incl. the codec round trip): NEXTEST=0, 1/1.
- 25912 lavapipe --cfg m2v_cpu_icd runtime inert_dispatch: NEXTEST=0, 3/3. Counter: empty
  direct/threads/indirect +3, workgroup-store-only +1, loop and device-store +0 (fills write
  1..=N); a fence and an event around a skipped dispatch still order a later read of an earlier
  write.
- 25913 clippy --workspace --all-targets --all-features -D warnings (plain): CLIPPY=0.
Not yet run at landing: clippy under m2v_gpu and m2v_cpu_icd, rustdoc -D warnings (dispatched by
ftconv), the 2080 before/after run and a walk with the counter.

ARTIFACT_FORMAT_VERSION 517 -> 518 (the artifact codec carries inert); RUNTIME_VERSION
2227 -> 2228.
2026-11-13 09:58:44 -08:00
Anees Iqbal b36335e5ba FAST-PATHS: the ANV stage bound's refusal follows what the driver compiles
The known-gaps entry for DriverWorkaround::SerializedStageWrapsLargeModules now says the
refusal reflects what the driver can compile, not only the 20-bit serialization defect. On the
Iris Xe of RPL-P (ANV, Mesa 26.2.6), the consumer kernel of entry weight 1,565,083, created as a
VK_EXT_shader_object compute shader (which skips the precompiled round trip; no NIR
deserialization was reached), still held more than 8 GiB within ten minutes and did not finish
(job 25810, killed at its cap).

Measured alongside (radvcompile, ms01, counts only): 23% of that kernel's weight is dead under
its specialization; two emitted search routines inlined at every call make 31% of the live
weight; the Emulated simdgroup form costs at most about 5%. Neither shrinking nor splitting
brings such a stage within what ANV compiles in practical time and memory, so no class fix is
built. Docs only, no version bump.
2026-11-13 09:32:58 -08:00
Anees Iqbal 80ff4aafa7 Re-bless the authored compile census at 2869f44698
The census at the pin-71 tip (m3-max-25799): 2369 cases over 21 profiles, 48670 compiled, 1079
refused, 0 failed, 0 differences, 0 regressions, 348 uncovered cells as at pin 70. 22 cells'
artifact hashes (two cases) move with SEMANTICS 2089-2091, each still compiled. The slowest
compile took 2.5 s and the largest case worker 391 MB (RSS), inside the 20 s and 500 MiB
ceilings.
2026-11-13 09:22:04 -08:00
Anees Iqbal d16c0a4a43 Re-bless the golden tables at 2869f44698
The golden tables at the pin-71 tip (m3-max-25797; inventory, golden and printout blesses each
exit 0):
- The four ANV profiles' rows (intel-arl-anv, intel-irisxe-anv, intel-irisxe-rplp-anv,
  intel-uhd770-rpls-anv) move with SEMANTICS 2091's DriverWorkaround::
  SerializedStageWrapsLargeModules.
- kernel_rate_map_pointer_array.ll moves, and tests/air_input/rate_map_integer.txt is added,
  with SEMANTICS 2090's uint2 rate-map overloads. That printout was missing, so
  engine_fixtures_match_their_golden_printout failed on development until now.
Test data only. The NVIDIA shaderFloat16 columns (SEMANTICS 2092) and the fan-out probe
(SEMANTICS 2093) land after this pin and are re-blessed at the next one.
2026-11-13 09:22:04 -08:00
Anees Iqbal fc226fdc16 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 09:21:25 -08:00
Anees Iqbal 791035345b SEMANTICS 2093 / RUNTIME 2227: a rate-mapped draw draws only its blocks that hold a flagged triangle region by region
For each flagged triangle, the fan-out probe's geometry stage also sets the bit of its block of
BLOCK_TRIANGLES (64) in a sixth set of 32 words (PROBE_BLOCKS 1024, PROBE_SETS 6; the last block
also takes every triangle past 65,536). A flagged draw in parts is drawn as its runs of flagged
blocks region by region: the first run cut to the first flagged triangle, the last to the last,
everything before, between and after the runs fanned out. Runs less than RUN_GAP (170 =
REGION_DRAW_WORK/3) apart are joined; a draw has at most MOST_RUNS (4) runs, the nearest joined
first. WorkCounts::rate_map_region_runs counts them. Exact is unchanged. FAST-PATHS row 50 edited
in place; api_surface gains BLOCK_TRIANGLES and PROBE_BLOCKS.

Why: on the pieces lane's wide frame, 23 flagged draws with 36 flagged triangles drew 106,519
triangles region by region (whole spans from first to last flagged triangle). Now 8983 in 35 runs,
and the frame splits into 2 pieces instead of 8.

Verified (ratemap, release, command-buffer GPU time on the wide frame, base aea1543936 vs the
change, order base/after/after/base on um790, jobs 25793 and 25796):
  780M (Mesa 26.2.6) warm 115.0/90.5 -> 61.2/57.7 ms (Exact 257.0); cold 178.2/176.4 -> 80.4/86.9
  RTX 2080 (620.70.06) warm 28.7/27.9 -> 16.6/18.7 ms (Exact 60.1); cold 59.1/56.1 -> 44.2/48.9
Pixels equal Exact's on lavapipe (25771, 3/3, incl. a second wide triangle far from the first;
asserts 6 flagged triangles, 52 triangles in 6 runs). Clippy workspace all targets/features clean
(25770); touched translator tests 297/297, runtime 16/16; unit tests for cuts, joins, the tail
block, a draw with no bits, and a 3000-draw property check. Not built: this rebased tip (clean
rebase; generators unchanged).

Tiles (B, steelbrain/ratemap-tiles c3d51ef25c) not landed: 2080 27.3 -> 23.8 ms but 780M
91.7 -> 568.2 ms (14.4M geometry invocations a frame at ~33 ns on RADV).

SEMANTICS 2092 -> 2093 (the linked fan-out geometry stage changes); RUNTIME 2226 -> 2227.
2026-11-13 09:20:43 -08:00
Anees Iqbal 010888b011 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 09:18:01 -08:00
Anees Iqbal 54752dd4f7 RUNTIME 2226: a draw compares whole only the kept bind shapes of its key
Each kept bind shape now stores a 64-bit key of every field except its used resources
(BindShape::key_beside_used). A draw computes its own key once, in place, without making the
shape (BindState::shape_key_beside_used). The recent-shape lookup (RecentShapes, 5 shapes) and
the settled-shape lookup (GraphicsState::kept_shape, 4) compare whole only the shapes whose key
matches. A state's key equals the key of every shape it has, so a shape with another key cannot
be its shape; one with the same key is still compared whole, so the answer is exact. The
argument samplers' shapes enter the key as an OR of their hashes, so a shape's set and a state's
list (which may repeat a sampler) key alike.

Why: on the XTX Launchpad walk, draw_resident holds 44-48% of our CPU per frame with no single
dominant callee; the shape lookups were about 7.5% of it (profile bound). Expected cut about
0.25-0.35 ms a frame after paying for the key. Not measured at the frame level yet.

New public surface: WorkCounts::draw_shape_compares, BindState::shape_key_beside_used,
BindShape::key_beside_used (api_signatures.tsv in the commit).

Verified (imgleak, msi job 25756, off aea1543936): clippy -D warnings all features on metal2vulkan
and metal2vulkan-runtime clean; translator bind and API tests 482 passed; runtime unit suite 1525
passed, including the new recent_shape_keys tests (every fixture state's key matches its shapes
and other shapes key apart; with 5 recent shapes each is found with one whole compare, before
5 - at). Conformance cost recordings carry the new count: re-blessed on development if needed.

RUNTIME_VERSION 2225 -> 2226.
2026-11-13 09:17:12 -08:00
Anees Iqbal 4f0e02ac6b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 09:15:55 -08:00
Anees Iqbal 118d3c1818 SEMANTICS 2092: NVIDIA computes half on its 16-bit instructions under the float controls
The pair-fold workaround (HalfConversionPairFolded) made controlled_modes() return None on every
NVIDIA device. That one switch turned off three separate things: rounding f32 to half through
the conversion pair, all native 16-bit arithmetic, and half_hold. NVIDIA computed half in f32,
which breaks rule 1 (the device's native arithmetic is the only form where it has one).

NVIDIA folds only the round trip: an OpFConvert 32->16 whose result is widened back to f32. A
single conversion, and the 16-bit instructions under RTE/DenormPreserve/SZINP for Float16, are not
a round trip, so the spec makes them Metal's on NVIDIA too.

- narrow::half_controls(p): shaderFloat16 plus every mode of controlled_modes, which no longer
  reads the workaround.
- quantize_form is Controlled only where the driver keeps the pair: NVIDIA stays Converted for
  that rounding and still records NativeHalfConversion.
- Keyed on the controls instead: half + - * / and sqrt, fma::half_route (OpFmaKHR where
  shaderFmaFloat16), spirv::half_hold, the 16-bit mode declaration and its widening note.
- Docs: API.md's native-half-conversion entry, HOWTO.md, code docs. FAST-PATHS unchanged.

Verified (heapchunk, at e059188e5a on 133872994d):
- tests::engine_native_half::nvidia_computes_half_on_16_bit_floats_under_the_float_controls:
  RTX 50 profiles plus the 2080 (0x1E87) and 3090 (0x2204) IDs emit 16-bit OpFAdd/OpFMul,
  declare the modes, no note, L3. Negative controls (no 16-bit RTE; Pascal) keep the note.
- RTX 2080 (um790, driver 620.70.06) lane half_arithmetic_under_the_float_controls_answers_metals
  (m3-max-25740): 16384/16384 equal Metal's per-operation half answers; the old f32 form differs
  at 15292. 29 half/maths/driver-deviation lanes pass (25743 + 25746).
- Translator suite 3553/3555 (25712): the two failures are golden tables, re-blessed on
  development at the next pin (379 golden-hash cells, NVIDIA shaderFloat16 columns only; the
  rate_map_integer printout from SV2090). Clippy all three configurations and rustdoc clean
  (25741). Release: slowest row hfb_filter_bank 0.12 s / 34 MiB on nvidia-rtx50-linux.
Expected, not run: this tip (rebased past SEMANTICS 2091) compiles as before; the 3090 and 5080.

SEMANTICS_VERSION 2091 -> 2092: NVIDIA translator output changes.
2026-11-13 09:15:12 -08:00
Anees Iqbal 23d8979b8f narrow and blend docs: the controlled pair is the rounding form, quantize_form's
narrow.rs's module doc said the controlled form is exact on every device
whose driver keeps the pair, "not NVIDIA's", as if NVIDIA took it; it
takes the device's conversion for the round trip (quantize_form), and
computes under the controls otherwise. blend.rs's half_of pointed at
controlled_modes for the workaround, which no longer reads it.

Docs only; cargo fmt.
2026-11-13 09:14:25 -08:00
Anees Iqbal c50b66ab6e NVIDIA computes half on its 16-bit instructions under the float controls
DriverWorkaround::HalfConversionPairFolded (every NVIDIA_PROPRIETARY GPU)
made narrow::controlled_modes return None, so NVIDIA's profiles lost the
16-bit float controls altogether: quantize_form was Converted and
f16_arithmetic None, a half + - * was computed in f32 and "rounded" by an
FConvert pair the driver folds away, spirv::half_hold never ran, and a
half / and sqrt were f32. The workaround is the pair's alone: NVIDIA's
compiler folds an OpFConvert 32->16 and its widening back into the 32-bit
value; it reports RTE, DenormPreserve and SignedZeroInfNanPreserve for
Float16 (independence ALL), under which its 16-bit instructions and a
single conversion are Metal's by the Vulkan spec (owner rule 1: the
device's native form is the only form).

- narrow::half_controls(p): shaderFloat16 and every mode of
  controlled_modes, which no longer reads the workaround.
- narrow::quantize_form: Controlled (the decorated pair under the
  controls) only where the driver keeps the pair; NVIDIA stays Converted,
  so an f32 result rounded to half through a round trip is still the
  device's conversion, recorded NativeHalfConversion.
- What keyed on Controlled but is no round trip now keys on the controls
  (ArithPlan::controls, ModuleBuilder::half_controls): a half + - *
  (f16_arithmetic), / (divide::native), sqrt (math::float_fn), the half
  fma route (fma::half_route), spirv::half_hold, and in compile.rs the
  declaration of the modes and the widening/narrowing note. The modes are
  declared for a pair only where the pair is Controlled.
- Unchanged: blend's half_of, round, round_texel and the bit conversions
  follow the rounding form.

Docs: narrow.rs, half_hold.rs, divide/math/fma, the workaround's doc,
PrecisionNote::NativeHalfConversion, docs/API.md's
native-half-conversion entry and docs/HOWTO.md say NVIDIA computes under
the controls and keeps the native conversion for the round trip only.

Tests:
- tests::engine_native_half::nvidia_computes_half_on_16_bit_floats_under_the_float_controls:
  nvidia-rtx50-linux, nvidia-rtx5080-laptop and the 5080 laptop's
  description with an RTX 2080's (0x1E87) and an RTX 3090's (0x2204)
  device ID emit 16-bit OpFAdd/OpFMul for a half sum, product and chain,
  declare the three 16-bit modes, require their properties, record no
  NativeHalfConversion, pass L3, and round each operation on the
  interpreter; a half narrowed and widened alone stays the noted round
  trip. Negative control: the 2080 description without
  shaderRoundingModeRTEFloat16, and Pascal (no shaderFloat16), emit no
  16-bit instruction or mode and record the note.
- Existing tests that pinned NVIDIA's widening note or keyed on
  Controlled for the controls follow the split.
- runtime_lane::native_maths::half_arithmetic_under_the_float_controls_answers_metals
  (device): a half sum, difference, product and product plus a third
  operand over 4096 threads equal Metal's per-operation half answers
  exactly where the module declares the controls; it prints how many
  words the f32 computation (the folded pairs' answer) differs at.
  half_rounding_answers_within_its_recorded_bound now expects the sum
  Metal's and the round trip noted on a driver that folds it.
2026-11-13 09:14:25 -08:00
Anees Iqbal 2869f44698 select: select_entry hands the widest-pin choice on to finish
f51f600047 passed `widest_pin` into finish from select_entry, but select_entry is its own
function and never had it: select destructures it and called select_entry without it. The
library still did not compile at f51f600047 (E0425 at the finish call; census job 25778 at
f51f600047 shows it). select now passes it to select_entry, which passes it to finish.

Verified: grep shows every use of the value now sits in a function that takes it (select,
select_entry, finish). The compile and suite proof is the pin-71 merged check at this commit.
No version bump.
2026-11-13 09:12:05 -08:00
Anees Iqbal f51f600047 select: finish takes the widest-pin choice it reads
c53ea4164e made lower::select::finish read `widest_pin` (whether a plan made again past its
driver's stage bound keeps the widest mode's pin), but only select() had it, as a parameter that
was never passed on. The metal2vulkan library did not compile at c53ea4164e or f10af8e35a
(E0425 at select.rs, and the parameter unused in select). select now hands it to finish.

The checks quoted for c53ea4164e never compiled the library: rustdoc (the only step that passed
in 25736) does not type-check function bodies, and 25748 at f10af8e35a stopped at this E0425.

Verified: the change is the one-argument pass-through; its compile and suite check is the pin-71
merged check at this tip (msi). No version bump: the translator's output is what c53ea4164e meant
(SEMANTICS 2091).
2026-11-13 09:09:43 -08:00
Anees Iqbal f10af8e35a Tests: select's callers pass the widest-pin choice
c53ea4164e changed lower::select::select to take (inputs, WidestPin) but left ten test callers
in crates/metal2vulkan/src/tests passing the inputs alone, so the metal2vulkan lib tests (and
workspace clippy --all-targets) did not compile. Each now passes WidestPin::Weighed, the choice
every first plan makes.

Correction to c53ea4164e's message: it says checks job 25736 was green. It was not. The job's
wrapper exited 0, but inside it clippy and the metal2vulkan suite both exited 101 (these ten
E0308 errors); only rustdoc passed. That commit's test and suite claims are unverified until
this commit's check.

Verified: job 25736's log shows the ten errors. This fix's check is job 25748 (msi: workspace
clippy, then the full metal2vulkan suite). Tests only: no version bump.
2026-11-13 09:07:51 -08:00
Anees Iqbal 5865f5b2e5 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 09:06:28 -08:00
Anees Iqbal c53ea4164e SEMANTICS 2091: on ANV, a stage past the serialized-object bound keeps the widest pin or is refused
Mesa's common pipeline runtime (vk_pipeline.c) serializes every compute stage into a precompiled
shader and reads it back before compiling it. nir_serialize names each object by a 20-bit index
(MAX_OBJECT_IDS 1<<20) checked only by an assert, so a release build wraps past 2^20 objects and
the driver faults inside vkCreateComputePipelines. On Intel Iris this took a consumer's host
process down on a large compute kernel (its translated stage: idx_table_len 1,096,128).

DriverWorkaround::SerializedStageWrapsLargeModules (keyed on ANV) bounds the stage's weight at
SERIALIZED_STAGE_WEIGHT = 786,432 instructions, every call counted as its callee's body. A module
over the bound is never handed to the driver: a kernel that emulated its simdgroups only in place
of the widest mode's pin compiles pinned to 32 lanes again (lower::simd::WidestPin::Kept), and any
other is refused as Unsupported::driver_defect(Feature::StageSize, ..), where Metal compiles it.
The gap is recorded in docs/FAST-PATHS.md's known gaps; REFUSALS regenerated, reach.tsv marks
StageSize rare, api_signatures carries the two new variants.

The bound's basis: 22 stages measured at 0.14-0.99 serialized objects per weight unit; 786,432 is
3/4 of 2^20 at the worst measured ratio of about 1.

Verified: the crash reproduced live on ms01's Iris (job 25723) with both the consumer kernel and a
synthetic 360k-FMA chain; test
a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused; checks job 25736 (msi): clippy
on the workspace, rustdoc, the full metal2vulkan suite, green. Not yet verified: the consumer's
Iris run at the next pin.

SEMANTICS_VERSION 2090 -> 2091: translator output and refusals change on ANV.
2026-11-13 09:05:44 -08:00
Anees Iqbal aea1543936 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 08:53:39 -08:00
Anees Iqbal 6113644db5 RUNTIME_VERSION 2225: an indirect command buffer's buffer setters write without the buffer's lock
The four commits before this one let an indirect command buffer's buffer setters write their
slots without taking the buffer's lock (edit_slot), count the unlocked writes apart from the
locked ones, and keep edit's error mapping in place. Encoding changes runtime behaviour (RUNTIME).

Verified by perdraw5's runs: icbcheck at 6bc6ea9cb9 (25691): clippy plain and m2v_cpu_icd, the
API signature table, and the 19 ICB, kept-command and write-route tests on lavapipe. Quiet bench
on msi (25690, load 1.5, three rounds, development -> this): three fields set then a draw, 91.9-92.2
-> 74.5-75.5 ns a command at 16384 commands and 85.8-87.0 -> 67.4-70.6 ns at 256; a draw alone
40.2-41.6 -> 40.3-41.3 ns at 256 (rounds 2-3; round 1 read 46.8 in both runs) and 42.1-43.0 ->
43.2-43.7 ns at 16384, about 1 ns (2.5%) slower. Landed on the balance: a command that sets its
buffers then draws, the common encode, takes about 17 ns less; a draw-only command (inherited
buffers) about 1 ns more at the largest size.
2026-11-13 08:52:59 -08:00
Anees Iqbal 986f7c3249 ICB: edit maps a refused field in place, as on development
Through a shared fn (field_error), the draw's edit was about 1 ns slower
(tests::icb_encode_bench on lavapipe, msi, P-cores): the closure stays in
edit, and field_error serves edit_unlocked alone.

Quiet run (job 25690, load 1.5), dev 330ca5a282 against this, three rounds:
three fields 91.9-92.2 -> 74.5-75.5 ns (16384 commands), 85.8-87.0 ->
67.4-70.6 ns (256); draw only 42.1-43.0 -> 43.2-43.7 ns (16384), 40.2-41.6
-> 40.3-41.3 ns (256) past a first round of 46.8.
2026-11-13 08:52:23 -08:00
Anees Iqbal a3127ef9c7 ICB: the unlocked writes counted apart, the locked ones by a load and a store again
The lock-free buffer setters made every write under pipelines count itself
by an atomic add (a locked instruction), so the unlocked writes would not
lose one; a draw took 45.9 ns a command on development and 49.7 with the
lock-free setters (lavapipe, msi, job m3-max-25413). The unlocked writes
now add to a counter of their own, the locked ones count as before, and
cpu_writes() answers the sum: each part only grows, so a change of either
moves it.

Verified: cargo fmt; measured next.
2026-11-13 08:52:23 -08:00
Anees Iqbal 67c98e656c ICB: a buffer slot's write takes edit_slot, edit the locked write alone
The unlocked branch at the top of edit slowed the setters that take the
lock: on lavapipe (msi, jobs m3-max-25314, 25351, 25384) a draw took 45.8
ns a command on development and 50.4 to 51.9 with the lock-free buffer
setters. The buffer's set_buffer now calls edit_slot (unlocked on a buffer
the GPU may not have written, else edit), and edit is development's
locked write.

Verified: cargo fmt; measured next.
2026-11-13 08:52:22 -08:00
Anees Iqbal 3a7eea4cf5 ICB buffer setters write without the buffer's lock
A buffer slot's setter on a buffer the GPU may not have written names no
state and adds nothing to what the records may hold, so only the count
of the CPU's writes and the kept recordings of its chunk follow it. It
now writes the field without pipelines' lock:

- the chunk is noted in UnlockedWrites (a flag a chunk and one for any),
  published before the write is counted;
- cpu_writes counts every write by an atomic add (Release), under the
  lock or not (a load and a store under the lock alone no longer count
  every write once writers race);
- KeptChunks::settle forgets the noted chunks, as a locked write forgets
  them, at the next look: kept_chunks reads the count before it settles,
  so every write the count counts is forgotten and one it does not moves
  the count; keep_chunk keeps nothing of a chunk a note still names.

Writes of the same command from two threads at once are the program's
race, as on Metal; the SAFETY comments say so.

Probe (job 24544, Iris Xe host, icb_encode_bench, earlier base): the
lock-free path with every count an atomic add took two buffer setters
from 117 to 82 ns a command and three fields from 216/192 to 164 ns.
Before/after on this commit follows.

Test: kept_commands' a_write_without_the_lock_is_forgotten_at_the_next_settle.
2026-11-13 08:52:22 -08:00
Anees Iqbal 133872994d Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 08:33:12 -08:00
Anees Iqbal cbcf4e7888 SEMANTICS_VERSION 2090: a shader's uint2 rasterization-rate map overloads compile to Metal's decoder
The two commits before this one: canon compiles the uint2 overloads of map_screen_to_physical_
coordinates and map_physical_to_screen_coordinates beside the float2 ones, reusing the float2
decoder. Screen to physical is the float2 answer at the pixel's centre, converted to uint
(saturating, NaN 0); physical to screen is the bits of the float (0 - offset) * reciprocal of the
entry of granule c >> 5, as an Apple M3 Max answers (the coordinate's place inside its granule is
not read). The maths is the device's float (owner rule 1), under the existing denormals note. A
table entry's boundary byte is compared on its low seven bits, as Metal does, for float2 too.
Until now a fragment or kernel using the uint2 forms was refused Unsupported{RasterizationRateMap,
NotImplemented}, where Metal makes it (the consumer's Modern Rendering sample's light-heatmap
pipeline). Translator output changes (SEMANTICS); docs/REFUSALS.md is regenerated.

Verified by heapchunk's runs: the M3 probe rate_map_integer_overloads (m3-max-25539, macOS
27.0.1): 20,114 coordinates over 4 maps, at each map's layers and two past them, every one
matching both formulas; 1,561 of those answers kept as test vectors (Metal's answers to our probe
on our maps). At 247e8b66b2 (25640): metal2vulkan-air rate_map 7/7, metal2vulkan 54/54
(bind::rate_map, engine_rate_map with the integer tests, public_fixtures_engine::llvm_as,
engine_refused_families, refusal_surface); the translated kernel in the interpreter equals the
M3's recorded answers at all 587 points on the maps' own layers on 4 profiles. Negative control:
without the seven-bit mask 2 of the 1,561 answers differ. clippy plain, m2v_gpu and m2v_cpu_icd
and rustdoc clean (25607, the same diff before the rebase). Release: the uint2 kernel 0.24 s cold,
about 32 MiB, on moltenvk-m3. The fixture's two .air.ll rows (macOS-only metal-as) run at the
next pin's checks.
2026-11-13 08:32:31 -08:00
Anees Iqbal b31ce16c85 The uint2 rasterization-rate map overloads compile to Metal's decoder
A fragment shader's map_screen_to_physical_coordinates and
map_physical_to_screen_coordinates with uint2 arguments were refused
(Unsupported{RasterizationRateMap, NotImplemented} at the lowering of
Fragment::MapCoordinates). Canon now expands them beside the float2
overloads, reusing the float2 decoder:

- screen to physical: the float2 decoder at the pixel's centre (c + 1/2),
  converted to uint saturating (a NaN to 0), the conversion the float2
  index path already uses;
- physical to screen: the bits of the float (0 - offset) * reciprocal of
  the entry of granule c >> 5 on the axis's to-screen table; the
  coordinate's value within the granule is not read.

Both are Metal's answers as our probe rate_map_integer_overloads measured
them on an Apple M3 Max under macOS 27.0.1: 20,114 coordinates over four
maps (one of two layers), at each map's layers and two past them, every
one equal to these formulas. The arithmetic is float and the device's own
(owner rule 1); where a device's denormals differ from Metal's flushed
ones the existing PrecisionNote::DeviceDenormals reading applies, as for
the float2 decoder. The boundary byte of a table entry is compared on its
low seven bits, as Metal's decoder does (the probe's maps hit an entry
with the high bit set).

The decoder's Rust models gain shader_screen_to_physical_integer and
shader_physical_to_screen_integer. Lowering's MapCoordinates arm is now an
invariant error: canon compiles every overload before lowering.

Tests:
- bind::rate_map::apple_tests::metals_integer_answers: 1,561 of the M3's
  answers (apple_integer_vectors.txt: Metal's answers to our probe on our
  maps, no Apple binary) against the Rust models, each map's bytes
  checked by sha-256;
- tests::engine_rate_map::integer: the fixture rate_map_integer (kernel
  and fragment) compiles on every tested profile, robust and not, passes
  L3 with no RasterizationRateMap note; the interpreter's answers equal
  the decoder's arithmetic at every layer and two past, and Metal's on a
  map's own layers; and the translated kernel's answers equal the M3's
  recorded ones at all 587 recorded points of the maps' own layers, bit
  for bit;
- the fixture's four expectation rows go from the refusal to ok on all
  profiles; integer_rasterization_rate_maps_are_refused is removed.

docs/REFUSALS.md regenerated: the fragment select site leaves the
RasterizationRateMap sites.
2026-11-13 08:31:52 -08:00
Anees Iqbal 32952d53e9 A fixture and an M3 probe of the uint2 rasterization-rate map overloads, refused today
What: rate_map_integer.metal, MSL of ours compiled by scripts/regen-air-fixtures
(.ll and .air.ll companions, TOOLCHAIN line), holding the uint2 overloads of
rasterization_rate_map_decoder's map_screen_to_physical_coordinates and
map_physical_to_screen_coordinates in both directions: a kernel over
coordinates a buffer holds, and a fragment function over its own pixel, the
shape of the consumer's light-heatmap fragment shader. Its rows in
public_fixture_expectations_engine.tsv state today's answer on every committed
profile: Unsupported{RasterizationRateMap; NotImplemented}, the refusal at
lower/fragment/mod.rs's Fragment::MapCoordinates (canon compiles only the
float2 overloads).

And probes/rate_map_integer_overloads.m (conformance): plain Metal's answers
of both uint2 overloads beside the float2 ones and the map's CPU answers, at
every integer coordinate along each axis of four maps, at each map's layers
and two past them.

Why: the consumer's Modern Rendering sample's light-heatmap pipeline is
refused for these calls; Metal accepts them. This commit records the refusal;
the next lowers the overloads.

Verified: not run at this commit; the fixture rows are checked by
public_fixtures_engine at the next commits' runs.
2026-11-13 08:31:52 -08:00
Anees Iqbal af393e883d Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 08:27:56 -08:00
Anees Iqbal 45914edb81 RUNTIME_VERSION 2224: count the bytes of indirect command buffers' records the GPU copies and resets
The commit before this one adds WorkCounts::indirect_record_bytes_gpu_copied and
indirect_record_bytes_gpu_reset: a blit's copyIndirectCommandBuffer and resetCommandsInBuffer
count their records' bytes (COMMAND_BYTES, 2248 a command) as each is encoded. On the RTX 2080 a
copy of 8162 records (18.3 MB) took 16.25 ms of GPU time against 0.66 ms for executing them (the
commit body's table), so a guest walk's counts decide whether sizing records by their descriptor
pays. Counting is runtime behaviour (RUNTIME).

Verified by ratemap's runs on msi (25624, before the rebase onto 65ad8ba049): clippy clean
workspace-wide and on the runtime under --cfg m2v_gpu; the new device test (a copy of 3 commands,
an empty copy and a reset of 2: 3 and 2 records' bytes) and the ICB setters test pass on
lavapipe; signatures --check passes.
2026-11-13 08:27:17 -08:00
Anees Iqbal 18cf0cab66 Count the bytes of indirect command buffers' records the GPU copies and resets
A blit's copyIndirectCommandBuffer and resetCommandsInBuffer move whole
records on the GPU, COMMAND_BYTES (2248) a command whatever the
buffers' descriptor, and nothing counted them. One timestamp-split run
showed they can dominate a command buffer: the 8162-command indexed
merged GPU form of the trail tests, each part its own command buffer on
one device with the trail off (RTX 2080, NVIDIA 620.70.06, a release
build at c9c7b364fb, a measurement not landed):

  part                                              GPU time (ms)
  blit of the 8162 records into a Shared ICB        16.253
  the same into a Private ICB                       16.779
  execution of the Shared ICB, cold                  0.659
  execution of the Shared ICB, warm                  0.658, 0.657
  execution through an empty range (the preprocess
    and both merge passes over every command)        0.151, 0.151
  execution of the Private ICB                       0.657, 0.661
  blit and execution in one command buffer, Shared  16.854, 17.838
  blit and execution in one command buffer, Private 17.282, 17.877
  the trail test's own command buffer               17.051

The 18.3 MB of records the blit reads from the Shared source over the
bus (about 1.1 GB/s there, whatever the destination) are 95% of the
command buffer; the execution's preprocess and merge passes are
0.15 ms, and reading the records from a Shared or a Private buffer
changes nothing measurable.

Whether a workload moves records this way decides whether records
sized by their buffer's descriptor are worth their cost, so the blits
now count what they move, as each is encoded:
WorkCounts::indirect_record_bytes_gpu_copied and
indirect_record_bytes_gpu_reset. A device test encodes a copy of 3
commands, an empty copy and a reset of 2, and checks 3 and 2 records'
bytes.
2026-11-13 08:26:43 -08:00
Anees Iqbal 65ad8ba049 SEMANTICS_VERSION 2089: the lockstep pair search skips answered pairs, so long barrier-free kernels fit their work budget
The commit before this one replaces Reach with a search (lower/simd/lockstep/search.rs) that tries
no pair whose barrier is already a want, answers from one side where a block is uniform, walks
breadth-first, and stops expanding a block whose dominator (forward) or post-dominator (backward)
subtree is closed, barrier-free and acyclic once every divergent block in it is answered, trying
the uniform blocks inside by preorder interval. The wants are unchanged by construction, but
kernels refused as FALLBACK WorkUnits now translate, so a cached refusal must be computed again
(SEMANTICS).

Verified by radvcompile's runs: golden_hashes_match_the_table passes at the change and at
b60fd75969, engine_simd_lockstep 27/27 (m3-max-25588). a_long_barrier_free_kernel_s_work_grows_
with_its_blocks: whole-compile work for P0 K1 2.84M at S1024 and 11.38M at S4096 (4.0x, bound
6x); the_authored_4096_step_kernel_compiles_inside_the_budget (P1 K16) takes 36.98M units. On the
old search both fail LimitExceeded(WorkUnits) at 134,217,729 units (negative control 25582).
Unbounded work: P0 K1 S4096 313M -> 11.4M, P1 K16 S4096 328M -> 37.0M. Release command line on
msi (25596): P1 K16 S4096 1.41 s / 264 MB (RTX 5080 profile), 1.69 s / 279 MB (Iris); P0 K1 S4096
0.40 s / 73 MB; P1 K16 S2048 1.27 -> 0.70 s. Known open: a pair that never conflicts and whose
answer is never a want (many divergent writes to distinct objects all reaching each other) is
still tried against every access it reaches.
2026-11-13 08:22:31 -08:00
Anees Iqbal 30bcdf7019 lockstep: the pair search skips answered pairs and stops where every pair beyond has its barrier
The pair search walked every block each written block reaches, forward from its writes and back
from its writes to the reads, and tried each reached pair. On a long barrier-free body whose
pairs conflict that is quadratic in the blocks: the authored `grow` kernel of 4,096 steps (P1 K16,
about 258,000 instructions, 12,000 blocks; and P0 K1, about 57,000 instructions) was refused with
FALLBACK WorkUnits, though under the inline cap.

What changes (lower/simd/lockstep/search.rs):
- A pair whose barrier is already wanted is not tried. Place's answer depends on one side only
  when a block is uniform across the threadgroup (after `a`, or before `b`), and on the source
  block alone for a divergent target that its crossing block dominates (the first uniform block on
  its post-dominator chain that does not dominate it, with no earlier chain block under it). Wants
  only grow, so a skipped pair stays answered.
- Walks are breadth-first and stop expanding a block whose dominator subtree no edge leaves, with
  no barrier and no retreating edge (forward), or whose post-dominator subtree no edge enters from
  outside (backward), once every divergent block in it has its pairs answered. The uniform blocks
  inside it whose barrier is not wanted yet are tried directly, found by preorder numbers. A walk
  from a uniform block ends once each of its writes has its barrier.
- A block's own end reaches its start (a loop around it) from the strongly connected components
  of the barrier-free body, walked only for a block with a barrier.
- conflict() is monotone in the back-edge flag for two different accesses, so trying a pair once
  per way it is reached gives the wants trying it once with every way would.

The wants, and so every barrier, are unchanged.

Verified (msi, nextest):
- golden_hashes_match_the_table passes at this change and at b60fd75969 (m3-max-25588).
- engine_simd_lockstep: 27/27, with the two new tests; clippy -p metal2vulkan --all-targets
  --all-features -D warnings rc 0 (m3-max-25588).
- New test a_long_barrier_free_kernel_s_work_grows_with_its_blocks: whole-compile work 2.84M at
  1,024 steps (P0 K1), 11.38M at 4,096 (4.0x; the test allows 6x). New test
  the_authored_4096_step_kernel_compiles_inside_the_budget: 36.98M work units. Both fail on the
  old search (m3-max-25582): LimitExceeded(WorkUnits) at 134,217,729 units.
- Unbounded work, old -> new: P0 K1 S4096 313M -> 11.4M; P1 K16 S4096 328M -> 37.0M.
- Release command line (m3-max-25596): P1 K16 S4096 1.41 s / 264 MB (RTX 5080 profile), 1.69 s /
  279 MB (Iris); P0 K1 S4096 0.40 s / 73 MB, 0.45 s / 73 MB; P1 K16 S2048 0.70 s (was 1.27 s).
2026-11-13 08:21:50 -08:00
Anees Iqbal 103658a406 Re-bless the authored compile census at beff81a8b9
The census at the pin-70 tip (m3-max-25568): 2369 cases over 21 profiles, 48670 compiled, 1079
refused, 0 failed, 0 differences, 0 regressions, 348 uncovered cells as at pin 69. 188 cells'
artifact hashes move with SEMANTICS_VERSION 2086-2088, each still compiled. The slowest compile
took 3.2 s and the largest worker 222 MiB, inside the 20 s and 500 MiB ceilings.
2026-11-13 08:18:44 -08:00
Anees Iqbal aac0815714 Re-bless the golden tables at beff81a8b9
The golden tables at the pin-70 tip (m3-max-25567): 3 golden hash rows move under unchanged keys
with SEMANTICS_VERSION 2088 (a loop's AIR unroll request reaches its OpLoopMerge):
engine/hnq_half_layer_composite (.ll and .air.ll; #pragma unroll asks Unroll) and
kernel_threadgroup_float_bbox_atomics (unroll(disable) asks DontUnroll). The inventory and the
golden printouts are unchanged. Test data only.
2026-11-13 08:18:44 -08:00
Anees Iqbal beff81a8b9 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 08:10:35 -08:00
Anees Iqbal 76f5b1b53f SEMANTICS_VERSION 2088: a loop's AIR unroll request reaches its OpLoopMerge
The two commits before this one carry a loop's llvm.loop unroll metadata from the AIR latch to
its SPIR-V OpLoopMerge: unroll.full and unroll.enable ask Unroll (clang's enable: fully where the
trip count is known, partly otherwise, SPIR-V's "to the degree possible"), unroll.count N asks
PartialCount N (SPIRV_VERSION 1.5 has it, held by a const assertion), unroll.disable asks
DontUnroll, and a count of 0 or no request asks nothing. Metal's compiler honours the same
requests; until now every OpLoopMerge carried None. It changes no answer, so it is not a
speed-for-accuracy choice. Translator output changes (SEMANTICS). docs/REFUSALS.md follows a
renamed site (structure_loops).

Verified by imgleak's runs: engine_loop_unrolling, one test per form (5/5 at ba2b803e57, 25358);
negative control with e7ea80f1bb's lower/view.rs, so no request is read: the four form tests fail
(unroll_count [[0]] where [[256, 4]] is expected), the no-request test passes (25376). Before the
rebase, clippy -p metal2vulkan all targets and features clean and 585/586 touched tests, the one
failure golden_hashes on kernel_threadgroup_float_bbox_atomics (unroll(disable)) and
engine/hnq_half_layer_composite (#pragma unroll), re-blessed at the next pin (25343).
Cold creation (driver caches off) and GPU time of the SR conv kernel 199ed, read in place on
um790, base b4a3e4e91c -> nuw e7ea80f1bb -> unroll (25521-25523): RTX 2080 creation 0.076 ->
0.083 -> 0.448 s, GPU 119.8 -> 120.3 -> 6.46 ms a dispatch (binary 23936 -> 106368 B); RX 7900
XTX 0.021 -> 0.116 -> 0.044 s, 12.7 -> 0.72 -> 0.71 ms; Radeon 780M 0.019 -> 0.043 -> 0.042 s,
over 6 s -> 6.08 -> 6.04 ms. On the 2080 the hint costs 0.37 s of cold creation once and saves
113 ms a dispatch; on the AMD devices it keeps nuw's creation and cuts code 15404 -> 12448 B.
Authored fixtures on all three: creation within run-to-run noise.
2026-11-13 08:09:54 -08:00
Anees Iqbal 3d45eccf6c A loop's unroll.enable asks Unroll and its unroll.count PartialCount
The coordinator widened the rule: Metal's compiler honours a plain
#pragma unroll, which it writes as llvm.loop.unroll.enable, so leaving it
unhinted dropped the source's intent. clang's enable means unroll fully
where the trip count is known, else partly: SPIR-V's Unroll, "to the
degree possible". The mapping now:

- unroll.full, unroll.enable: Unroll (0x1);
- unroll.count N, N >= 1: PartialCount (0x100) with N, a SPIR-V 1.4
  control; every module is 1.5, held by a const assertion beside
  SPIRV_VERSION;
- unroll.disable: DontUnroll (0x2);
- nothing else, a count of 0 included, asks anything.

Unrolling gains PartialCount(u32) and literal(); the serializer keeps
each loop's Unrolling and writes the literal after the control, and its
lookup takes .get() (clippy's indexing_slicing, from m3-max-25303).

Tests: engine_loop_unrolling, one test per form (full, enable, count 4,
disable, count 0 and no request), each checking its loop's OpLoopMerge
words after the targets and the interpreter's answer (10) on four
profiles, with spirv-val. m3-max-25303 passed the first test and every
touched test but the golden table, whose 19 bbox-fixture cells move
with its unroll(disable) loop (main re-blesses at landing).
2026-11-13 08:09:11 -08:00
Anees Iqbal 68783530ad A loop's AIR unroll request reaches its OpLoopMerge
The AIR states a loop's unroll request on its latch (!llvm.loop), and the
front end decoded it (LoopHints) but every OpLoopMerge asked LoopControl
None. A latch carrying llvm.loop.unroll.full now makes its loop ask
Unroll, and one carrying llvm.loop.unroll.disable DontUnroll; nothing else
asks anything. Metal's compiler writes unroll.full for #pragma clang loop
unroll(full), unroll.disable for #pragma nounroll, unroll.enable for
#pragma unroll and unroll.count N for #pragma unroll N (xcrun metal -O2,
checked on the M3); the last two still ask nothing.

The hint changes no answer, so there is no switch and no FAST-PATHS row.
It changes translator output, so SEMANTICS moves at landing.

How: LoopMeta's dont_unroll bool becomes Unrolling {Driver, Unroll,
DontUnroll}, carried by Stmt::Loop and LoopSpec; the serializer writes
each loop's control from a sorted table. CfgView::unrolling reads a
block's terminator hints (EntryView: the latch's LoopHints); the
structurizer takes, per loop, the request of the first of its own blocks
that makes one, metered. The rolled regions, the dispatch loop, the
anisotropic routine loop and the fan-out loop keep DontUnroll.

Test: engine_loop_unrolling, four kernels summing words 1..4 (full,
disable, enable, no request), checks each OpLoopMerge's control and the
interpreter's answer (10) on four profiles. Verification: msi job next.
2026-11-13 08:09:10 -08:00
Anees Iqbal c9c7b364fb Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 08:02:48 -08:00
Anees Iqbal c4abcb289e SEMANTICS_VERSION 2087, RUNTIME_VERSION 2223: the fan-out probe counts each draw's flagged triangles
The commit before this one adds a fifth 32-lane set to the rate-map fan-out probe: a flagged
triangle adds 1 into the word its PrimitiveId picks, Probed::flagged_triangles sums the set, and
WorkCounts::rate_map_flagged_triangles counts every flagged triangle of every instance once.
PROBE_DRAW_WORDS = 1 + PROBE_SETS * PROBE_COUNT_WORDS is the one place the word count is stated.
flagged_triangles over parted_region_triangles is the density that decides whether drawing blocks
of flagged triangles pays. The probe's SPIR-V changes (SEMANTICS); the counter is new (RUNTIME).

Verified by ratemap's runs: rate_map_probe_gpu_nanos on lavapipe, 3 alternating rounds, the first
cold, before (44eda17f1d) 20.63, 3.44, 2.43 ms against after (44665e1bce, the same diff) 16.36,
2.60, 1.79 ms, after below before in every round (25310). clippy all targets and features clean;
translator and runtime suites 5066/5067 (25455), the one failure golden_hashes on 40 rows its
base 65ca5fc387 fails the same (re-blessed at pin 69); signatures and the refusal surface
checked. The link test now counts 2 AtomicIAdd, the probe-words unit test sums the fifth set, and
the fan-out device test counts 4 flagged triangles.
2026-11-13 08:02:09 -08:00
Anees Iqbal 758ed9348b The fan-out probe counts each draw's flagged triangles
A flagged draw drawn in parts draws its triangles from the first the
probe flagged to the last region by region
(rate_map_parted_region_triangles), but nothing said how many of those
are flagged themselves: the probe kept only the first and the last.
That density decides whether drawing blocks of flagged triangles apart
would cut the region-by-region triangles.

The probe's geometry stage now adds one, for a flagged triangle, into
the word its PrimitiveId picks of a fifth set of PROBE_COUNT_WORDS after
the flag (PROBE_SETS = 5, PROBE_DRAW_WORDS = 1 + PROBE_SETS *
PROBE_COUNT_WORDS, the only place the word count is stated). The
runtime sums that set (Probed::flagged_triangles) and counts it at the
probe: WorkCounts::rate_map_flagged_triangles. The pieces lane prints
it beside the parted draws' region-by-region triangles and checks it
is non-zero exactly where draws were flagged, and no more than those
triangles.

Tests: the probe's link test counts two atomic adds (the copies', the
flagged count's); the probe words' unit test sums the fifth set; the
fan-out device test checks its four flagged triangles.

The probe's GPU time, verified on lavapipe (LP_NUM_THREADS=1, as CI)
by the fan-out device test (rate_mapped_fan_out::a_host_step_fans_out_
the_commands_the_probe_does_not_flag, one probe of 8 draws, 4 flagged),
release runtime binaries under --cfg m2v_cpu_icd at 44eda17f1d (before)
and this change on that base (after, 44665e1bce), taking turns on msi,
rate_map_probe_gpu_nanos:
before 20.63, 3.44, 2.43 ms; after 16.36, 2.60, 1.79 ms (the first
round of each cold). No growth past the noise: each round's after is
below its before.

Also, from the landed device-local replay scratch (RUNTIME 2220): its
resident root table now lies at a multiple of 32 bytes, which fixes the
internal refusal (RootTable::resident_fields, a moved resident set)
that the old scratch could meet where the upload alignment is 16
(RADV, lavapipe), read from the code, not observed; the compute replay's
scratch (gpu_execute.rs) is upload_aligned to 32 with its table at
slots * SLOT_TABLE_BYTES + PARAMS_BYTES, a multiple of 32, so it has
none.
2026-11-13 08:01:34 -08:00
Anees Iqbal 47fb2942e5 FAST-PATHS: on NVIDIA a no-copy object across two imported guest RAM chunks is a copy
What: a known-gaps entry for the copied-host-pages copy of a no-copy object
whose pages cross the end of a guest RAM's chunk with both chunks imported
(CopiedBecause::OverRamChunk). The consumer's boot makes one on the RTX 2080
and the RTX 3090: a 2 MiB Shared heap 0xde000 bytes before a 64 MiB chunk's
end. It names why only NVIDIA meets it and why no in-place form exists there.

Why only NVIDIA: the plan, not alignment. NVIDIA's held pointer imports cost
a submission nothing, so its plan is Plan::AHEAD: the device's thread imports
the RAM's chunks by pointer before the objects over them exist, and a
straddling object finds both imported. RADV and ANV take the listed plan
(the consumer's RAM has a dma-buf source and each held import costs every
submission there): a chunk is imported only for a copy over it, and an object
over chunks no copy imported takes its own import.

Routes judged:
- Sparse binding over both chunks' imports: VUID-VkSparseMemoryBind-memory-01096
  needs a memory type the sparse buffer takes; on the RTX 2080 (620.70.06)
  that is type 1 alone (device-local, 64 KiB alignment), every usage, with the
  host handle type or without, where host pointers import as types 3 and 4
  (system memory). The intersection is empty.
- A plain buffer binds one memory, its whole size inside it
  (VUID-vkBindBufferMemory-buffer-07459, -None-10741).
- Chunk ends that follow objects: each chunk is imported before the objects
  over it and binds others by the time a straddling one comes; no cut or
  extension puts the object in one memory without a page imported twice.
- An own import beside the chunks: of the pointer, a second import of the
  same pages (VK_EXT_external_memory_host issue 6); of dma-bufs, an alias of
  a pointer import Vulkan does not define (the beside route exists only for
  dma-bufs beside dma-bufs on the listed plan).
- The Managed route's GPU copy in (003dc10fee) rests on Managed's explicit
  synchronization; a Shared copy's coherence is the three-way merge at every
  commit and completion, which a GPU form would run over the host pages at
  each batch's start and end.

Verified on the RTX 2080 (620.70.06, um790, potluck m3-max-25500, at
65ca5fc387): tests::sparse_host_pages printed the types above ("the
intersection is empty: no bind"); host_ram_device's
a_heap_across_two_imported_chunks_is_a_copy_and_imports_nothing passed, its
copied-host-pages notice naming the chunk cause. Docs only; no code changed.
2026-11-13 07:59:51 -08:00
Anees Iqbal b60fd75969 SEMANTICS_VERSION 2086: a long barrier-free kernel's lockstep pair search fits its ledger
The commit before this one keeps one block's reachable list at a time in the lockstep pair
search, so a long barrier-free kernel no longer runs out of its ledger. The pairs, wants and
barriers are unchanged, but kernels that were refused (FALLBACK LedgerBytes) now translate, so a
cached refusal must be computed again (SEMANTICS).

Verified by radvcompile's runs: release on msi, the authored P1 K16 S2048 kernel (about 129,000
instructions) from FALLBACK LedgerBytes in 0.71 s to translated in 1.27 s at 139 MB resident on
the RTX 5080 profile and 1.30 s / 149 MB on Iris; S1024 unchanged at 0.50 s / 78 MB
(m3-max-25407). Negative control (25404, the new tests on the old search): ledger peak 10.3 MB at
256 steps against 144.5 MB at 1024 (14x), so the at-most-5x test fails, and the 2048-step test is
refused at 471.85 MB. At 0e4f537ef7, fmt and clippy rc 0 and the metal2vulkan suite 3545/3546
(25405). The one failure, golden_hashes_match_the_table, lists the same 837 cells at the tip and
at its base 65ca5fc387 alone (25442), all re-blessed at pin 69. Known open: a 4096-step kernel
is still refused (WorkUnits), the pair search's work being quadratic; that is next.
2026-11-13 07:57:50 -08:00
Anees Iqbal 19a0e85a9e lockstep: the pair search keeps one block's reachable blocks at a time
The lockstep pair search (lower/simd/lockstep.rs, pairs) asked Reach for each block's blocks
reachable on barrier-free paths and kept every list it computed, cloned each list it walked
(charged and never released), collected each written block's writes into a charged vector, and
left each walk's touched list on the ledger. On a long barrier-free body every block reaches
every later one, so the kept lists and the leaked charges grew with the square of the blocks: an
authored kernel of 2,048 steps (about 129,000 instructions, 6,000 blocks) was refused
LedgerBytes in 0.7 s with 135 MB resident, the ledger at 471.8 MB of its 471.9 MB bound when
Reach::of grew one more list.

Reach now keeps only the last block's list (pairs asks one block at a time, its accesses in
block order, so a block is walked at most once a pass) and releases the one before; pairs
borrows the lists instead of cloning them, filters a block's writes before its first barrier on
the fly, and releases Reach's tables as it ends; a walk releases its touched list. The answers
are the lists as before, so the pairs, wants and barriers are the same.

Tests (engine_simd_lockstep): a long barrier-free kernel's ledger peak grows at most five times
for four times its steps (a_long_barrier_free_kernel_s_ledger_grows_with_its_blocks), and the
authored 2,048-step kernel compiles inside the standard budget
(the_authored_2048_step_kernel_compiles_inside_the_budget).
2026-11-13 07:57:13 -08:00
Anees Iqbal 50f9eca561 Re-bless the authored compile census at 330ca5a282
The census at the pin-69 tip (m3-max-25454): 2369 cases over 21 profiles, 48670 compiled, 1079
refused, 0 failed, 0 differences, 0 regressions, 348 uncovered cells as at pin 68. 462 cells'
artifact hashes move with SEMANTICS_VERSION 2084 and 2085, each still compiled. The slowest
compile took 2.1 s and the largest worker 231 MiB, inside the 20 s and 500 MiB ceilings.
2026-11-13 07:50:26 -08:00
Anees Iqbal 59ae8089da Re-bless the golden tables at 330ca5a282
The golden tables at the pin-69 tip (m3-max-25453): 88 golden hash rows move under unchanged keys
with SEMANTICS_VERSION 2084 (a pressured kernel takes the Emulated tier in place of the widest
mode's pin on the four ANV profiles) and 2085 (a narrow integer operation the AIR marks nuw keeps
no mask). The inventory and the golden printouts are unchanged. Test data only.
2026-11-13 07:50:26 -08:00
Anees Iqbal 330ca5a282 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-13 07:44:17 -08:00
Anees Iqbal 67ac1116bf RUNTIME_VERSION 2222: a command pool keeps what its uses of the last 5 to 10 s handed out
The commits before this one: a spare command pool keeps, past its last RECENT_USES uses, as many
command buffers of each level as its uses in the last two RECENT_FOR spans handed out, and
RECENT_FOR goes from 1 s to 5 s. A frame's count of command buffers varies over seconds, so with
1 s spans a pool freed command buffers a later frame took again, trimmed, and made them anew: on a
guest's walk on the RX 7900 XTX (RADV), 60-110 command buffers a second freed past recent uses,
10-14 trims a second, about 43 ms a second in allocate_command_buffers and 39 ms a second on the
free thread. HELD (4096) and IDLE_FOR (10 s) still bound what is kept. tests::spares_walk is a
walk-shaped load (a frame of 47-141 passes about 41 times a second beside about 1,600 small
command buffers a second from three queues); pass_costs gains fresh primaries per pass and
--begins. Keeping more spares changes runtime behaviour (RUNTIME).

Verified by perdraw5's runs, release, two rounds per side: 780M (RADV, 25293) 24.8 and 5.2
command buffers allocated a second before, 14.2 and 2.4 freed, 4.2 and 1.4 trims; 0, 0 and 0
after. lavapipe (25352): 2.6 and 7.4 allocated a second before, 0.4 and 0 after. Thread time per
command buffer within noise; spares held 554-623 command buffers after against 504-726 before.
clippy plain and m2v_cpu_icd, Rustdoc and the 23 spares tests on lavapipe pass (25418). The proof
on the real load is a guest walk, where the frees and trims counters should fall to near zero.
2026-11-13 07:43:36 -08:00
Anees Iqbal 5ef0971b1a spares: a pool keeps what its uses of the last 5 to 10 s handed out (was 1 to 2 s)
A guest's Launchpad walk on the RX 7900 XTX freed 60 to 110 command
buffers a second past their pools' recent uses (spare_command_buffers_
freed_past_recent_uses), with 10 to 14 trims a second, and made them
again: its profile had about 43 ms a second inside allocate_command_buffers
(secondaries for passes not inline, encoder primaries, continuations,
barrier primaries, stocked secondaries) and 39 ms a second in the free
thread's frees and trims. pass_costs on the 780M: a primary made new (its
pool trimmed) costs about 13 us to allocate, 14 to 16 us to begin and 23
to 26 us to free and trim, against 0.6 to 0.9 us to begin one kept.

A frame's count of command buffers varies over seconds, and spans of 1 s
forgot what a pool handed out within two. RECENT_FOR is now 5 s; HELD
(4096) and IDLE_FOR (10 s) still bound what the spares keep.

Verified: tests::spares_walk on lavapipe (msi, job m3-max-25352, release,
two rounds each): spans of 1 s allocated 2.6 and 7.4 command buffers a
second and freed 7.2 and 5.2, with 1.0 and 1.2 trims; spans of 5 s
allocated 0.4 and 0 and freed none. The thread time of each command
buffer did not move past the run's noise (compositor 1,673 and 1,559 us
against 1,677 and 1,563; small 74 and 63 against 65 and 69). The RADV run
(780M) is queued; the walk itself is reims's.
2026-11-13 07:42:58 -08:00
Anees Iqbal 872b975b9b tests::spares_walk: frames of 47 to 141 passes, small command buffers of 1 to 8 encoders
A steady shape settles to no churn (a model of the spares' policy agrees);
the walk's frames vary, and a pool's share of a varying frame is what its
recent uses forget. A fixed sequence keeps the runs comparable.

Verified: cargo fmt; the run is the next potluck job.
2026-11-13 07:42:58 -08:00