Commit Graph
1536 Commits
Author SHA1 Message Date
Anees Iqbal fc79fdd4e9 Announce every NVIDIA RTX 5080 Laptop clear and plain fill off a whole code: its clears take either nearest code
runtime_lane::color_fills::plain_color_fills_are_the_device_s_clear (vkCmdClearColorImage of 762
colours into each of 70 formats) on the RTX 5080 Laptop GPU at 0b556ddfd6: 352 fills stored 382
normalized channels a code from Metal's, each one of the two codes nearest the scaled value,
unannounced where the value was not near a midpoint. Vulkan allows it ("returns one of the two
unsigned binary integer values with exactly b bits which are closest to the floating-point value
r. Implementations should round to nearest"). The 8- and 16-bit unorm and snorm channels went
toward zero (R16Unorm's 0.001, 65.535 codes, stored 65; R8Snorm's -0.5 stored -63), packed and
10-bit channels and an sRGB format's alpha at times to the code above the nearest. An under-note.

What:
- DriverFact::ColorClearTakesEitherCode, on the RTX 5080 Laptop GPU (NVIDIA), with its
  measurement in its doc.
- clear_value::rounds_apart takes the fact: on such a driver a normalized channel's clear is in
  question wherever its scaled value is off a whole code, not only near a midpoint; the clear and
  the plain colour fill (blit_fill, fill_value, render_pass) announce device-color-conversion then.
- docs/API.md's catalogue entry for the clear conversion names the fact.
- Tests: driver_facts' table test; a fill_value unit test of the rule on the measured cases with
  and without the fact; api_signatures for the new variant.

Verified: in the lane proof runs on the 5080 and the M3 (counts in the series' last commit). The
M3's and lavapipe's facts are unchanged, so their notices are.

(cherry picked from commit f2da9346bb51ed034f0d5f8bf076c8d55c57f277)
2026-11-05 05:10:38 -08:00
Anees Iqbal 3cfd7f7aa0 Hold an 8-bit sRGB word's encode and decode to the device's announced conversions in color_writes and word_samples_msaa
On the RTX 5080 Laptop GPU (NVIDIA 615.71.09) the lane's color_writes stored 3,170 of 53,907
R8Unorm_sRGB channels a code from Metal's, and word_samples_msaa's sRGB reads differed from the
transfer by up to 1.88e-3 over 29 reads at 0b556ddfd6. The device renders neither R8_SRGB nor
R8G8_SRGB, so the runtime draws through the word's view (metal::format::WordAttachment::Srgb8):
the fragment encodes through its own Pow, recorded as PrecisionNote::DevicePackConversion, where
Metal encodes through its twelve-bit table; and the device decodes an sRGB sample its own way
(srgb-texel-decode; it rounds its decode of R8_SRGB to a 1/256 step). Both are announced; the lane
held them to Metal's bits. A test bug, not a translation gap.

What:
- color_writes: an 8-bit sRGB word's codes count as the device's conversion where the fragment
  stage records DevicePackConversion; they are printed against Metal's and not held.
- word_samples_msaa: an sRGB word's read is held within 1e-3 of the transfer where the device
  decodes through Metal's own texture unit (VkProperty::MetalSampler, MoltenVK on Apple's GPU) and
  within a code (1/255) elsewhere, where srgb-texel-decode is allowed among the notices.

Verified: in the lane proof runs on the 5080 and the M3 (counts in the series' last commit).
(cherry picked from commit dbc5461c6b96524f6c318a81c078c8f954c4c3c8)
2026-11-05 05:10:38 -08:00
Anees Iqbal 1ec132c75b Join an encoder's summaries resource by resource, not use by use
The replayed textured page's steps thread waited on a mutex after
each host step: 270 of its samples at e4cbc73d53, 644 (22.7%) at
09c75dd580. A release build with line tables (CARGO_PROFILE_RELEASE_DEBUG
=line-tables-only, a dSYM made with dsymutil; not committed) put the
wait at scheduler/steps.rs:150, lock(shared.inbox.state()), the
scheduler's State. The scheduler thread's pass holds that lock
(inbox.rs, pass_once and pass_again), and that thread spent 44.5% of
its samples in tracker::Summary::join, under State::place in
submit_batch. join placed each joined use by scanning every known
use: with the indirect execution's resident uses, about 20,000 on
each side, that is about 400 million comparisons a frame, under the
lock.

Both summaries' uses are sorted by resource (the field's invariant,
which every constructor keeps and a debug assertion checks). So now
each joined use meets only the known uses of its own resource, found
by a binary search, and the uses of it joined before it (join_use).
The candidates are the same ones in the same order: the old scan
compared only uses of the use's own resource, the known ones first,
then those it added, in order. The added uses go after the known
ones, and the same stable sort orders them. So the answer is the old
one, entry for entry.

The test a_join_looks_at_each_resource_s_own_uses_alone:
- compares the join with the old use-by-use join (written in the test)
  over 64 sets of mixed uses: ranges met again, resources past
  ENTRIES_PER_KEY ranges, byte and image ranges;
- joins two summaries of 4096 resources each, half shared, and checks
  that the join looked at fewer known uses than twice the uses joined.
  It counts them with a counter that exists in tests only
  (JOIN_LOOKED_AT).
Its negative control, every known use scanned for each joined use
(scratch edit), fails it.

Measured, release, the replayed textured page on the M3 (MoltenVK
1.4.2):
- macOS sample of 6 s of an 80-frame run, against 09c75dd580:
  - the scheduler thread's Summary::join: 3 of 1619 samples (0.2%),
    from 1265 of 2840 (44.5%);
  - State::place: 18 samples, from 1276;
  - the steps thread's wait on the lock in record: 32 of 1619 samples
    (2.0%), from 644 of 2840 (22.7%).
- Interleaved with 09c75dd580 over two rounds of 3 frames:
  - encoding to completion 65.9-70.9 ms in the warm frames, from
    114.3-117.1, and 100.6-101.9 in the first, from 149.1-150.9;
  - host_step_ms 32.8-34.9, against 32.3-33.3 (the join ran on the
    scheduler's thread, not in the step);
  - pixels e3306dc52a1c9e86 in both.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1630 of
  1631, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247;
- frame_costs: 18.71 allocations a draw in debug, 6.88 in release;
- the negative control fails the new test: 18,873,344 known uses
  looked at.

(cherry picked from commit 3a4b3e74e2e1840373bb664606e53dbcb69c4980)
2026-11-05 05:10:38 -08:00
Anees Iqbal a0452fd099 Check no draw against the writes before fragments where there are none
A render draw checks its uses against what earlier draws of its render
pass instance wrote before their fragments
(GeometryWrites::barrier_before), and so does a rebound draw's check
whether it may rebind. Both walked every use where the instance holds
no such write: on the replayed textured page, 25,035,006 resident uses
a frame (resident_uses_geometry_checked), for no barrier.

Now barrier_before answers None at once where it holds no write, and
the walk is counted only where there is one. The answer is the one the
walk gave: with no write, no use meets one.

The test an_instance_without_geometry_writes_answers_no_barrier_before_fragments
checks the answer with no write, with a read alone, and with a write
before the fragments. The resident-uses test asserts that no draw of
its scene, which writes nothing before its fragments, walks its uses
for the check. Its negative control, the early answer and the guard
taken out (scratch edit), fails that test.

Measured, release, the replayed textured page on the M3 (MoltenVK
1.4.2), against the commit before the one before (the walk of a draw's
resident uses for its kept-draw check is the other half), over two
rounds of 3 frames:
- resident_uses_geometry_checked 20,000 a frame, from 25,035,006;
- host_step_ms of both together 31.2-32.6 in the warm frames, from
  57.5-61.7, and 51.5-56.7 in the first, from 79.2-82.6;
- pixels e3306dc52a1c9e86 in both.
A profile of the commit before the one before (macOS sample of the
steps thread) put barrier_before at 142 of draw_resident's 851 samples.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1629 of
  1630, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247;
- frame_costs: 18.71 allocations a draw in debug, 6.88 in release.

(cherry picked from commit bdeb202f2c9bc0feafd747e29390361442b00235)
2026-11-05 05:10:38 -08:00
Anees Iqbal 900cc93140 Walk a draw's resident uses for its kept-draw check once an identity
A render draw that may be kept for drawing again asks of its uses
whether they write nothing and read nothing as indirect arguments, and
whether one reads an image other than as an attachment. It walked every
use at every draw, those of what the encoder made resident included:
on the replayed textured page, 5006 uses at each of its 5001 draws a
frame. Profiles at 5ab66c0e6b put that walk (Iter<Use>::all) at 4.1%
of the steps thread on the 5080 and 3.4% on the M3.

The uses of what the encoder made resident come first among a draw's
and are a function of their identity (CommandUses::prefix,
binding::ResidentPrefix): two draws' uses of one identity begin with
the same uses. So the answer for those is kept with their identity
(RenderLowering::resident_again), and a draw walks only its own uses
after them. draw_again::unwritten gives both answers; where the uses
write something, the image answer is false, which no caller reads
(only a draw kept for drawing again reads it, and such a draw's uses
write nothing).

WorkCounts::resident_uses_again_checked counts the resident uses the
check walked. The resident-uses test asserts it is 0 at every draw
that keeps its resident uses, and above 0 where they are made again.
Its negative control, the kept answer never used (scratch edit),
fails that test.

Measured, release, the replayed textured page on the M3 (MoltenVK
1.4.2), on the tree with this commit and the next (no walk of the
uses where an instance holds no write before its fragments), against
the commit before, over two rounds of 3 frames:
- resident_uses_again_checked 5006 a frame (one walk, at the first
  draw);
- host_step_ms of both together 31.2-32.6 in the warm frames, from
  57.5-61.7, and 51.5-56.7 in the first, from 79.2-82.6;
- pixels e3306dc52a1c9e86 in both.
A profile of the commit before (macOS sample of the steps thread) put
this walk at 285 of draw_resident's 851 samples.

Verified on the M3 (potluck), on the tree with the next commit:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1629 of
  1630, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247;
- frame_costs: 18.71 allocations a draw in debug, 6.88 in release.

(cherry picked from commit dfd19ea10491de4bada3e59636a6945a87243a28)
2026-11-05 05:10:37 -08:00
Anees Iqbal f0d602fba5 Work out what a render draw asks of its plan's writes once a settle
A plan's descriptor writes number its heap's members: one for each
texture of the device in each heap image array of set 1
(BindingPlan::heap_elements). Five walks of them ran at each render
draw:
- samples_attachment, the slots whose textures a write samples (twice
  at a draw);
- storage_colors, the slots a write binds as a storage image;
- reads_handles, whether a write is a handle table's;
- the tile memory a write binds;
- ExtendedShadows::draw_uses, the colors whose extended-range shadows a
  write binds;
- the plain-draw check, whether a write binds a YCbCr texture.
On the replayed textured page (5002 resident textures, 5001 draws a
frame) those walks were most of the steps thread. Profiles at
5ab66c0e6b: storage_colors 11.2% on the 5080 and 12.2% on the M3, the
extended shadows' walk 4.0% and 10.4%.

Each answer is a function of the plan alone. So PlanFacts
(render/plan_facts.rs) works them all out in one walk as a pipeline
state settles the plan for a bind shape (GraphicsState::settle_shape),
and the settle keeps them (Settled::facts). A draw, and a rebound
draw's check, read the facts. The extended colors are kept ascending,
each once, as the BTreeSet the shadows' walk built gave them.

Measured, release, the replayed textured page on the M3 (MoltenVK
1.4.2), interleaved with the commit before over two rounds of 3 frames:
- host_step_ms 216.9-253.2 a frame before, 58.0-88.0 after (the
  warm frames 216.9-225.2 before, 58.0-71.7 after);
- pixels e3306dc52a1c9e86 in both.

The test draws_work_out_what_they_ask_of_their_plan_s_writes_once_a_settle
counts the facts worked out (PLAN_FACTS_MADE, tests only): at most one
at each draw that settles, none at the others. Its negative control,
each draw working the facts out again (scratch edit), fails it.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1628 of
  1629, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247;
- frame_costs: 18.71 allocations a draw in debug and 6.88 in release,
  as at the commit before.

(cherry picked from commit ba85eb5614018f8012e100417a0a849bb19bf05d)
2026-11-05 05:10:37 -08:00
Anees Iqbal 2137a20004 Bless the golden tables at stack 29's tree
The stack's heap half reads merge their class arms as the texel's half bits (bfc5a95e03), which
changes that read's SPIR-V on every profile, 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 04:48:48 -08:00
Anees Iqbal aea05bedf8 Pin the runtime sources at stack 29's picks so far
The staging wait (7647e46008) and the heap half reads (bfc5a95e03..141c0787ad) change hashed
runtime and translator sources. RUNTIME_VERSION moves once at the stack's end.

Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
2026-11-05 04:29:11 -08:00
Anees Iqbal 141c0787ad Record the M3's heap half reads in the MetalHalfConversion measurement
What: the MetalHalfConversion paragraph of the driver-facts record states the two gate lanes'
results on the M3 Max: a heap's half read of every code of the five forms it holds by raw texels
(BGRA10_XR, BGR10_XR, R16Bfloat, RG16Bfloat, RGBA16Bfloat) is the nearest even half of the same
read as float, and the slot's half read, in all 262,144 channels of each; and every one of the
2,170 lanes of an argument buffer's reads of a member of another class (the half ones among them,
a NaN's bits included) is the slot's words. runtime-sources.sha256 moves for this doc edit, which
changes no behaviour of a run.

Why: the previous two commits count a decoded texel's half rounding as the measured conversion
and merge a heap half read's class arms as bits; these are the runs that measure both.

Verified (potluck m3-max-960, --gpu m3max, MoltenVK 1.4.2, at 1757bd7866):
runtime_lane::(cross_class_reads|heap_extended_reads|half_conversions|alpha_in_red)::, 25 tests,
25 passed; HEAP-HALF-ROUNDING: 0 of 262144 channels for each form, note false; CROSS-CLASS
argument-buffer reads: 2170 lanes checked, 0 differ, 0 hold a half NaN of the device's bits,
announced {SetPastLayoutSupport, DeviceNanEncoding, HalfTexelConversion}. Negative control
(m3-max-971, at a scratch commit on 1757bd7866 whose half read merges its arms' widened values
again): the same lane fails with the stack 28 gate's 66 of 2170 lanes (R8Sint as half
[00007e00, ...] against [0000fff5, ...]), and engine_cross_class's
an_argument_buffer_half_read_merges_its_arms_bits fails there too (m3-max-961).

(cherry picked from commit 2ff2ed23f56110fcc2d066b84ff99077275abeee)
2026-11-05 04:28:30 -08:00
Anees Iqbal f1def3dffe Count a texel's half rounding as the measured conversion on MetalHalfConversion profiles
Re-applies 384734851d (reverted in the stack by 5dbf6f3be3) on top of the previous commit, which
merges a heap half read's class arms as the texel's half bits.

What: narrow::round_texel rounds through round_measured, so in QuantizeForm::Converted the
conversion pair's narrowing is recorded as measured. On a profile that takes
DriverDeviation::MetalHalfConversion (MoltenVK on the Apple M3 Max's macOS 27 identity) a texel's
half rounding records no PrecisionNote::NativeHalfConversion, and the module requires
VkProperty::MetalHalfConversion instead: a texel the module decodes itself
(extended_range::decode), a merge of texels (a heap read's phi of its fetched texel and its decode
routine's) and an image instruction's. The note stays for roundings by narrow::round: half
operations and functions computed in float, filter sums, packs and the rest. Other profiles never
read the measured set, so they are unchanged by construction, and round_measured emits the same
pair, so the SPIR-V is unchanged. SEMANTICS_VERSION 1967: recorded notes change on moltenvk-m3.

Why: reims-vgpu's strict Mac tests die on native-half-conversion at a kernel that reads an
argument buffer's texture as half (their ycbcr_probe.metal read_held, over BGRA8Unorm). Every heap
half read carries the decode routine of the seven extended-range/padded/bfloat forms, and its
merge, so it recorded the note whatever the texture. MetalHalfConversion measured the device's
conversion as Metal's half(float) for loaded and computed floats; where Metal's half texel is not
the nearest even half of the texel's value, the access's own note states it: HalfTexelConversion
(outright for a heap element, by the bound class at a slot) or DevicePackConversion (a decoded
texel). The stack 28 gate's cross-class lane failure that reverted it came from the heap read's
merge of widened halves, not from a rounding: an integer texel's bits read as half go through no
rounding, and the previous commit merges them as integers, so they keep their bits without a note.

Kept from 384734851d: the core tests heap_half_texels_round_by_the_measured_conversion and
decoded_half_texels_round_by_the_measured_conversion, the M3 lane
heap_extended_reads::heap_half_reads_of_every_code_round_their_float (half_conversions::half_of
made pub(super) for it), and the docs: the PrecisionNote, DriverDeviation and VkProperty rustdoc,
API.md's native-half-conversion exemption, the driver-facts record (which now also says the
argument buffer's cross-class half read rounds nothing and names its lane), narrow's docs.
runtime-sources.sha256 moves for the doc edits in driver_facts.rs and requirements.rs, which change
no behaviour of a run.

Verified: pending in this commit; the next jobs run the core and M3 lane checks on it.
(cherry picked from commit 1757bd7866aa87c4e38ab83f0b4c4d83e68c75bb)
2026-11-05 04:28:29 -08:00
Anees Iqbal bfc5a95e03 Merge a heap half read's class arms as the texel's half bits
What: a half read of a texture an argument buffer holds, whose class arms read a member of
another numeric class (Read::heap_cross), now hands its merge each arm's half bits in u32 lanes
(narrow::to_bits: a sibling's noted bits, its words' low 16; the own arm's texel narrowed by the
device), zero where the handle is null, and widens the merged bits once after the merge
(narrow::from_bits). Before, each arm widened its half and selected it against the null handle's
zero, and the merge carried the texel structs of those floats. emit::read is split into
read_texel (the texel, the handle's liveness, the status word) and the null select and status
word, which read_crossed's half arms apply to the bits instead. The read's word estimate counts
the arms' narrowing and the widening. SEMANTICS_VERSION 1966: the SPIR-V of every such read
changes on every profile.

Why: the stack 28 gate's M3 lane
runtime_lane::cross_class_reads::argument_buffer_cross_class_reads_are_the_native_words, run with
a texel's half rounding counted as measured, answered 0x7e00 where the slot's read keeps an
integer texel's NaN bits (R8Sint, RGBA8Sint, RG16Sint, RGBA16Sint, RGBA32Sint, RGBA16Uint and
RGBA32Uint as half, 66 of 2170 lanes). The module (the lane's held half read, translated through
the CLI on moltenvk-m3 at a1c2a5f52e) merged OpPhi %_struct of
OpSelect(live, OpFConvert(bits as half), 0) from the Sint and Uint arms with the own arm's
texel, then narrowed the extracted float for the store: the merge of a widened half selected
against zero with another widened value that Metal's compiler does not fold back to the bits
(narrow::merges_mixed_selects' measurement: 2045 of 2046 NaNs 0x7E00), which the analysis did
not see through the struct. With the bits merged as integers, the value after the merge is the
slot's shape (the words' low 16 bits widened, then moved and stored), which keeps every NaN's
bits on the M3. The NativeHalfConversion the module recorded for its texel roundings had been
letting the lane accept those NaNs.

Verified: pending in this commit; the next commits' jobs build and run it (the new core test
engine_cross_class::an_argument_buffer_half_read_merges_its_arms_bits: a u32x4 phi and no texel
struct phi for a half read on every committed profile with a sampled heap, a struct phi for a
float read, inside the word estimate, L3).

(cherry picked from commit 3e9fedbf34cb1ff78f7a32c2322fdd67b5fc36db)
2026-11-05 04:28:23 -08:00
Anees Iqbal 2c6f549f0c Rewrap Device::staging_wait's doc comment
The once-per-VkQueue change joined two of its lines into one of 134
columns; the text is unchanged.

Verified: cargo fmt; no added line over 100 columns in the branch's diff.
(cherry picked from commit 91f8b186c1e89253891749fa5b74245a901aa597)
2026-11-05 04:28:23 -08:00
Anees Iqbal 95975b621c Describe the staging-batch lane's workload by its shape, not the program that made it
The module doc named the guest program whose start made the 1776
replaceRegion burst; it now says what the burst is (1776 calls back to
back, each into a small texture of its own), and that a staging submission
is waited for by the first batch on each VkQueue after it.

Verified: cargo fmt; doc comments only.
(cherry picked from commit 1bda154285a9333989da080f38463b5004c7f1c3)
2026-11-05 04:28:23 -08:00
Anees Iqbal 7647e46008 Wait for a staging submission once per VkQueue, not in every batch while it runs
Every batch took a GPU wait on the staging queue's last submission for as
long as the host had not seen it complete, so each batch committed during a
copy carried its own semaphore wait: on an RTX 5080 Laptop GPU, about 3.3
batches per staging submission (1691 to 2097 waits for 539 to 573 staging
submissions in 240 frames of 100 command buffers beside a thread uploading
7 MiB of Shared and Managed texels every 8 ms). A batch with a wait cannot
join a group, and on drivers whose submissions stall on semaphore operations
every extra wait is another chance of a stall.

One wait per VkQueue is enough: a semaphore wait's second synchronization
scope holds every command later in submission order on that queue, so the
copies are visible to every later batch there. The scheduler already keeps,
per VkQueue and per timeline, the value a batch there last waited for
(State::waited, with the staging queue's place after the VkQueues and the
internal submissions); the staging wait now reads and sets it. A held group
goes to its VkQueue before any later batch there, and a failed submission
puts the values back, so the mark never runs ahead of a made wait. Internal
submissions keep their own wait.

New lane runtime_lane::staging_batches::batches_after_one_that_waited_for_a_
staging_copy_follow_its_wait: one 64 MiB replace_region, then 32 command
buffers on one queue that each blit a square of it; every square reads the
call's bytes, and the staging waits are one, not one per batch.

Verified on the RTX 5080 Laptop GPU (release, --cfg m2v_gpu, this change on
top of a lane-only commit): the new lane passed 3 of 3 (gpu_waits 1, every
square's bytes right); the same tree with command_buffer/submit.rs as before
this change failed it 3 of 3 (32 waits, the bytes right); the staging_batches
module passed 9 of 9. In the uploading frames, staging_gpu_waits fell to the
staging submission count (548 to 558) and NVIDIA's over-1 ms submits on the
graphics queue from 25 to 24 per 240 frames; frame times did not move (p50
6811 to 6828 us against 6839 to 6889 us, one frame in flight 6876 to 6934
against 6911 to 7006). Not run: clippy, rustdoc and the suites on this
commit.

(cherry picked from commit 516d31e3d47c3c238ec7e6666f5e03097e5b9ca4)
2026-11-05 04:28:23 -08:00
Anees Iqbal 58aca59d68 Re-bless the authored compile census at stack 28's build
The census on the stack 28 tree (corpus-triage --audit authored-compile, 2262 cases, 21 profiles,
47502 cells) found no failed cell, no difference and no regression: 46395 compiled, 1107 refused,
327 uncovered (host-replayed command buffers). 1391 cells' SPIR-V digests had moved with the
stack's translation changes (the struct table shared by content, the MoltenVK precision notes),
every outcome class unchanged. --bless wrote the table at this build.

Verified: the audit ran on the M3 (potluck) with the main checkout's private corpus; failed=0,
differences=0, regressions=0, blessed=true.
2026-11-05 04:26:24 -08:00
Anees Iqbal 42919a4cc5 Re-record the conformance costs at stack 28's tree
The stack's runtime changes move counts across the suite (kept host steps and indirect record
copies, queue sharing and waiters' submissions, resident uses looked at once per identity, the
pass-start cleared copy and the fixture pipelines it no longer makes, among others), and its new
cases (the subnormal pixel samplers, the YCbCr gathers, the composited pass-start row) had cost
records with no contrast behind them. A whole-set run (`conformance cost --runs 8 --write`, 1150
cases, 1141 measured and 9 written down with the reason the venue could not measure them) then a
run of each of the 643 changed cases alone (`cost --runs 8 --alone --write`) re-recorded them on
the Apple M3 Max.

Verified: both runs exited 0 on the M3 (potluck m3-max-1009); the conformance suite and
`conformance cost --check` rerun on this tree.
2026-11-05 04:10:51 -08:00
Anees Iqbal d3aedcabd9 Pin the runtime sources at RUNTIME_VERSION 1767
Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
2026-11-05 03:30:14 -08:00
Anees Iqbal c7390725b7 Bump RUNTIME_VERSION to 1767: carrier textures looked at once per residency change, the runtime's own device holds stopped at the last drop, fewer allocations a draw
- A render draw looks for the textures an argument buffer holds once per change of what its
  encoder made resident, as compute already did (draw_resident_textures_looked_at).
- The program's last drop of a device stops the runtime's own holds of it (the in-place check's
  class check, the warm pass's pipeline creation) and waits for them, so an adopted VkDevice is not
  destroyed while they run; Device gains a private field, a hand-written Clone and a Drop.
- A draw's heap part is worked out into a released part's storage, ResidentOf::compared is a fixed
  array, the heap elements' Arc and the debug checks' storage are kept: frame_costs reads 18.71
  allocations a draw in debug (bound 20) and 6.88 in release (bound 9) on the M3.
Nothing public is removed.

Verified: the cherry-picked commits carry their own evidence; this stack's gate reruns on the tree.
2026-11-05 03:30:13 -08:00
Anees Iqbal 399a94382b Make a kept draw's resident uses whole for their check in kept storage
runtime_lane::frame_costs' draw allocations, built with debug
assertions, were 20.33 a draw on the M3 after the two commits before
this one. The bound, DRAW_ALLOCATIONS_DEBUG, is 20.

Where the last 0.5 came from: in builds with debug assertions,
command_uses_into checks the resident uses a draw kept against uses
made whole (command_uses). That made a new CommandUses at each check,
3 allocations: the uses, their sources, and the positions of the
plan's other uses. 5ab66c0e6b keeps the uses at a switch to a plan
that lists the same uses, so more draws keep them, and each such draw
runs the check. A backtrace of every allocation of the counted frame's
draws (a diagnostic, not committed) put these 3 at 201 of the frame's
402 draws, 3 draws in each pass of 6. The +0.5 is one more such draw
in each pass.

Now the check makes the uses whole over the last check's storage, a
CommandUses this thread keeps (WHOLE_USES). They are made through
uses_into for no kept plan, as command_uses makes them. A remake
empties every compared field first or sets it whole: resident_uses_into
empties the uses, sources, others and reaching, and settle_resident
sets resident from reaching. So the compared fields (uses, sources,
used, resident) are those a new CommandUses gets. The kept storage
holds resource keys alone (ResourceKey is a u64), nothing alive.

Measured, frame_costs on the M3:
- debug, --cfg m2v_gpu: 18.71 allocations a draw, from 20.33 (19.83 at
  fdb282e3ae, before the heap part). The check's 3 allocations are gone
  at every checked draw: 1.5 a draw at those 201 draws, and 0.12 more,
  the same 3 sites at 16 other draws of the frame;
- release, without m2v_system_alloc: 6.88 a draw, against
  DRAW_ALLOCATIONS, 9 (7.38 with the first of these three commits
  alone).
The negative control is the two commits before this one: 20.33, over
the bound.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
  1628, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247, frame_costs included.

(cherry picked from commit 50c59a440c1b85c1b2d05218c126ff8824b14e91)
2026-11-05 03:30:10 -08:00
Anees Iqbal 01a902edd5 Keep a heap part's elements allocated whatever plan it is worked out for next
A heap part held where its heap writes go as an Option<Arc<HeapElements>>.
A part worked out again went into the storage of one let go of, or of the
part drawn through longest ago. Where that part's plan had no heap, the
part held no Arc, so the next plan with a heap allocated a new one.

Now HeapPart holds the elements as an Arc<HeapElements> always, and a
flag, heap, that says whether its layout has a heap set. A part worked
out again writes the elements into the Arc in place (Arc::get_mut). It
allocates a new Arc only while a draw still holds the old one. A draw
of a layout without a heap gets None, as before.

Measured, frame_costs on the M3, debug, --cfg m2v_gpu: 20.33 allocations
a draw, the same as before. That tree also held a later change (a
draw's facts of its plan worked out once a settle), which moves no
count: 20.33 with and without it on the commit before this one. The
window-shaped frame's layouts have no heap set: a backtrace of every
allocation of its counted frame's draws (a diagnostic, not committed)
shows no heap elements made.

Verified with the commit after this one, on the tree that holds both
(see its message).

(cherry picked from commit 815720023cd9a72a92e5e10e8f7f82fbdb9f762a)
2026-11-05 03:30:10 -08:00
Anees Iqbal fa99ed2c19 Keep the plans a draw's resident uses were compared with in place
A draw that switched to a plan whose uses differ pushed the plan into
its ResidentOf's compared list (5ab66c0e6b), allocating the list. It
then made its uses again under a new ResidentOf, dropping the list. In
runtime_lane::frame_costs' window-shaped frame, whose draws switch
pipeline state from draw to draw, that was an allocation at nearly
every draw.

ResidentOf::compared is now an array of COMPARED_PLANS slots.

Measured, frame_costs on the M3, debug, --cfg m2v_gpu: 20.33
allocations a draw, from 20.83.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
  1628, the one failure exit_guard's known base failure;
- the lanes: 246 of 247, the one failure frame_costs' debug bound at
  20.33.

(cherry picked from commit 1c237630db1b4273faa14068c653e926952f62fe)
2026-11-05 03:30:10 -08:00
Anees Iqbal 2282779a74 Work a heap part out into a let-go part's storage, and keep its listing's
12f8301c62 and 5ab66c0e6b raised runtime_lane::frame_costs' draw
allocations, built with debug assertions, from 19.83 a draw on the M3
(at fdb282e3ae) to 21.50. The bound, DRAW_ALLOCATIONS_DEBUG, is 20. The
window-shaped frame's draws switch pipeline state from draw to draw, so
an encoder works out a heap part for each of its plans. Two of the
allocations were these:
- Each part worked out allocated its tables' list, what it is made of
  (samplers, function tables, slots) and its listing anew.
- A kept part's check allocated a list for the tables it worked out
  again.

Now:
- KeptHeap keeps the parts an ended encoder let go of, emptied (the
  module docs). Their plan is let go of, and what a part holds
  otherwise is plain data, so they hold nothing alive.
- A part worked out goes into the storage of one of those, or of the
  part drawn through longest ago where it keeps as many as it may.
- PastHeap keeps its list's storage (PastHeap::forget, which empties
  it in place).
- The check works the tables out into a list the KeptHeap keeps.

Measured, frame_costs on the M3:
- debug, --cfg m2v_gpu: 20.83 allocations a draw, from 21.50;
- release, without m2v_system_alloc: 7.38 a draw, against
  DRAW_ALLOCATIONS, 9.

Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
  1628, the one failure exit_guard's known base failure (a547d0ce33);
- the lanes: 246 of 247, the one failure frame_costs' debug bound at
  20.83. The commits after this one address it.
The same results, 1626 of 1627 in the suite, came on this change over
5ab66c0e6b without 60bb566cdc.

(cherry picked from commit fcb0f1885b8fb69fedd9d138bc4a7f00a0dd276a)
2026-11-05 03:30:10 -08:00
Anees Iqbal eaae5c9e67 Bless the API table for Device's hand-written Clone and its Drop
The runtime's own holds of a device (bd779ba8c8) give Device a second, private field (holds::Share)
and write its Clone by hand, and Device now implements Drop: the program's last drop stops the
runtime's own holds and waits for them. For a consumer nothing breaks: Device is still Clone, and
its fields were private, so no program could destructure it or move a field out of it.

Verified: python3 scripts/api-signatures/signatures.py --check passes after the bless (2 added, 1
changed, none removed).
2026-11-05 03:26:35 -08:00
Anees Iqbal bd779ba8c8 Stop the runtime's own holds of a device at the program's last drop, and wait for them
The device's check of textures over host pages (in_place_check.rs) and its warm pass (warm/pass.rs)
upgrade a weak handle on threads of their own and hold the device while they make objects on it:
the check across a class's rounds (its device and its class's buffer), the pass across a record.
A program that drops its last handle meanwhile leaves the holder the last share, so the device is
torn down on the holder's thread after the program's drop returned. A consumer that adopted the
VkDevice destroys it once its last drop returns, and Vulkan requires every object made from it
destroyed first (VUID-vkDestroyDevice-device-05137). The same class as the queue-switch check's
(de2554f1ac), whose thread could be made to hold no device handle; these two make buffers,
textures and pipeline states that hold the device, so they cannot.

What (device/holds.rs):
- Every device handle is counted as the program's or as a holder's. WeakDevice::hold takes a
  holder's handle; a clone of one is a holder's too (the device of every object the holder makes);
  every other handle (the device's own, its objects', a runtime thread's upgrade) is the
  program's. The handle carries its kind (Share: the registry where it is a holder's), so a
  Device is 16 bytes, and its first field stays the Arc (the auto-trait walk that
  consumer_auto_traits holds to the default recursion limit keeps its depth).
- The drop that leaves the program no handle stops the holds; on a thread of the program's it
  waits until the holders' handles went, each counted gone only once its share of the device
  went, so the device's last share is the program's and the teardown runs on its thread before
  the drop returns. On a runtime thread it waits for nothing (those threads serve the work the
  holds may wait for).
- The holders read the stop between their steps (Device::holds_go_on): the check before each
  round, the warm pass before each record. The wait is at most the check's round in progress and
  its release of its buffer, or the record the pass is making; only at teardown.
- A stopped device is gone: no holder takes it, and Device::system_default_with makes a new
  device rather than revive it (WeakDevice::revive).
- exit_guard::on_runtime_thread tells the runtime's threads apart.
- Device's rustdoc and the runtime README state the last-drop contract.

Tests (tests/teardown_threads.rs, behind the crate's existing gated hold, freed_memory::held):
- a_running_in_place_check_leaves_the_device_to_the_program_s_thread: the check held before a
  round while it holds the device and its buffer; the program's last drop tears the device down
  on its own thread before it returns, having waited for the check. Skipped, saying so, where
  the device takes no texture in place or its check makes no round.
- a_running_warm_pass_leaves_the_device_to_the_program_s_thread: the same for a warm pass held
  before its first record.

Not the queue-switch check's wait: its test (de2554f1ac) is unchanged here.

Verified, at this tree (scratch 016ea26f28), --cfg m2v_gpu device tests:
- Apple M3 Max, MoltenVK 1.4.2, macOS 27.0.1: tests::teardown_threads three
  times, 10 run, 10 passed each ("the last drop took 7.55ms, of which the
  wait for InPlaceCheck 991µs"; the warm pass's wait 22 to 113 µs). The
  runtime suite: 1636 run, 1636 passed, 5 skipped. cargo clippy plain and
  under --cfg m2v_gpu, and RUSTDOCFLAGS='-D warnings' cargo doc, clean.
- RTX 5080 Laptop GPU, NVIDIA 615.71.09 (b5080, the hazard filter):
  tests::teardown_threads three times, both new tests passing in each
  (the wait for InPlaceCheck 3.98, 5.35 and 7.06 ms; for WarmPass 84,
  208 and 239 µs); 10 of 10, 9 of 10 and 10 of 10, the one failure the
  unchanged queue-switch test's 16 ms bound (it waited 26.5 ms, beside
  the runtime suite; 13.4 and 14.3 ms in the other runs), followed up
  apart. The runtime suite: 1653 run, 1652 passed, 5 skipped, the one
  failure srgb_fetch_images::an_srgb_attachment_is_fetched_through_its_
  unsigned_integer_view (an image plan's view formats at 4 samples; no
  hold is involved), attributed apart.
- Negative control (the last drop waits for nothing: one line removed,
  built into a separate nextest archive): both new tests FAIL on the M3
  and on the 5080, "the device was not torn down on this thread before
  its last drop returned" (left: Err(Empty)).

(cherry picked from commit 4ca5040b55afcd816e22b4f2c9ddae6e675006b3)
2026-11-05 03:25:49 -08:00
Anees Iqbal f5d7b958a0 Look for textures a carrier holds once a residency change, at render draws too
A profile of the replayed textured page at 5ab66c0e6b:
- RTX 5080 (perf, cycles:u): 32.5% of all samples in
  pvrtc::held_for_copies, plus 3.2% in image_plan::block_family, which
  it calls.
- M3 (sample, the steps thread): 32.6% under
  pvrtc::degrade_unreadable.

Every render draw or tile dispatch whose functions read texture handles
(RenderLowering::command_encoded) asked held_for_copies of every
texture its encoder made resident. That is 5002 textures at each of
the page's 5001 draws, yet whether a carrier holds a texture's bytes is
fixed at the texture's making.

Compute's dispatches already looked once per change of what their
encoder made resident (pvrtc::ResidentUnreadable). That memo now keeps
every such texture, with the render stages it was made resident in, and
a render encoder keeps one too. A draw looks among those alone, in the
order they were made resident, so the texture it announces, where it
announces one, is the one it announced before.
Residency::textures_reached gives way to textures_made_in.
WorkCounts::draw_resident_textures_looked_at counts the looks, and the
replayed-frames lanes print it. api_signatures is blessed for the new
field, an addition.

Measured on the M3 Max (MoltenVK 1.4.2), release, the replayed textured
page, 3 frames, interleaved with 5ab66c0e6b over two rounds:
- host_step_ms a frame: 391-485 at 5ab66c0e6b, 214-237 with this change;
- draw_resident_textures_looked_at: 2 a frame;
- pixels e3306dc52a1c9e86 in both.
The tree measured also carried the next commit's allocation changes,
which build no less at a draw than before.

Verified on the M3 (potluck), the tree measured:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
  targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of 1628,
  with the new test passing. The one failure is exit_guard's known base
  failure (a547d0ce33).
- the lanes: 246 of 247. The one failure is frame_costs' debug draw
  bound, which the next commit addresses.
- Negative control: with the textures found again at every command, the
  new test fails at the first encoder's draw 1 (1 look, expected 0).

(cherry picked from commit 60bb566cdcc30ea10d6b49dedbb9557c0158bfac)
2026-11-05 03:25:48 -08:00
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