Commit Graph
672 Commits
Author SHA1 Message Date
Anees Iqbal c418a1f55b device-texel-conversion: state RADV's nearest-sample flush of a denormal float texel
PrecisionNote::DeviceTexelConversion's recorded bound named NVIDIA's
gathers, which flush a 32-bit float texel's denormal to a zero of its
sign, and answered Metal's value for every other class. On RADV (Mesa
26.2.6, both the RX 7900 XTX and the Radeon 780M on 2026-11-07),
denormal-word-fetches differed at its four nearest-sample sites alone:
each differing word is a denormal against the zero of its sign (largest
difference 0x7FFFFF, a whole mantissa), and none of its gather sites
differs. So the device's samples flush and its gathers keep. That is
the device's native answer (rule 1), announced for the case as
device-texel-conversion, and the note's documentation now says so, in
artifact.rs and in docs/API.md's catalogue entry. The case's module doc
records the RADV reading beside its runtime_lane one.

Doc comments only: no product path changes. artifact.rs is outside the
runtime sources pin, and degradation.rs is not touched. Verified: the
replays m3-max-4102 and 4108 (the four lines, identical on both GPUs),
and the driver version read with vulkaninfo (m3-max-4201).

(cherry picked from commit 7fc262b99f7ab4b080e9efb506021908fa9121e4)
2026-11-07 09:14:32 -08:00
Anees Iqbal 9ab152f477 Ledger: RADV's remaining families, 295 rule-1 rows (275 RADV, 20 NAVI31)
The rest of the RADV ledger round: every line the whole RADV replays
read as unlisted, on the RX 7900 XTX (m3-max-4102, 306 lines) and the
Radeon 780M (m3-max-4108, 281 lines, each identical to an XTX line),
except the 10 lines the case declarations of b5c45c23cf settle and
pass-bytes-srgb-decode-all-bytes' one line, which amdperf owns.

Each row names the native note the RADV run announced for its case at
that site (the case block's "the device's native notes this case
announced" line, or a case-declared notice that fired), and states the
device's own answer with RADV's first differing element and largest
difference:
- 275 rows read "RADV": the 780M holds each of them with the same
  answer, so a RADV row holds on both of the consumer's AMD GPUs.
- 20 rows read "NAVI31": ycbcr-gathers-* and ycbcr-minify-band-*,
  where the XTX's memory is not the host's and the slot binds a
  converted image. The 780M, which reads the planes in place, does not
  diverge there.

Families with a text of their own:
- sampler-r-address-modes and sampler-border-colours: one lane, r the
  negative smallest subnormal, which Metal reads as layer 0 and the
  device reads below it.
- sampler-axis-mode-triples: the device's weight in whole 1/256 steps.
- denormal-word-fetches: the device's nearest samples flush a denormal
  and its gathers keep it.
- BC1 to BC3 sRGB: the sRGB decode moves, since the 780M's block decode
  is measured to be Metal's. BC4 and BC5: the device's decode.
- a2c-*: the device's coverage at alpha 0.5 is samples 0 and 2, and its
  resolve rounds a tie down, as device-rounded-resolve records for RADV.
- texture-fills, nearest-sample-positions, sample-positions-default-*,
  math-frexp-ilogb-half, the pass-bytes tanh and encode sites, and
  blend-interaction-format-*.
The other rows take another venue's venue-neutral text, after the first
differing element and the largest difference were substituted and the
text was read against RADV's answer.

docs/CONFORMANCE-COVERAGE.md re-derived (scripts/conformance-coverage).
Proof: the whole RADV replay on both GPUs at this branch's tip.

(cherry picked from commit 2e0f7f2baf5f72200580b2092005e49645eca4be)
2026-11-07 09:14:32 -08:00
Anees Iqbal 1b5c55ed02 Linux exit: wait for the runtime's work within the bound, then run the earlier exit handlers
On Linux with glibc the exit hook waited for nothing: with another thread's section or a CPU
device's work in flight it wrote the at-once notice and called _exit, so every exit handler
registered before the runtime's last registration was skipped. QEMU registers its exit notifiers
(usb-host's re-attach of host USB devices to their drivers, tap's downscript, the pidfile unlink)
and its terminal restore before the device exists; a quit in that window left a user's host USB
devices detached. Metal's exit runs those handlers.

The hook now waits there as on macOS: for the sections in progress at most BOUND (2 s), at most
MAKING_BOUND (60 s, with its notice) while a pipeline's making is in progress, then for a CPU
device's work within what is left; once they ended it returns and the earlier handlers run. Only
past the bound does it end the process at once with the exit's status (the notice now names the
bounds), which keeps a driver deadlocked inside a submission (the GPU-assisted validation layer's)
from holding the exit and keeps destructors from running beside the driver's work.

After the hook returns no call of the runtime's is in flight: a section publishes its calls'
results before it ends, and none starts once the guard closed. What may still call the driver is
the program's own threads (their race, as before) and the driver's own threads (Mesa's thread
queues, which its own exit handler joins after the hook): the module docs say so.

Tests: an_exit_runs_the_handlers_before_the_hook_once_the_work_ended (a section, and a CPU
device's work, ending 100 ms into the exit: the handler registered before the hook runs, no
notice), which fails where the hook waits for nothing; a_busy_exit_past_the_bound_ends_at_once_
with_its_status (stuck section or CPU work: the exit's status, the notice, after 2 s and within
3 s); the_at_once_notice_names_the_bounds. The exits lane expects the wait on Linux as on macOS.
Docs: exit_guard.rs, pool.rs, shader_cache/worker.rs, docs/API.md's accepted difference.

(cherry picked from commit ec4b802fce26f18920ba0586eeadf32fe694816e)
2026-11-07 09:13:10 -08:00
Anees Iqbal 231a7d86f7 Put a DontCare colour's kept texels behind DontCareColorPolicy::Kept
The owner's rule 1 keeps the fast form of every speed-for-accuracy choice the
default. A colour attachment of a texture's own image stored DontCare now
stores as the driver stores it by default (DONT_CARE where the driver is
measured to keep one of Metal's answers or to store as Metal's own, else
STORE), announced dont-care-store, and renders through the pooled backing
that keeps its earlier texels only under the new opt-in switch
DevicePolicy::dont_care_colors = DontCareColorPolicy::Kept, which
DevicePolicy::exact_answers() selects.

- metal2vulkan: the new public field DevicePolicy::dont_care_colors and enum
  DontCareColorPolicy { Driver (default), Kept }. Its docs give each form,
  its cost and Metal's documentation ("You need to assume that GPU discarded
  the texture's contents"). The runtime alone reads it, so no profile carries
  it (tests::fast_paths checks that no fingerprint moves).
- runtime: kept_bytes::settle takes the backing only under Kept. The docs of
  kept_bytes, render_target, attachment_stand_in, degradation and
  WorkCounts::kept_texels_passes, which counts only the Kept form's passes,
  now say which policy they describe.
- docs/FAST-PATHS.md: the choice moves from "Costs of matching Metal" into the
  table, as a row with its default, its switch, its bound and its measured
  cost. docs/API.md's dont-care-store entry and the Render passes accepted
  difference name the policy.
- Tests of both settings. dont_care_stores' default-policy tests are back to
  their earlier form (each texel one of Metal's two answers, announced where
  the driver does not store as Metal's own) and assert that no pass took a
  backing. The new exact_answers_keep_a_dont_care_color_s_earlier_texels_on_
  every_driver runs under Kept: the single-sample cases, both barriers and the
  two 4x colours keep their texels exactly and are counted.
  deferred_calls's refused-end test is back to its DontCare form.
  clear_reach gains lane_with.
- conformance: the Policy::Exact doc lists queue_sharing and dont_care_colors.
  The colour case's dont-care-store comment says what each policy gives.
- The known-gaps ledger keeps the eight pass-sequence-color-actions rows
  removed. It is held against `conformance replay`, which takes the exact
  policy, as the BGRA10_XR compressed-blit rows already are.
- The API signatures are blessed and docs/CONFORMANCE-COVERAGE.md is
  re-derived (its ledger table had kept the rows that both families removed).
  REFUSALS.md does not change.

Verified: cargo fmt only. The Linux clippy, rustdoc, suites and lavapipe
replays under both policies follow as potluck jobs.

(cherry picked from commit ec3479464c0f72ab5443223a28e23e84ec23e78d)
2026-11-07 09:05:59 -08:00
Anees Iqbal 8d8db05c06 Record what a bit-24 no-copy buffer's dropping copy costs off macOS
On the RTX 5080 Laptop GPU, commit to completion, median of 300 (the
scratch example rows3_cost, b5080 entry rows3-t2 in batch m3-max-3848):
beside a live 16 MiB copy whose pages carry no log, a 256-byte fill into
a writable 16 MiB no-copy buffer took 1.5 ms (49 us beside a 64 KiB
copy), and the same fill into the copy 2.6 ms; into a 64 KiB copy 53 us.
Before the page-at-a-time restore (rows3-t1, same batch) the fill into
the 16 MiB copy took 13.1 ms. The known gap in docs/FAST-PATHS.md now
says so; one code span there is rewrapped onto one line.

(cherry picked from commit 3c595e52ada9f9088a86e8077ab6a536c43c204f)
2026-11-07 09:05:41 -08:00
Anees Iqbal 75137702ab Record what a DontCare colour's kept texels cost
Family A's change came in be0b42bc67/568dd0d59b (a DontCare colour of a
texture's own image keeps its texels through a pooled backing) and
18b42a54bc/e3b68145f3 (drop the pass-sequence-color-actions rows). Their
subjects say WIP and they have no body, so this is their body:

What: kept_bytes::settle now also renders a colour attachment of a
texture's own image stored DontCare (not memoryless, resolving nothing,
not over a buffer) through a backing its queue keeps for the
attachment's shape (attachment_stand_in::pooled_backing, which now takes
whether it copies, Cause::KeptTexels), into which a Load copies the
texels first; the backing is stored DONT_CARE and nothing is copied back.
Not where the pass hands the store to a driver whose DONT_CARE is
Metal's own (MoltenVK), nor the viewed/executes/taken passes, nor where
a format makes no stand-in. No dont-care-store is announced for it, as
the texture keeps Metal's answer; WorkCounts::kept_texels_passes counts
each such pass.

Why: Metal's documentation leaves a DontCare store's contents open ("You
need to assume that GPU discarded the texture's contents"); what the M3
Max leaves, measured by pass-sequence-color-actions over eight runs, is
the attachment's texels from before the pass. Vulkan's DONT_CARE leaves
them undefined, and llvmpipe and the RTX 5080 left the pass's clear and
draw (8 ledger rows). STORE_OP_NONE does not keep the texels of a pass
that writes, so no store op alone matches; the backing does at the cost
below.

Verified:
- lavapipe: pass-sequence-color-actions every plane equal to Metal's
  (m3-max-3621, m3-max-3768, m3-max-3807 at the rebased tip); the whole
  lavapipe set matches the ledger exactly (3768: 1156 rows; 3807: 1137);
  the touched lane tests pass under m2v_cpu_icd (48 at the tip, 3807),
  among them dont_care_stores'
  a_dont_care_color_keeps_its_earlier_texels_on_every_driver, which
  counts kept_texels_passes.
- MoltenVK on the M3 Max: the case announced, its planes exact
  (m3-max-3743, m3-max-3822); 46 lane tests pass under m2v_gpu.
- Negative control (keeps_texels forced false, steelbrain/rows3-negctl,
  m3-max-3729): the 4 llvmpipe rows come back.
- Costs (this commit, docs/FAST-PATHS.md): the scratch example
  rows3_cost on the RTX 5080 (b5080 t entries rows3-t1, rows3-t2, batch
  m3-max-3848) and lavapipe (m3-max-3765, m3-max-3782).

(cherry picked from commit b0197dcf1103f2794723a2cf520f20d698a7b2fd)
2026-11-07 09:05:41 -08:00
Anees Iqbal 3eb84d76c6 Off macOS, drop the GPU's writes to bit-24 no-copy memory through a copy
Metal drops what a shader or the blit engine writes into no-copy memory
made with its private option bit 24: the write completes with no error,
a later command of the same command buffer may read it back, and neither
a later command buffer nor the CPU sees it (probes/readonly_gpu_writes.m,
an M3 Max under macOS 27.0.1; the owner's ruling of 10-23: drop, never
refuse, on every driver). macOS imports the pages through a read-only
view of them. Elsewhere the import was of the caller's own pages, so the
GPU's writes reached the pages, the CPU and later command buffers
(host-page-writes-kernel-store-read-only and
host-page-writes-visibility-read-only diverged on llvmpipe and the RTX
5080), announced as private-resource-option. No import can keep the
writes out there: Linux drivers pin imported pages for writing, and ANV
lost the device and RADV failed every submission over read-only imported
pages.

So off macOS such a buffer, heap or rebind is made over a copy of the
pages whose GPU writes are dropped, the mechanism copied.rs already has
for pages the process maps read-only: each commit copies in what the CPU
changed, later commands of the batch read the GPU's writes, and the
batch's completion puts every byte the GPU changed back, writing nothing
to the pages. The gate is not asked (nothing is imported), the copy joins
no other buffer over the bytes, and a rebind whose bytes moved in their
page is now a copy laid out at the old offset rather than refused.

- buffer_descriptor.rs: buffer_over_host_memory makes the copy
  (CopiedFor::ReadOnly) where drops_writes and the system maps no
  read-only view; the rebind path copies the same way (read_only_copy);
  copied_buffer takes why it copies, and passes read_only to
  CopiedBuffers::add and drops_writes to the buffer's HostCell.
  no_copy_options moves here from degradation.rs and no longer
  announces private-resource-option off macOS (that notice stays for a
  heap of the runtime's memory and an indirect command buffer).
- copied.rs: add() takes read_only, which drops the copy's GPU writes
  whatever the pages' protection.
- buffer.rs: BufferParts carries drops_writes into host_lie.
- New: CopiedBecause::ReadOnly, WorkCounts::copied_read_only_memory.
- Docs: read_only_view.rs, copied.rs, capabilities.rs (the answer stays
  no off macOS), values.rs, host_backing.rs, interop.rs, host_aliases.rs,
  error.rs (RebindTextures is macOS-only now), degradation.rs, docs/API.md
  (private-resource-option, copied-host-pages), docs/HOWTO.md and the
  docs/FAST-PATHS.md known gap: off macOS a command buffer committed while
  the writer is in flight still reads its writes, and a render pass's
  store-out into the copy completes where Metal's faults.
- Tests: degrade_notices' bit-24 lane tests assert the writes are
  dropped on every driver and count the copies (3 and 1 off macOS, 0 on
  it) and the kinds (copied-host-pages off macOS, none on it);
  copied_surfaces' dropping buffer is a copy of its own off macOS.
- host-page-writes read-only rows declare copied-host-pages in place of
  private-resource-option; their 8 ledger rows are removed.
- api_signatures.tsv blessed for the new field.

Verified: see the replay and lane-test jobs named in the branch report
(lavapipe, the RTX 5080 through b5080, MoltenVK on the M3).

(cherry picked from commit 1f24b1f035d61f093ecf2c76fae4b9c2e4b541d9)
2026-11-07 09:05:40 -08:00
Anees Iqbal f085d298cb Regenerate REFUSALS.md for kept_bytes::settle's second Render site
kept_bytes::settle now matches NotImplemented(Render) from the pooled
backing of a DontCare colour (it keeps the pass in place there), which the
refusal surface reads as a second site of gap::Render. Regenerated with
python3 scripts/refusal-surface/refusal_surface.py; no refusal changed.

(cherry picked from commit 8ca3ed766dc2d022ace03a294694d78b03faf7a9)
2026-11-07 09:05:40 -08:00
Anees Iqbal e08ad161e6 WIP: a DontCare color of a texture's own image keeps its texels through a pooled backing
(cherry picked from commit 568dd0d59b0ae6b30a6308a2f7587cfe7c4a41dd)
2026-11-07 09:05:39 -08:00
Anees Iqbal c0d0511d68 Ledger: RADV's half-output-blends, pixel-downscales, half NaN, pixel-samplers and vertex-format families, 201 rule-1 rows
From the same whole RADV replay (m3-max-4016 at 7470a49e6d). Each
family's notes are announced for its cases on RADV (the case's own
native-note line, or every declaration fired: none of these cases is
among those whose declarations did not all fire, save the MoltenVK-only
set-past-layout one), and each row states RADV's own answer:

- half-output-blends (63): the device's fixed-function blend where
  Metal's compiler folds blend and conversion under fast math, under
  half-output-fast-math-blend; the rows say whether a site is within
  that note's bound is not established, as llvmpipe's do.
- pixel-downscales (42): a normalized downscale differs by 0.031 of a
  code at most, inside device-sampling's RADV bound (0.548); a pixel
  sampler's by up to 0.876, inside pixel-sampler-scaling's 2/255; the
  digest sites point at the head and tail rows.
- half-texel-nans, half-read-nans, half-write-nans (38): each a NaN
  whose sign and payload are the device's, under native-nan-encoding
  and the case's announced conversion note, with RADV's first
  differing element.
- pixel-samplers (38): digests of the device's own sampler and
  conversion; the subnormal arg and slot sites hold the digest
  MoltenVK and lavapipe answer, the device's floor of a negative
  subnormal, under device-denormals.
- vertex-format (20): a narrow float attribute's NaN widened with its
  payload, under device-nan-encoding; a float read as half keeps the
  NaN's sign, under native-nan-encoding.

All are scoped to RADV. CONFORMANCE-COVERAGE.md re-derived.

(cherry picked from commit 8e309cbacd31cdf61ecc74bbad8876225ae7a299)
2026-11-07 08:37:49 -08:00
Anees Iqbal ff6d387aa7 Ledger: RADV's extended-swizzles family, 193 rule-1 rows
The whole RADV replay (RX 7900 XTX, RADV NAVI31, Mesa 26.2.6; potluck
job m3-max-4016 at 7470a49e6d) read 704 lines not in known-gaps.tsv;
193 of them are the extended-swizzles family (extended-range,
padded 10-bit, packed 16-bit, bfloat and sRGB-twin formats under
every swizzle and op). Each is a site the case's M3 Max, NVIDIA and
llvmpipe rows already hold, and each is the same answer:

- 124 sites read exactly the count and largest difference another
  venue's row holds, and 15 more (the sRGB twins' gathers and reads)
  differ from it only in the largest word difference (91309 here
  against 91311-91315), the same one-step code; their row texts state
  the module's own decode and encode arithmetic and the device's
  conversions, venue-neutral, under device-pack-conversion, which
  every one of these cases announced on RADV, so they are reused as
  they stand;
- 20 extended-range linear samples (sl) blend their taps by the
  device's FMix, under bicubic-filter-arithmetic, which these cases
  declare and which fired on RADV (none of them is among the cases
  whose declarations did not all fire); each row now names RADV's
  own first mismatch and how far apart it is in value;
- 14 bfloat NaN sites keep the NaN's sign and payload where Metal
  answers 0x7fc00000 (RADV's first: ours 0xFFEF0000), under
  device-pack-conversion;
- 20 packed 16-bit linear samples are the device's own filter and
  widening, under device-sampling and device-texel-conversion
  (announced); each row names RADV's first differing element and
  that device-sampling's RADV bound (0.548 of a code) is measured on
  unpacked formats only.

All are scoped to RADV. CONFORMANCE-COVERAGE.md re-derived.

(cherry picked from commit b255f138531068fea5f2d4edc2be7f2084d24c09)
2026-11-07 08:37:37 -08:00
Anees Iqbal fde4ef5bb3 Ledger: RADV's sRGB decode beyond the read-write tier, four rule-1 rows naming srgb-texel-decode
The whole RADV replay (AMD Radeon RX 7900 XTX, RADV NAVI31, Mesa
26.2.6; potluck job m3-max-4016 at 7470a49e6d) read four lines not in
known-gaps.tsv at the 8-bit sRGB `beyond` sites of
read-write-tier-round-trip-float (768 elements, largest 67649) and
read-write-tier-held (192 elements, largest 64922), for BGRA8 and
RGBA8 alike. They are the device's native sRGB decode, the same
answer the case's llvmpipe and NVIDIA rows hold at the same sites:

- both cases announce srgb-texel-decode on RADV;
- the U32 difference is between f32 bit patterns, not codes: the
  round trip's first element is Metal 0x3C840841 (66 / 4095) against
  our 0x3C830000; the held read's are Metal 0x3D080881 (136 / 4095)
  against our 0x3D0798DA, the transfer of code 51, and 0x3BB80B81
  (23 / 4095) against 0x3BB7AD6B, the transfer of code 17;
- RADV stores no sRGB format (its optimal tiling of B8G8R8A8_SRGB and
  R8G8B8A8_SRGB lists no STORAGE_IMAGE, read with vulkaninfo, job
  m3-max-4052), so the held texture is read through its UNORM alias
  and decoded through the device's Pow, as on the other two venues.

The rows are scoped to RADV: the decode is the driver's compiler's,
not one Mesa build's. CONFORMANCE-COVERAGE.md re-derived (2600 rows).

(cherry picked from commit 6efa9157436862f6e6d990f298f53fd84ab11b06)
2026-11-07 08:37:20 -08:00
Anees Iqbal b64908f468 Ledger: the RTX 5080's own YCbCr conversion and filter, twenty rule-1 rows for ycbcr-gathers and ycbcr-minify
The 5080 replay of the two-plane YCbCr cases (potluck b5080 entry
replay-replay-nv-ycbcr-072438 at 394b4db3f6) read twenty lines not in
known-gaps.tsv: ycbcr-gathers-{edge,zero,white,repeat} at
case/samples/{420v,x420}/{float,half} and ycbcr-minify-band-{x,y} at
case/samples and case/samples/ends, each a digest Metal's and ours
differ at. The digests are the ones the 5080 answered at 10012a618f.

They are the device's native answers. The 5080's memory is not the
host's, so the runtime binds the texture's image of converted texels
rather than reading the planes in place (lavapipe and MoltenVK read
them in place and match Metal at every one of these sites):

- the 8-bit 420v surface: the device converts the format itself
  (ycbcr_device.rs; NVIDIA 615.71.09 enables samplerYcbcrConversion
  and its optimal tiling of G8_B8R8_2PLANE_420_UNORM reports
  SAMPLED_IMAGE, TRANSFER_DST and MIDPOINT_CHROMA_SAMPLES, read with
  vulkaninfo, potluck job m3-max-3911), and samples are its own
  filter: announced as ycbcr-filter-not-exact and device-sampling;
- the 10-bit x420 surface and the minify bands: the device does not
  convert it (RuntimeDriverDefect::TenBitCodesReadAsWords names
  NVIDIA), so the texels are Metal's fixed-point conversion and only
  the filter is the device's: announced as device-sampling.

Both notes are suite native notes, which loosen no value
(replay::NATIVE_NOTES), so each site is a row naming its note. The
sites compare by digest, so which lanes moved is not separated, and
the rows say so. CONFORMANCE-COVERAGE.md re-derived.

(cherry picked from commit 05a4e4d3994ef83845ca55417f480aa0aab3606d)
2026-11-07 08:36:55 -08:00
Anees Iqbal c36bf38d91 Scheduler: wake after a committing thread's pass only where it submitted alone a batch that may group
The wake that ends a committing thread's pass (ff870f6403) came after every such pass. Before the
alone path (4d4e103471), a commit_and_submit's batch of a VkQueue whose batches may wait in a group
was left to the scheduler's thread, which the commit woke; every other batch it submitted itself,
waking nothing. So on a driver whose check finds no merge (lavapipe) the base never woke the thread
for a commit_and_submit, and the unconditional wake added one there: on lavapipe the "seen handler
alone" shape's commit to watch went to p50 14.7-15.0 us, p90 21.9-22.6, against the base's
13.7-13.9 and 16.0-17.3, while the same binary with the wake switched off was at the base
(m3-max-3884, gem10 exclusive).

Now `submit_plain_ready` counts the batches it submitted whose `VkQueue`'s batches may wait in a
group (`Plain::alone`: for a committing thread, those `plain` lets go alone where the group would go
at once, `goes_alone_at_commit`), and a committing pass that left nothing wakes the thread
(`Woken::Commit`) only where that count is above zero: the wake the batch's hand-off to the thread
would have made. Every driver keeps the base's cadence by construction: RADV its wake per such
commit, lavapipe and any driver whose check finds no merge none. Docs: the scheduler module,
`submit_at_commit`, `Plain`, `Woken::Commit`, `CommandBuffer::commit_and_submit`,
`WorkCounts::scheduler_wakes_commit`, the runtime README's item, FAST-PATHS row 37's figures. The
scheduler_wakes test is now
`a_commit_and_submit_wakes_the_sleeping_thread_only_for_a_batch_that_may_group`: once the
submission checks answered, ten commit wakings of ten where the batches may group, none elsewhere.

Verified (m3-max-3922, gem10 exclusive, one job, this diff on 7e57099fa3; base = the three
scheduler files before 4d4e103471; two alternating rounds of both lanes on each driver):
- lavapipe (Mesa 26.2.6): the thread's counts over the lane as the base's, sleeps 4000 and
  commit wakings 4000 at both, 2000 submitted at commit; "seen handler alone" commit to watch
  p50 13.8-14.1 us, p90 16.9-17.5, against this run's base 12.9-13.2 and 15.9-16.9 (3884's base
  13.7-13.9 and 16.0-17.3), the unconditional wake's p90 21.9-22.6 gone; a checked fill's commit to
  submission handler p50 12.5-13.4 us against 12.4-13.4.
- RADV (RX 7900 XTX): sleeps 6000 at both, the commit_and_submit batches' wakes counted as a
  commit's (commit 6000, host 0) where the base counted them as a host signal's (4000 and 2000);
  the plain shapes' commit to watch p50 32.1-47.3 us against 38.9-46.7, the thread's wake p50
  4.0-4.5 against 4.1; commit_and_submit's gain kept: a checked fill's commit to submission
  handler p50 30.4-32.8 us, p99 48.8-57.8, against 36.2-55.7 and 112.1-198.5, 520 of 520
  submitted at commit; another queue's head waiting, p50 24.7-25.0 against 32.7-39.2; the shape in
  turn with the plain ones, commit to watch p50 31.9-36.1 against 39.2-50.1.
- Tests alone (commit_and_submit, deferred_calls, scheduler_wakes, each --exact on one thread):
  31 of 31 on RADV (the new test: batches grouping, 10 commit wakings of 10) and on lavapipe (not
  grouping, 0 of 10). Negative controls: on RADV with 3e9230adf2's scheduler (no wake) the new test
  fails with 0 of 10; on lavapipe with 7e57099fa3's (the wake after every pass) it fails with 10.
- Clippy (plain, m2v_gpu, m2v_cpu_icd) and rustdoc with -D warnings pass (m3-max-3923, ms01).

(cherry picked from commit 9184d15a5707ff4e89c00f32af225b66ec40875e)
2026-11-07 08:17:57 -08:00
Anees Iqbal f118559e73 Binary archives: add mesh pipelines, and load a metallib as an empty archive
Two of the conformance ledger's every-venue rows, both of the runtime's
archive surface.

binary-archive-mesh-adder: BinaryArchive had three of Metal's four
pipeline adders. add_mesh_render_pipeline_functions
(addMeshRenderPipelineFunctionsWithDescriptor:error:) makes the state as
new_mesh_render_pipeline_state does with the default options, answering
its error, and keeps the descriptor's archive key (metal_key::mesh). A
mesh creation compiles its pipeline whole and looks in no archive, so
the add keeps no compiled artifact. Under FAIL_ON_BINARY_ARCHIVE_MISS a
mesh creation, which every listed archive missed before, now hits an
archive holding its key (binary_archive::mesh_missing). Which fields
Metal keys a mesh pipeline by is not measured, so the key holds every
field of the descriptor: a creation hits only an add of an equal
descriptor, where Metal's hits too, and one differing in a field Metal
does not key misses here where Metal's may hit, as the add's and
new_mesh_render_pipeline_state's docs say.

binary-archive-sources: Metal takes a metallib as an archive (the case's
M3 Max recording); container::read refused it as no archive of ours. A
file that parses as a metallib (Library::from_metallib, container tags
alone) now loads as an archive holding nothing: its lookups miss and it
serializes as one nothing was added to. What Metal's archive of a
metallib holds is not measured; new_binary_archive's doc says so.

The suite's runtime side answers the mesh add through the new call. The
ledger's two rows go; api_signatures.tsv gains the method, and
METAL-COVERAGE (coverage.tsv) marks the call implemented. Tests: unit
tests the_mesh_key_holds_every_field_and_a_lookup_names_the_mesh_function
and a_metallib_loads_as_an_archive_holding_nothing; lane test
a_mesh_add_is_found_by_its_own_descriptor_and_a_metallib_loads_as_an_
empty_archive (hit, miss before the add and for another color format,
the add's error, serialize and reload, the metallib's miss and nothing
to serialize). Verified by those tests and a whole lavapipe conformance
replay (see the tip report).

(cherry picked from commit adadb73f7c2063341e1dbe54fe887a5ceddf86b7)
2026-11-07 08:02:57 -08:00
Anees Iqbal 0d368fbfe7 Draw a split depth/stencil resolve's drawn aspect into its own texture
Metal resolves separate Depth32Float and Stencil8 textures with the
depth filter Min or Max beside the stencil filter Sample0, each into its
own resolve texture. On a device with no MIN or MAX depth resolve mode
(lavapipe) the runtime draws the picked depth after the pass, but a
split resolve (aspects resolving into different textures) refused any
drawn aspect NotImplemented(DepthStencilResolve): the draws wrote the
first step's scratch image, whose copy takes that step's aspect alone.

Now a split resolve draws its drawn aspect into that aspect's own
resolve texture (or a scratch image copied there, Destination::attach),
held as the resolve's drawn_into, which drawn_target prefers; the other
aspect resolves in its subpass step as before. Both aspects drawn, each
into its own texture, stays refused. The image separate textures render
through is made sampled where such a resolve may be drawn
(resolve::may_draw, which shares the filter-to-mode choice with
depth_stencil through aspect_modes), since the draws read its samples.

The ledger's two llvmpipe rows of resolve-stencil-under-depth-filters
(Sample0 under Min and Max) go. The lane test
split_depth_and_stencil_resolves_are_metals now expects every case but
both-aspects-drawn to be built and to hold Metal's answers; before this
change sep_min, sep_max, two_min, two_max and slices_max were refused
on lavapipe. Verified on lavapipe: the lane test and the conformance
replay (see the tip report).

(cherry picked from commit c2b4cbc80bf7f8f209d02ecbd5e5aec186b04d96)
2026-11-07 07:28:20 -08:00
Anees Iqbal 9b1a531a25 Re-derive the conformance coverage document for attribute-stride-vertex-buffer
python3 -I scripts/conformance-coverage/coverage.py: one more case module
and recording, and setVertexBuffer:offset:attributeStride:atIndex: on the
render encoder now exercised by the Metal leg (812 of the reachable).

(cherry picked from commit dce4bd753c2e298f3b1cbb84b5c808d2cabb85b1)
2026-11-07 07:21:49 -08:00
Anees Iqbal e39a0cab5c Conformance: a tile state's thread limit follows its dispatch's device-gap ruling
tile-simd-blur-columns and -rows on llvmpipe compared the tile state's
maxTotalThreadsPerThreadgroup, Metal's 1024 against the runtime's 960,
as a divergence of ours, while the same case's 32x32 dispatch, refused
typed with Feature::LocalSize and a Capability::Limit, already read as
the device's gap (a_dispatch_the_device_cannot_take_is_the_devices_gap).
960 is lavapipe's: its emulated 32-lane simdgroups hold 960 threads of
the blur's pipeline, and the runtime reports the device's lower limit
by contract (pipeline/tile.rs).

Now the tile_threadgroups family, where the device refused a dispatch
Metal ran of the state as its gap and the state's descriptor states no
limit, states the state's maxTotalThreadsPerThreadgroup site as that
gap (Sites::device_gap), and the comparison reads a value site our side
stated so as a DeviceGap instead of a divergence (compare.rs, before
any allowance, as a refused site's gap). A state whose answer matches
Metal's records nothing; an unstated difference still diverges.
Metal's side never states one: its failures carry no lacks.

The two llvmpipe ledger rows go; the cases now read lacks-feature
there. Test: a_getter_our_side_states_is_the_devices_limit_is_the_
venues_gap holds both directions (stated reads lacks-feature, the same
answer unstated reads divergent, a stated site matching Metal exact).
Verified by the conformance unit tests and a whole lavapipe replay
(see the tip report).

(cherry picked from commit ffa0411fb87a3dc61ca14a5418b16a60e06c3fa2)
2026-11-07 07:20:06 -08:00
Anees Iqbal ff870f6403 Scheduler: a committing thread's pass ends by waking the scheduler's thread, as a commit does
Since a committing thread's batch went alone on a grouping driver (4d4e103471), a
`commit_and_submit` that submitted its batch itself no longer woke the scheduler's thread;
before it, on such a driver, that batch was left to the thread, whose wake came with it. The
thread so slept across those commits, and the plain `commit`s made beside them often fell into
a slow mode: in the completion-latency lane (three shapes committed in turn 2 ms apart), the
plain shapes' p50 was slow in 4 of 6 rounds (three jobs) without the wake and in none of 10 with
it, before the alone path or after this change.

Mechanism (gem10, RX 7900 XTX, RADV, Mesa 26.2.6, exclusive; m3-max-3816, a probe build):
the thread's own counts over the lane show the wake source: before the alone path, sleeps 6000,
woken by a commit 4000 and by the host 2000 (the committed batch left to it), batches submitted
at commit 0; at 3e9230adf2, sleeps 4000, commit 4000, host 0, at commit 2000; with a wake after
the committing thread's submissions, sleeps 6000, commit 4000, host 2000, at commit 2000. The
latency followed: in 3e9230adf2's slow round, the plain shapes' thread wake p50 4.5-10.6 us
(p90 51-104) and commit to watch p50 56-104 us, `vkQueueSubmit` itself 27-62 us at the median,
on every thread, the committing one's included; with the wake, both rounds at the old figures. The system-wide
cpuidle counts (entries and residency of each state, the menu governor, amd-pstate-epp) did not
separate the legs, so the idle-depth part of the account is not shown by them.

Fix: `Scheduler::submit_at_commit` wakes the thread after its pass, for what it left
(`Woken::Host`, as before) or else for the commit itself (`Woken::Commit`), once a sleep as any
waker. The wake comes after the submissions and their submission handlers, so nothing on a
command buffer's way to its `VkQueue` waits for it. Docs: the scheduler module, `submit_at_commit`,
`Woken::Commit`, `CommandBuffer::commit_and_submit`, `WorkCounts::scheduler_wakes_commit` and
`scheduler_wakes_host`, the runtime README's item, and FAST-PATHS row 37's figures for the alone
path. New test: `tests::scheduler_wakes::a_commit_and_submit_wakes_the_sleeping_thread_as_a_commit_does`
(ten `commit_and_submit`s after idle gaps, each submitted at commit, each a commit's waking).

Verified (m3-max-3823, gem10 exclusive, release, base = the three scheduler files before
4d4e103471, dev = development's scheduler, fix = this; two alternating rounds of both lanes):
- the plain shapes back at base: commit to watch p50 31.3-37.0 us against base 29.9-39.4 (dev
  33.4-169.9), the thread's wake p50 4.1-4.5 us against 4.0-4.2 (dev 4.3-51.0);
- commit_and_submit keeps its gain: a checked fill's commit to submission handler p50 30.7-32.2
  us against base 34.2-70.0, 520 of 520 submitted at commit; the call returns at 32.0-33.5 us
  against dev's 31.8-33.8; the shape in turn with the plain ones, commit to watch p50 31.3-31.6 us
  against base 31.3-39.5 (dev 29.6-102.4).
Tests alone on RADV (each `--exact`, one thread): commit_and_submit, deferred_calls and
scheduler_wakes, 31 of 31 pass at the fix; with development's scheduler 30 of 31, the new test
failing with 0 commit wakings of 10. Clippy (plain, m2v_gpu, m2v_cpu_icd) and rustdoc with -D
warnings pass (m3-max-3824, um870).

(cherry picked from commit b80e092759fb412a0154365bfb378ee38e096f56)
2026-11-07 07:16:37 -08:00
Anees Iqbal 027bb2e682 A compute state's static threadgroup length is the kernel's own, as Metal reports it
ComputePipelineMetalInfo::static_threadgroup_memory_length answered, on
a device that emulates simdgroups, the declared arena plus the scratch
of the most threads (32768 on lavapipe for compute-threadgroup-simd-
scratch, whose kernel declares 24 KiB), and elsewhere the kernel's
static part plus a predicated walk's vote word. Both additions are
ours: Metal's staticThreadgroupMemoryLength is the static part of the
kernel's own layout (KernelFacts::static_threadgroup_bytes), and the
getter now answers exactly that.

The planner keeps counting the scratch and the vote word in each
dispatch's total (bind::plan::compute: the arena from
RuntimeFact::SimdgroupEmulation, the vote beside it, the scratch rule
per region), so a dispatch whose threadgroup lengths fit beside the
reported length but not beside the scratch is refused
ThreadgroupMemorySize, the device's gap, where before the inflated
getter kept a well-behaved client from asking. The emulated tests
check both: region_k reports 0, a Metal client's remainder beside it is
refused at the most threads, and a region that fits beside the arena
and the scratch runs; barrier_k reports its own 31 KiB.

The compute-threadgroup-simd-scratch llvmpipe row goes. The runtime
getter's doc names the refusal. SEMANTICS_VERSION 1980 -> 1982 (1981 is
rows2's).

Verified: runs next (targeted translator tests, lavapipe replay).
(cherry picked from commit dd3d0a893bf900fbf11cb885f5fb9a7b7cfd9055)
2026-11-07 06:57:11 -08:00
Anees Iqbal 6126e8a237 FAST-PATHS: the Grouped row's figures for a batch a committing thread submits alone
Measured in job m3-max-3640 (homelab-gem10-1, exclusive, release test
binaries of the fix's tip and of the form before it, alternating, two
rounds each): tests::completion_latency::runtime_commit_to_submission
and runtime_completion_latency on RADV (RX 7900 XTX, Mesa 26.2.6,
whose submission check finds merges: 520 batches submitted at commit
at the tip, 1 before) and on lavapipe (whose check finds none: the two
forms alike). The plain commits interleaved with commit_and_submit ones
saw the scheduler thread wake later at the tip, in three of four rows;
the row states it.

(cherry picked from commit d94a28e714c46ca24fe764700ee5017c2041c297)
2026-11-07 06:47:43 -08:00
Anees Iqbal 4d4e103471 commit_and_submit: on a grouping driver, submit a batch alone where the group would go at once
On lavapipe (and on every Mesa driver, whose queues merge a submission that
signals nothing into the next), commit_and_submit's committing thread never
submitted anything: tests::commit_and_submit printed "0 of 40 handlers on the
caller; passes at commit 40, batches 0", and six of its tests failed (lines
126, 217, 284, 427, 535, 624), with deferred_calls.rs:1106 (the check and
handler ran on the scheduler's thread, not the lowering thread). Under the
default CompletionPolicy::Grouped there, every batch "may wait in a group"
(group::groups), and scheduler::plain refused any such batch to a thread
other than the scheduler's, so each commit went to the scheduler's thread, a
wake and a pass away: the extension did nothing on the drivers it was made
for (the runtime README states it submits the ready command buffers needing
no host step and no storage-form switch; only the method's doc said "no
group").

A pass that holds a batch in the group sends the group at its end unless two
or more earlier submissions of its VkQueue are not seen complete
(Group::keeps). So where at most one runs, a committing thread now submits
such a batch alone (CommandBufferShared::goes_alone_at_commit, read from the
queue's timeline without its lock, as keeps reads it): it reaches the GPU no
later than through the scheduler, and the wake and pass are saved. Where two
or more run, it is left to the scheduler's thread, which holds it in the
group with the commits that join it, as before. submit_batch takes `alone`,
which a thread other than the scheduler's passes, so such a batch never joins
the group. A thread about to block keeps leaving groupable batches to the
scheduler.

Docs: commit_and_submit's doc, the scheduler module doc, the runtime README
and the Grouped row of docs/FAST-PATHS.md (its switch and forms unchanged).

Verified on lavapipe (layer 1.4.363) by the commit_and_submit and
deferred_calls tests and the grouped-submission lane at this commit and with
plain()'s change reverted, in one job (see the report for the job id).

(cherry picked from commit 25a43729192f80d5fc2ca3af42ef4c14596ae1f0)
2026-11-07 06:47:43 -08:00
Anees Iqbal def2c7f1d7 Re-derive the conformance coverage document after the ledger removals
python3 -I scripts/conformance-coverage/coverage.py: the ledger count
falls from 2619 to 2605 (the four attribute-stride rows, the three
slice-past used-size rows and the seven move rows), the slice-past row's
note follows the ledger, and the sparse families count the
allowGPUOptimizedContents call the move rows now make.

Found by tests::the_conformance_coverage_document_is_what_the_sources_derive
failing at fcfdf2bcb1 (job m3-max-3620, the only failure of 1,019).

(cherry picked from commit cc6e6740161cc876cfdf2f8ccc008088de24970b)
2026-11-07 06:26:54 -08:00
Anees Iqbal d158a960dd Read the sparse move rows through uncompressed textures
The move family's rows (inside-the-level, past-the-destination's-row,
clipped-source) read a tile a move rebound as 0 in 3,968 of its 4,096
words on Metal and whole on ours. probes/sparse_move_compression.m (job
m3-max-3570, an M3 Max under macOS 27.0.1, five descriptors, two runs
each, one outcome) shows that is lossless compression's: under the
case's own descriptor (ShaderRead, allowGPUOptimizedContents YES) a
moved tile kept its word in 128 texels, the first 4 by 2 of each 16 by
16 block, and with allowGPUOptimizedContents off, ShaderWrite or
PixelFormatView usage both moved tiles read whole. Controls: untouched
tiles whole, moved-from tiles zero, every command buffer completed,
usedSize unchanged.

A move is documented to move the tile's mapping, and the rows read
which tiles it moved, so they now make both textures with
allowGPUOptimizedContents off:

- SparseTextureSpec gains gpu_optimized (Metal's default, true) and
  unoptimized(); both sides forward it to their descriptor. An
  unoptimized texture adds a byte to its fingerprint and a site suffix
  where the default adds none, so every other sparse case's recording
  keeps its fingerprint.
- moved() builds its two textures unoptimized; the four move rows'
  recordings are re-taken on the M3 in the next commit.
- docs/API.md's accepted differences gain the compressed case: Metal's
  moved tile may read only part of its texels, ours reads all of them
  under every descriptor; the runtime does not reproduce the loss.
- The probe's header records its results.

(cherry picked from commit b3f8f28dbf18ce6756587702dd012ebd282c4f3a)
2026-11-07 06:26:30 -08:00
Anees Iqbal 08ca74da22 Charge a sparse heap for a mapping update of a slice past the texture's
Plain Metal takes a sparse mapping update whose slice is past the
texture's own (its API validation refuses it) and charges its heap's
usedSize exactly what the same region on an in-bounds slice costs: one
page a tile of the region clipped to the level's tiles, idempotent per
tile, given back on an unmap of that tile, never below where it stood
(probes/sparse_indirect_usedsize.m and sparse_mapping_past_the_bounds.m
on the M3 Max, macOS 27.0.1, both selectors). Ours counted nothing, so
sparse-mapping-a-slice-past-the-textures read 65,536 where Metal read
81,920 at used-size/2, /3 and /4.

UnitGrid::clipped_region now names such a region's units at the slice
(past_slices tells them apart); sparse/bind.rs's apply takes and gives
back their heap room into SparseState::charged and binds nothing for
them, and undo reverts them with the rest. The move keeps the slice
bound (clipped_size), as measured.

The texels plain Metal's page reaches (read/4: a 16 by 16 block of slice
0's tile (0, 0) reads its unwritten pattern) are not mirrored, on the
owner's call via the orchestrator: an accepted difference in docs/API.md
section 10 (Vulkan binds nothing past an image's layers,
VUID-VkSparseImageMemoryBindInfo-subresource-01723, and the address is
not derivable), which the remaining ledger row now names.

Removes the three used-size rows of known-gaps.tsv. tests::sparse holds
the counts against Metal's readings row by row (every row now equal).

(cherry picked from commit 636522137c717715521cdda950fbb7213e00089f)
2026-11-07 06:26:30 -08:00
Anees Iqbal 1edd55cb98 Read a stage-in layout bound with MTLAttributeStrideStatic as Metal does
Plain Metal on the M3 Max (macOS 27.0.1) answers each of the compute
encoder's four stride forms bound with MTLAttributeStrideStatic, under a
[[stage_in]] layout of MTLBufferLayoutStrideDynamic, with the element at
the bind offset for the first element and zero for every element past it
(the attribute-stride-* recordings). That is a fetch at the constant's
low 32 bits, 2^32 - 1, by the same truncation every other stride takes:
element 1 lies 2^32 - 1 bytes on, past the buffer (an ICB command read
the real byte there in a buffer that holds it). Ours mapped the constant
to "no stride" and read every element at stride 0 (three divergent
rows), and refused the inline-bytes form (one refused row).

- Runtime: a compute table's stride forms hold the argument's low 32
  bits, the constant included (argument_table::per_bind_stride); the
  plain setters still set none (stride 0), and a render stage's table is
  unchanged. fetch_reach then sees the constant's real reach.
- Bind layer: PushField::StageInStride pushes inline bytes' stride as a
  buffer's; the NotImplemented(KernelStageIn) refusal for bytes at
  u32::MAX is gone (REFUSALS.md regenerated).
- Translator: a kernel stage-in read that steps by thread position
  decides exactly whether its bytes lie in the first 2^32 bytes from the
  bind offset (e * stride + offset + size <= 2^32, without the u32 wrap;
  fetch::within_reach), and in a view whether the bind residual plus the
  displacement still fits; past it the read takes the bind offset and
  yields zero bytes on every device (access::pulled::prepare_within).
  Before, the wrapped displacement landed back inside the buffer (element
  1 at 2^32 - 1 + 4 read byte 3).

Removes the four attribute-stride-* rows of known-gaps.tsv.
SEMANTICS_VERSION 1981 (the orchestrator's number).

Tests: engine_kernel_stage_in::an_element_past_four_gigabytes_reads_zero
(every profile, with and without robustness: the constant on both
layouts, beside a stride of its own, and a stride of 2^32 - 8 whose
element 2 wraps to 2^32 - 16); tests::argument_table::
the_static_constant_is_a_compute_tables_widest_stride.

(cherry picked from commit f4d8011ccd1fe723c5192dd58e6b2eef7553fb37)
2026-11-07 06:26:29 -08:00
Anees Iqbal 2e8e0353b2 Regenerate REFUSALS.md for the input-form shadow's refusals
lower/fragment/input_shadow.rs refuses FramebufferFetch where the device
lacks the interlock, fragment stores, multisampled storage or the
shadow's storage format, and NotImplemented for the shapes it cannot
keep Metal's answer in (python3 scripts/refusal-surface/refusal_surface.py).

(cherry picked from commit 8a9d1405ec2dc326f1d78fd8831065ac75276e70)
2026-11-07 06:19:16 -08:00
Anees Iqbal 9175e22891 Degrade catalogue: lavapipe's passes hold the extended-range shadow beside the input attachment
docs/API.md's entry for extended-range-blends-stored-codes said every
pass over input attachments keeps the codes; on a device with the pixel
interlock, fragment stores and Rgba16f storage images the pass holds the
shadow, and the notice fires there only where the shadow cannot follow
(a multisampled load, a refused shadowed variant) and, for a masked
word write, only where the pass holds no shadow. The four
xr-masked-bgr10xr notice rows that went in 9b264b29fe are that last
case. Degradation::ExtendedRangeBlendsStoredCodes' doc says the same.

Verified: doc text; the runtime suite's catalogue test runs with the
suites.

(cherry picked from commit 536615e3c3460673f6defce426dfa72fc51f8f3f)
2026-11-07 06:19:16 -08:00
Anees Iqbal 91a95766bb Conformance ledger: lavapipe's extended-range blends read the half shadow beside the input attachment
With the shadow held over input attachments (and the input-form draws
kept for recording again), the lavapipe xr replay on msi (m3-max-3561,
at 43b2d2dd54; 109 xr-* cases) answers the 26 group-1 texel sites
exactly as the RTX 5080 does, and 22 of them as the M3 Max does (the
four xr-gradient-*blended* rows differ from the M3's by the device's
arithmetic, as the 5080's do):

- xr-gamut-bgra10xr-{over,straight}-{half,float}-{x1,x4}, the sRGB twins
  and the x4-stencil pair, xr-masked-bgra10xr{,-srgb}-rgb-over,
  xr-masked-bgr10xr{,-srgb}-red-over and
  xr-gradient-bgra10xr{,-srgb}-blended-{x1,x4}: each row's answer is the
  measured one, and its text the 5080's (the device's blend arithmetic,
  encode and resolve, in replay::NATIVE_NOTES or announced and
  declared), saying the function blends over the input attachment and
  reads and writes the shadow beside it in the interlock. None is our
  gap any more.
- The four notice rows of xr-masked-bgr10xr{,-srgb}-{red,blue-green} go:
  extended-range-blends-stored-codes is no longer announced, as the pass
  holds the shadow.

The gamut and masked cases' allowance docs no longer say lavapipe holds
no shadow. CONFORMANCE-COVERAGE.md regenerated.

Verified: the msi replay above (lavapipe, LLVM 23.1.1). The whole
replay on the homelab lavapipe (LLVM 23.1.4) runs next.

(cherry picked from commit cd910afb74e5faf67a0e6affdea77ced18205747)
2026-11-07 06:19:16 -08:00
Anees Iqbal 14e55e0c6c A reset compute pipeline descriptor is a fresh one: an accepted difference
MTLComputePipeline.h documents -[MTLComputePipelineDescriptor reset] as
"Restore all compute pipeline descriptor properties to their default
values", and maxTotalThreadsPerThreadgroup as "If it is not set,
returns zero". The runtime's reset is ComputePipelineDescriptor::new,
every field at its default. Metal's reset on the M3 Max (macOS 27.0.1)
keeps threadGroupSizeIsMultipleOfThreadExecutionWidth,
maxTotalThreadsPerThreadgroup and requiredThreadsPerThreadgroup as the
program set them (true, 96 and 8 by 6 by 2 in compute-descriptor-reset),
while the tile and mesh descriptors' resets restore every field on the
same machine. The owner's decision: the header's contract is Metal's,
and the compute descriptor's kept fields read as one release's defect.

docs/API.md section 10 (Kernels) states it. compute-descriptor-reset
loosens its five thread-shape sites to the runtime's default alone
(AnyOf the default, so Metal's kept value is still a divergence),
justified by that entry, and its five known-gaps rows go. A module test
holds the entry, the five paths and the defaults; the other two shapes
loosen nothing. CONFORMANCE-COVERAGE.md regenerated.

Verified: the conformance suite and clippy run on this branch next.
(cherry picked from commit 3dbd14b8fa45f6fcb836603b32aace527d009c0e)
2026-11-07 05:47:31 -08:00
Anees Iqbal 924f46aac7 use_host_ram and HOWTO: the no-source case and the dma-buf route in one statement
flakes's landing (bc13149480) documented a RAM of shared memory on a
device that refuses shared pointers (RADV) as imported nowhere with no
dma-buf source; this branch documented the dma-buf route. The doc of
use_host_ram now says both together: with a source such a RAM's chunks
go as dma-bufs, with none it is taken but imports no chunk and each
object over it is refused. HOWTO's chunk bullet says the same.

flakes's test a_ram_of_shared_memory_a_device_refuses_imports_no_chunk_
and_refuses_its_objects now also reads this branch's counters: the
chunk's pointer import refused (host_ram_pointer_imports_failed >= 1)
and no dma-buf import (host_ram_dma_buf_imports == 0), printed as a
HOST-RAM line. Its insertion had left the doc comment of
an_object_made_while_its_imported_chunk_is_looked_at_is_bound_in_the_
chunk above it; that doc goes back to its test.

Verified: cargo fmt; the RADV run follows as a potluck job.
(cherry picked from commit 1534099c85ec27c7c2d8f2e1b48047c1026d568d)
2026-11-07 05:45:54 -08:00
Anees Iqbal ba7ed4d150 Bless the API signatures and regenerate the refusal surface for the submission checks and HostRam's dma-bufs
Removed: DriverFact::PointerImportsFollowTheirAddress and
DriverFact::SubmissionsWithoutSignalsMerge (in metal2vulkan::device and the runtime's
re-export). New: HostRam::with_dma_buf, Device::pointer_imports_follow_their_address, the
doc(hidden) Device::submissions_merge, fresh_pages_pay, settle_submit_checks and
submit_check_report, and WorkCounts submit_checks_run, submit_checks_recalled,
submit_check_calls, host_ram_dma_buf_imports and host_ram_pointer_imports_failed.
REFUSALS.md: Problem::DmaBuf gains its site in ram_span_as_dma_buf.

Verified: scripts/api-signatures/signatures.py --bless and
scripts/refusal-surface/refusal_surface.py (both read source only).

(cherry picked from commit 027b38e988e93373d58a26b388d0989a98809b33)
2026-11-07 05:45:53 -08:00
Anees Iqbal 718f6543b4 HostRam: chunks imported as dma-bufs where held pointer imports tax every submission
reims measured raw Vulkan on the Radeon 780M: each live host-pointer import adds about
0.75 us plus 0.33 us per MiB to every vkQueueSubmit (amdgpu gets every page of a userptr
again in each CS), each dma-buf about 0.44 us with no per-page cost. A guest RAM imported
in 64 MiB pointer chunks would cost RADV about 24 us per chunk per submission, and RADV
refuses the pointer of any shared mapping (a memfd's) anyway, so the consumer imports
13-135 region blocks and its IOSurfaces one dma-buf each there.

- `HostRam::with_dma_buf(source)` (new public method) gives the RAM a DmaBufSource. Each
  import of the RAM, a chunk or an object's run imported alone, is then one dma-buf of its
  pages where the device's submission checks found a held pointer import taxing every
  submission (the ImportTax verdict; the pointer where that import fails), and elsewhere
  the pointer first, the dma-buf where the pointer is refused. The decision reads the
  device's measured verdict or the driver's refusal, never its identity: NVIDIA, ANV and
  MoltenVK (untaxed) keep the pointer path unchanged. `use_host_ram` waits (at most 10 s)
  for the checks first when the RAM has a source.
- A buffer bound in a dma-buf chunk is made for DMA_BUF_EXT memory
  (VUID-vkBindBufferMemory-memory-02985; `host_buffer` takes the handle type). Its
  placement lends the chunk's imports, so textures over it take the dma-buf image route
  (an image over a dma-buf of their own pages from the RAM's source), asked at the RAM's
  addresses (`Placement::dma_buf_address`: the caller's view may differ from the RAM's).
  A rebind into such a chunk makes the heap's and in-place images again as a rebind onto
  the caller's dma-bufs does. `host_backing` reports such a buffer InHostRam; its
  deallocator goes at once (it frees no memory of its own); the chunk's RAM keep-alive
  goes after the chunk's dma-buf import is freed.
- Counted: WorkCounts::host_ram_dma_buf_imports (new field).

Also in this commit, for the submission checks of 363fa41176: the docs that named the
removed DriverFact rows (PointerImportsFollowTheirAddress, SubmissionsWithoutSignalsMerge)
name the device checks (FAST-PATHS grouping row and known gaps, HOWTO, fresh_pages.rs,
buffer.rs, buffer_descriptor.rs, host_memory.rs, work_counts.rs); fresh_pages.rs and
FAST-PATHS give the measured reason for the tax gate (one 64 MiB fresh-page buffer: a
commit's p50 10.7 -> 36.6 us on the 780M, 14.7 -> 164.7 us on the RX 550,
submit_per_fresh_page_buffer at 27b9b13bcd); the checks' 10 s answer wait is one constant
(submit_check::ANSWER_WAIT) shared with the in-place check; and the recall test's
failure names the record, where it lies, the cache's rejected/failed reads and both
identities (it failed on lavapipe, msi-laptop, m3-max-3160: no device recalled the record
in 60 s; the cause is not known yet).

Verified: cargo fmt only; compiled and tested in the following jobs.
(cherry picked from commit fa8c27f1549fe09d769847ef63f8e34d51f2c6af)
2026-11-07 05:45:53 -08:00
Anees Iqbal f8ca661520 Conformance ledger: the RTX 5080's held sRGB reads, and its BGR10A2 held write runs
The 5080 replay at 3e5ef48250 (b5080 entry replay-r4-nv-043226, whole
suite, 1228 verdicts) reported three ledger mismatches beyond the 20
known ycbcr gather and minify sites:

- read-write-tier-held diverges at BGRA8Unorm_sRGB and RGBA8Unorm_sRGB
  (192 elements, largest 64919). The 5080 stores neither sRGB format,
  so the heap views a held texture through its UNORM alias and the
  function decodes by the MSL transfer through the device's Pow, as on
  lavapipe; srgb-texel-decode is announced for the case. Two rows, in
  the sRGB decode section, whose header now names both venues and the
  held alias read.
- norm-storage-fields-bgr10a2unorm no longer refuses hsw_held/dispatch
  on the 5080 (the heap's storage aliases, f4c1fbd170): its row goes.

The held BGR10A2Unorm texels match Metal on the 5080 (no row), and so
do the RGB9E5 attribute reads: the one RGB9E5 site left,
attribute-format-fetches' attribute3/Half2, is the listed half NaN
quieting of another attribute.

Verified: the replay output above; coverage regenerated with
scripts/conformance-coverage/coverage.py. Not verified: a 5080 replay
at this commit.

(cherry picked from commit e127ed348db352da2a4a4fa97fecd8f836ea867f)
2026-11-07 05:40:03 -08:00
Anees Iqbal 25b6686318 Regenerate CONFORMANCE-COVERAGE.md for the host-scoped lavapipe rows
bc3e17852b split five ledger rows by host (2619 to 2625 rows), which
conformance_coverage::the_conformance_coverage_document_is_what_the_sources_derive
caught (potluck job m3-max-3361). Regenerated with
scripts/conformance-coverage/coverage.py.

(cherry picked from commit a348cf1f29cacd026d796a2ecadae48fc70c8384)
2026-11-07 05:40:03 -08:00
Anees Iqbal 85685b7941 Link a visible-function reference to a definition of another type by position
A pipeline refused a linked function whose definition's type differed from
the reference's (InvalidDescriptor(LinkedFunction { problem: Signature })).
Metal makes those pipelines and passes the arguments by position: MPS's
reduce_stitched declares float reductionStitched::write_fn([8 x i8], float,
float), and the stitcher defines write_fn as float([8 x i8], float), which is
how Geekbench's Background Blur and Face Tracking failed on the consumer.

What Metal does was measured with the probe linked_function_signatures.m
(m3-max-3238, M3 Max, macOS 27.0.1) and the consumer's probes (m3-max-3228,
Radeon Pro 5300M and UHD 630, macOS 26.7.1): every pipeline is made; an
extra trailing argument is dropped (5 on all three); a missing trailing
parameter reads 0 (all three); a same-width plain value is reinterpreted
bit for bit, arguments and results alike (all three); another width is
undefined on the M3 and the 630 and the low bits on the 5300M; a pointer for
a value, a value for a pointer, another address space and an aggregate of
another type are undefined on the M3.

Now a stub whose type differs from its definition's resolves to an adapter
(canon/adapt.rs): an internal function of the stub's type that calls the
definition with the arguments by position, which inlining takes. Dropped
trailing arguments, zero for missing parameters, bitcast at one width, low
bits or zero-filled bits at another (scalars and vectors of int and float, a
bool as one bit, widths up to 64 bits), the result likewise, zero from a void
definition, dropped by a void reference. Anything else (pointer/value,
address space, aggregate of another type, vararg, isomorphic structs of other
identity) is Unsupported(Linking, not implemented) at a surviving call, where
it was an InvalidRequest that claimed Metal refuses it. Stub::Resolved keeps
the definition (the linked function, for the call-stack model) apart from the
function its calls call. The import pairs the definition's type with the
reference's by position, so a definition of another arity still takes the
reference's identified structs.

LinkProblem::Signature had no producer left and is removed (a public
variant of metal2vulkan-air, re-exported by metal2vulkan; api_signatures.tsv
re-blessed). SEMANTICS_VERSION 1976 -> 1977: refused inputs now translate.
docs/API.md section 3 states the contract and section 10 the choices where
Metal's answer is undefined and the refused shapes; REFUSALS.md regenerated
(unchanged).

Tests: link_tests (extra arguments, missing parameters, one-width bits,
other widths, void results, the refused shapes), engine_linking's renamed
linked_scale now links and computes, error/tests maps another LinkProblem.

(cherry picked from commit 493bc2dabe979e2280aea2d3fcbf5d17e2446f28)
2026-11-07 05:19:22 -08:00
Anees Iqbal bc13149480 HostRam tests: fresh RAM a device imports; shared RAM a device refuses imports no chunk
On RADV (a Radeon 780M, Mesa 26.2.6) 8 of the 19 host_ram_device tests failed every run: every
test over fresh_ram, a memfd mapped shared as QEMU's memory-backend-memfd,share=on RAM is. RADV
imports a pointer through amdgpu's userptr, which takes private anonymous pages alone, so it
refuses those pages (Device::imports_shared_host_pointers answers false there): the device's
thread imported no chunk ("one chunk from the RAM's start", left 0), and a no-copy buffer over
the RAM was refused, Unsupported(HostMemory, NotRepresentable) (diagnosed on homelab-um870-1,
potluck jobs m3-max-2986, 3083 and 3119). The runtime's answer is the right one with no dma-buf
source; the tests asked RADV for RAM it cannot import.

fresh_ram now takes the device and maps the memory it imports: the memfd mapped shared where
imports_shared_host_pointers answers true (NVIDIA, lavapipe, MoltenVK), else private anonymous
memory, as QEMU's memory-backend-ram RAM is, both never touched and advised for huge pages.
ahead_device asks the probe once up front, so no test's counts or allocation limit meet its
one-page import. A new test pins the no-source case where the device refuses shared pointers:
a_ram_of_shared_memory_a_device_refuses_imports_no_chunk_and_refuses_its_objects makes the
memfd RAM, uses it, and expects the buffer over it refused (Unsupported, HostMemory), no chunk
imported or live, and the RAM's keep-alive dropped after the use; elsewhere it says so and
passes. use_host_ram's docs and HOWTO state that no-source case.

(cherry picked from commit 48202da5ba0c0cb7f49d0a630e59efd11c5918f7)
2026-11-07 05:09:36 -08:00
Anees Iqbal 99c195f869 Conformance ledger: lavapipe's held read-write rows follow the heap's alias views
f4c1fbd170 lets the heap view a held RGBA8Unorm_sRGB, BGRA8Unorm_sRGB or
BGR10A2Unorm read-write texture through its storage alias. On lavapipe
(CachyOS, LLVM 23.1.4, 256 bits, job m3-max-3206 on homelab-gem10-1)
read-write-tier-held's three `beyond` rows now dispatch, and their
read-back, status, stored and stored-bytes sites are exact; only texels
differ, by the device's own answers:

- BGR10A2Unorm: 10 elements one f32 ulp low (Metal 0x3E48320D, ours
  0x3E48320C), the device's reciprocal product, device-texel-conversion,
  as the slot path's row of read-write-tier-round-trip-float says;
- the two sRGB formats: 219 elements, the largest difference 64921 bits,
  the MSL transfer through the device's Pow where Metal takes its
  twelve-bit table (Metal 0x3BB80B81 = 23/4095, ours 0x3BB7AD6D, the
  transfer of code 17), srgb-texel-decode, which the runtime announced for
  the case in that run, as did device-pack-conversion.

So the 18 refused and only-Metal llvmpipe rows go and three native-answer
rows take their place, and norm-storage-fields-bgr10a2unorm's llvmpipe
refusal at case/hsw_held/dispatch (the same heap write, refused the same
way) goes: that site now dispatches. The NVIDIA rows wait for a 5080 run.

The engine_heap_binder table test now allows FLAG_RED_BLUE and checks it
is set on the BGRA8Unorm member alone (it failed at f4c1fbd170: "other
flags are reserved", left 4). read-write-tier-held's allowance comment
says when unnamed-texture-unviewable fires now. CONFORMANCE-COVERAGE.md
regenerated.

Verified at f4c1fbd170 (the binary of this commit differs only in the
ledger and that test): 317 of 318 selected metal2vulkan tests passed, the
one failure the table test fixed here; the replay's unlisted and stale
sites for these rows are the ones this commit lists and removes.

(cherry picked from commit 3e5ef48250375a08ec2f9eadccae7a83481add6b)
2026-11-07 04:56:07 -08:00
Anees Iqbal 3d5bb02ba0 Hold sRGB and blue-first read-write textures in an argument buffer
Metal reads and writes an RGBA8Unorm_sRGB, BGRA8Unorm_sRGB or
BGR10A2Unorm texture through access::read_write, and through an argument
buffer too (read-write-tier-held's `beyond` rows). The heap binder
refused such a member's storage element, NotImplemented
(ArgumentBufferTextures), wherever its storage choice was an alias:
lavapipe and NVIDIA store no 8-bit sRGB format and no A2R10G10B10, so
the dispatch's bind state was refused there, where a slot of the same
texture converts in the shader through the alias.

The heap now does what the slot does, keyed by what the handle carries:

- bind::heap::storage_conversions(profile) lists, per texel class index
  and red-blue order, the formats whose heap storage choice is an alias a
  function converts by (SwizzleBgra, SrgbEncode, SrgbEncodeBgra), one
  class per key; a key whose formats choose otherwise converts nothing.
  The binder views a member of such a choice through its alias (which its
  image lists among its view formats) instead of refusing it; another
  alias (RGB9E5Float's word, ARGB8's rotation, an RGBX format) and a
  swizzle that loses the class are still refused.
- A blue-first format shares its texel class with its red-first kin
  (BGR10A2Unorm with RGB10A2Unorm), so the handle-table entry gains
  FLAG_RED_BLUE (bit 2, metal::format::red_blue_exchanged: BGRA8Unorm,
  BGRA8Unorm_sRGB, BGR10A2Unorm), carried in handle bit 30 by a new
  Lookup::Flagged field where a module converts.
- lower::texture::heap_storage_conversions gives a heap storage read or
  write of a float or half texel the same list; emit::heap_converted
  exchanges red and blue and decodes or encodes the sRGB codes where the
  handle's key is listed, as from_image and to_image do for the slot
  classes. A read's decode notes SrgbTexelDecode and a write's encode
  DevicePackConversion, the slot's notes (rule 1: the device's own
  transfer), recorded outright as other heap accesses' are. On the M3
  Max's MoltenVK, which stores each of these formats itself, the list is
  empty: no conversion, no new note.

Tests: the binder's storage-member test now expects the aliased view
(lavapipe's three formats) and a refusal for the rest; a new test pins
lavapipe's and the M3's conversion lists; metal::format's new test ties
red_blue_exchanged to every committed profile's red-blue choices; the
search's host model and masks cover the new carried bit; an engine test
checks the notes and the carried bit on lavapipe and their absence on the
M3. SEMANTICS_VERSION 1978. docs/API.md's two note entries name the
argument-buffer form.

Verification: Linux unit tests and lavapipe and 5080 replays of
read-write-tier-held follow this commit (sent with the tip).

(cherry picked from commit f4c1fbd1702877f44060593d006dc3372838a112)
2026-11-07 04:56:07 -08:00
Anees Iqbal e9b236a978 Pull a FloatRGB9E5 vertex attribute on every device
Lavapipe reports VERTEX_BUFFER for E5B9G9R9_UFLOAT_PACK32, so a
FloatRGB9E5 attribute went to fixed-function input there, and lavapipe
answered 0 in the fourth component (Metal and Vulkan both say 1) and
other values in the first three: vertex-format-float4 and -half4
differed in 32 (LLVM 21.1.8) or 38 (LLVM 23.1) elements by up to 65409,
and vertex-format-instance-step in its 12 fourth components.

The decision is now structural, made from the format, not the driver:
fetch_as pulls the shared-exponent format on every profile
(fixed_function_format). Vulkan requires no device to fetch it as vertex
input (Table 95, "Mandatory Format Support: 64-bit/uneven Components",
lists only sampled-image features for it), and its decode has no rounding
to leave to the device: each component m * 2^(e - 24) is an f32 and the
fourth is 1. So the module's own decode (lower::stage_io::fetch) gives
the answer a conformant fixed-function fetch gives, and lavapipe gives it
too. FloatRG11B10, the other packed float, stays fixed function: its NaN
widening is the device's.

The vertex-format sweeps now compile two modules where they compiled one
(the pulled format's), and the engine tests say so. SEMANTICS_VERSION
1977: a FloatRGB9E5 attribute's projection and module change. The three
RGB9E5 rows of known-gaps.tsv go (vertex-format-float4 and -half4 on
LLVM 21.1.8, -instance-step on llvmpipe); the LLVM 23.1 pair went in
613a98e22d. docs/API.md's vertex_input entry says it.

Verification: in the commit after this (Linux unit tests, lavapipe
replays on CachyOS LLVM 23.1.4, LLVM 23.1.1 and Ubuntu LLVM 21.1.8, the
5080 and the M3 Max).

(cherry picked from commit 6f2a6f3572b130db513bf457a9daf365ea241951)
2026-11-07 04:56:07 -08:00
Anees Iqbal 8623866704 Conformance ledger: unlist two product bugs this stream's rows recorded
A ledger row is right only where the divergence is the device's native answer (owner, 11-07:
"If its a failure, fix it. Dont sweep it under the rug"). Two sets of rows this stream wrote
record product bugs instead, so they go, and the bugs go back to the orchestrator:

- read-write-tier-held on the RTX 5080 (18 rows): we refuse the dispatch's bind state,
  `Unsupported(ArgumentBufferTextures, NotImplemented)`, for a read-write texture of a `beyond`
  format (`RGBA8Unorm_sRGB`, `BGRA8Unorm_sRGB`, `BGR10A2Unorm`) held in an argument buffer, which
  Metal round-trips. Runtime and translator work (a held read-write texture whose format the heap
  array cannot view).
- vertex-format-float4 and -half4's `FloatRGB9E5` attribute on lavapipe LLVM 23.1 (2 rows): the
  format reaches fixed-function vertex input as `E5B9G9R9_UFLOAT_PACK32`, and lavapipe answers 0
  for the missing fourth component (Metal 1.0) and decodes other elements wrongly; translator work
  (pull the fetch, or fill the component after the load).

The sites read as unlisted on those venues until the bugs are fixed. The same bugs' older rows
(lavapipe's read-write-tier-held, the "llvmpipe" and "LLVM 21.1.8" RGB9E5 rows) were not this
stream's and are handed back with them rather than removed here.

Verified: only those 20 rows are removed; docs/CONFORMANCE-COVERAGE.md regenerated.
(cherry picked from commit 613a98e22de81f35fb926228fc4534ddcd7e848b)
2026-11-07 04:56:07 -08:00
Anees Iqbal 25a0afe356 Conformance: rgb10a2-srgb's sample cases declare the decoded-tap filter's note
rgb10a2-srgb-samples-{nearest,linear}-{f,h} sample `RGB10A2Unorm_sRGB`, which no Vulkan format
holds, through a runtime sampler. The module does not know the slot's state, so it holds the
linear filter of the decoded taps whatever the slot's filter, and records that filter's sum as
the device's arithmetic (`lower::sampler::select`: a filtered access of a decoded form records
`PrecisionNote::BicubicFilterArithmetic` unless its sampler is a constant nearest one). Every
venue run announces `bicubic-filter-arithmetic` for the four cases (the M3 Max's ledger rows, the
RTX 5080 and both 256-bit lavapipe replays), and the cases declared it nowhere, so each read as an
undeclared notice: a test artifact. two_plane_samples declares the same note for the same reason.

The cases now declare it (a notice declaration: it loosens the notices site alone, so every
sample still compares exactly), and the M3 Max's four case/notices rows, which only restated it,
are removed. The module doc no longer says the cases carry no allowance.

docs/CONFORMANCE-COVERAGE.md regenerated: the ledger-row count goes from 2662 to 2658 and nothing
else moves, so the count development carries is the one its sources derive.

Verified by the replays that follow on the M3 Max (MoltenVK), lavapipe and the RTX 3090.

(cherry picked from commit ac79ff3f6a158bdb86a51b291c992436208005e5)
2026-11-07 04:56:06 -08:00
Anees Iqbal e1c3821e23 Announce DevicePointSize only at a draw that rasterizes points
What: `PrecisionNote::DevicePointSize` (a vertex function's `[[point_size]]`, or a mesh
function's `set_point_size`, on a device whose `pointSizeRange` ends below Metal's 511
pixels: ANV 255, lavapipe 256) was announced by `Device::degrade_stages` at the variant's
making and at every bind, whatever the draw's primitive. A point size sizes points alone:
Metal has no point fill mode, and Vulkan reads `PointSize` only where it rasterizes points,
so a triangle or line draw of such a state is Metal's exactly. reims's
`gpu::encode_render` many_passes tests on ANV (Iris Xe) draw only triangles through a
vertex function writing `psize [[point_size]] = 1.0`, and died in strict mode at
drawPrimitives on this false notice.

How: `degrade_stages` skips the note, as it skips `ArgumentPixelSamplerScaling`, and
`Device::degrade_point_size` announces it from a draw's settings
(`ShapeInputs::settings`, the place `UnsizedPoints` is announced, so an execution's
command announces it where the runtime records it) where the draw rasterizes points: a
`POINT_LIST` draw, or a mesh draw whose mesh function outputs points
(`GraphicsState::mesh_corners == Some(1)`), without rasterizer discard. The draw shape
memo keeps it as it keeps every settings notice (announced once, or at every draw on a
device that announces the kind at each occurrence, through `EachWatch`).

The conformance allowances that hid it are narrowed to the cases that draw points:
render-draw-forms declares `device-point-size` from its rows (points and empty draw
points; triangles and lines do not), with a module test that the declaration follows the
rows; sample-positions (triangles only) drops it; topology-class declares it for the
point-size function's point draws; primitive-type-crossings keeps it for its `Point`
cells, its comment saying so. The validation lane's `making_kinds` mirrors the runtime.
docs/API.md's catalogue entry says where it is announced.

Test: `tests::point_size_notices` draws a point-size state as triangles, lines, strips
and points on a device that announces the kind at every occurrence, and asserts the
creation and every non-point draw announce nothing and each point draw announces it once
where the device's largest point is below 511 (none where it is not).

(cherry picked from commit db5a2306aceeb4f9994002e68ff6b2ac3fea0813)
2026-11-07 04:26:25 -08:00
Anees Iqbal 0fe90ba3d4 Leave rgb10a2-srgb-samples' unclassified notice site unlisted off the M3 Max
rgb10a2-srgb-samples-{nearest,linear}-{f,h} announce `bicubic-filter-arithmetic`, which the
cases declare nowhere, on the RTX 5080 and both 256-bit lavapipe venues. The rows the two
earlier commits gave that site reused the M3 Max's text, which describes the format's value
conversions and says nothing of the notice; whether the cases should declare it or the note is
recorded wider than their accesses is not established, so the site stays unlisted there.

Verified: the 8 rows removed are the only rows of those cases' case/notices site outside the M3
Max; docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit e28a9842627a2b1c0291c488ec0e317cb17659ba)
2026-11-07 02:59:46 -08:00
Anees Iqbal 231972d92e Cite only the notes each venue's run announced in the new ledger rows
The fix2 replays print, for each failing row, the native notes its own run announced. Read
against them, 36 of the new rows cited a note the case did not announce on that venue:

- fetch-ordered-*-srgb on the RTX 5080 holds the attachment in the interlocked storage form, so
  its conversions are the module's (`device-pack-conversion`), not `srgb-texel-decode` and
  `device-color-conversion`; the row says so and leaves the per-write bound open;
- half-write-nans-*16f on the 5080 announces `native-nan-encoding`, not `device-nan-encoding`;
- integer-vertex-attributes cited `device-vertex-conversion`, which covers normalized fields only;
- vertex-format-half4's narrow-float NaN rows on the 5080 are `native-half-conversion` and
  `native-nan-encoding`;
- half-texel-nans-rg11b10f's rows on the 5080 and both 256-bit lavapipe venues cited
  `device-texel-conversion`, which none announced.

Verified: every note a 5080, LLVM 23.1.1 or LLVM 21.1.8 row cites that is one of
`replay::NATIVE_NOTES` is in that case's announced list in the venue's fix2 replay, but the
xr-gamut and xr-masked rows, which name each of the two blend-source notes for its own fill kind.

(cherry picked from commit 1f14597553913a62fbbce2c462577b25b0fd2a03)
2026-11-07 02:59:40 -08:00
Anees Iqbal a988acb096 Hand a mipmapped sampler a minLod past every last level, not FLT_MAX
Metal's lodMinClamp of FLT_MAX reads a texture's last level. The translator handed it to the
device as minLod itself, and lavapipe on x86-64 (CI's Ubuntu 26.04 Mesa 26.0.8 and msi's 26.2.4,
both 256 bits) reads that sampler at level 0: sampler-mip-nearest and sampler-mip-linear's
clamp-float-max sites answer 1.0 (level 0) where Metal answers 2001 (level 2), 16 elements each.

Vulkan clamps the level into [minLod, maxLod] and then to the view's last level, so every bound at
or past LAST_WORD_LEVEL (15, past every Metal texture's last level, 14) reads the same level. A
mipmapped sampler's minLod is now its lodMinClamp clamped into [0, 15] (`mipmapped_min_lod`); a
bound up to 15 is handed as before, and maxLod stays the descriptor's (never below minLod).
Nothing keys on a device: the bound is exact on every one.

SEMANTICS_VERSION 1973 -> 1974: a sampler descriptor's minLod changes for lodMinClamp above 15.
docs/API.md's device-sampling entry says the bound is handed as 15.

metal/sampler.rs is one of the runtime-sources pin's inputs, so the pin moves with this commit
(RUNTIME_VERSION and the pin are left to the landing).

Verified: `a_mipmapped_samplers_min_lod_is_held_past_every_last_level` fails without the change
(minLod f32::MAX, not 15) and checks every view of 1 to 15 levels reads Metal's clamped level under
the handed bounds; the venue replay is the lavapipe evidence.

Landed with SEMANTICS_VERSION 1976: the branch took 1974, which stack 37 and the heap YCbCr notes
(1975) had already taken.

(cherry picked from commit bdb7efa414f579579e73c33d8f82fd7b312a61c6)
2026-11-07 02:59:40 -08:00
Anees Iqbal b739f0a49a Scope the lavapipe ledger rows by LLVM and vector width
The generic "llvmpipe" rows were measured on the arm64 container's lavapipe (LLVM 21.1.8, 128
bits). CI's Ubuntu 26.04 lavapipe (amd64, LLVM 21.1.8, 256 bits) and msi's (LLVM 23.1.1, 256 bits)
answer otherwise at 79 of their sites, and 253 sites no lavapipe row named:

- a row a 256-bit venue no longer holds is re-scoped to the venues it does hold ("128 bits",
  "LLVM 21.1.8"), and each 256-bit answer gets its own row ("256 bits" where both 256-bit venues
  answer alike, else per LLVM). A row whose text states no number the new answer moves keeps its
  text; the rest get texts from that venue's first differing element: the half NaN families (the
  quiet bit set and the payload kept at 256 bits, a sign and payload, LLVM 23.1.1 dropping the
  half round trip), norm-storage-codes (the 128-bit text plus the case's NaN of each sign, which
  the two sides store at opposite ends of the format; Vulkan leaves a NaN's conversion
  unspecified), 3D samples on LLVM 23.1.1, and the RGB9E5 attribute row's counts;
- the extended-range, padded 10-bit, sRGB 10-bit, xr blend and two-plane families reuse the M3
  Max's venue-neutral texts (mechanism only, no site numbers); xr-planes alpha gets a lavapipe
  ties-to-even text; pixel-samplers-subnormal a digest-only text;
- the 14 compressed-blits-rg11b10f and -rgb9e5f rows are removed: the accepted difference
  `a-device-answers-as-the-class-of-mac-it-presents` now justifies those sites on every venue
  without lossless compression (313abb4b47).

The two sampler-mip clamp-float-max sites get no row: the next commit fixes them.

Verified: every new row is generated from the fix2 census's own paste rows at 2776dd8f06 on each
256-bit venue (site, expects and answer verbatim); a prediction against those censuses leaves 2
sites unlisted (the sampler-mip ones) and no stale row on either venue. A replay at this tree on
both venues is what proves it. docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit a1dd53b33b5676b46fdc7654de060ccc8ab0d239)
2026-11-07 02:59:24 -08:00
Anees Iqbal f98735bbdb List the RTX 5080's native-arithmetic divergences in the conformance ledger
886 rows for "NVIDIA GeForce RTX 5080 Laptop GPU", each a site the whole-suite replay on the
5080 (NVIDIA 615.71.09, exact policy, at b982d02d53) reported as divergent or refused and the
ledger did not list, each with the class it was triaged into and the note that records it:

- device NaN encodings (half NaN 0x7FFF, float 0x7FFFFFFF, small-float all ones; gathers of NaNs
  and denormals) under device-nan-encoding, native-nan-encoding, native-half-conversion and
  device-texel-conversion, whose documentation already names this device's encodings;
- BC decode against compressed-texel-decode's NVIDIA bound (covered, or past the colour bound and
  named as open, or not established for an sRGB form's decoded value);
- packed 16-bit texels widened by bit replication (device-texel-conversion's 0.18-code bound);
- 8-bit unorm stores a code apart near a tie (fragment outputs, storage writes, fills, a2c
  targets) under device-color-conversion, which states the 5080 stores 0.5 as 0x7f; each
  norm-storage-codes texel holds one value in four channels, so the largest word difference
  bounds every channel at one code;
- attributes read as half keeping the float, NVIDIA folding the conversion pair
  (native-half-conversion, DriverWorkaround::HalfConversionPairFolded);
- the nearest mip level at a halfway clamp (device-sampling states the shape);
- filters, 3D samples, pixel samplers, downscales and resolves through the device's own units,
  whose bounds are measured on lavapipe and MoltenVK and not on this device: those rows say so
  and name the bound as open;
- read-write-tier-held's refusal, the same open runtime work lavapipe's rows name.

The 80 xr rows and 191 rows reusing venue-neutral texts of the M3 Max's rows are among them.
Sites that the accepted-difference slug fix and the two shared-memory declarations remove
(fresh-*, compressed-blits-*, xr-clear-routes-*, buffer-textures-stride-below-the-row,
format-footprints-plain-stragglers) get no row. ycbcr-gathers-* and ycbcr-minify-band-* (20
digest-only sites) stay unlisted: their class is not established, and the YCbCr notes are
another stream's work.

Verified: the rows are generated from the 5080 census's own paste rows (site, expects and answer
copied verbatim), each text from the site's first differing element in that run; a replay at
this commit on the 5080 is what proves they hold. docs/CONFORMANCE-COVERAGE.md regenerated.

(cherry picked from commit 0bf9ec15eac473fa19002a218ec2978f2e7a1f0f)
2026-11-07 02:59:12 -08:00
Anees Iqbal b37276fa4c Note a heap texture's YCbCr filter where its handles and sampler can reach one that filters
What. A filtered `half` or `float` sample of a texture an argument buffer holds (a heap's) now
records `PrecisionNote::HalfSampleFilter` / `FloatSampleFilter` on a device that samples through
Metal's own sampler (MoltenVK), as a slot's sample does, under clauses the plan answers at each
draw or dispatch:
- `SpecKey::HeapYCbCrTextures(stage)`: a heap member of the command reaching the stage (a texture
  it makes resident, or binds at a texture slot of the stage) is of a two-plane YCbCr class
  (`TexelFormat::two_plane_ycbcr`);
- through an argument buffer's sampler, `SpecKey::FilteringArgumentSampler`: a listed argument
  sampler (`BindShape::argument_samplers`, every live state) has a linear min, mag or mip filter,
  anisotropy or a cubic filter; through a runtime slot, the bound word (`filtering_word`); a
  constexpr sampler that reads one texel of one level records nothing.
Only a 2D, one-layer, color, single-sample heap sample can reach a two-plane texture, so 3D, array,
depth and multisample heap samples record nothing. The plan computes both keys in `record_noted`
(which now takes the heap's stage reach), so they are a function of the bind shape: the runtime's
bound-value memo, keyed by (variant, plan, specialization), stays valid. The runtime announces a
holding heap clause as `ycbcr-filter-not-exact` (`degrade_clauses`), naming the stage.

Why. A probe on the M3 Max (MoltenVK) showed a 4:4:4 two-plane texture (identity address-mode map:
`YCBCR8_444_2P`, `YCBCR10_444_2P`, their sRGB twins, the packed 10-bit one) held by an argument
buffer and sampled linearly through a constexpr, runtime-slot or argument-buffer sampler ran and
announced nothing, where Metal's own sampler filters the kept image's float texels, not Metal's
exact filter: an under-announcement. (4:2:0, 4:2:2 and the code-reading 4:4:4 textures reached
through handles are refused, `MappedTextureSampling { through: Handles }`; a slot texture sampled
through an argument buffer's sampler is refused at translation, `ArgumentBufferTextures`.) Which
sampler state an argument buffer holds is in its memory, which no plan reads (the binder's rule:
argument samplers come from object lifetimes), so the argument-sampler test is "a live state
filters": a program whose live states are all nearest announces nothing.

SEMANTICS_VERSION 1973 -> 1974 (precision notes change for heap samples on metal-sampler
profiles); ARTIFACT_FORMAT_VERSION 489 -> 490 (two `SpecKey` variants in the codec). The golden
table does not move (no SPIR-V changes). `api_signatures.tsv` gains the two variants.
heap_linear_samples_are_the_device_s now expects the specialized note on MoltenVK 2D samples.

Verified (potluck):
- M3 Max, MoltenVK, GPU (job m3-max-2786): 64/64 lane tests (ycbcr_textures, ycbcr_in_place,
  degrade_notices, pixel_samplers, ycbcr_device_reads, argument_linear_samples), the new
  a_ycbcr_texture_through_an_argument_buffer_announces_its_filter_only_where_it_can_filter
  printing, for YCBCR8_444_2P and YCBCR10_444_2P_sRGB: constexpr linear 1, runtime nearest 0,
  runtime linear 1, argument nearest 0, argument linear 1, argument nearest with a linear state
  alive 1; RGBA16Float 0 in every case.
- lavapipe (msi, llvmpipe LLVM 23.1.1; job m3-max-2775): the same 64/64; announced only where
  the device converted the 8-bit 4:4:4 texture itself.
- M3 unit tests (jobs m3-max-2767, m3-max-2774): the new
  tests::engine_heap_binder::a_heap_texture_s_ycbcr_filter_note_holds_where_its_sampler_can_filter
  and 134 more (engine_heap_binder, engine_ycbcr_in_place, engine_handles, golden_hashes, cache),
  api_signatures/api_surface/refusal_surface 19/19, runtime tests::degradation 17/17; clippy
  plain, --cfg m2v_gpu, --cfg m2v_cpu_icd and rustdoc -D warnings clean.
- Negative controls, both failing: no heap note (the unit test, and the lane's constexpr linear
  case announcing nothing on the M3); a plan answering 1 for both keys (the unit test at
  "YCBCR84442P beside none", the lane's argument nearest case announcing on the M3).
- Release CLI on moltenvk-m3, tip against 80d2dc465f, 3 runs: tail_argument_samplers
  argument_sampler_sample 0.02 s / 25.1 MB both; handles argument_buffer_runtime_sampler 0.02 s /
  25.6 MB both; grd_half_many_samples 0.05 s / 25.9 MB both.

(cherry picked from commit 8403d3746182d6c1acf7795666fc46fea811e660)
2026-11-07 02:57:47 -08:00
Anees Iqbal ffbfb8631d Bump SEMANTICS_VERSION to 1974 and regenerate the conformance coverage at stack 37's picks
Three picked branches each moved SEMANTICS_VERSION from 1972 to 1973 on their own: runtime sampler
slots' filter notes now carry a test of the bound sampler word; an object function's barriers
are predicated so a partial object threadgroup runs as Metal's; and extended-range partial masks
and unwritten padded or bfloat attachments link. Together their outputs differ from any one
branch's at 1973, so the version moves once more. docs/CONFORMANCE-COVERAGE.md is regenerated
from the merged sources and recordings (the picks' conflicts kept the earlier text).

Verified: conformance-coverage --check, signatures.py --check and refusal_surface.py --check pass
on this tree; metal-coverage is current.
2026-11-05 21:15:23 -08:00