What: a new cost fact, DriverWorkaround::UniformAddressStorageReadsSlow, derived for ANV on
the Iris Xe RPL-P alone. On a profile that takes it, with robust descriptors:
- the memory plan finds a kernel's read-only slots read in a loop at a per-instance uniform
offset (SlotPlan::uniform_loop_reads); the loop forest and the per-instance uniformity run
only there (memory::plan::marks_uniform_loop_reads), nowhere else;
- lowering (lower::access::loop_uniform_views) reads such a slot through a uniform view in
place of its storage view when the slot is also one unwritten_slots admits: an argument
the AIR declares unaliased (air-buffer-no-alias) that no store, atomic, volatile or coherent
access reaches, so no write of the dispatch lands on it and the view reads the bytes the
storage view would. No aliasing fact, no bind-time check, no runtime change;
- the view is sized as Profile F's fallback sizes its views (fallback_view): its window's
range, or maxUniformBufferRange where the window does not bound it. Then the slot states
RuntimeFact::UniformViewRange as Viewed and no BufferRangeLimit, so a plan whose shape binds
a buffer whose length class does not fit asks for the existing storage_view_slots variant,
whose compile keeps the slot a storage view and states it Kept (a fixed point). That variant
is made only for such a shape.
Every other profile and stage is unchanged.
Why: Iris job m3-max-36137 measured a convolution's weights, read in its tap loop at the loop
counter, at 316.3 us per tap through the storage view and 249.0 us per tap through a uniform
view of the same bytes (4896.8 and 4042.4 us a dispatch at 15 taps, 10589.8 and 8523.5 at 33).
The uniform view is the one form A's walk and that arm measured fast; ftreg's twin removal
(8933378831) left this slot a storage view, since its window is unbounded.
Docs: the workaround's doc, RuntimeFact::UniformViewRange, finish_slots and loop_uniform_views,
the memory plan's slot docs, docs/API.md section 5. api_signatures.tsv adds the variant;
docs/REFUSALS.md regenerated with no change.
Tests (each fails without the change):
- tests::engine_loop_uniform_views::
- a_loop_uniform_slot_is_a_uniform_view_where_the_profile_takes_the_workaround: on
intel-irisxe-rplp-anv the weights are UniformWords, set 0 writes UNIFORM_BUFFER there,
the range fact is Viewed and no BufferRangeLimit; on intel-uhd770-rpls-anv (same driver and
capabilities, no workaround) a storage view and STORAGE_BUFFER;
- a_loop_uniform_view_needs_an_unaliased_argument_nothing_writes: without
air-buffer-no-alias, or written by the kernel, the weights stay a storage view;
- a_large_buffer_at_a_loop_uniform_view_asks_for_its_storage_variant: a 2 GiB binding asks
for storage_view_slots {weights}, whose compile is a storage view stated Kept, the same key
for the same shape;
- a_loop_uniform_view_reads_the_bytes_the_storage_view_does: on the CPU interpreter the base
module and the storage variant write the same output, the convolution's own.
- memory::plan::tests::uniform_reads: planned on the Iris profile; on moltenvk-m3 the tap
loop's weights are not marked.
The Iris A/B (horizontal and vertical at the guest's shapes, B's output bytes equal to A's)
runs before landing; no landing before it shows the gain.
With it, the two facts it uses (folded from a3088b6722 and 42dfede633):
Memory plan: read-only slots read in a loop at a per-instance uniform offset
lower::simd::uniform gains a per-instance mode (Uniformity::per_instance): values
among the threads of a workgroup that execute one dynamic instance of an
instruction. A header phi is divergent only through a divergent incoming value,
so a counter with a uniform start and step stays uniform inside a loop whose
exit is divergent. Two rules replace the phi's divergent incoming block: a phi at
a join of a divergent branch (labels from the branch's successors, up to its
immediate post-dominator) is divergent, and a value defined in a loop holding a
divergent branch and used outside it is divergent.
The memory plan adds MemoryPlan::read_only (access READ, no atomic, declared
air.read, a buffer parameter's own slot, no dynamic buffer root) and
SlotPlan::uniform_loop_reads: a read-only slot loaded in a loop at an offset that
is not one constant through a per-instance uniform pointer. The loop forest and
the analysis run only where such a load exists.
Step 1 of the uniform-view work for same-address reads on ANV; nothing reads the
fact yet, so this stays on its branch until the view choice is wired.
Uniformity per instance: bound a walk's stack by the body's edges
Cfg::edge_count is test-only; count the body's successor edges instead.
Verified by the next check job.
Verified on the Iris Xe (m3-max-36775, ANV Mesa 26.2.6), A = development 19f8fb7588, B = this change, guest-shaped separable convolution kernels bound as the guest binds them, settled GPU medians per dispatch of 20 x 5: horizontal 15 taps 4908 -> 4037 us (0.823), 33 taps 10601 -> 8522 (0.804); vertical 15 taps 4409 -> 3993 (0.906), 33 taps 9561 -> 8437 (0.882). Output digests equal A and B for every shape; the weights slot is StorageBuffer in A and Uniform in B; B made one module (no storage variant). m3-max-36746 tests 155/155, clippy 0, three negative controls fail; m3-max-36765 clippy --cfg m2v_gpu and m2v_cpu_icd 0, rustdoc 0. Release translation of the library's 10 kernels: slowest 7.7 ms median (8.9 max), peak RSS 16.4 MiB. Golden tables and the compile census are re-blessed on development.