Files
metal2vulkan/docs
Anees Iqbal 6be4be9791 Keep the predicted plain half arm in a key's general form: a creation makes one pipeline, not two
What: on a device that samples through Metal's own texture unit (MoltenVK), a texture slot a
function converts to `half` declares SpecKey::PlainHalfTexels and SpecKey::UnmeasuredTexels.
The general form (render/residual.rs) zeroed both, so a state's creation made its predicted
key's general form (the class routine's arm, PlainHalfTexels 0) and handed the predicted key
itself (the plain arm, 1, as an unbound slot takes) to the pool right after. Every draw of a
plain class takes the predicted key, so the general form served a draw only while the
predicted key was still being made; the conformance cases render-then-sample-magnified-nearest
and -linear made it and no draw took it (cost.rs named it an open bug). PlainHalfTexels is no
longer a constant of the general form: a key keeps the plain arm its binding gives it. The
predicted key is now its own general form, and the creation makes that one pipeline.

What still takes a general form: a draw binding a class whose `half` conversion is not
measured (BC4 to BC7, the linear ASTC formats) keys UnmeasuredTexels 1, which no instruction
reads; its general form is the predicted key, made at creation, so it draws at once and runs
its own key's instructions while its own is made on the pool, as before. A draw binding a
YCbCr field on the grid 8192 (PlainHalfTexels 0) makes its own key at its draw, as any key the
creation did not predict; on a device whose memory is the host's such a slot reads its planes
in place in a variant of its own (VariantKey::ycbcr_in_place), which no creation predicts
either.

Tests: tests::general_form now expects the plain arm kept ([1,1,1,5,3] -> [0,1,0,5,3], an
unmeasured plain class's key -> the predicted key, a YCbCr class keeps the routine's arm); the
made_at_creation lane expects one making at creation on every device (it expected two on
Metal-sampler devices) and the unmeasured-class draw to take the predicted key as its general
form; ycbcr_textures' and runtime_lane's comments follow. Docs: residual.rs, predicted.rs,
WorkCounts::residual_form_draws, API.md's general-form bullet, and cost.rs's open-bug
paragraph (the recordings read 3 made until the rows' next measurement; WASTED_BY_CLASS's
draws ceiling can then drop by 2).

Verified on the M3 Max (MoltenVK 1.4.2), the same diff at 3e0db77c6f over 6f7bb169d2:
- conformance cost --runs 8 --show, each case, in order and alone (jobs m3-max-13511,
  13518): render-then-sample-magnified-nearest and -linear read creation_pipelines_made 2,
  creation_render_pipelines_made 2, variant_pipelines_made 2 (the record holds 3 of each),
  creation_pipelines_drawn 2 (the record's 2): the pipeline no draw took is gone, every
  pipeline made is drawn.
- conformance replay, the whole set (70 s): exit 0, "the 391 row(s) above are exactly the
  open gaps known-gaps.tsv expects on this venue": no case's answers moved.
- 77 touched tests under --cfg m2v_gpu passed: made_at_creation, ycbcr_textures' creation-made
  slot, pipeline_creation's pool draws, draw_work, general_form, uniform_bind_offsets,
  draw_again, draw_shape_notices.

(cherry picked from commit 56ddedfc3498c9376384a3ad4b57e7607d78594a)
2026-11-10 03:07:56 -08:00
..