Files
Anees Iqbal e9e52050d0 Runtime and translator: a compute encoder binds a buffer with its attribute stride, and a dynamic stage-in layout fetches at it
What:
- ComputeCommandEncoder gains three methods:
  set_buffer_with_attribute_stride (setBuffer:offset:attributeStride:atIndex:;
  setBuffers:offsets:attributeStrides:withRange: is a loop of it, as every
  other range call of the runtime is), set_buffer_offset_with_attribute_stride
  (setBufferOffset:attributeStride:atIndex:) and
  set_bytes_with_attribute_stride (setBytes:length:attributeStride:atIndex:).
- Each buffer slot's binding (Slot::Buffer, Slot::Bytes) keeps the stride's
  low 32 bits, so MTLAttributeStrideStatic is 2^32 - 1. A new
  FieldValue::StageInStride(slot) pushes it. It is mapped from the
  translator's PushField::StageInStride, and the interface accepts
  RuntimeFact::StageInStride.
- set_buffer, set_buffer_offset and set_bytes bind a stride of 0, which
  clears an earlier one. That includes set_buffer of the buffer and offset
  the slot already holds, which used to return early.
- Translator: the identity domains accept PushField::StageInStride
  (lower/select.rs), as they accept the vertex analogue
  PushField::VertexBufferStride. Before, a dynamic layout was their typed
  refusal, EncoderValue "StageInStride(1)". The translator test
  a_fixed_layout_records_no_stride_and_a_dynamic_one_records_its_own now
  makes the pipeline, which records RuntimeFact::StageInStride of layouts 1
  and 2 and none for layout 3, the constant step.
- Deleted: StageInKind::DynamicStride, unbuilt_stage_in and its call at
  state creation. Gap::StageIn now names only IndirectRegion.
- Conformance:
  - The runtime side plays the four attributeStride steps and
    setStageInRegion:.
  - The four DynamicStride ledger rows of attribute-stride-buffer,
    -buffer-offset, -inline-bytes and -plural-buffers are replaced by each
    case's dispatchType row (case/outcome/dispatch_type, the consumer's own),
    which every compute-pass case carries.
  - CONFORMANCE-COVERAGE.md is regenerated.
- Regenerated:
  - REFUSALS.md and error/basis.rs;
  - METAL-COVERAGE.md and coverage.tsv (the four setters are implemented);
  - api_signatures.tsv (three methods added, one variant removed).
- Docs:
  - The runtime README's compute section and its known gaps.
  - Validation's ToolingRequirement::DynamicStageInStride doc: the runtime
    builds the layout, and the engine's candidate does not yet bind with the
    stride form. Its classification is unchanged.
- Versions, renumbered at landing: RUNTIME_VERSION 2570 and
  SEMANTICS_VERSION 2370, because the
  translator's refusal becomes a pipeline. runtime-sources.sha256 does not
  move: lower/select.rs, cache/mod.rs and the runtime crate are not among
  its inputs.

Why: the planner ruled DynamicStride BUILD. The translator already lowered
the fetch at PushField::StageInStride. The runtime refused the state because
its compute encoder had no attributeStride setter and no field that pushed
the stride, and the identity domains refused that encoder value.

What a plain bind reads: Metal documents no answer for a plain bind of a
slot that a dynamic layout reads, and the debug layer answers differently.
Probe dynamic_stride_plain_binds.m, job m3-max-85456 (Apple M3 Max, macOS
27.0.1), read stride 0 for every plain bind, alone and after a stride bind
(setBuffer:offset:atIndex:, setBufferOffset:atIndex:,
setBytes:length:atIndex:). Its stride-8 control read stride 8. The planner
ruled to build that answer without pinning it against Metal: there is no
conformance row for it. The setter's doc says Metal documents no answer, and
the runtime device test below holds the runtime's own behaviour.

Consumer search (git grep -n -w DynamicStride in the consumer's checkout at
a34e93e4fa): 8 hits.
- Code that will no longer compile:
  - rt_platform/diag.rs:3077 and :3085 name rt::StageInKind::DynamicStride
    in a test.
- Tests that will fail:
  - rt_platform/compute.rs:1394 expects the dynamic-stride state to be
    refused (StageIn-DynamicStride).
- Docs and comments:
  - rt_platform/compute.rs:18 and :1246.
  - rt_platform/diag.rs:7 and :3081.
  - docs/accuracy-ledger.md:129.
Per compute.rs:14, the consumer binds the attributeStride selectors as the
calls without them. It can now call these setters.

Tests: every_device_fetches_a_dynamic_stride_layout_at_the_stride_each_bind_gives
makes ten binds and dispatches:
- strides 40 and 80, 2^32 + 40 (reads at 40), and MTLAttributeStrideStatic
  (thread 0's element, then zeros);
- set_buffer of the same buffer and offset after a stride bind (stride 0);
- set_buffer_offset after a stride bind (stride 0, one element on);
- set_buffer_offset_with_attribute_stride;
- set_bytes_with_attribute_stride;
- set_bytes after a bytes stride bind, and after a buffer stride bind
  (stride 0).

Verified, at this tree (2f654e598c before the fold):
- Device tests, filtered test(stage_in) | test(dynamic_stride), 8 tests
  each, every one passed; each card printed the dynamic-stride test's line:
  - lavapipe, job m3-max-85611 (998 skipped);
  - RX 7900 XTX (RADV, Mesa 26.2.6), job m3-max-85587, --cfg m2v_gpu;
  - RTX 3090 (NVIDIA 620.70.06), job m3-max-85588, --cfg m2v_gpu;
  - Iris Xe (ANV, Mesa 26.2.6), job m3-max-85601, --cfg m2v_gpu.
- Conformance replay of attribute-stride-buffer, -buffer-offset,
  -inline-bytes and -plural-buffers on the same four devices, same jobs:
  EXIT=0. Each case's one refusal is its dispatchType ledger row, with no
  divergence, so every stride slot read the words the M3 recorded,
  MTLAttributeStrideStatic and the 2^32-truncated strides included.
- Suites, job m3-max-85586:
  - product: 3471 passed, 4 failed, 24 skipped. One failure is
    golden_hashes_match_the_table (the SEMANTICS placeholder; golden tables
    are re-blessed on development). The other three are the fixture tables
    inventory_lists_every_fixture_in_order,
    engine_fixtures_match_their_golden_printout and llvm_as::part_5_of_8.
    All three fail on engine/dvw_depth_views, which development's
    aedc38190f added without rows in public_fixture_expectations_engine.tsv
    or an air_input printout. No file of this change touches them.
  - validation: 1344 passed, 2 skipped.
  - conformance: 1059 passed, 0 skipped.
  - doctests: EXIT=0.
- clippy: plain m3-max-85592, --cfg m2v_gpu m3-max-85593 and
  --cfg m2v_cpu_icd m3-max-85602, each EXIT=0.
- rustdoc, api-docs and rustdoc --document-private-items: job m3-max-85599,
  EXIT=0.
- refusal_surface, metal-coverage, conformance-coverage and api-signatures
  --check: current.
2026-12-03 15:15:11 -08:00
..