Translator: a buffer slot takes the storage view on every profile; the uniform view goes

A buffer slot took a uniform view only where containment was the device's
(contain::encoding gave Check::None, under robustBufferAccess or robustBufferAccess2): the
uniform arm of the slot's view choice and Profile F's per-stage storage-buffer fallback. The
runtime enables neither feature, so no runtime module took one. The next commit deletes the
robustness choice; memory, lower and spirv are crate-private, so its dead_code would fail that
commit on its own. The uniform view goes first, with everything that only it reached:

- the uniform forms of a view (UniformWords and UniformVec4) and their reads, and Profile F's
  fallback (fallback_view, fallback_rank). Profile F (runtime-floor without device addresses,
  below the runtime's floor) now refuses a stage past maxPerStageDescriptorStorageBuffers as
  DescriptorCount, where before it read its read-only slots through uniform views, under robust
  descriptors only;
- SlotPlan::lane_read and its planner pass, and Uniformity::among_active_lanes, which only that
  pass ran;
- the storage-view variant: LoweringInputs and VariantKey storage_view_slots, the binder's
  storage_view_variant and large_view_candidates;
- RuntimeFact::UniformViewAliasing and UniformViewRange with UniformViewChoice, and the binder's
  aliasing check with its refusal BindError::UniformViewAliased (docs/REFUSALS.md regenerated:
  binder refusals 9 to 8);
- SpecKey::RangeAtBindOffset (only uniform views declared it), BindState::view_base_alignment and
  uniform_views_at_residual, StageTable.at_bind_views and StageTable::class_alignment;
  BoundBuffer::shape, BoundBuffer::same_shape and StageTable::shape lose their
  view_base_alignment parameter;
- BufferRanges.uniform: BufferRanges::length_class and the binder's offset alignment now read
  maxStorageBufferRange and minStorageBufferOffsetAlignment alone. Nothing in the runtime crate
  reads BufferRanges, BindState, BoundBuffer, StageTable or BindShape (git grep: 0 hits); it
  reaches validation's candidate engine only;
- AccessClass::Uniform, DescriptorView (Storage, UniformWords, UniformVec4) and
  BufferForm::uniform_view; BufferForm::Descriptor loses its DescriptorView field.

The loop hoist stays: the argument table's Uniform block (lower::access::table, the spilled
push fields) still feeds it. Its docs no longer name a buffer slot's uniform view.

Removed or changed public items and the types that own them, each with 0 hits in the
consumer's checkout at bd9d6ae85a and at ad28ebd881 (git grep -w -F over *.rs, *.toml, *.md):
DescriptorView, UniformWords, UniformVec4,
UniformViewChoice, UniformViewRange, UniformViewAliasing, UniformViewAliased, RangeAtBindOffset,
storage_view_slots, view_base_alignment, uniform_views_at_residual, at_bind_views,
class_alignment, uniform_view, same_shape, AccessClass, BufferRanges, buffer_ranges, BufferForm,
StageTable, BoundBuffer, BindState, VariantKey, LoweringInputs, RuntimeFact, SpecKey, BindError.
crates/metal2vulkan/tests/api_signatures.tsv and api_surface.rs are blessed in this commit, and
docs/API.md (the uniform-view form, the bind-offset key, BufferRanges) changes with it.

Stored: VariantKey's storage_view_slots, and the codec tags of BufferForm::Descriptor (no
field), SpecKey (RangeAtBindOffset gone), RuntimeFact (two variants gone) and DescriptorView
(gone). The batch's ARTIFACT_FORMAT_VERSION bump (590 to 591), applied last once for the
batch, covers them; no version moves here.

Tests deleted whole, neither a containment proof: engine_storage_view_variant.rs (the
variant's fixed point) and engine_lane_reads.rs (the uniform view's lane choice). Deleted with
the forms they tested: the uniform-view cases of engine_access.rs and engine_binder.rs, the
slots tests of the large-view candidates and the bind-offset range, the variant's cache round
trip, and the active-lanes tests of lower/simd/uniform. The kept containment proof, a constant
buffer shorter than its window, runs on the storage form
(a_constant_buffer_shorter_than_its_window_is_contained_in_shader). Profile F's new refusal has
its test (a_stage_past_the_storage_buffer_limit_without_device_addresses_is_refused).

Golden: at the batch's top only the stated set's 24 texel-buffer rows moved, the 312 cells
commit 2 alone moved before the rebase; no other row moved on either set. The .air.ll half (567 typed-pointer fixtures,
which need metal-as) is unchecked per commit; the batch's golden bless on the M3 covers it.

Verified:
- On unshipped's tip before this rebase (96d953bb0b), the same change: compile job
  m3-max-66120 green (fmt, signatures, refusals, clippy plain, m2v_gpu and m2v_cpu_icd,
  workspace Rustdoc, api-docs). Before that rebase, this commit alone (hash probe job
  m3-max-65979) read 252 rows equal to its base's arm.
- At the batch's top on 96d953bb0b (all four commits, probe job m3-max-66130): the hash probe's
  252 rows equal unshipped's arm at 4861c9863d (m3-max-65976); the golden probe's set without
  buffer robustness (the runtime's state) equals the base arm 96d953bb0b (m3-max-66128), 1855 of
  1855 rows.
- The states-only play at the batch's top (render and compute states made and refused,
  pipelines_created, made_ahead_variants) is the coordinator's, run on the branch; it is not
  evidence here.
- Here: cargo fmt; signatures check; refusal surface regenerated. The compile job follows on the
  branch tip.
This commit is contained in:
Anees Iqbal committed 2026-11-22 00:17:41 -08:00
1 parent 0fe6627d58
commit 5e3477e60a
76 files changed
+664 -3591

No files matched your search

+13 -29
View File
@@ -1166,8 +1166,6 @@ for dependency in &pipeline.dependencies {
where it does not push set 0; the rest stay of their own types. Keep a binding of several
variables static on MoltenVK 1.4.1: its SPIRV-Cross writes Metal that does not compile for a
dynamic buffer an entry point uses through more than one variable.
- A buffer slot's uniform view is a `Uniform` block (`DescriptorView::UniformWords`, or
`UniformVec4` without `uniformBufferStandardLayout`).
- On MoltenVK, push set 0 (a push descriptor set layout) for a pipeline whose fragment stage writes
a storage buffer of set 0 inside its interlock (an interlock execution mode, and a `StorageBuffer`
variable of set 0 not decorated `NonWritable`): binding through Metal argument buffers, MoltenVK
@@ -1186,29 +1184,16 @@ for dependency in &pipeline.dependencies {
`half` result also specializes one bit of it: whether the class converts its texels to `half` by
rounding to nearest even alone (every class but those with 32-bit float channels, 16-bit
normalized ones and YCbCr fields on the grid `8192`), so a slot bound to both kinds of format
takes two pipelines. Other bound values (a slot's
presence, a sampler's word, whether a uniform buffer's descriptor range starts at its bind offset)
are specialization constants. The last lets a driver load the constants ahead of the shader:
inline bytes take that form, and so does a buffer bound at a multiple of
`max(minUniformBufferOffsetAlignment, 16)` at a slot whose table tells that alignment apart
(`state.view_base_alignment`, and the slot's bit in its table's `at_bind_views`). A buffer bound at any other offset, or at a slot left out, takes the other form, a
pipeline of its own: leave out a slot bound at offsets that move, so that its draws keep one
shape and one pipeline (the runtime leaves out each slot of a state once it finds one bound at
an offset the alignment does not divide). A consumer that draws and dispatches every key with
its uniform views at their residuals (each uniform view's `RangeAtBindOffset` at 0, as the
runtime does on every device whose driver is not measured to load such reads ahead of the
shader) says so with
`state.uniform_views_at_residual = true`: its uniform views then bind ranges their bind offsets
share (below), as a bounded storage view's do. No storage view declares the key: it reads at its
residual, its range from the buffer's start, so the bytes before a bind offset stay reachable.
takes two pipelines. Other bound values (a slot's presence, a sampler's word) are
specialization constants. A buffer slot's storage view reads at its residual, its range from
the buffer's start, so the bytes before a bind offset stay reachable.
- A bound buffer's length enters its shape only as a length class (`bind::length_class`), which a
plan compares with the device's `maxUniformBufferRange` and `maxStorageBufferRange` alone
(whether every range of the buffer fits each). Set each table's
`buffer_ranges = BufferRanges::of(limits)` and its shape tells apart only the classes those
limits tell apart (`BufferRanges::length_class`: a class rounded up to the greatest one that fits
the same limits), so commands over buffers of many sizes keep one shape and one plan: on a device
whose two limits are both 4 GiB, every buffer below 4 GiB. The default tells every class apart.
The runtime sets them on every table it reads.
plan compares with the device's `maxStorageBufferRange` alone (whether every range of the
buffer fits it). Set each table's `buffer_ranges = BufferRanges::of(limits)` and its shape tells
apart only the classes that limit tells apart (`BufferRanges::length_class`: a class rounded up
to the greatest one that fits the same limit), so commands over buffers of many sizes keep one
shape and one plan: on a device whose limit is 4 GiB, every buffer below 4 GiB. The default
tells every class apart. The runtime sets it on every table it reads.
- A two-plane YCbCr texture whose planes a function may read in place states them in its facts
(`TextureFacts::ycbcr_in_place`, a `YCbCrInPlace` of its planes). A slot whose function only samples it (nearest or linear, no comparison,
anisotropy or `min_lod_clamp`), gathers it or reads its size (`RuntimeFact::YCbCrInPlace`) takes the
@@ -1392,11 +1377,10 @@ lies at or past the padded end, the range starts at the bind offset aligned down
descriptor base alignment. An access that reaches back before the bind offset, inside the buffer,
reads the buffer's bytes there, as Metal's does.
A slot of a bounded window read at its residual -- a storage view's always, a uniform view's
where the state says `uniform_views_at_residual` -- takes a range its bind offsets share in the
same way: the buffer from 0 to its padded end where that fits the view's maximum range (a uniform
view's is `maxUniformBufferRange` capped at 64 KiB, its texel form's `maxTexelBufferElements`
texels) and 4 GiB, else the block of half that
A slot of a bounded window read at its residual (a storage view's) takes a range its bind offsets
share in the same way: the buffer from 0 to its padded end where that fits the view's maximum
range (`maxStorageBufferRange`; a texel form's is `maxTexelBufferElements` texels) and 4 GiB,
else the block of half that
maximum (rounded down to a power of two) its window starts in, to the maximum past the block's
start. A window of at most half the maximum starting in a block ends inside its block's range; a
longer one, or one at or past the padded end, takes the range from its bind offset, as every