Commit Graph
9295 Commits
Author SHA1 Message Date
Anees Iqbal e8a3feef6b docs: CONFORMANCE-COVERAGE.md without the level-sizes-storage gap row
The ledger row went with the storage levels' form; the generated coverage document counted it.

Checked by: scripts/conformance-coverage/coverage.py --check (the conformance suite's
the_conformance_coverage_document_is_what_the_sources_derive failed on it in m3-max-70944).
2026-11-23 09:04:38 -08:00
Anees Iqbal c2919f6f36 rt test: the device with everything has the level elements' room beside the attachment reads'
the_enable_set_is_what_creation_enables_on_a_device_with_everything gives its synthetic device the
descriptor room the attachment reads need; that room now holds the storage array's 65,536 level
elements too (per-stage resources and the pools' total).

Checked by: the failure it fixes, on the Iris Xe (m3-max-70950) and the 780M under RADV and AMDVLK
(m3-max-70951), where the rest of the suite passed; the lane's next lavapipe run.
2026-11-23 09:04:38 -08:00
Anees Iqbal 9e8c74dc2f rt test: the indirect tests' Draws holds no level slots
The draws helper of tests::indirect builds a Draws literal, which the level slots' field joined.

Checked by: the lane's lavapipe job (the cpuicd build of metal2vulkan-runtime's tests failed on the
missing field in m3-max-70938).
2026-11-23 09:04:38 -08:00
Anees Iqbal ed4b0ecd76 rt: storage textures written or read at a run-time level, through runs of set 1's level elements
What: under the identity domains a storage slot written, read or size-queried at a level other
than the constant 0 indexes a run of set 1's storage-image array instead of being refused as
Unsupported{IdentityDomains} ("an encoder value the function reads as TextureLevels(S)"). The
translator pushes the bound texture's level count (PushField::TextureLevels) and the run's first
element (the new PushField::TextureLevelBase, beside it), states no StorageTextureLevels or
StorageTextureLevelViews fact, and an access at level l takes element
first + min(l, max(n, 1) - 1) of the array, NonUniform, inside l < n. A texture of one level
pushes its own index, nil 0 with count 0.

The runtime's binding 1 grows by 65,536 level elements past its 65,536 textures, 4,096 runs of 16
(floor::LEVEL_ELEMENTS, floor::LEVEL_RUN). The first dispatch or draw that binds a texture of more
than one level to such a slot (the encoder's checks, compute and render stages alike) gives it a
run: a single-level storage view of each level, of its storage element's type (a cube's level as
the 2D array of its faces, a view's from its own first level), written at the run's elements. A
later bind takes the texture's lock and pushes the same two words: no Vulkan call. The run goes
back through the pool and reaper once the texture is released and its work retired: elements null,
views destroyed (Gauges::level_elements). Every run held, or a texture of more than 16 levels, is
the new Limit::LevelElements { max: 4096 }, and the dispatch or draw does not run. The floor's
storage-image limits and both totals rise by 65,536: storage 196,608, per-stage resources 327,688,
pools 351,680; every lab device's profile is far above (llvmpipe 1,015,808 storage, the least).

SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION bump in the branch's last commit (a new PushField).

Why: 17 guest kernels in 6 libraries were refused at state creation by this form.

Docs: REFUSALS.md and the signatures table regenerated, RESOURCE-ID.md (binding 1 past 65,536),
API.md (storage levels under identity), the runtime README (Set 1, the floor table, the known-gap
line replaced by the Limit), the runtime-floor profile's limits, and the conformance ledger's
level-sizes-storage row removed.

Checked by: engine_texture_levels' identity test and the runtime's storage_levels device tests
(red at 6ad1c33124: jobs m3-max-70886 and m3-max-70892 on lavapipe), engine_identity's
a_storage_slot_written_at_a_run_time_level_is_an_element_of_its_run; the lane's jobs report the
runs per card.
2026-11-23 09:04:38 -08:00
Anees Iqbal 316d88a913 Runtime test: storage_levels' level is a u32
Its dispatch loop's level was an untyped integer, which set_bytes cannot take the bytes of
(job m3-max-70886: the runtime's test build failed).
2026-11-23 09:04:38 -08:00
Anees Iqbal 751de69af4 Tests: a storage texture written at a level read from a buffer, under the identity domains and on the runtime
Red at development 211c10a594: the identity domains refuse the write as
Unsupported{IdentityDomains} (an encoder value the function reads as TextureLevels).

- Translator: engine_texture_levels::under_the_identity_domains_a_write_at_a_run_time_level_is_lowered
  compiles txt_level_write on lavapipe and runtime-floor under the identity domains, links and validates
  it, and asserts no fact of the bound texture's levels and the slot's level count pushed.
- Runtime: tests::storage_levels, an owned kernel writing (x, y, lod, 1) at level lod of an 8 by 8
  RGBA32Float texture of four levels, lod read from its buffer: dispatches at levels 0, 1 and 2 write
  their 64, 16 and 4 texels exactly, and level 3 keeps its fill, the shape Metal wrote on an Intel Mac.
2026-11-23 09:04:38 -08:00
Anees Iqbal 17473a1a42 Player: a render encoder's residency declarations play through the runtime
The render encoder's arm played its eight residency forms (useResource:usage:,
useResources:count:usage:, useHeap:, useHeaps:count:, each with stages: or without) as nothing,
"as the runtime's render encoder has none". The runtime's RenderCommandEncoder has use_resource
and use_heap now, so they play through it as a compute encoder's do: each resource of the call,
or of its list, through use_resource with the call's usage; each heap, or each of its list,
through use_heap. The stream records each C array and its count as one list, so the usage is
argument 1, and the stages come last; the runtime's render encoder takes no stages, so they are
not read.

What each read before, and now:
- Render encoder, all eight forms: before, no argument and no runtime call; a skipped object they
  named was not counted. Now: the resource ({Buffer: object} or {Texture: object}) or heap of
  argument 0, each of a list; the usage at argument 1; a skipped object is a skipped call, each
  of a list as its own, as docs/REPLAY-STREAM.md says of skipped_calls.
- Compute encoder, the four forms: unchanged in what they read; one resolver (NewRuntime::uses)
  now serves both encoders, and heap_of, which only the compute arm called, is gone.
- The usage: before, 1, 2 or 3, any other value refused. Now MTLResourceUsage's option set of
  read (1), write (2) and sample (4), any other bit or none refused. Without the sample bit, a
  render encoder's useResource:usage: of read | sample, which played as nothing before, would
  now be refused.
- objects_named, which the unwritten count reads a render or blit encoder's call by, and which
  notes the objects a command buffer's encoders name (resource indices owed, placed buffers' and
  no-copy Managed buffers' users, tiled textures' takes): before, bare objects and lists only, so
  a residency declaration's {Buffer: object} or {Texture: object} named nothing. Now it names the
  resource too, on compute and render encoders alike.

docs/REPLAY-STREAM.md: render and compute encoders play their residency declarations through
the runtime's encoder, the stages forms as those without; the unwritten count's reaching calls
include a residency declaration's resource.

Tests: the commit before this one (red: the skipped-object device test and the unwritten test).
2026-11-23 09:02:13 -08:00
Anees Iqbal 980262d1b4 Tests: a render encoder's residency declarations play through the runtime and count as their single forms (red)
The render encoder's arm plays all eight residency forms (useResource:usage:,
useResources:count:usage:, useHeap:, useHeaps:count:, each with stages: or without) as nothing:
it reads none of their arguments, and the runtime's RenderCommandEncoder::use_resource and
use_heap are never called. So a skipped object a render encoder's declaration names is not
counted among the skipped calls, as a compute encoder's is (docs/REPLAY-STREAM.md: every call of
a skipped object, each of a list as its own). Off the device, the unwritten count reads a render
encoder's call by the objects it names (objects_named), which takes no resource map, so a buffer a
render encoder's useResource:usage: names as the stream records it ({Buffer: object}) is not
reached by it.

- rt_replay.rs (device), red: a render encoder's useResource:usage:stages: of a skipped texture
  and useResources:count:usage: listing it beside a buffer are two skipped calls, and the draw
  after them plays (skipped_calls is 0 today).
- rt_replay.rs (device), guard: the eight forms' test now also uses a texture and the usages
  read | sample (5) and read | write (3), and is renamed to say they play through the runtime.
  It passes today, as the arm reads no usage; with the arm reading the usage it holds that each
  of Metal's usage bits plays.
- tests.rs, red: a buffer a render encoder's useResource:usage:stages: or
  useResources:count:usage: names as {Buffer: object} is reached, so a later dispatch's read of it
  is not unwritten.
- tests.rs, guard: the covers test of the compute plurals runs on a render encoder's stages forms
  too; the covers rule reads them already (82d1c62eb5).
- across_planes: the skipped texture of the range test, shared with the new skipped test.
- uints and resource: their doc comments were swapped (a5d498d99c).

Not run here: no local builds; the device tests need --cfg m2v_gpu or m2v_cpu_icd.
2026-11-23 09:02:13 -08:00
Anees Iqbal 3e9cd15b0a Player: a release of an object its device's release dropped plays as nothing
Metal's objects keep their device, so a program may release its device before what it made: a
guest recording's last two calls release the device and then the host's display library made on
it. The player drops everything a device made at the device's release, and the library's release
that followed found no object and stopped the play as an invalid stream, after every frame had
played. The player now keeps the ids a device's release dropped, and the stream's own later
release of one removes it from that set and plays as nothing; the backend released it once,
with the device. Ids are never reused (docs/REPLAY-STREAM.md, section 4), so the set holds only
objects whose release may still come. A second release of such an object, or the release of an
object no call made, still stops the play.

Verified: an_object_released_after_its_device_plays_as_released_with_it and the replay tests in
the job named in the lane's report; no local build.
2026-11-23 08:59:40 -08:00
Anees Iqbal a7673582cb Tests: an object released after its device plays as released with it (red)
A guest recording's last two calls release its device and then the host's display library made
on it. In Metal every object keeps its device alive, so a program may release its device first.
The player drops everything a device made at the device's release, so the library's own release
that follows finds no object and stops the play as an invalid stream, after the last frame had
played. The test plays a device, two sampler states, the device's release and then both
states': the play ends ok, and the backend releases each state once, with the device. A second
release of a dropped object still stops the play.

Red: today the first play stops at "release of #3, made by no call".
2026-11-23 08:59:40 -08:00
Anees Iqbal 7f8df4f044 Player: compare-dumps's word walk reads each word through a function, not a closure
4027438d7d dropped the closure's copy of each word, and a closure that returns a slice of its
argument does not name that lifetime, so the crate did not compile (m3-max-71456). The word is
now read by a nested function whose signature ties the slice to the bytes.

Verified: clippy and the dump tests in the job named in the lane's report; no local build.
2026-11-23 08:53:32 -08:00
Anees Iqbal 4027438d7d Player: compare-dumps reads each dump's bytes only as it compares them
compare-dumps read every .bin file of both plays into memory before comparing any: two plays of
the 24,000 command buffers of one guest recording's first workloads dump 90 GB each, and the
compare went over an 18 GiB job's memory limit before printing a line. The listing now keeps each
dump's path, and the compare reads the two files of one dump, compares them and drops them, so it
holds two buffers at a time. Dumps that are equal byte for byte skip the word walk, which no
longer copies each word into a vector of its own either: the counts and lines it prints are the
same.

Verified: the dump tests (the compare's own among them) in the job named in the lane's report;
the measurable check is the compare's peak memory over those two 90 GB dump sets, before (over
18 GiB, killed) and after, in the job named in the lane's report. No local build.
2026-11-23 08:49:19 -08:00
Anees Iqbal 15af4d5de0 Player: --dump-command-buffers takes a list of ranges and single ids
A play that should dump only the command buffers holding a changed kernel's dispatches had to
dump every command buffer between the first and the last of them: on a recording whose workloads
interleave, tens of gigabytes the compare then reads for nothing. The option now takes LIST:
FIRST..LAST ranges (both ends held) and single ids, joined by commas, in any order
(CommandBufferList, in dumps.rs beside the dumps it selects). Ranges that overlap or touch are
merged and a lookup is one ordered-map search, so a list of thousands of command buffers costs
the play nothing per call. A single FIRST..LAST range reads as before; anything else stops the
play before it starts, as a bad range did.

Before: the dump test helper passed 20..=29 as a RangeInclusive, the only form there was.
Verified: the red tests from the previous commit (a_dump_list_holds_its_ranges_and_ids_and_
nothing_between, a_play_dumps_the_listed_command_buffers_alone) run in the job named in the
lane's report; no local build.
2026-11-23 08:48:02 -08:00
Anees Iqbal f96b637291 Tests: a dump list of ranges and single ids, and a play that dumps the listed command buffers alone (red)
--dump-command-buffers takes one FIRST..LAST range today, so a play that should dump only the
command buffers holding a changed kernel's dispatches dumps every command buffer between the first
and the last of them. These tests name the list form: CommandBufferList::parse reads FIRST..LAST
ranges and single ids joined by commas and refuses anything else, and a play of command buffers 20,
22 and 24 with the list 20,24..24 dumps 20's and 24's buffers and not 22's.

Red: CommandBufferList does not exist yet and Player::dumping takes a RangeInclusive, so the
crate's tests do not compile until the next commit.
2026-11-23 08:45:35 -08:00
Anees Iqbal 340cbf5591 Docs: HalfTexelConversion's recorded bound names the driver that keeps a 32-bit texel past 65504 at 65504
What: the half-texel-conversion note's recorded bound (PrecisionNote::HalfTexelConversion's doc and
docs/API.md's catalogue entry) now states both answers past +-65504 for a 32-bit float texel read into
`half`. Metal saturates a sample and takes a read to the infinity. The device's rounding takes both to the
infinity. AMD's open Linux driver (AMDVLK 2025.Q2.1, Radeon 780M) keeps both at +-65504, against the 16-bit
float controls the entry declares. Documentation only: no module, refusal or note changes.

Why: under AMDVLK, half-texel-nans-r32f/rg32f/rgba32f's read() sites answered 0x7bff for the largest finite
float texel where Metal answers 0x7c00 (42, 85 and 171 elements a site). The note's text named only the
mirror case (RADV's infinity where Metal saturates a sample), so the static note did not cover what that
driver answers.

How verified (gem10's Radeon 780M; probe branch steelbrain/amdvlkconf-probe, never lands):
- m3-max-71424, built on 7024d568df: every differing element of the four half-texel-nans cases under RADV
  and AMDVLK, read one by one.
  - Under AMDVLK every element is a NaN-encoding difference except the largest-float texel's: read 0x7bff
    against Metal 0x7c00, and the nearest sample 0x7bff equal to Metal's.
  - Under RADV every element is a NaN-encoding difference except that texel's nearest sample: 0x7c00
    against Metal 0x7bff, the case the note already named.
  - The kernels are byte-identical under both drivers. Both declare RoundingModeRTE, DenormPreserve and
    SignedZeroInfNanPreserve for 16 bits, and OpImageFetch -> OpFConvert half carries NoContraction.
- m3-max-71434: a standalone 4x4 repro (our own SPIR-V and C).
  - Under AMDVLK, OpFConvert to half of 65536, 70000 and FLT_MAX gives 0x7c00 from a storage buffer and
    from an R32_SFLOAT texel buffer, but 0x7bff from an R32_SFLOAT 2D image fetch.
  - RADV gives 0x7c00 in every form, and 65519 gives 0x7bff in every form.
  - The Vulkan spec makes OpFConvert correctly rounded, by IEEE 754 roundTiesToEven under RoundingModeRTE,
    so the driver's 2D-image form is its own deviation. A draft report is staged for the owner.
- The old runtime's modules cannot change: this commit touches doc text only.
2026-11-23 08:36:11 -08:00
Anees Iqbal 82d1c62eb5 Player: the plural residency declarations play and count as their single forms
A compute encoder's useResources:count:usage: and useHeaps:count: were refused ("not played on a
compute encoder"), so a play stopped at the first one; a guest recording on the Iris Xe stopped
at frame 290 of 430 there. They play now as Metal defines them: each resource of the list as
useResource:usage: with the call's usage, through the runtime's use_resource, and each heap of
the list as useHeap:, through use_heap. The stream records each C array and its count as one
list (docs/REPLAY-STREAM.md), so the usage is argument 1.

What each read before:
- The compute encoder read useResource:usage: alone (its resource as {Buffer: object} or
  {Texture: object}, the usage at argument 1) and refused both plurals.
- The covers rule and the unwritten count read useResource:usage:'s resource with as_object,
  which takes only a bare object, so a recorded {Buffer: object} wrote and uncovered nothing in
  them; both plurals fell through as calls that only name objects. They read the resource now as
  the stream records it (Value::as_resource), and each resource or heap of a plural as its single
  form.
- The render encoder reads none of its residency declarations' arguments (it plays them all as
  nothing), so it read no usage wrongly.

The player's resolvers gain held (a resource value) and block_of (a heap id), which resource and
heap_of now call. docs/REPLAY-STREAM.md says compute encoders play the four forms through the
runtime and that the unwritten count, the skipped calls and the covers rule read the plurals as
their single forms.

Tests (the two commits before this): the device test of a compute encoder's four forms, the
unwritten test of the plural and of the singular on the format, and the covers test of the
plurals. Not run here: no local builds; to be checked on development.
2026-11-23 08:21:07 -08:00
Anees Iqbal a5d498d99c Tests: residency declarations name their resources as the stream records them (red)
docs/REPLAY-STREAM.md records a resource argument as the map {Buffer: object} or
{Texture: object}, and a C array of them with its count as one list of such maps. The residency
tests passed bare objects: the unwritten test's useResource:usage:, the render residency test's
four resource forms, and the new compute and covers tests. The compute encoder reads its
useResource:usage: argument as the map already. The covers rule and the unwritten count read it
with as_object, which takes only a bare object, so a real recording's useResource:usage: wrote
and uncovered nothing in them. On the format, the unwritten test's useResource:usage: is red
too, beside the plural tests. Heaps stay bare objects (useHeap: takes an id<MTLHeap>, not a
resource).
2026-11-23 08:19:27 -08:00
Anees Iqbal 060482f654 Tests: the plural residency declarations play and count as their single forms (red)
A compute encoder's useResources:count:usage: and useHeaps:count: are refused today ("not played
on a compute encoder"): the player plays only the single forms through the runtime. Off the
device, the unwritten count and the covers rule read only useResource:usage: and useHeap:, so a
plural use with write usage neither writes nor uncovers what it names, and a plural heap use
binds nothing.

- rt_replay.rs (device): a compute encoder's useResource:usage:, useResources:count:usage:,
  useHeap: and useHeaps:count: before a dispatch play, nothing refused or skipped.
- tests.rs: a dispatch reads or writes each buffer a useResources:count:usage: names by its
  usage's bits; a compute encoder's useResources:count:usage: with write usage takes a cover off
  and its useHeaps:count: binds the heap's objects, counted as a binding.
- The render residency test's stream now records each C array and its count as one list, as
  docs/REPLAY-STREAM.md says ("A C array and its count are one list"): it carried the count as
  its own argument before (useResources:count:usage: as list, count, usage; useHeaps:count: as
  list, count). The render encoder's arm reads none of these arguments (it plays every
  residency form as nothing), so it read no usage wrongly; only the test's stream was off the
  format.

Found by a play of a guest recording on the Iris Xe that stopped at a compute encoder's
useResources:count:usage:. Not run here: the device test needs --cfg m2v_gpu or m2v_cpu_icd;
the card-free tests run in the validation suite.
2026-11-23 08:17:25 -08:00
Anees Iqbal 7024d568df Golden tables: blessed at 30d426774d (SEMANTICS 2293 -> 2294)
30d426774d reverted the split, so every kernel lowers as at 38c5f2e96a again. Blessed on the M3
(job m3-max-71380): authored compile 2347 cases over 9 profiles, 21,123 cells, 0 failed, 0
differences. Both tables now equal 38c5f2e96a's apart from their version lines: golden_hashes.tsv
differs from it only in "semantics 2292" -> "semantics 2294", and authored-compile.tsv only in its
artifacts_at product fingerprint.
2026-11-23 08:08:50 -08:00
Anees Iqbal 30d426774d Translator: a kernel's floor tail folds into its pushed fields again (revert of the split)
The split (3a4fe0d314, with its tests c2d505c30c) made a kernel return at entry where its floor
tail holds what the consumer never pushes, in place of the select per pushed field. At pin S
(3bc285acaa) a guest's run of a GPU compute benchmark on the Iris Xe (8086:a7a0, ANV, Mesa
26.2.6) failed the benchmark's own output validation in its first workload, where the same run at
38c5f2e96a passed and every other vendor's run at S passed (3090, RX 7900 XTX, Radeon 780M
RADV). R..S holds the split alone. Until the cause is named, every stage folds the tail as at
38c5f2e96a, which passed on that card.

This commit undoes both commits' changes to lower/emit.rs, lower/push.rs, the arena and identity
tests and docs/API.md section 5; SEMANTICS_VERSION 2293 -> 2294, as every kernel under a floor
tail lowers as at 38c5f2e96a again. The split returns as its own change with its Iris value proof.
2026-11-23 08:03:41 -08:00
Anees Iqbal 7c0df2d721 rt README: the RADV counts beside AMDVLK's import copies are another run of the same benchmark
f3cc8d5570 said "in the same run", which reads as both drivers in one run. Wording only, from the
consumer's review.
2026-11-23 07:58:55 -08:00
Anees Iqbal f3cc8d5570 rt README: the known gap of no-copy imports under AMD's open Linux driver on the Radeon 780M
Under AMDVLK 2025.Q2.1 on a Radeon 780M no no-copy import takes a guest's pages, so the consumer
copies them. The dma-buf import is refused by our first-type-only rule: the fd's query offers
every type and the first is not host-visible. The host-pointer import of the same pages fails in
the driver. With no granule there is no route for pages over several dma-bufs. The line gives the
copies' cost in one benchmark run beside RADV's on the same card, and notes that AMD's Windows
driver takes host pointers in place.

Facts and counts are the consumer's, read from its counters and logs and reviewed by it before
landing. Docs only.
2026-11-23 07:58:45 -08:00
Anees Iqbal 37e9b06134 rt test: the sRGB unorm-view write prints its texel bytes, its decoded read and what it added to the extended-view count
every_device_writes_an_srgb_texture_through_its_unorm_view now prints, for each arm (plain and over a buffer), the
bytes each texel holds after the write, the decoded values the texture's own read returned, and what the write
added to Metrics::extended_view_dispatches (and, where it is refused, what the refused dispatch added). A device
leg's log then shows the values and the count it checked, on a device that stores the sRGB format and on one that
does not.
2026-11-23 07:37:43 -08:00
Anees Iqbal e91d665c89 rt test: the extended-view count of the sRGB unorm-view write is one only where the device does not store the sRGB format
every_device_writes_an_srgb_texture_through_its_unorm_view asserted that the write through the
RGBA8Unorm view adds one to Metrics::extended_view_dispatches wherever the write ran. That holds
only where the device does not store the texture's own format, R8G8B8A8_SRGB, which is true on
every Linux profile. KosmicKrisp on the M3 stores it: its optimal tiling has the storage image and
its writes without a format. So the texture's image takes the storage usage for its own format
(usage 0x1f), is not extended, and the unorm view's write goes through that usage. The counter,
which counts only writes through usage an image took for the view's format alone, correctly stays
at 0. The test failed at "Apple M3 Max: plain: the count" (left 0, right 1) in m3-max-71267, at
pin 38c5f2e96a. The product's behaviour does not change.

The count is now one only where the write ran and the device's format query says it does not
store the sRGB format (the test's existing `own`). The read's count is the write's. The bytes and
the decoded read are still asserted wherever the write runs, extended or not. The doc comment
says what happens on a device that stores the format.
2026-11-23 07:33:35 -08:00
Anees Iqbal 25bebf50db rt tests: each_device waits for the reaper's seed of the pipeline cache before the body
The seed sets Gauge::PipelineCacheBytes on the reaper after Device::new returns, by design: no
creation waits for a blob's read, and with a cache directory the gauge moves again when the blob
is taken. So the gauges are settled only once the seed is done, and each_device (open_each_device)
now waits for it (Caches::is_seeded) after the block-maker thread's first work, as it already
waited for that. Every body that compares the gauges across its work starts from settled ones:
import's refused-import checks (the AMDVLK failure), its dma-buf refusal, dma_bufs' and export's
before and after. No product change.

The device tests that open their own device read no cache gauge across their work: each compares
fields (blocks, textures, samplers, descriptor slots, idle and reserve bytes, staging bytes) or the
whole gauges against Gauges::default() at teardown, and the two that read pipeline_cache_bytes
(command's a_push_of_the_bytes_a_command_buffer_holds_records_nothing, render's cache-directory
test) wait for the seed already.
2026-11-23 07:30:32 -08:00
Anees Iqbal 1d89f35f15 rt test: an each_device body starts once the reaper has seeded the pipeline cache (red)
The reaper's first work, Caches::seed, makes the device's VkPipelineCache and sets
Gauge::PipelineCacheBytes to the empty cache's data size after Device::new has returned.
each_device waits for the block-maker thread's first work but not for the seed, so a body's first
gauge read can come before it: under AMD's open driver (AMDVLK), whose empty cache reads 52 bytes,
import's every_device_allocates_shared_memory_after_an_import_of_a_shared_file_mapping saw
pipeline_cache_bytes 0 before a refused import and 52 after it (the only field that differed), on
the Radeon 780M (job m3-max-71262) and the RX 7900 XTX (job m3-max-70391).

The new test makes the seed wait 200 ms at its start (Caches::delay_next_seed, a test-only delay
beside seed_hold, read once from a thread-local when the caches are made) and asserts the body
finds the cache seeded and its gauge still. It fails until each_device waits for the seed (the next
commit).
2026-11-23 07:30:32 -08:00
Anees Iqbal 9749fcbd63 rt: the block-maker thread takes a ring ask up before it makes the block, so an ask made during the make is answered
The block-maker thread cleared the pool's asked flag for an internal only after its make returned.
For the ring, the make hands its answer to the takes inside that call (Ring::make_ahead, or
Ring::unasked where it makes none), which sets the ring's next back to Unasked and drops the
ring's lock. A take in that window that left fewer than a block's chunks free set next to Maker
and asked again; the ask found the flag still set, and the thread then cleared it. The ring was
left with next == Maker and no ask pending, for the device's life: it never grew again, and a
take that found no chunk free waited in Ring::take's Condvar until a give-back, for ever where no
command buffer holding chunks would retire. Only the ring block is asked more than once (the zero
source and the staging region are asked once, at the device's making, and their calls re-check
after await_made), so it is the only internal with the window.

The form: the thread now takes the ask up (clears the flag) before it makes, under the same lock
it reads it with, and marks the internal as being made (Pool's `making`); await_made and the
tests' await_internals wait while the internal is asked or being made, so their callers wait for
the make exactly as before. An ask made after the take-up sets the flag anew and is made next, so
every ask has its own answer. One fact per state: the flag is "asked, not taken up", `making` is
"taken up, not done". The single-critical-section form (the ring clearing the pool's flag under
its own lock) would nest the pool's lock in the ring's and move the clear out of the thread's
generic loop into each internal's answer; the take-up form needs neither.

The test an_ask_made_once_the_ring_has_the_block_maker_thread_s_answer_is_answered forces the
window through the existing hooks: under MakerTest::Fail the thread's answer meets the ring's
park once the ring has it, a take asks again there, and after the release the ring must not be
left asked. The ring tests' waits are bounded (the barrier meetings, the joins, the take past the
ring's chunks, and await_internals at the tests' 60 s patience), so a lost step fails with its
message instead of hanging the leg.
2026-11-23 07:28:38 -08:00
Anees Iqbal 757cefd21f Golden tables: blessed at 3bc285acaa (SEMANTICS 2292 -> 2293)
The pin's one bless, at the pin candidate 3bc285acaa (job m3-max-71307 on the M3: inventory,
golden hashes, printouts, opened chains and the authored-compile census, each exit 0). Only the
two tables change; no source.

golden_hashes.tsv: every moved cell is a kernel stage's, module to module under unchanged
sources, from the kernel's floor tail returning at entry again (3a4fe0d314). Lane tailsplit
classed the whole table on the M3 (m3-max-71241, .air.ll rows included, 0 unobserved): 23,102
cells moved, all kernel; 0 vertex, 0 fragment, 0 render pair; no row added or removed.

authored-compile.tsv: the product fingerprint and 1,681 cases' compiled-artifact hashes. No
case's outcome class changed in any column (artifact hashes set aside); no row added or removed.

The quick check at 3bc285acaa (m3-max-71306) passed every step: signatures, clippy plain, gpu
and cpu, Rustdoc, rt 685/685 on lavapipe, conformance build and replay.
2026-11-23 07:27:49 -08:00
Anees Iqbal 3bc285acaa Translator: SEMANTICS_VERSION 2293 for a kernel's floor tail returning at entry
A kernel's lowering under a floor tail changed (3a4fe0d314: the entry return in place of a select
per pushed field), so every such kernel's output moved under an unchanged key. Render stages'
output is unchanged.

Verified card-free (job m3-max-71203, gb-3090-r3 and gb-780m-u2 lowered on nvidia-rtx50-linux,
amd-780m-radv and intel-irisxe-anv): 2,818 kernel modules changed, each by select -N, branch +1,
return +1, and split - tip equals b3fd1a568c - 059835018a in every instruction count; 5,025 of
5,025 render states' stage modules byte-identical to the tip's.
2026-11-23 06:43:13 -08:00
Anees Iqbal 3a4fe0d314 Translator: a kernel's floor tail returns at entry again; a render stage's folds into its other pushed fields
Since 059835018a every stage folded its tail's test into each other pushed field through a
select. A kernel's entry also returns invocations before its body where its dispatch passes its
grid (dispatch::emit_entry), so a return at entry is a kernel's own shape, and the selects cost
kernels on three vendors. A fragment stage has no other return at its entry; AMD's open driver
(AMDVLK 2025.Q2.1) died making one whose body ran under the never-taken return, which is what the
fold removed.

Now the stage kind decides it, the same on every device:
- Stage::Kernel loads its push fields in placement order, then returns where the tail holds what
  the consumer never pushes (EmitCx::emit_tail_guard, lower::push::return_never_pushed), as
  before 059835018a. The tail's read is in the first block, and everything the kernel does after
  the return depends on it.
- A render pipeline's stage (vertex, fragment, object, mesh) keeps the fold as shipped
  (EmitCx::fold_tail, lower::push::fold_never_pushed): no branch on the tail.
- EmitCx::tail_test reads the tail and makes its test for both; load_fields loads the fields a
  filter takes, in placement order.
- Docs: lower/push.rs, lower/emit.rs, the arena test's module doc, docs/API.md section 5.

Same pushed bytes, same placement, no interface change.
2026-11-23 06:26:25 -08:00
Anees Iqbal c2d505c30c Tests: a kernel returns at entry where its floor tail holds what is never pushed (red)
The floor's tail test folds into every pushed field through a select in every stage since
059835018a. A kernel's entry already returns invocations past its grid before its body, so a
return at entry is a kernel's own shape, and the fold costs kernels a select per pushed field.

- a_kernel_returns_at_entry_where_its_tail_holds_what_is_never_pushed: many_of(3), a kernel, on
  PROFILES and runtime-floor: the tail's test is the condition of one branch and of no select,
  and the module returns twice. Fails at the tip (4 selects, no branch, one return).
- the_floor_s_tail_folds_into_the_other_pushed_fields_with_no_branch narrows to render stages as
  a_render_stage_s_tail_folds_into_its_other_pushed_fields_with_no_branch: the same reads in a
  fragment function (many_in(true, 3)), one select per pushed field, no branch, one return.
- many_in builds many_of's reads as a kernel or a fragment function; tail_test_uses reads the
  tail test's uses for both tests.
2026-11-23 06:26:24 -08:00
Anees Iqbal 38c5f2e96a rt: decide's lifetime is elided, and the cache-directory test reads the observer's two modules again
Fixes forward e59c621e48, whose compile job m3-max-71176 failed two ways:

- clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd): needless_lifetimes at encoder.rs decide().
  Its one reference input since the restore is `compiled`, so the returned kernel's lifetime is
  elided.
- every_device_takes_the_kernels_a_device_before_it_lowered_from_the_cache_directory on lavapipe:
  `left: (3, 0)`, `right: (2, 0)`. The restore makes an observing kernel's state lower its plain
  module and its partial-threadgroups variant again, so the first device translates three modules
  (the tiling kernel's and the observer's two) and the second loads three from the directory. The
  test's counts, its comment and its doc go back to their values before d8eb5ea024 (the test of
  a103b4dc5a), which had moved them to two when the variant became the state's only module. The
  code is right; the expectation was the series'.

The other 684 rt tests on lavapipe passed in m3-max-71176, among them the 10 observer and
ragged-grid tests.
2026-11-23 06:23:17 -08:00
Anees Iqbal e59c621e48 rt: an observing kernel's whole grids, threadgroup dispatches and indirect dispatches run its plain module again; its partial-threadgroups variant runs ragged grids only
This restores 28e1026b3d's routing, in a new commit past four that changed it:
- 6453edbea7 ran an observer's whole grids on its partial-threadgroups variant;
- f090d99c9a added its indirect dispatches;
- 9a01f1e8ee kept the plain module only where the variant's vote word passed the limit;
- a103b4dc5a lowered the variant alone unless keeps_plain held.

The variant's predicated walk and partial-group answers cost each whole grid. The series was
measured at 3.5% slower a dispatch on an RX 7900 XTX when it landed (README known gap,
m3-max-67284), and the guest's GPU fall on the 3090 lies in 28e1026b3d..f979769faf, which holds
the series.

- encoder.rs decide(): the observer route goes. A dispatch runs choose()'s module: whole grids,
  threadgroup dispatches and indirect dispatches the plain module, a ragged grid the variant, and
  a threadgroup that is not whole SIMD groups the emulated variant. decide() takes the device's
  threadgroup memory bytes alone, for the vote word's refusal site. The ragged grid's
  threadgroup memory check is unchanged: a ragged grid whose lengths with the variant's vote word
  pass the limit is still Limit::ThreadgroupMemory (9a01f1e8ee's refusal, kept).
- pipeline.rs: an observing kernel's state lowers its plain module and its variant beside it,
  always (Partial::Alone and keeps_plain go). Its main pipelines at the declared size are two,
  as before the series: the plain module's (main_key, now the whole module's by decide) and the
  variant's ragged grid (ragged_key). finish_pipeline makes both, a kernel past the stage bound
  makes both at the creation, and a first use of either is an unfinished-pipeline wait. No
  variant is made lazily at a first ragged grid.
- Metrics::partial_variant_whole_grids stays, and reads 0. The conformance runner's
  dispatch-forms line prints only where it is above 0.
- Docs: the rt README's compute pipeline states (the routing, and the main pipelines), with the
  known-gap bullet the series added (3.5% XTX, 2.7% Iris) gone; docs/API.md section on the
  variant's regions; the Metrics docs; decide(), choose(), dispatch_threads and pipeline.rs's
  module docs.

No translation changes: the translator's modules and keys are the same, so there is no SEMANTICS
or ARTIFACT bump and no bless. Only rt files change.

Tests (red at 8a2f9109aa, green here):
- every_device_runs_an_observing_kernel_at_its_own_threadgroup_size: its whole grids,
  threadgroup and indirect dispatches add 0 to partial_variant_whole_grids, its ragged grids
  count in partial_variant_ragged_grids, and the creation lowers two modules.
- every_device_keys_a_dispatch_by_the_pipeline_it_runs: the whole, threadgroup and indirect
  entries share the plain module's key; the ragged ones take the variant's.
- every_device_finds_made_what_prepare_dispatch_made: a ragged grid and u32::MAX threads each make
  the variant's pipeline.
- every_device_keeps_a_kernel_that_reads_across_rows_after_a_barrier_at_its_own_size and
  every_device_makes_a_declared_bound_s_grids_with_the_state: a declared size makes two pipelines
  with the state, and its whole and ragged grids make nothing and wait for nothing.
- kernel_map's shared-content test: the observing content lowers twice.
The ragged-grid tests stay as they were:
- every_device_runs_a_stage_in_kernels_partial_threadgroup;
- every_device_runs_a_1024_thread_observers_ragged_grid_in_the_limit_less_its_vote_word;
- every_device_runs_a_kernel_without_a_vote_word_at_a_length_past_its_answer;
- every_device_runs_an_observer_on_its_plain_module_where_the_vote_word_passes_the_limit.
2026-11-23 06:16:29 -08:00
Anees Iqbal 8a2f9109aa rt README: the layered-resolve gap names the card it was measured on
The line from af268e90c8 named the Radeon 780M too, on a record that both AMDVLK cards gave the
same result; no job output shows the 780M's layered resolve (m3-max-70391 ran both cards but
prints no per-card case lines, and the repro m3-max-70937 ran the RX 7900 XTX alone). The line
names the RX 7900 XTX alone, as measured.
2026-11-23 05:15:37 -08:00
Anees Iqbal 45fa4d2d7a rt README: AMD's open driver resolves a slice above 0 of a multisample array from slice 0
A known gap of render encoders, where a user reads it. Under AMD's open Linux driver (AMDVLK
2025.Q2.1), a render pass resolve of a 2D view of a slice above 0 of a multisample array texture
writes the right slice of the resolve texture with the samples of the array's slice 0: the
conformance case layered-resolve-places reads 64 of 64 texels 0 in the resolved slice (job
m3-max-70391, the RX 7900 XTX); RADV on the same card is exact. Vulkan's resolve combines the
samples of the attachment's own view (vkspec 8.7; VkImageSubresourceRange::baseArrayLayer), so it is
the driver's, with no rt form (workaround ladder rungs 3 and 4).

Verified: a standalone Vulkan repro with no runtime code (dynamic rendering, a TYPE_2D view of layer
N of a 4-sample 3-layer R32_SFLOAT image resolved with AVERAGE into layer N of a single-sample
array) on the RX 7900 XTX in one job, m3-max-70937: AMDVLK fails 5 of 7 runs (every layer 1 and 2
run; with the multisample layers cleared first, the resolved layer holds layer 0's clear, 0.5),
passes layer 0, and vkCmdResolveImage shows the rendering itself in the right layer; RADV (Mesa
26.2.6) passes 7 of 7. The upstream draft is staged for the owner (report 143). No replay stream
resolves: 0 resolve attachments over the 26 streams (census jobs m3-max-70810, 70811, 70812), so
no form search. No ledger row: known-gaps-rt.tsv holds no row for the AMDVLK venue for any case,
and the case has no row on the matrix venues, where it matches.
2026-11-23 05:15:31 -08:00
Anees Iqbal 06058348cd Golden tables: blessed at bd37a327d0 (SEMANTICS 2287 -> 2292)
The pin's one bless, at the pin candidate bd37a327d0 (job m3-max-70960 on the M3: inventory,
golden hashes, printouts, opened chains and the authored-compile census, each exit 0). Only the
two tables change; no source.

golden_hashes.tsv, classed:
- 120 cells changed, all amdquad's (211c10a594, a fragment's quad reductions through quad
  instructions): 5 subjects (gsm2_quad_ops fragment_quad_bitwise, fragment_quad_ops_divergent,
  fragment_quad_scans; rch_helper_tangle rch_tangle_quad_after, rch_tangle_quad_before) in both
  fixture forms, on the 12 profiles with quad control; moltenvk-m3, nvidia-pascal-linux and
  runtime-floor unchanged.
- 30 cells new: rag429's fixture kernel_stage_in_groups (stage_in_neighbour, both forms, 15
  profiles), recorded as its refusal class NeedsInput{StageInputDescriptor} (the table lowers
  without a stage-input descriptor).
- quadvote (de44227e11) changes no cell: no golden fixture has a fragment quad vote.
- Nothing else moved; no row removed.

authored-compile.tsv: the product fingerprint; 5 quad-control cases' compiled artifacts (the
quad reductions' new form); rag429's Metal case ff2af27df7f8 added as
not_supported{tooling_requirement:kernel_stage_input}.
2026-11-23 05:15:04 -08:00
Anees Iqbal bd37a327d0 Translator: SEMANTICS_VERSION 2292 for a stage-in kernel's partial-threadgroups variant
The variant of a kernel that reads a stage-input region was a refusal and is a module since
c6feccf773, under the same key, so cached translations of it are stale. c6feccf773's message names
2290 and its red test by the sha before this branch was rebased (9089b4eea2, now f4ae2c826f): the
quad vote form took 2291 on development first, and this bump is the one that commit describes. No
plain module changes.

Verified with the rebased tree's compile job (named in the landing report).
2026-11-23 04:48:13 -08:00
Anees Iqbal a2eefc6b3d Case: a stage-in fetch in a partial threadgroup beside a barrier, qualified on Metal
stage-in-fetch-in-a-partial-threadgroup-beside-a-barrier (case ff2af27df7f8) runs the public
fixture kernel_stage_in_groups' stage_in_neighbour as a grid of 25 threads in threadgroups of
1,024 (dispatchThreads), over a stage-in region at origin 7 of size 1,024 whose data ends at the
last thread's element, and records all 26 uint4 of its output buffer: each thread's neighbour's
attribute, threads_per_threadgroup, its grid position and its index, and the 26th uint4 untouched.

Verified: qualified on the M3 Max (apple-m3-max-macos27.0.1) by corpus-metal in job m3-max-70928,
three runs; the output's hash (835a95a8668c) equals the hash of the bytes the rationale states,
computed apart (threads_per_threadgroup reads 25, the partial threadgroup's size).
2026-11-23 04:48:01 -08:00
Anees Iqbal c6feccf773 Translator: a kernel that reads a stage-input region takes its partial-threadgroups variant
plan_partial_groups refused a kernel's partial-threadgroups variant wherever it had a stage-input
descriptor, so rt refused every dispatchThreads grid that is not whole threadgroups of a kernel
with a [[stage_in]] attribute (Gap::PartialThreadgroups at the translator's site). The probe over
the 11,580 indexed kernels (m3-max-70807) counted 62 such kernels on amd-780m-radv,
nvidia-rtx50-linux and intel-irisxe-anv alike; a consumer's first-time setup meets one of them.

The refusal goes and nothing is added to any module: the fetch already stays inside the grid.
An invocation past its threadgroup's threads returns in dispatch::emit_entry, which the entry
runs before stage_io::emit_entry's fetch. Where the body holds a workgroup barrier the variant
walks it predicated instead, so such an invocation does fetch, but its position in the
threadgroup is lin unflattened over the threads left (local_pos), so along x and y, the only axes
a step reads, it is inside the grid, and its element is one a Metal thread there fetches too; it
runs none of the body. A kernel that does not observe its partition now takes the grid-tiles
variant, whose invocations past the grid return before the fetch as well.

SEMANTICS 2290: the variant of a stage-in kernel was a refusal and is now a module, under the
same key. No plain module changes.

The two tests of 9089b4eea2 turn green: the translator's interpreter run over a source buffer
ending at the last thread's element and a region that clamps nothing traps on any fetch past the
grid, and rt runs both kernels' partial threadgroup of 25 in 1,024.
2026-11-23 04:48:01 -08:00
Anees Iqbal f4ae2c826f Tests: a stage-in kernel's partial threadgroup of 25 in 1,024 (red)
rt's every_device_runs_a_stage_in_kernels_partial_threadgroup dispatches a grid of 25 threads in
threadgroups of 1,024 of engine/kernel_stage_in's stage_in_fetch, which does not observe its
partition, and engine/kernel_stage_in_groups' stage_in_neighbour, which holds a threadgroup
barrier, each under its stage-input descriptor, with the stage-in region at origin 7 and 1,024
elements long over a source buffer that ends at the last thread's element. It checks all 25
threads' words against Metal's, every word past the grid unwritten, and that the walked kernel
counts one ragged grid on its partial-threadgroups variant.

The translator's a_stage_in_kernels_partial_threadgroup_fetches_inside_its_buffer runs both
kernels' partial-threadgroups variants on the CPU interpreter over the same layout, with the
source and output buffers exactly as long as the threads reach and the zero range unmapped, so a
fetch past the buffer or a store past the output traps.

Both fail today: the translator refuses a kernel's partial-threadgroups variant where it reads a
stage-input region (plan_partial_groups), and rt refuses the dispatch as
Gap::PartialThreadgroups at the translator's site.
2026-11-23 04:47:56 -08:00
Anees Iqbal b31e8bc917 Fixture: kernel_stage_in_groups' companions, its inventory rows and its golden printout
Compiled by scripts/regen-air-fixtures on the M3 (job m3-max-70842; metal 32023.922, SDK 27.2),
with the engine inventory and the engine printouts blessed in the same job. Without a stage-input
descriptor the kernel is NeedsInput{StageInputDescriptor} on every profile, as every stage-in
fixture is. The golden rows are blessed on development.
2026-11-23 04:47:56 -08:00
Anees Iqbal add7f28ad0 Fixture source: kernel_stage_in_groups, our MSL fetching a stage-in attribute beside threadgroup memory and a barrier
One kernel, stage_in_neighbour: each thread fetches a uint [[stage_in]] attribute, stores it in
threadgroup memory, and past a threadgroup barrier reports its threadgroup's next thread's word
with threads_per_threadgroup, its grid position and its index. It observes its threadgroup
partition and holds a workgroup barrier, so a dispatchThreads grid that is not whole threadgroups
runs it on the partial-threadgroups variant's predicated walk. The companions follow from
scripts/regen-air-fixtures on the M3.
2026-11-23 04:47:56 -08:00
Anees Iqbal de44227e11 Translator: SEMANTICS_VERSION 2291 for a fragment's quad votes in the quad vote form
What: SEMANTICS_VERSION goes from 2289 to 2291 (2290 is held by another
change). A fragment's quad_all and quad_any are now
OpGroupNonUniformQuadAllKHR and OpGroupNonUniformQuadAnyKHR (1958c34e85),
so its words change under an unchanged key.

Why: a cached artifact of the ballot form would serve AMDVLK's wrong
answer for a quad with a helper.

Verified, base c4aee831e9 (the red test alone) against fix d701f8e921:
- Red/green, um790, m3-max-70847 and m3-max-70857. AMDVLK 2025.Q2.1
  with the base: 12 of the 36 covered pixels wrong on the RX 7900 XTX and
  on the Radeon 780M, each covered pixel of the four diagonal quads
  reading quad_any(x > y) = 0 and quad_all(x <= y) = 1 where Metal
  answers 1 and 0. With the fix 36 of 36 on both cards. RADV (Mesa
  26.2.6) reads 36 of 36 on both cards with both arms. The quad
  reduction test reads its quads whole in all eight arms.
- Checks at d701f8e921 (m3-max-70855, msi): fmt; clippy -D warnings on
  the workspace (all features), on metal2vulkan with no feature and with
  serde, ash and cli alone, and under --cfg m2v_gpu and --cfg m2v_cpu_icd
  for metal2vulkan and the runtime; Rustdoc -D warnings; the
  translator's simd, spirv, quad and golden tests, 499 of 500, the one
  failure the golden table (bless due); the runtime's device suite on
  lavapipe (--cfg m2v_cpu_icd), 683 of 683, quad_votes 36 of 36.
2026-11-23 04:46:39 -08:00
Anees Iqbal f8bd4941e2 rt test: quad_votes' fragment stage holds one quad vote instruction of each kind and no ballot
every_device_votes_over_its_quads_helpers now also checks the translated
fragment stage: one OpGroupNonUniformQuadAllKHR, one
OpGroupNonUniformQuadAnyKHR and no OpGroupNonUniformBallot, so it fails
without the quad vote form on every device, not only where a driver
leaves the helper out of the ballot. The stage's opcodes come from a
helper, fragment_ops, which quad_sum_after_a_return's checks now share.
2026-11-23 04:46:38 -08:00
Anees Iqbal 624c5a38b9 Translator: a fragment's quad votes are OpGroupNonUniformQuadAllKHR and QuadAnyKHR, helpers included
What: in a fragment function, Metal's quad_all and quad_any are now
SPV_KHR_quad_control's OpGroupNonUniformQuadAllKHR and
OpGroupNonUniformQuadAnyKHR of the predicate, in place of the quad's four
bits of the ballot of the predicate (compared with the ballot of the
active lanes for quad_all). Kernels and vertex functions have no helpers
and keep the ballot form. The IR gains GroupInst::QuadAll beside
QuadAny (no scope operand; QuadControlKHR, SPV_KHR_quad_control and
shaderQuadControl), and the builder's group_quad_any becomes
group_quad_vote(all, pred), as group_vote is. The interpreter, the
serializer and the requirement deriver follow. items.txt lists
GroupNonUniformQuadAllKHR, and scripts/regen-spirv-grammar regenerated
spv.rs from SPIRV-Headers vulkan-sdk-1.4.341.0: the opcode loses its
cfg(test); the test parser's table already held it.

Why: Metal's helpers are active lanes of their quad and take part in
its votes. Vulkan section 9.31 runs quad group operations over a quad's
helpers in every entry, and its other group operations, the ballot
among them, only where the entry declares MaximallyReconvergesKHR. AMD's
open Vulkan driver leaves a partly covered quad's helper out of the
ballot even though the entry declares MaximallyReconvergesKHR beside
RequireFullQuadsKHR (report 142), so a vote read through the ballot
missed the helper: the runtime test quad_votes read quad_any(x > y) = 0
and quad_all(x <= y) = 1 on the 12 covered pixels of the diagonal quads,
where Metal answers 1 and 0 (m3-max-70847, AMDVLK 2025.Q2.1 on the RX
7900 XTX and the Radeon 780M; RADV right on both). The quad vote
instructions are right by the spec on every device whatever the entry's
reconvergence (rung 1), the form the quad reductions took (54517169dd).

What full_quads asks: unchanged, shaderQuadControl. A fragment vote's
operation class moves from Ballot to Quad, which Vulkan requires
wherever shaderQuadControl is supported. No new query.

Still through the ballot in a fragment: quad_ballot, the active mask,
is_first, broadcast_first, the quad prefix sums, and every simdgroup
operation.

Tests: operation_classes_follow_the_tier gains a fragment's quad All and
Any (Quad); fragment_quad_votes_are_quad_vote_instructions compiles a
fragment of both votes on every committed profile with quad control (one
QuadAllKHR, one QuadAnyKHR, no ballot) and checks a kernel's votes
(a3_quad_votes_divergent) take neither instruction.
2026-11-23 04:46:38 -08:00
Anees Iqbal 831a7979ac rt test: a fragment's quad votes count the helper of a quad the triangle cuts (red under AMD's open driver, expected)
The input is the test's own fragment, quad_votes: each pixel writes its
quad's quad_any(x > y) and quad_all(x <= y), drawn by the triangle the
quad_control test draws, which covers the pixels with x <= y and cuts
each diagonal quad at its top right pixel, a helper. In a diagonal quad
only the helper is right of the diagonal, so Metal's quad_any holds and
its quad_all does not; in a quad the triangle covers whole the other way
round. Every device of the cfg's kind with quad control makes the state
and each covered pixel must read those votes.

The draw moves into a helper, diagonal(), which the quad_control test
now shares.

Why: under AMD's open Linux driver a fragment's OpGroupNonUniformBallot
leaves out a partly covered quad's helper (report 142), and a quad vote
still reads its quad's bits of the ballot (lower::simd::group, quad_op).
2026-11-23 04:46:38 -08:00
Anees Iqbal b755b42af5 rt docs: two private intra-doc links that no longer resolve or are redundant
CI's "Private intra-doc links" step holds metal2vulkan-runtime at 0 diagnostics; development
carried 2 (found by lane d3dsync's gate, jobs m3-max-70845, 70861, 70891):

- pipeline.rs: a kernel interface's `threadgroups` doc linked `Variant::threadgroup_lengths`,
  a field Variant does not have (the encoder holds the lengths as set; a variant keys them as
  `lengths`, whose words follow `threadgroups`' order, encoder.rs ~1554). It links
  `Variant::lengths` now.
- function_table.rs: `[`MAX_BUFFER_LENGTH`](crate::MAX_BUFFER_LENGTH)` is redundant where the
  name is in scope; the plain link resolves to the same item.

Verified: the private-items Rustdoc pass for every crate, in the job named in the follow-up.
2026-11-23 04:39:56 -08:00
Anees Iqbal 3700faf60f rt: Direct3D 11 planes read twice back to back, and a timing of 64 such reads
Two reads of the planes Direct3D 11 drew, each a command buffer of a
queue of its own so each goes in a submission of its own, the second
committed before the first is waited for: both read picture 1 exactly,
and the two submissions count two in Metrics::d3d11_plane_submissions,
two acquires and two releases, the barriers recorded printed. This is
the case whose first release nothing ordered before the second's
acquire until the global barrier ahead of each acquire; a job may run it
under the validation layer's synchronization checks
(VK_KHRONOS_VALIDATION_VALIDATE_SYNC).

On an instance without the layer, 64 reads committed back to back on one
queue, the last waited for: wall time per command buffer, five runs,
their median and plane-keeping submissions printed only. The read helper
is split so both tests encode the same blits; the import is a helper.

Verified: cargo fmt. The UHD jobs that run them follow.
2026-11-23 04:38:55 -08:00
Anees Iqbal 0a3625b07e rt: a global barrier from and to every stage before a Direct3D 11 plane's acquire
An acquire from VK_QUEUE_FAMILY_EXTERNAL ignores its srcStageMask, so its
first synchronization scope does not apply, and Vulkan 1.4 section 7.7.6
has the release before it happen-before it. Two plane-keeping submissions
in flight together on rt's one queue (two reads with no wait between) had
nothing that ordered the first's release before the second's acquire:
rt meets event waits on the CPU and adds no semaphore wait.

The head command buffer now records a global barrier, ALL_COMMANDS to
ALL_COMMANDS (record::barrier, Reach::Commands), before the acquire. Its
first scope takes the earlier release ("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
is the only valid stage to wait on or wait for these operations") and its
second the acquire after it. One more barrier per plane-keeping submission,
counted in Metrics::barriers.

Verified: cargo fmt. The test of two reads back to back and the gate and
UHD jobs follow.
2026-11-23 04:38:55 -08:00
Anees Iqbal 35243bc211 rt: each submission that uses a Direct3D 11 plane acquires it at its start and releases it at its end
A Direct3D 11 surface's planes were acquired from VK_QUEUE_FAMILY_EXTERNAL
by Surface::external_writes_done and released by
release_surface_to_external, one call each, which the consumer had to pair
around every Direct3D 11 access. The consumer never called the release
(zero hits in its checkout at 76c55a4074), so rt kept the planes from the
first acquire on while Direct3D 11 drew into them.

Each submission whose command buffers or uploads use a plane now acquires
it from VK_QUEUE_FAMILY_EXTERNAL in a command buffer of rt's own ahead of
everything (the uploads included) and releases it in another after
everything, both GENERAL to GENERAL (VUID-VkImageMemoryBarrier-
srcQueueFamilyIndex-12332, -dstQueueFamilyIndex-12331): Direct3D 11 owns
the planes' memory between rt's submissions. Planes are kept per segment
(keep_texture), so a submission of segments before an event wait, which
the submit thread meets on the CPU, acquires none of the planes the
segments after the wait use; a segment that signals passes its planes to
the next, as a texture bound after a signal is used by the command that
splits. The two command buffers are uploads, so they retire with the
submission, and the release holds the images. The release takes the
last segment's signals, so no VkSubmitInfo2 is added; nor is a submission
or a wait. Metrics::d3d11_plane_submissions counts each such submission,
and each barrier counts in external_acquires or external_releases.

Surface::external_writes_done and release_surface_to_external record
nothing for a Direct3D 11 surface now; no public item is removed. The
consumer's external_writes_done call (d3d11_surface.rs:93 at 76c55a4074)
stays valid.

Docs: d3d11.rs, the runtime README, the Metrics fields and the two calls
state the per-submission hand-over, and that no keyed mutex is used by rt
or on the textures (SHARED | SHARED_NTHANDLE, not SHARED_KEYEDMUTEX).

Tests: the import test asserts that its three submissions that keep the
planes count three, with three acquires and three releases; the drop
test's three drops now send nothing, no upload holding a plane.

Verified: cargo fmt; api signatures and the refusal surface unchanged
(signatures.py --check, refusal_surface.py --check). The device-cfg
builds, clippy, Rustdoc, lavapipe and the UHD 630 run are named in the
next commit or the landing report. AMD and NVIDIA Windows drivers are
unverified: the lab's one Windows GPU is the UHD 630.
2026-11-23 04:38:55 -08:00