Commit Graph
1511 Commits
Author SHA1 Message Date
Anees Iqbal 7fdfa8c915 Name the subnormal grid in pixel_samplers' module doc without linking the private function
RUSTDOCFLAGS='-D warnings' cargo doc failed on the stack 28 tree: the public module doc linked the
private subnormal_grid (rustdoc::private_intra_doc_links). It is named in code text now; the
public subnormals case list stays linked.

Verified: the stack 28 gate's doc step failed on exactly this link; the docs leg reruns.
2026-11-05 03:21:19 -08:00
Anees Iqbal e4207f6a4a Count a layout chain's table with its second leaf shared, in the nesting-cap tests
abi::tests::deeply_nested_layouts_are_refused_without_recursing and
layouts_at_the_nesting_cap_decode_on_a_small_stack decode a chain of `cap` layouts beside a second
parameter's leaf layout, a node of its own that decodes like the chain's innermost layout. Since
layouts that decode alike share one entry (4edc720908), that leaf is the chain's entry, so the
table holds `cap` layouts, not `cap + 1`; the cap and its refusal one level past it are unchanged.

Verified: both tests failed in the stack 28 gate's core leg with 64 against 65 (cap 64); they
rerun in the gate's next leg.
2026-11-05 03:11:04 -08:00
Anees Iqbal a1c2a5f52e Pin the runtime sources after the half-rounding revert
The revert (5dbf6f3be3) changes translator sources the runtime pin hashes (narrow.rs, driver_facts.rs).
RUNTIME_VERSION stays 1766: that version is not landed yet, and the revert gives back the notes
development records today for a texel's half rounding, which the 1766 bump never listed.

Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
2026-11-05 02:47:15 -08:00
Anees Iqbal 5dbf6f3be3 Revert counting a texel's half rounding as measured on MetalHalfConversion profiles
This reverts the stack's pick of 384734851d ("Count a texel's half rounding as the measured
conversion on MetalHalfConversion profiles"); SEMANTICS_VERSION goes to 1965, since the recorded
notes change back.

The stack 28 gate's M3 lane run failed
runtime_lane::cross_class_reads::argument_buffer_cross_class_reads_are_the_native_words: an
argument buffer's half read of an integer texture (R8Sint, RGBA8Sint, RG16Sint, RGBA16Sint,
RGBA32Sint, RGBA16Uint, RGBA32Uint; 66 of 2170 lanes) answers the device's quiet NaN 0x7e00 where
the slot's read of the same texel keeps its bits (0xfff5 and the like). The heap read rounds its
texel through float, and that rounding's narrowing no longer recorded NativeHalfConversion on
moltenvk-m3, so the stage carried no note that leaves a half NaN's bits to the device (the notes
were SetPastLayoutSupport, DeviceNanEncoding and HalfTexelConversion). The commit's measurement
covered the extended-range forms' codes, not an integer texel's bits read as half. Until a fix
keeps those bits or notes them, the note stays as it was before the change.

The doc conflict in driver_facts.rs (a later pick's measurement paragraph for the reverted rule)
takes the text from before the change.

Verified: not yet; the gate reruns the core suite and the M3 lanes on this tree.
2026-11-05 02:46:28 -08:00
Anees Iqbal 4edc720908 Decode struct layouts that decode alike to one entry of the ABI's table
The ICB vertex-encode textured fixture's fragment takes the same `Entry` layout that the vertex
function's argument buffer holds. Its typed spelling (metal-as) gives the two uses different
holder types, so the decoder, which memoizes by layout node and holder, built the layout twice
(StructRef 1 and 3) where the opaque spelling (llvm-as) shared one, and
tests::air_abi::typed_and_opaque_spellings_decode_the_same_abi and
tests::air_canon::typed_and_opaque_fixtures_specialize_identically failed on stack 28's tree.

A finished layout is now looked up by the hash of its members, and one equal to an earlier layout
is that layout, so the table depends only on what the layouts decode to, not on how the module
spells or uniques their nodes. Nested layouts are built first, so equal members name the same
nested entries and the shared entry's height is the same. SEMANTICS_VERSION goes to 1964: a
module with layouts that decode alike now has fewer entries, which its translation sees.

Verified: both tests failed in the stack 28 gate's core leg with exactly this difference; the
rerun follows in the gate.
2026-11-05 02:43:25 -08:00
Anees Iqbal 6d63b1154c Pass the copy-ordering test's one run of pages as a slice of it
clippy::single_range_in_vec_init (with --cfg m2v_gpu) rejected `vec![at + page..at + 2 * page]`
as a one-element Vec of a range; the test means a list holding one run, so it now names the run and
passes std::slice::from_ref of it. No behaviour changes.

Verified: the stack 28 gate's clippy --cfg m2v_gpu leg failed on exactly this line; it reruns next.
2026-11-05 02:28:55 -08:00
Anees Iqbal a4b770393a Import CommandBufferStatus and Instant in cross_queue_shadows for every build of the lane
The join retry (45ea28feae) uses both in joined(), which every build of the lane compiles, but on
the stacked tree the opt-in hazard tests' change had put both imports under
cfg(any(m2v_cpu_icd, m2v_gpu_hazards)), so the plain --cfg m2v_gpu build failed (E0433 at the
retry's start time and its fills' status). Both are now imported unconditionally; the hazard-only
imports stay gated.

Verified: the stack 28 gate's lane build failed with exactly these two errors; the rebuild runs in
the gate's next lane leg.
2026-11-05 02:28:54 -08:00
Anees Iqbal a285861e81 Bless the golden tables at stack 28's fixtures
The stack's MoltenVK precision notes add the subnormal and in-place gather fixtures
(ycg_sample_gather, ncw_constant_colors) and move SEMANTICS_VERSION to 1963, so the engine
inventory, the AIR input printouts and the golden hashes are blessed on the stacked tree.

Verified: the bless leg's check of the five fixture tests (metal_as part 2 of 4, llvm_as part 7 of
8, golden_hashes_match_the_table, engine_fixtures_match_their_golden_printout,
inventory_lists_every_fixture_in_order) passed after the bless.
2026-11-05 02:21:26 -08:00
Anees Iqbal 452ab75e82 Pin the runtime sources at RUNTIME_VERSION 1766
Correction to the bump's message: max_buffer_length's device-local heap bound is not in this stack
(it is on the 5080 lane's branch); everything else it lists is.

Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
2026-11-05 02:10:30 -08:00
Anees Iqbal 46f11f0dc4 Bump RUNTIME_VERSION to 1766: kept host steps, kept heap parts, cleared pass-start copies, device-memory overflow, copied host RAM window
- Host-replayed ICBs keep a step's chunks where two steps read the records alike, and put the copy
  of a chunk off where its records changed at two steps in a row (one step in 8 copies it). Each
  batch's footprint is built once. New counters: host_step_chunks_kept,
  host_step_chunks_recorded_again, host_step_records_compared, host_step_compare_nanos,
  host_step_chunk_copies_put_off, indirect_record_bytes_copied, footprints_built,
  footprint_lock_waits, commit_refusals_held.
- A draw's heap part is kept while what it is made of holds, and plans that list the same resident
  uses share them; resident writes, indirect reads and geometry writes are added once per identity.
  New counters: draw_heap_parts_made, resident_uses_unordered_writes, resident_uses_indirect_reads,
  resident_uses_geometry_writes, resident_uses_geometry_checked.
- A pass-start read of the clear alone reads a copy cleared to the clear instead of splitting the
  pass (attachment_read_clears).
- Device-local allocations that fail fall to other memory types with the device-memory-overflow
  degradation (device_memory_overflows); max_buffer_length follows the largest device-local heap.
- Fresh Private textures: unfilled or zero-filled as the presented fact says (MacClass,
  private_textures_unfilled, private_textures_zero_filled).
- Copied no-copy buffers join host memory (run_bound_buffers_made, run_imports_live), with the
  MoltenVK aliased-import blit ordering recorded as RuntimeDriverDefect::AliasedImportBlitsUnordered.
- MoltenVK precision notes: bound sampler words and unary denormals (DriverDeviation and VkProperty
  MetalUnaryDenormals).
Nothing public is removed (api_signatures: 35 rows added, none removed).

Verified: the cherry-picked commits carry their own evidence; this stack's gate runs on the tree.
2026-11-05 02:10:16 -08:00
Anees Iqbal 4f32162f99 Regenerate the conformance coverage document for stack 28's cases and recordings
The coverage document is generated from the suite's sources and recordings; the stack's picks
each regenerated it on their own base, so it is derived again here once over all of them.
Verified: python3 -I scripts/conformance-coverage/coverage.py --check reports it as derived.
2026-11-05 02:09:58 -08:00
Anees Iqbal 1c05ea0004 Time the composited pass-start row
times::every_case_is_timed::every_case_carries_its_timing failed on the new row (potluck
m3-max-792, the conformance suite's one failure in 1018): conformance times --runs 8 --write
pass-start-barrier-private-composited on the M3 Max (m3-max-797, exit 0) writes its record, 1
call within 10x and none over over 8 rounds. The command notes the instrument read 10.38 of its
own costs at Metal's cheapest call on this run, against 1.0 the gate would allow; a time is
reported and never gated.

The same job replayed the 14 rows at 3dc1d0b38d on the M3, exact and default policy, exit 0 both,
with render-pass-split declared on the two draw-barrier-read rows alone.

(cherry picked from commit 1f34f423b4732890567d8367e1a8a52594a66377)
2026-11-05 02:08:35 -08:00
Anees Iqbal 3bfc4ab63d Hold the draws class's wasted creation pipelines at 47 again: the pass-start family wastes none
The pass-start family's 39 wasted creation pipelines were its cases making all five of the
fixture's pipelines and drawing with one to three (fixed in c8d97b90c4 and 2ca0c09fd6, which make
each row the pipelines it draws with), not a misprediction: in the stack-27 records the rows with
no split wasted as many as the split rows, every row's creation_pipelines_drawn was the number of
pipelines its draws bind, and variant_pipelines_made equalled the creation's 5, so no draw made a
variant.

The family's cost records are measured afresh on the M3 Max (potluck m3-max-774): the records the
rows carried were dropped first, since a re-measure keeps a held record's alone-run ceilings and
creation_pipelines_made stayed at 5 through a plain --alone write (m3-max-695, m3-max-753); then
conformance cost --runs 8 --write and conformance cost --runs 8 --alone --write over the 14 rows,
both exit 0, 14 measured. Each row now reads creation_pipelines_made equal to
creation_pipelines_drawn: 2 and 2 on the 11 rows of two pipelines, 3 and 3 on
pass-start-barrier-new-texture-chain, 1 and 1 on pass-start-barrier-new-texture-tile, and 3 and 3 on
the new pass-start-barrier-private-composited. They also carry the cleared copy: 1
attachment_read_clears on the seven barrier rows whose read comes before any draw, 2 on the chain
and the composited row, and attachment_read_splits 1 on the two draw-barrier-read rows alone.

The census of cost::the_creation_prediction over the committed recordings (read off them by a
replica of census(), which reproduces the table before this change exactly) reads the draws class
at 184 rows, 846 made, 799 taken, 47 by none, and all classes at 529 rows, 1,377 made, 848 taken,
529 by none: the ceiling goes back to 47 and the module's table and paragraph say so.

The same job's replays of the 14 rows on the M3 exited 0 under both policies. Their cost half
reads unmeasured, as every selection's does (cost::judge holds a case to its record only in a
whole-set replay), so these bounds are next judged by a whole-set replay.

Verified: the census above; the conformance crate's tests not yet run on this commit.
(cherry picked from commit 3dc1d0b38df80f4fa12f1a3a9d1e630bd996a130)
2026-11-05 02:08:34 -08:00
Anees Iqbal d1bb2b04d9 Declare render-pass-split only on the pass-start rows whose read follows a draw
With the cleared copy and its shadow made at the decision (e0399e2ed3), a read of the clear before
any draw of its pass no longer splits. The family's replays at 0147b3a386 announced
render-pass-split on the two draw-barrier-read rows alone, and the allowance went unfired on the
seven other barrier rows (private and over-buffer barrier-read and barrier-sample, display, chain,
tile) on every venue that ran them: the M3 Max (potluck m3-max-753, exact and default policy),
lavapipe on the msi (m3-max-775, both policies) and the RTX 5080 Laptop (batch entry
pass-start-cc-5080-011619, both policies), every replay exit 0. The allowance now names those two
rows alone, and the module docs say which rows announce what.

Verified only as above, with the old allowances: the replays with these allowances are next.

(cherry picked from commit 637fe40bad9475799b7437489b4c9dc5f5500ed4)
2026-11-05 02:08:34 -08:00
Anees Iqbal 95859dac16 Regenerate the conformance coverage document for the composited row
python3 scripts/conformance-coverage/coverage.py over the tree with
pass-start-barrier-private-composited's recording: one more recording, case and Metal-run answer,
and the Metal items the row reaches counted once more.

(cherry picked from commit 0147b3a386081175dfaffa7c72513efac6def034)
2026-11-05 02:08:34 -08:00
Anees Iqbal 7308a1b909 Make a pass-start read's shadow when the draw decides on its cleared copy
On the M3 (potluck m3-max-695) runtime_lane::attachment_reads::
a_draw_after_a_barrier_at_the_pass_start_reads_the_clear failed: its target, a new texture, split
(splits 1, cleared copies 0), and the conformance row pass-start-barrier-private-composited
announced render-pass-split from its first pass, where the compositor's-shape cost run, whose
first command buffer is untimed, cleared its copy from its second on. Texture::cleared_copy asked
for the texture's usage shadow through usage_shadow_copies, which answers only once a binding has
made it, and a draw decides before its own binding makes it: the first read of every texture split.

Texture::attached_shadow_copies makes the shadow as the draw's sampled binding of a texture that
presents an attachment of its instance makes it (that binding makes it moments later in any case),
None where it is not served. cleared_copy asks for it last, after the structural tests, and takes
the draw's call for its errors.

Unverified: not built yet. The failing lane test is the regression check.
(cherry picked from commit e0399e2ed36795f6ac03b7eccf1d0b53844befd6)
2026-11-05 02:08:34 -08:00
Anees Iqbal 751a984ea5 Record the pass-start family on Metal again, and its composited row
The rows make only the pipelines they draw with (Row::functions), which changed their inputs, so
every row's Metal answers are taken again on the M3 Max (macOS 27.0.1, potluck m3-max-695:
conformance record over the 14 rows, exit 0), and pass-start-barrier-private-composited is
recorded for the first time.

The cost records these files carry are the earlier ones and are re-measured next: an --alone
write folded into the old in-order bounds (creation_pipelines_made still 5) and the composited row
has none yet. The replay on the M3 (same job) held every texel of the 13 rows as before; the
composited row's texels matched too, and it diverged on the notices alone (render-pass-split, from
its first pass, whose copy no binding had made yet when the pass decided).

(cherry picked from commit f12fc777c9eef83994557dc8cac03a5088175db6)
2026-11-05 02:08:34 -08:00
Anees Iqbal 2a0467006c Take the composited row's allowances over the targets a barrier's read renders
Row::barriered_targets was read by the tests alone, and clippy (m3-max-658) failed the library on
it as dead code. The allowances now take the targets they state an answer for through it, where
the zip with every target relied on the answers' list being the shorter.

Unverified: not built yet.
(cherry picked from commit 2ca0c09fd6244a5a23fbc5f0fdd11f9a29106930)
2026-11-05 02:08:34 -08:00
Anees Iqbal 38bf5ce21d Make each pass-start row the pipelines it draws with, and no other
Every row of the pass-start family made all five of the psb_reads fixture's pipelines and drew with
one to three of them, so the creation prediction of each pipeline it never drew with was made for
nothing: 39 over the 13 rows (11 rows of 2 drawn wasting 3 each, the tile row 4, the chain row 2),
the 39 the draws class of cost::the_creation_prediction gained when these rows got their first cost
records.

It is not a misprediction of the split's instances. The stack-27 cost records say so: the rows with
no barrier and no split (private-read, private-sample, over-buffer-read, over-buffer-sample) waste
3 each as the split rows do; on every row creation_pipelines_drawn is the number of pipelines its
draws bind (2, the tile 1, the chain 3), and variant_pipelines_made equals the 5 the creation made
(graphics_pipelines_looked_up 2 for 2 draws): no draw made a variant, so every draw took its
pipeline's prediction.

Row::functions names the functions each row's work draws with; the case makes and fingerprints
those alone, and every_row_makes_the_pipelines_it_draws_with_alone holds that against the pipelines
each row's work binds. The composited row makes psb_solid and psb_sample and its blended pipeline.
The inputs change, so every row of the family is re-recorded on the M3 next, with its cost record,
and the draws class's ceiling goes back to 47 with them.

Unverified: not built yet.
(cherry picked from commit c8d97b90c490c36103d26a2500242eb22b118089)
2026-11-05 02:08:34 -08:00
Anees Iqbal a2749870ce Wrap render-pass-split's trigger doc to the tree's width
Docs only.

(cherry picked from commit c426d2c2315a5bd2c98180b626f3d74bab742e74)
2026-11-05 02:08:33 -08:00
Anees Iqbal bc1d0ab837 Say in render-pass-split's trigger that a read of the clear alone takes a cleared copy instead
The declaration in degradation.rs and docs/API.md's catalogue entry both said a draw that reads a
color attachment's texture after a memory barrier splits the pass. A read of the clear alone
before any draw of the pass now reads its copy cleared to the clear in the pass's one instance
where the copy can be (WorkCounts::attachment_read_clears), so both name that exception.

Docs only; unverified beyond cargo fmt.

(cherry picked from commit 1bcf89e89571bc7f65694c10ea34bdde6c3af6b0)
2026-11-05 02:08:33 -08:00
Anees Iqbal 9e11186924 Ask the pass-start read of a compositor's shape: twice a command buffer, then blended quads
A new row of the pass-start family, pass-start-barrier-private-composited: a 64x40 private
target that an earlier pass leaves as the small rows' targets are left, then two passes in the
one command buffer that each clear it, begin with the barrier over the render targets, sample the
target itself in pixel coordinates over a quad of a quarter of it, and draw three blended quads
that sample three other textures, each overlapping the quad. It is the shape a compositor draws
and the one the cleared copy serves: no draw before the read, the read the pass's first draw, and
a second pass whose copy is cleared again after the first pass's reads of it.

The case states both answers: the Mac2 one in its allowance (the clear, reordered, where the
sample wrote), and the M3 Max's in a test held to the recording (each pass reads the texels from
before its pass, so the quad holds the earlier pass's texels reordered twice). The blended pipeline
is made and fingerprinted by this row alone, so no other row's inputs or transcript move. The row
declares no render-pass-split notice: a cleared copy splits nothing.

Unverified: not built, not recorded on the M3 yet.
(cherry picked from commit 4d3def487fd1fcb564b21800d74cbdb67bc02a1d)
2026-11-05 02:08:33 -08:00
Anees Iqbal de64560175 Name the pass-start read's cleared copy in the API guide's accepted difference
docs/API.md: a draw that reads the clear after a render-target barrier before
any draw of its pass reads its copy cleared to the clear in the pass's first
instance where the copy can be so (WorkCounts::attachment_read_clears), else an
instance after one of the clear alone.

Unverified: documentation of 4259b7f41c, whose runs are pending.
(cherry picked from commit cc9312dcc9a97d5c663efbfea3f0f25374581249)
2026-11-05 02:08:33 -08:00
Anees Iqbal 9a332d2ac6 Hold the pass-start lane to the cleared copy, and weigh a compositor's shape
runtime_lane::attachment_reads:
- Moved counts attachment_read_clears; check() takes a cleared copy for a
  read after a barrier, as a split or a snapshot, and asks for a shadow copy
  only where none of those served it.
- a_draw_after_a_barrier_at_the_pass_start_reads_the_clear: the texture of
  its own image, a whole one-level, one-slice texture the pass clears in
  place to whole codes, reads its copy cleared to the clear in the pass's one
  instance (one cleared copy, no split, one instance begun) wherever the
  device does not snapshot it.
- a_draw_after_one_that_wrote_behind_a_pass_start_barrier_reads_what_it_wrote
  (new): the barrier, draw A over [8, 16)^2, then the read through READ_AREA:
  A's red inside A's block, the clear around it, and no cleared copy, as the
  copy after the instance A drew in holds. A cleared copy would read the
  clear inside A's block, so this is the negative control of the rule that a
  copy is cleared only before any draw of the pass.
- started_pass takes the optional draw A.

runtime_lane::attachment_read_costs::pass_start_clear_read_costs (new,
ignored, release): 60 passes in one command buffer over a 3840x2400 private
BGRA8Unorm target, each loading Clear and storing, its first command a
render-target barrier from the fragment stage to the fragment stage, then a
quad over a quarter of the target sampling it (psb_sample) and three blended
quads sampling other textures; prints GPU and CPU time per pass and per pass
the splits, instances begun and texels copied in. It reads no counter the
tree before the runtime change lacks, so it runs on both.

Unverified: not built or run yet (potluck jobs next).
(cherry picked from commit 0a45d4a84cdf34cad9f11d235025df3d561151a2)
2026-11-05 02:08:33 -08:00
Anees Iqbal 754d3ea009 Read a cleared copy's sample count as the translator's flags give it
Texture::cleared_copy compared ImagePlan::samples with an ash constant the
translator's SampleCountFlags does not have; it now reads the raw count, as
snapshot_color does.

Verified: the build error is gone only once the next clippy job runs.
(cherry picked from commit cc7d3deeb2684c58bb23d3b5a95445af7fdf0719)
2026-11-05 02:08:33 -08:00
Anees Iqbal 2d6b322e40 Clear a pass-start read's copy to the clear instead of splitting the pass
A pass that clears a color, begins with a memory barrier over the render
targets and then samples that color's texture split off a first instance of
the clear alone, stored it, loaded it again in the next and copied the read's
texels between (3797c098eb). On the M3 Max under MoltenVK that cost 8 to 12%
of a frame of 60 such passes over a 3840x2400 target, about 17 to 27 us of GPU
time and 11k host instructions a pass.

Before any draw of the pass has recorded, the copy the draw reads holds
nothing but the clear. So where that copy can be cleared to it
(Texture::cleared_copy: the texture's shadow is an image of its own, the
texture a single-sampled 2D one of one level and slice that exactly one
color renders whole, in place, in the image's format, inside the render
area, loading it Clear with no clear whose note the load withholds and no
extended-range route, stand-in or sample planes), the draw stays in the
pass's first instance and the copy in before the pass is a clear of the
shadow's image to the pass's clear value (vkCmdClearColorImage, which Vulkan
converts as the load operation). The shadow then holds the truth nowhere, so
no carry takes it and its next use copies in again. Later draws of the
instance read the same copy. Once a draw has recorded (it may have written
the attachment, which the copy must then hold), a tile dispatch ran or the
pass split, a draw that needs a new such copy splits as before.

- shadow.rs: ShadowUse::cleared and ShadowCopy::clear; ShadowSync::before
  plans the clear in place of any copy in; a clear copies no texel and is
  not counted in shadow_copies; ShadowCopies::cleared_image.
- render/shadows.rs: an instance's gathered clears (InstanceShadows) mark
  its shadows' uses.
- render.rs: the draw's decision (cleared_copies) and its gathering.
- WorkCounts::attachment_read_clears counts the draws that brought new such
  copies, apart from attachment_read_splits and instance_splits_attached_read.

Unverified: not built yet (no local cargo here; the build and the lanes go
through potluck next).

(cherry picked from commit 685063b3af2fbc64100749bf4f641d077780375c)
2026-11-05 02:08:33 -08:00
Anees Iqbal 9cd726b365 Retry the one-VkQueue cases' join with two new queues until one joins
The two cross_queue_shadows cases on one VkQueue failed 9 of 12 runs on the
RTX 5080 Laptop GPU across three trees, every time at "the queue joined":
queue 2's command buffer, made after 24 short fills on queue 1 were
scheduled, did not join queue 1's VkQueue. That join is the precondition, not
the claim: queue_share.rs joins a busy VkQueue only while its oldest batch in
flight is younger than 0.5 ms and no long queue holds it, and one try loses
that where queue 1's fills are done before queue 2 looks, or where other
processes' work on the GPU (the module's own 1.5 s spins, run beside it by
nextest) holds the oldest fill past 0.5 ms or spans a fill past 2 ms, so
marking queue 1 long.

joined() now makes its two queues itself and, where the device shares, tries
again with two new ones (the old ones' work waited for, so a long mark goes
with them) until a try joins, for up to 20 s. Each miss prints what the
joiner met: fills seen complete, the GPU's last fill end against the look,
the oldest unfinished fill and its approximate head age, the longest fill,
and the sharing counters' deltas. The data assertions are unchanged.

Verified: clippy (--cfg m2v_gpu, all targets, all features) is clean. The
runs on the M3 Max (no sharing, one try) and the 5080 loop are pending.

(cherry picked from commit 45ea28feae518d91f88d37cbbc0576900f4dcfb3)
2026-11-05 02:08:32 -08:00
Anees Iqbal d3f2bf185a HostRam: test a run-bound buffer against copies of its pages; copies' take wording
On gate/stack27b the HostRam copies (copy_from_host_ram,
copy_to_host_ram) and the run imports compose: a copy reads and writes
a chunk's pages through the chunk's import, and an object over a chunk
not imported yet is bound in an import of its own run, two imports of
the same pages ordered only by their host bytes (host_aliases.rs).

New device test
a_run_bound_buffer_and_a_copy_of_its_pages_order_by_their_host_bytes:
four pages over a chunk not imported are bound in their run's import,
and then, both ways:
- a fill through the buffer before a gather of its second page;
- a scatter into that page before a copy out of the buffer.
Each way runs in one blit encoder (a barrier recorded between them),
in two encoders of one command buffer, and across two queues in commit
order (the writer behind 2 GiB of private fills). The six copies import
nothing, and the run's import stays live. On a device with
RuntimeDriverDefect::AliasedImportBlitsUnordered (MoltenVK) the test
asserts the fallback: no run import, the buffer imports the chunk and
lies in the copies' import.

Docs: copy.rs's module docs and HOWTO said a copy takes a chunk "as an
object does", importing it or waiting for its import; objects no longer
wait, so both now say that a copy makes no run import of its own and
waits. host_ram.rs and HOWTO add the copies to what a run-bound
object's uses order against, and the test module's docs add the
composition.

Verification is pending in this commit: M3 and RTX 5080 device runs.

(cherry picked from commit be6d43fbf2c0a5921a2468038740ef3604a2da9f)
2026-11-05 02:08:32 -08:00
Anees Iqbal c074aa490e Document the HostRam window's direction, the runs' imports and their fallback
docs/HOWTO.md's "One run inside one chunk" bullet now says what the
branch's runtime does: the window opens in the takes' direction, up or
down the RAM; an object over a chunk not imported yet is bound in an
import of its own run (run_bound_buffers_made, run_imports_live) and
never waits for the chunk's fault-in; the price is up to one more
allocation and pin per such object; and where the object falls back to
the chunk's import (thread stopped, chunk failed or given back,
allocations within the margin, a whole-chunk run, or
RuntimeDriverDefect::AliasedImportBlitsUnordered on MoltenVK).

It adds the measured result from tests/host_ram_window_bench.rs on the
RTX 5080 laptop (NVIDIA 615.71.09), at 2b2419c67c: 256 2 MiB heaps
upward, downward and scattered had no making of 5 ms or more (slowest
1.4, 1.5, 3.7 ms), against 2, 8 and 15 makings importing a chunk
(slowest 8.2 to 8.7 ms) without the change; 128, about 76 and 20 heaps
were bound in their own runs' imports.

Docs only; verified by reading the text against host_ram.rs's
for_object and after_take.

(cherry picked from commit 25572e5af997da7009960fa31bf94c5d478e2370)
2026-11-05 02:08:32 -08:00
Anees Iqbal 9e335aae31 HostRam: no run imported alone where barriers miss aliased imports (MoltenVK)
What:
- RuntimeDriverDefect::AliasedImportBlitsUnordered (metal2vulkan::error): a
  pipeline barrier between two blits does not order them where they reach the
  same host pages through two imports, which Vulkan counts as aliases of one
  memory ("Memory Aliasing": memory bound through external memory import
  mechanisms). MoltenVK has it (driver_defects.rs: its barrier between blits
  ends the Metal blit encoder and leaves the order to Metal's hazard tracking,
  which is per MTLBuffer, and each import is an MTLBuffer of its own).
- On a device with it, RamOnDevice::for_object never binds an object in an
  import of its own run: the object imports the chunk, or waits for the
  thread's import of it, so every object over a chunk's pages lies in the
  chunk's one import, which Metal orders, as before the run imports.
- The HostRam device tests hold both forms (runs_alone): the window, the
  downward run and the ordering test assert the run imports where the device
  orders aliased imports, and the fallback (no run import, the chunk imported
  by the object, which waited for it) where it has the defect. The ordering
  test asserts the order on every device.
- host_ram.rs states the trade the run imports make: up to one more
  allocation and pin per object made while its chunk is not imported, for the
  object's life (128 of the bench's 256 upward heaps on the RTX 5080 laptop).
- Docs: the defect's variant and table entry, host_ram.rs, Device::use_host_ram,
  HostMemory::with_runs, WorkCounts::run_bound_buffers_made; the defects test
  lists it for MoltenVK; api_signatures.tsv. REFUSALS.md regenerated
  (unchanged: no refusal names it).

Why: on the M3 Max (macOS 27.0.1, MoltenVK 1.4.2) at 2b2419c67c,
tests::host_ram_device::a_run_bound_and_a_chunk_bound_buffer_over_the_same_pages_order_by_their_host_bytes
failed: "run to chunk: the copy in one encoder read the fill" (stale bytes;
the runtime's command barrier was recorded, command_barriers grew). The same
test passes on the RTX 5080 laptop (NVIDIA 615.71.09), in one encoder, two
encoders and across queues. HostRam on a Mac is not a product path (the
consumer uses its Metal arm there), so losing the no-wait gain on MoltenVK
costs nothing real; the ordering holds on every device.

Verified: cargo fmt; scripts/refusal-surface/refusal_surface.py (no change).
Build, clippy and tests run through potluck jobs after this commit.

(cherry picked from commit 3eb01a011f20ac5aa96c134b50b15219c93c1a34)
2026-11-05 02:08:32 -08:00
Anees Iqbal 77ee1a0d5d HostRam: no object waits for a chunk's import; the window follows the takes' direction
What:
- An object over one run inside a chunk not imported yet (outside the window,
  or the chunk the device's thread is importing) is bound in an import of its
  own run alone (RamOnDevice::for_object, a RamChunk of kind Imported::Run made
  through the same import_chunk): its pages faulted in and pinned, no more,
  on the making thread, while the thread imports the chunk. The objects over
  the chunk after that are bound in the chunk's import. The gate is not asked,
  as for a chunk. Counted: WorkCounts::run_bound_buffers_made, and the gauge
  run_imports_live (a run's import goes with its last holder).
- The fallback is the blocking chunk() as before, where the run is the whole
  chunk, the device's thread does not run (held, never started, or ended:
  Wake::running, cleared by a drop guard however the thread ends), the thread
  failed or gave back the chunk (tried), the device's allocations are within
  the margin of maxMemoryAllocationCount the ahead import leaves
  (Allocations::room_ahead), or the run's import fails. The making never
  fails for it.
- Window: the chunk an object last took is first in it (the thread imports
  the taken chunk where an object bound its run alone), then the chunks past
  it in the takes' direction: a take inside the window or next to the chunk
  last taken opens AHEAD_CHUNKS that way, a jump one chunk in the jump's
  direction. So a run of heaps down the RAM finds its chunks imported, as one
  up it does.
- chunk() keeps its signature and behaviour (the HostRam copy port waits for
  whole chunks through it); import_chunk takes the kind.
- Docs: host_ram.rs (module, Device::use_host_ram, bind_in_chunk),
  HostMemory::with_runs, the two WorkCounts fields; api_signatures.tsv.

Why: reims-vgpu measured each chunk's first object over fresh RAM waiting
for the whole chunk's fault-in on the RTX 5080 laptop (p50 39-123 ms, worst
1.46 s) whenever its heaps went down the RAM or jumped, since the window only
followed upward runs and an object outside it imported the whole chunk on its
own thread.

Tests (host_ram unit and device tests):
- a_take_inside_the_window_or_next_to_the_last_opens_it_in_the_takes_direction
  and the order test (the taken chunk first, the window below a step down,
  nothing below the RAM's start).
- the_window_ahead_moves_with_the_objects_and_imports_no_more: the jump's
  heap is bound in its run's import and the thread imports its chunk too.
- a_run_of_heaps_down_the_ram_finds_its_chunks_imported_and_none_waits_for_one:
  CPU and GPU bytes through a run-bound heap; the window goes down; the runs'
  imports go with their heaps (run_imports_live back to its start).
- an_object_within_the_allocation_margin_imports_its_chunk_and_no_run.
- a_run_bound_and_a_chunk_bound_buffer_over_the_same_pages_order_by_their_host_bytes:
  write through one, read through the other, both ways, in one blit encoder
  (command_barriers grew), two encoders, and across queues in commit order.

Verified: cargo fmt. Build, clippy and the device tests run through potluck
jobs after this commit.

(cherry picked from commit 9a2fd93d37aaed5dc952bc9f50f905f350ccec9a)
2026-11-05 02:08:32 -08:00
Anees Iqbal 8e0bc77252 Add the HostRam window bench: 256 heaps over fresh RAM, upward, downward and scattered
What: tests/host_ram_window_bench.rs, an ignored release bench (cfg m2v_gpu or
m2v_cpu_icd). On fresh RAM of its own for each order (a memfd advised for huge
pages on Linux, anonymous shared memory elsewhere) and the device as the
product makes it, it makes 256 no-copy heaps of 2 MiB over the RAM a device
uses: upward (two bursts of 128 consecutive heaps, 1 s apart), downward (the
same runs from the top, each heap the one below the last) and scattered (256
distinct runs over 32 chunks, 10 ms apart). It prints the makings of 5 ms or
more, the slowest and the median, the chunks imported ahead and by the
makings, and the heaps bound in a chunk (HOST-RAM-WINDOW). The device tests'
fresh_ram, ahead_device, resolver, itself and gate are now pub(super) for it.

Why: reims-vgpu's guest makes its heaps over RAM that goes down the address
space or jumps; the window ahead follows only upward runs, so each chunk's
first heap of such an order imports the whole chunk on the making thread. The
bench uses only API present before the fix, so the same file measures before
and after.

Verified: cargo fmt; built and run through potluck jobs after this commit.
(cherry picked from commit 472d6a912cc8e52e89842289d4047a5f2c0fca8c)
2026-11-05 02:08:32 -08:00
Anees Iqbal d5329d1398 Record beside place() that a failing device-local try past a full heap is cheap
Measured on the RTX 5080 Laptop GPU (b5080 entry fresh-vram-time2-011808,
kind t, the test's pageable-off build at 722bbd5faa). The heap was full
after 56 x 256 MiB and topped up with 48 MiB buffers. Past it, 8 bare
device-local allocations of 48 MiB answered
VK_ERROR_OUT_OF_DEVICE_MEMORY within 4 us (median under 1 us).

The whole make of each block-sized resource past it, every one of the 16
overflowing:
- 48 MiB Private buffers: median 6.9 ms, longest 7.2 ms. Before the fill,
  in device-local memory: median 0.47 ms, longest 10.4 ms (the first).
- 4096 x 4096 RGBA8Unorm textures: median 9.2 ms, longest 9.5 ms. Before
  the fill: median 0.65 ms, longest 1.2 ms.

So the failing try is under 0.1% of an overflowing make, and place()
keeps no record of a full heap: no budget query, no skip, no counter.
What the rest of an overflowing make costs was not split apart.
Everything still read back correctly, 12 placements past the fill
overflowed, and the notice was announced once.

Verified: the run above; fmt only for this comment.
(cherry picked from commit 84182dc006eba552c3f2e16d1a0d9a058cc1fdba)
2026-11-05 02:08:31 -08:00
Anees Iqbal a25eaf15bf Time block-sized makes past a full heap, topped up first, with the allocations' answers
The first timing run did not answer the question. Its 1 MiB buffers and
256 x 256 textures pooled into blocks made before the fill, so most makes
past the full point needed no new block. The fill also stopped at its
first overflow with up to 256 MiB still free: 2 of 4 64 MiB buffers past it
were placed device-local. The 8 bare allocations all failed at a median
under 1 us, longest 40 us, but their result codes were not printed.

The timed resources are now one block each: 8 Private buffers of 48 MiB
and 8 textures of 4096 x 4096 RGBA8Unorm. Past the fill, the heap is
topped up with such buffers until one overflows, and the test prints how
many of the timed placements overflowed and each bare allocation's
vk::Result.

Verified: nothing yet (cargo fmt only); the 5080 run follows.
(cherry picked from commit 722bbd5faa28a4db2aaefee53eed87f5721e7331)
2026-11-05 02:08:31 -08:00
Anees Iqbal 9dca9144cd Time small Private makes before and past a full device-local heap
Past a full heap every Private placement that overflows first fails to
make a new device-local block, and on NVIDIA a failing vkAllocateMemory
may be slow if the driver tries eviction. The device test now times the
makes of 32 small Private buffers (1 MiB) and 32 textures (256 x 256
RGBA8Unorm) before the fill and again past the full heap, and also times
8 bare allocations of a block in the device-local type there. It prints
the median and the longest of each (VRAM-OVERFLOW) and asserts no time.

Verified: nothing yet (cargo fmt only); the 5080 run follows.
(cherry picked from commit 12a16b062902258c5a86cfc4d44ddd456a554461)
2026-11-05 02:08:31 -08:00
Anees Iqbal 040a382d03 Record the RTX 5080's overflow types and its driver's paging
What the overflow device test measured on the RTX 5080 Laptop GPU (Linux)
now stands in the docs it backs. Its memory types are flags 0x0@heap1,
0x1@0, 0x6@1, 0xe@1, 0x7@0, and its heaps are 17.09 GB and 75.66 GB. A
placed buffer takes types 0b11111 and an optimal color image takes 0b11,
so Private buffers overflow into types 0, 2 and 3 and images into type 0.
Images therefore take the overflow route and need no refusal or known
gap; depth images were not probed. With
VK_EXT_pageable_device_local_memory the driver paged: 72 Private buffers
of 256 MiB were made without one overflowing. Without it, the 60th
overflowed.

Verified on the 5080 (b5080 entry fresh-fresh-vram-003651-003652, kind
t, workspace at 18cf0ae4e8):
- as committed: pass, pageable true, 72 buffers filled with nothing
  overflowed, 0 announced, max RSS 4.87 GB;
- pageable sabotaged off: pass, the heap was full, every buffer (Private
  and Managed) and texture past the fill lies in system memory, 15
  placements overflowed, announced once, every byte read back, and a
  buffer made after the frees lies in device-local memory again;
- pageable off and overflow_candidates sabotaged empty in place(): fail,
  the fill's new_buffer refused with OutOfMemory(Device). This is the
  negative control.

(cherry picked from commit 7f74f3c75b766f45b2aa239d4224333e4ab30d75)
2026-11-05 02:08:31 -08:00
Anees Iqbal 3cab7e4460 Bless the API table for the overflow counter and notice
WorkCounts.device_memory_overflows and Degradation::DeviceMemoryOverflow
(python3 scripts/api-signatures/signatures.py --bless). REFUSALS.md
regenerated with no change.

Verified on the M3 (potluck m3-max-566, at 18cf0ae4e8): clippy
--workspace --all-targets --all-features, clippy --cfg m2v_gpu of the
runtime, validation and conformance, and clippy of the runtime with
--cfg m2v_gpu_hazards too, all -D warnings clean; 54/54 runtime CPU tests
(tests::memory, tests::device, tests::degradation*, the catalogue and the
lane-site closure) pass.

(cherry picked from commit d4199a09615c1acfce28ac6608ea996dd6cd870a)
2026-11-05 02:08:31 -08:00
Anees Iqbal 20b8d869fe Print memory types by their raw flags in the overflow device test
ash is built without its Debug impls here, so neither vk::MemoryType nor
MemoryPropertyFlags formats with {:?}: the test's TypeView derives no Debug
and the test prints each type's flags as raw bits.

Verified: the msi build at 586f2d0b5c failed on exactly these two errors
(E0277); the rebuild follows.

(cherry picked from commit 18cf0ae4e8561fd66a6147887a964439d28c5ace)
2026-11-05 02:08:31 -08:00
Anees Iqbal 749daae1d9 Say a texture's image of any storage mode may overflow past device-local memory
Every texture's image is placed in Private memory (image_plan.rs), so a
Shared or Managed texture's image overflows as a Private one does; the
notice's declaration, the catalogue entry, the runtime README and the
lane's site note now say so.

Verified: nothing (docs and comments only).
(cherry picked from commit ec5b5a70fdea000eb9a7d5ab84e5aaad02fffed4)
2026-11-05 02:08:31 -08:00
Anees Iqbal a720be9cf5 Read an overflowed buffer's placement only where it lies in the runtime's own pages
own_pages_overflowed went through OwnBytes::with, which for a buffer over
host pages reads them for ReadApart::Binding and keeps the import for good;
every program buffer is now asked, so that would be a side effect on each.
It now reads Lie::Fixed pages only, as in_fresh_pages does: host pages are
imported and never overflow.

Verified: nothing yet (cargo fmt only).
(cherry picked from commit 77702ceef4f18d30cfe32499fd3be25729e49bcb)
2026-11-05 02:08:31 -08:00
Anees Iqbal 8ccb2934c9 Place resources past a full device-local heap in system memory
Placement refused a resource once device-local memory was full: memory.rs
gives the Private class only DEVICE_LOCAL types, every texture's image is
Private, and a Managed buffer's own bytes on a device without unified memory
are Private, so place() returned OutOfMemory(Device). On the RTX 5080, 96 of
5090 1-MiB Managed GPU copies were refused at about 5 GB held, where Metal
on a 4 GiB Radeon Pro 5300M made, used and read back 12 GiB of Managed
buffers, six 1 GiB Private buffers and a 17 GB Private heap.

- memory.rs: overflow_candidates, the types a Private or Memoryless
  resource overflows into where none of its own has room (allowed,
  allocatable, neither device-local nor lazily allocated; those the host
  does not map first). place() tries them after the class's own types;
  such a placement is marked (Placement::overflowed) and counted
  (Memory::overflows, WorkCounts::device_memory_overflows). Metal's own
  refusals (max_buffer_length, texture limits) stay where they are.
- Driver paging first: VK_EXT_pageable_device_local_memory with
  VK_EXT_memory_priority, enabled where the device lists both and has
  pageableDeviceLocalMemory (enables.rs, create.rs); the spec lets such a
  driver page memory out rather than fail an allocation. Every allocation
  keeps the default priority.
- Degradation::DeviceMemoryOverflow (performance), announced once for a
  program's buffer or heap (degrade_system_memory, which now names the
  storage mode) and texture (Texture::overflowed) that overflowed.
- Tests: tests::memory::device_local_classes_overflow_into_system_memory,
  tests::device::pageable_device_local_memory_is_enabled_where_the_device_has_it,
  and the device test tests::device_memory_overflow (a GPU hazard, under
  m2v_gpu_hazards on a GPU, in the shape of 7b57d9a87a; check-cfg added),
  which fills device-local memory where it can overflow and makes, uses
  and reads back Private buffers, a Private heap with a buffer and a
  texture, Private textures and Managed buffers past it. The lane names
  the kind's site as the runtime's test (degrade_notices OVERFLOWED).
- Docs: API.md (runtime-own extensions, catalogue entry), runtime README
  memory model.

Verified: nothing yet (cargo fmt only); builds and runs follow as potluck
jobs.

(cherry picked from commit 586f2d0b5c6708016d9a255c0934f9727569125c)
2026-11-05 02:08:30 -08:00
Anees Iqbal f8ae28043e Show the adopted device's declared Mac class in its Debug
RawDevice's Debug named the new mac_class field in its destructuring but
wrote no field for it, which clippy -D warnings refuses (unused variable):
m3-max-380 at f3d6f24ca4, clippy plain and --cfg m2v_gpu both exit 101 on
it alone. It now writes it, as DeviceOptions' Debug does.

Verified: cargo fmt --all; clippy reruns as a potluck job on the M3.
(cherry picked from commit c3a6caa26f677d41f7050518af1196a72dba9db2)
2026-11-05 02:08:30 -08:00
Anees Iqbal 504d01b759 Present the Mac class the consumer declares, by default its GPU's, as the fresh-texture key
The fresh-texture key (DeviceProperties::lossless_compression) was
has_unified_memory. That is wrong for every integrated GPU that is not
Apple's. The consumer's oracle shows an Intel UHD 630 Mac reports unified
memory and reads zero or a released texture's texels from a new Private
texture, as the AMD 5300M does, and never Apple's pattern. The owner's
choice (option B): the consumer declares the Mac class the device presents,
and the default follows the GPU family.

What:
- MacClass { AppleSilicon, IntelOrAmd } (public, capabilities.rs), with
  MacClass::of_vendor: an Apple GPU (vendorID 0x106b, MoltenVK on Apple
  silicon) is AppleSilicon, every other GPU IntelOrAmd.
- DeviceOptions::mac_class and RawDevice::mac_class (Option, None by default:
  the GPU's class) feed presents_lossless_compression, still the one place
  the key is decided. lossless_compression is class == AppleSilicon. The
  options' equality and Debug list the field.
- A new Private texture under IntelOrAmd on a GPU that is not Apple's holds
  what its memory held, as before (private_textures_unfilled). On an Apple
  GPU, whose own image of such a texture is compressed and reads Apple's
  pattern, it is filled with zeros as it is made, which is what such a Mac
  reads where its memory held nothing. Counted by the new
  WorkCounts::private_textures_zero_filled. The pattern path now runs only
  where the device presents compression.
- AppleSilicon keeps the runtime's pattern and zeros on any GPU. The device's
  own contents are not Metal's pattern on the M3: in the negative control
  (m3-max-88) leaving Private textures unfilled failed 16 of the 28 lanes.
  No PrecisionNote: the fill is capability (the declared Mac's contract),
  not arithmetic. An Apple-class pattern that no clear or copy writes
  exactly still announces fresh-pattern-zeroed.
- Defaults change only where unified memory and GPU family disagree: Intel
  and AMD integrated GPUs and lavapipe now present no compression (their new
  Private textures are unfilled). The M3 (Apple) and the discrete GPUs
  answer as before.
- Docs: docs/API.md (the accepted difference and the fresh-pattern-zeroed
  entry), the runtime README, the degradation declaration, the work-count
  docs. api_signatures blessed. REFUSALS.md regenerated with no change. No
  FAST-PATHS row: no speed-for-accuracy choice.

Tests:
- tests::capabilities::lossless_compression_is_the_presented_mac_class
  (no device): every vendor kind (Apple, Intel, AMD integrated and
  discrete, NVIDIA, Mesa CPU) under no declaration and both declarations.
- tests::mac_class (device, both settings):
  the_default_class_is_the_gpu_s and
  a_declared_class_other_than_the_gpu_s_is_presented. Each reads a new
  Private RGBA8Unorm target and checks the counters: AppleSilicon reads
  Metal's magenta pattern; IntelOrAmd on an Apple GPU reads zero
  (zero_filled +1); IntelOrAmd elsewhere is unfilled (+1).

Verified: cargo fmt --all. Build, clippy and tests run as potluck jobs
after this commit (results in the next commit or report).

(cherry picked from commit f3d6f24ca447fbcadc8df56e63e598cbc92e09b7)
2026-11-05 02:08:30 -08:00
Anees Iqbal 9fe1b0175f Key the compressed shape's clear route in the extended-range and bfloat clear checks
A clear takes Metal's straight route only where nan_clear::keeps_nan_sign holds (render.rs),
which the fresh-texture key now makes false on a device that presents a Mac keeping no texture
compressed: there a 16 x 16 plain target is not compressed, so it clears through half, as
Metal's uncompressed targets do (expected, not measured on such a Mac). Three checks still
expected the straight route there and failed on the RTX 5080 Laptop at fd34a10316:

- conformance xr-clear-routes-{bgra10xr,bgra10xr-srgb,bgr10xr,bgr10xr-srgb}: divergent at
  case/plain-16/texels/0..3 alone (15 sites), unlisted, in the replay of job m3-max-120; the
  baseline replay at 0b556ddfd6 (job m3-max-141) held none of them (its other 908 unlisted gap
  sites are the same in both runs). ClearRoutes now declares
  replay::without_compression("plain-16").
- validation runtime_lane::extended_range_targets::clears_take_metal_s_route (15 clears
  differ, all the 16 x 16 draws-false shape) and runtime_lane::bfloat_targets::
  bfloat_clears_take_metal_s_route (11, all that shape), suite job m3-max-124: each now expects
  ClearRoute::Straight for that shape only where DeviceProperties::lossless_compression holds,
  else ThroughHalf.

docs/API.md's accepted difference says the clear route too, and keeps_nan_sign's doc says it
decides the route.

Verified on the M3 Max, no device: nextest metal2vulkan-conformance 1011/1011; cargo clippy -D
warnings on validation and conformance with --cfg m2v_gpu (all targets, all features);
docs/CONFORMANCE-COVERAGE.md re-derives unchanged. UNVERIFIED: none of the three has run with
this commit on the 5080 or the M3.

(cherry picked from commit 1c042263e5fee942b79fbd30042c2dc9f222b61b)
2026-11-05 02:08:30 -08:00
Anees Iqbal 2b8df8a36b Give the recycle tests and the BC fresh-blocks lane their arm for an unfilled device
On a device that presents a Mac keeping no texture compressed a new Private texture holds what
its memory held, written by no command (the fresh-texture key, DeviceProperties::
lossless_compression). Three tests still asserted the old fill there and failed on the RTX 5080
Laptop at fd34a10316 (potluck job m3-max-124, full runtime + validation suite, --cfg m2v_gpu):

- runtime tests::recycle::a_recycled_texture_reads_what_a_new_one_reads and
  a_burst_of_one_off_makings_keeps_the_proven_image: the recycled Private BGRA8Unorm texture
  read the parked image's clear colour (191,127,64,255) in all 4096 texels where the test wanted
  what a new texture read (zero). That is the contract now (docs/API.md: as the consumer's AMD
  5300M and Intel 630 read a released texture's colour). On such a device each now asserts the
  recycled making counted as unfilled (WorkCounts::private_textures_unfilled moved by one) and
  that it reads the parked image's texels or what a new one read, and prints which
  (RECYCLE-UNFILLED); with compression, the count stays 0 and the old assertion holds.
- validation runtime_lane::compressed_decode::new_bc_textures_read_zero_blocks: 28 cases (the 14
  BC formats x 2 rounds, Private alone) read other than zero blocks. A Private one on such a
  device now asserts its making counted as unfilled and prints what it read (BCFRESH-UNFILLED);
  the Shared ones still must read zero blocks, and with compression nothing changes.

Verified on the M3 Max, no device: cargo clippy -D warnings on the runtime and validation crates
(all targets, all features, --cfg m2v_gpu). UNVERIFIED: the three tests have not run on the 5080
or the M3 with this commit yet.

(cherry picked from commit f73c71cce747fd6eddcdb1d84198d9b8038ac266)
2026-11-05 02:08:30 -08:00
Anees Iqbal 17337510f4 Declare the venue difference at every compressed-blits format's seven blit sites
The previous commit declared the without-compression accepted difference only for the BGRA10_XR
rows, on the reasoning that the other two formats' blits write no canonical encoding of the
runtime's own. That was wrong about what the recording holds: the M3 Max recording of
compressed-blits-rg11b10f and -rgb9e5f carries Metal's compressor's canonical encoding (the quiet
NaN; the least shared exponent) at the seven sites a blit reaches through the compressed texture,
and on a venue presenting no compression the runtime now announces no device-nan-encoding or
shared-exponent-kept note there, so nothing justified those sites.

Measured on the RTX 5080 Laptop (potluck job m3-max-120, conformance replay --gpu at
fd34a10316): compressed-blits-rg11b10f and compressed-blits-rgb9e5f each diverge at exactly
case/tall, level-3-padded, cpu-in-blit-out, blit-in-cpu-out, out-of-compressed, into-compressed
and over-a-buffer, unlisted in known-gaps.tsv. A Mac without the compression keeps the bytes
through every blit (docs/API.md's entry already says "any texture"), so each format now declares
replay::without_compression at those sites, and the family's test expects the seven for every
format.

Verified on the M3 Max, no device: cargo clippy -D warnings on metal2vulkan-conformance (all
targets, all features); nextest of the conformance compressed_blits, fresh_contents, allowance
and replay tests 29/29; docs/CONFORMANCE-COVERAGE.md re-derives unchanged. UNVERIFIED: the 5080
replay with this commit has not run yet.

(cherry picked from commit e105b274c6f410876117dbdfd50872052ab0acd6)
2026-11-05 02:08:30 -08:00
Anees Iqbal 64bea51c0c Put the fresh-texture key behind one presented fact, and give every lane and case its arm
The key that decides whether the Mac a device presents keeps textures losslessly compressed is
now one public fact, DeviceProperties::lossless_compression, decided in one private function,
capabilities.rs presents_lossless_compression. Today it is has_unified_memory, as the approved
proposal said; the owner's open question (unified memory, a consumer-declared Mac class, or a
family split) changes that one function. Everything that differs because Apple silicon
compresses reads only that field: Device::metal_compresses_textures() (a new Private texture's
fill, compressed_blit::compressed(), nan_clear::keeps_nan_sign), the validation lanes
(fresh_contents::unfilled, patterns_of) and the conformance venue (Venue::lossless_compression;
the Metal side answers supportsFamily(MTLGPUFamily::Apple1)).

This finishes what the parked commit before it listed as open:

- docs/API.md: a new accepted-differences group, "The Mac a device presents", whose entry
  (slug a-device-that-presents-a-mac-without-texture-compression-answers-as-that-mac) gives
  reims's measured AMD 5300M and Intel UHD 630 rows for fresh Private contents and marks the
  blit encodings, fills and NaN clear sign as expected, and states the Intel-iGPU limit. The
  fresh-pattern-zeroed catalogue entry and its rustdoc say the key; so does the runtime README's
  "New resources" bullet.
- Conformance: Justification::WithoutUnifiedMemory became WithoutCompression (and
  Unjustified::VenueCompresses, Offered::lossless_compression, replay::without_compression /
  WITHOUT_COMPRESSION). The fresh family's Private rows declare it at their fresh site; the
  compressed-blits-* rows of the BGRA10_XR formats (the only ones whose canonical encoding the
  runtime writes) declare it at the seven sites a blit reaches through the compressed texture.
  The fresh test now asserts the new shape (renamed
  a_row_loosens_the_notices_site_and_a_private_texture_s_fresh_site); the compressed-blits test
  asserts the venue declarations site by site.
- Lane arms on an unfilled device: fresh_costs (the counter moves by count x runs per Private
  shape; no readback), fresh_writes (patterns_of in both controls and the scratch test; the
  forced single-sample note only where the device fills), parallel_encodes (no expected
  pattern), depth_denormals (no draw/store check of unwritten texels, no sign, no zeroed note),
  compressed_blits (the notes and the Canonical rewrite only where the device compresses).
  degrade_notices needs none (FRESH_PATTERNS is only its catalogue list); the tile-store lanes
  (rotated_textures, snorm_tile_store, padded_loads, extended_range_blends) read draw notes,
  which are not keyed.
- api_signatures.tsv blessed for DeviceProperties.lossless_compression and
  WorkCounts.private_textures_unfilled. docs/CONFORMANCE-COVERAGE.md regenerated (the Metal leg
  now calls supportsFamily:, and WithoutCompression is a justification it names).

No RUNTIME_VERSION or runtime-sources pin change here: left to the orchestrator.

Verified on the M3 Max, no device: cargo clippy -D warnings over the runtime, validation and
conformance (all targets, all features) plain and with --cfg m2v_gpu; nextest
metal2vulkan-conformance 1011/1011, metal2vulkan-runtime 1234/1234 (2 skipped),
metal2vulkan api_signatures + api_surface 15/15; the refusal-surface and metal-coverage checks
pass. UNVERIFIED: no device run yet (the lanes, the nan_signs test and the conformance replays,
on the M3 and the 5080), and no negative control yet.

(cherry picked from commit fd34a1031602645e87e4cb192d1044790f79a88f)
2026-11-05 02:08:29 -08:00
Anees Iqbal 8df325f336 Key a new Private texture's fresh contents on unified memory (work in progress, parked, unverified)
Parked mid-task on the owner's order. UNVERIFIED: nothing here has run on any device, and the
tree is known not to pass its own tests yet (listed below). Do not land it as it stands.

What it does so far:

- Runtime: Device::metal_compresses_textures() is DeviceProperties::has_unified_memory. On a
  device presented without it, Device::new_texture_image starts a program's new Private texture
  as Start::Held: no pattern, no zero fill, its first move the layout move alone. Shared and
  Managed keep their zeros; Memoryless is unchanged; heap answers and copy_exact_usage are not
  keyed. New WorkCounts::private_textures_unfilled counts each such texture.
- The compressor's artifacts follow the same key: compressed_blit::compressed() (the
  extended-range-bits-kept, device-nan-encoding and shared-exponent-kept blit notes, the fill
  note, and ExtendedRangeBlitPolicy::Canonical's rewrite) and nan_clear::keeps_nan_sign. Both are
  EXPECTED, not measured, on a Mac with a discrete GPU; only the fresh Private contents rest on
  measurements (the consumer's AMD 5300M and Intel 630 rows).
- Runtime test nan_signs: keeps_nan_sign expected false everywhere without unified memory.
- Validation lane fresh_contents: arms for a device without unified memory (counter moved by one
  per Private texture, no fresh-pattern-zeroed, texels not Metal's whole pattern, FRESH-UNFILLED
  printed), and the counter held at zero with unified memory.
- Conformance: Venue::unified_memory (runtime side from has_unified_memory, Metal side from
  hasUnifiedMemory); Offered::unified_memory with on_venue(); Justification::WithoutUnifiedMemory
  (slug) holding only on a venue without unified memory and only where docs/API.md's accepted
  difference exists; Unjustified::UnifiedMemory, exempt from compare_run's up-front check;
  replay::without_unified_memory(site) and WITHOUT_UNIFIED_MEMORY beside shared_memory_notice;
  the fresh family's Private texture rows and pattern rows declare it at their `fresh` site.

Known open before this can pass (not done):

- docs/API.md has no accepted-difference entry with the slug
  a-device-presented-without-unified-memory-keeps-no-texture-compressed yet, so every fresh row
  naming it fails its up-front check (NoSuchAcceptedDifference) on every venue.
- conformance cases::fresh_contents::tests::a_row_loosens_the_notices_site_alone still asserts
  the old shape (notices site only, one allowance per texture row).
- crates/metal2vulkan/tests/api_signatures.tsv is not re-blessed for the new WorkCounts field.
- Lanes not yet given arms: fresh_costs, fresh_writes, parallel_encodes, depth_denormals,
  degrade_notices, compressed_blits, rotated_textures, snorm_tile_store, padded_loads,
  extended_range_blends; and any other lane or conformance case that reads unwritten texels of a
  new Private texture on the 5080 (to be found by a whole-suite run there).
- Conformance cases whose values move on a venue without unified memory once the compressor's
  answers are keyed (compressed-blits-* under the suite's exact policy at least) need the same
  declaration at their value sites.
- Docs: the runtime README, the FreshPatternZeroed rustdoc and API.md entry, and the plain note
  that an integrated non-Apple GPU keeps the pattern. The consumer's later rows say the Intel
  630 reports unified memory yet reads zero like the AMD, so has_unified_memory misclassifies
  it; an Apple-family against Mac2-family split was suggested as the key instead. Revisit the
  key before finishing.
- No negative control and no M3 or 5080 lane run yet; RUNTIME_VERSION and the runtime-sources
  pin untouched.

Checked only: cargo check of metal2vulkan-runtime (all features) and of metal2vulkan-conformance
(all features, tests) on the M3 Max, before the last edits to the conformance fresh cases.

(cherry picked from commit b9faa4fc9c6c50751eb08b060ab56bf5a496d9e9)
2026-11-05 02:08:29 -08:00
Anees Iqbal 5a1e1748eb Time the subnormal and in-place gather cases on the M3
`conformance times --runs 8 --write` over the eight new cases (job
m3-max-697, Apple M3 Max, macOS 27.0.1, both legs). That job reported
"8 case(s) carry their timing", and times::every_case_is_timed
requires it. Four cases are within 10x of Metal. The four
pixel-samplers-subnormal-* cases are recorded as unmeasured: our leg
announced argument-pixel-sampler-scaling and set-past-layout-support,
so it did a different amount of work. Times are reported, never gated.

The same job's replay of the eight cases passed, the known-gaps rows
held. docs/CONFORMANCE-COVERAGE.md still matches the recordings
(--check).

(cherry picked from commit 851f740714908684a72dc68b57717ab978b9519c)
2026-11-05 02:08:29 -08:00
Anees Iqbal 2be3e497a7 Move pixel_samplers' test-only items into its tests module
With the subnormal cases, a case reads its cells through
coordinates_of and layout_of. SAMPLES, SUBNORMAL_SAMPLES, coordinates()
and layout() were then used only by tests, which the conformance lib
build denies as dead code (clippy on all features, plain and gpucfg,
job m3-max-670). The two constants move into the tests module, and the
two wrappers go: the tests call coordinates_of(&grid, ..) and
layout_of(SAMPLES) directly.

No behaviour change.

(cherry picked from commit 9ed4da444d4acc7fef4cca42ac6821836ccb48af)
2026-11-05 02:08:29 -08:00