On the profiles the quad-free tier changes, a quad-only kernel's partial-threadgroups variant was
refused before it (the emulated tier has no partial variant), so a ragged dispatchThreads grid of
such a kernel is a path that never ran there, and it runs at a size the device picks.
every_device_runs_a_quad_only_kernels_ragged_grid_on_its_partial_variant: quad_edge (inline AIR: a
quad_shuffle to the next quad lane and a quad_ballot of g % 3 != 0) over grids of 2 x 64 + 22 and
61 threads in threadgroups of 64 (or the variant's largest multiple). Each grid adds one to
partial_variant_ragged_grids and none to emulated_simdgroup_dispatches; every thread's ballot is
its quad's threads in the grid, every shuffle whose source thread is in the grid reads it (a read
past the grid is not promised, MSL 4.1 section 6.10.2), and the words past the grid keep their
fill. Where the device takes the quads at its own size the variant has no pinned size,
ALLOW_VARYING_SUBGROUP_SIZE and REQUIRE_FULL_SUBGROUPS, whole groups of maxSubgroupSize. Prints
which and the ragged grids it ran. quad_sizes is the existing quad test's device query, shared.
Verified by the jobs named in the landing line (lavapipe at 8 and 4 lanes, the Iris device leg).
device/subgroup.rs and lower/dispatch.rs are runtime guard inputs. Their change is compile-time:
SubgroupRequirement gains `varying`, quad_free and quad_requirement pick a quad-only kernel's
requirement, add_device_facts asks the stage flag ALLOW_VARYING_SUBGROUP_SIZE for it, and
plan_kernel takes that requirement. The requirement and its stage flags are in the pipeline the
artifact digests (the codec carries `varying`), and a requirement without `varying` runs as before,
so no run of a given artifact changes: the hash alone moves
(5f611d76cc7fe24cedb2197787d0796be5a8eb5a228d33aecb08e4a0e7d1a302, the value the guard test printed
in the suites job m3-max-71763 at 6f2b064366).
The quad-free Direct tier applies on lavapipe (8 lanes, 4 under a 128-bit native vector width), so
the tests that held every quad kernel there to the emulated tier now say which tier each takes:
- engine_simd_emulated: validate, run_kernel_under and barriers compile a kernel whose own plan is
quad-free (SimdPlan::quad_free, asserted Direct) as its emulated-simdgroups variant, the module a
dispatch whose threadgroup is not a multiple of lavapipe's size runs; every other kernel keeps
its own inputs. The module doc says so.
- engine_simd: float_group_arithmetic_without_fast_flags_keeps_signed_zeros names each profile's
simdgroup tier and quad tier (lavapipe: Emulated and Direct).
- engine_quad_ops: a kernel whose lockstep order needs emulated simdgroups (an inserted barrier of
Origin::LockstepEmulated) stays Emulated, as select.rs decides before the quad-free test;
quad_ops_divergent is one on lavapipe. The new test counts the kernels that took the varying
size and asserts some did, and runs at 32 lanes only a plan pinned at 32.
Found by the suites job m3-max-71763 at 6f2b064366 (product: 7 of these tests failed on lavapipe's
profile; nothing else but the golden table, blessed at the pin). Verified by the compile job named
in the landing line.
The 32 lanes of a Metal simdgroup are needed only by operations that read outside a quad. A kernel
whose every cross-lane operation is a quad operation (lower::simd::quad_only: some group operation,
each of quad scope, and no simdgroup-scope operation, AGX or matrix multiply-add, or subgroup-scope
barrier or fence) now takes the Direct tier with full subgroups and no required size where the
kernel stage runs full subgroups of its operations and its narrowest subgroup is below 32 lanes
(device::subgroup::quad_free, read from the stage's size range alone). Its requirement
(quad_requirement) sets ALLOW_VARYING_SUBGROUP_SIZE where the stage can take a size, and a local
size that is a multiple of the stage's largest size (VUID-VkPipelineShaderStageCreateInfo-flags-02758);
a threadgroup that is not runs the emulated-simdgroups variant, as a pinned kernel's does. Such a
kernel pins nothing, so the widest-pin rule does not weigh it. The pin to 32 stays where 32 is the
device's narrowest size.
Why it is exact: a quad is four subgroup lanes from a multiple of 4, all in one subgroup (Vulkan
9.27.9), and a compute dispatch runs one subgroup size (9.5.2); the kernel's simdgroup builtins
derive from the linear index (SubgroupId * SubgroupSize + SubgroupLocalInvocationId, reading the
SubgroupSize builtin where no size is pinned), and its quad operations from SubgroupLocalInvocationId
& 3 and & ~3, so every size of 4 lanes or more gives Metal's quads.
The guard min >= 4: a quad must be four lanes of one subgroup. A stage whose narrowest subgroup is
1 or 2 lanes could split a quad across subgroups, so such a stage keeps the tier its class takes.
A kernel with compute derivatives keeps the tier its class takes: their quads need its
two-dimensional local size, which the flattened tiers refuse (ComputeDerivativesWithSimd). Without
this exclusion lavapipe's quad kernels with derivatives, which run emulated today, would be refused.
Where it applies among the committed profiles: the four Intel ANV profiles (8 to 32: multiple 32,
varying), lavapipe and gate-lavapipe-x86_64 (8: multiple 8) and gate-lavapipe (4: multiple 4). Not
on NVIDIA (32), RDNA (32 to 64), moltenvk-m3 (its kernel stage takes no size, so it runs the API's
32 alone) or runtime-floor (no quad class).
Measured on the Iris Xe (RPL-P, ANV), job m3-max-71702, the lane-only form of this change (E: the
base at eda92e1207, Q: this form, E2: the base again; cold plays of the consumer's recording to
frame 345): the regression row's kernel took Q in all 21 of its constant sets (15832 dispatches,
100%); per dispatch E 1.6018 ms, Q 0.7314 ms, E2 1.6006 ms (Q/E 45.7%); values E/Q and E/E2 0
differing of 261 buffers; translation 18 s and 0.92 GiB peak against 17 s and 0.92 GiB. The
driver's executable statistics (job m3-max-71726): Q compiles at SIMD8 (SIMD16 for one state),
15 to 50% fewer instructions than the emulated form, against about 2800 spills a state when pinned
to 32.
SEMANTICS_VERSION 2297 (modules change on the profiles above); ARTIFACT_FORMAT_VERSION 595
(SubgroupRequirement gains `varying`).
Tests: device::tests::subgroup (the predicate over size ranges, the guard, and the committed
profiles it takes), engine_simd (a quad-only kernel's requirement on every committed profile, and
the flattened kernels' constraint), engine_quad_ops (the quad fixture's kernels in the Direct tier at
8 on lavapipe and at 8, 16 and 32 on an Intel profile; the emulated variant on lavapipe),
engine_dispatch (derivatives beside a quad keep lavapipe's emulated tier), and the runtime's
every_device_runs_a_quad_only_kernel_at_the_size_it_gives under a device cfg.
A new heap buffer looks at the heap's live textures, a new heap texture at all
its live placements, and a release takes out only its own entry (the two
commits before this one). The README now says so beside the heap calls, so the
cost of placing is stated where a consumer reads how to place.
The heap form counts a use that may write a heap buffer (a bound slot its
function does not read only, or a declared write) as a write of the whole
buffer, so every texture placed over its bytes goes stale and its next write
moves its whole image out of undefined. A guest that writes only part of such a
buffer, or none of it, can lose what such a texture held on a device whose move
resets an image. The known gaps now say so.
How the gap was weighed: a card-free model of the form's marking at c553ebbfcb,
replayed in commit order over three recordings (a discrete-made and an
integrated-made run of a GPU compute benchmark, and a 4,028-frame app walk; jobs
m3-max-71817 and m3-max-71825), counted the textures made stale only through
buffer write-uses and then read or written in place: zero on all three. Kernels'
access came from the compiled interface; no draw whose stage the model could not
read binds a linked texture or buffer. The model links at each format's least
size, so a device's larger images can only add meetings it did not count.
This lands with the two commits before it, which end the heap form's measured
regression (c553ebbfcb played +7.8% GPU busy and +34% wall on an RTX 3090, and
+40% wall on a Radeon RX 7900 XTX, on the discrete-made recording). The cost was
rt's own CPU in placing and releasing heap buffers, not the moves. Card-free
model, job m3-max-71838, placements examined per new placement, mean (largest):
recording kind new at c553 now
discrete buffers 48,555 1,412.2 (4,914) 0.1 (31)
discrete textures 3,382 26.3 (207) 26.3 (207)
integrated buffers 48,646 1,409.7 (4,914) 0.0 (9)
integrated textures 3,741 25.0 (185) 25.0 (185)
walk textures 1,121 2.4 (7) 2.4 (7)
In the discrete recording's frames 325-349 the scans fall from 68,541,756 to
2,000 and the links made and dropped from 21,265,001 to 600. Scope: the model
lets a placement go at the guest's release, while rt holds one while a command
buffer in flight holds it, so rt's own counts are at least the model's.
Measured, the same recording played cold to frame 344, base acda405b30 against
fec822fe72 (these two commits' runtime sources), arms alternated in one job:
RTX 3090 (m3-max-71842) GPU busy +0.53% mean, wall +0.5%, player CPU user
119.9 s against 123.9 s; RX 7900 XTX (m3-max-71841) GPU busy -0.19% to +0.01%,
wall -0.2%, player CPU user 30.0 s against 29.9 s; heap_moves 1,561 in every
form arm on both cards.
The heap form's CPU cost on the XTX (kernmap 71811: player CPU user 30.0 s base against 56.9 s with
the form and 55.4 s with the texture-links fix, in frames 325-349, where the recording places
48,555 heap buffers with 21.3 M buffer-buffer meetings) sat in three places, none of which the
form's moves need:
(a) every meeting stored two links, buffer-buffer meetings included;
(b) a release walked each link, locked the other and retained over its whole lists;
(c) each placement and each release retained over every placement of the heap.
Now:
- A meeting of two buffers makes no link. Nothing used one: only a texture is ever moved, a
write stales only its texture links, and a texture's check before its move looks only at the
texture's own links, its links to buffers among them.
- A heap's live placements are kept by kind, in maps keyed by address (`alias::Places`): a new
buffer looks at the heap's textures alone, a new texture at every live placement, and a release
removes its own entry, with no pass over the others.
- A release drops its link from each linked placement's list of its own kind alone.
The same textures move before the same writes: the links from textures are the ones they were.
Test: the buffers test also asserts that two meeting buffers hold no link and that each holds one
link, to the texture, once a texture is placed over them. A new device test counts the entries a
new placement looks at (a test-only count): a new buffer's equal the heap's live textures, with
none, 100 and 10,000 live buffers; a new texture's are at most the heap's live placements. Before
this change a new buffer looked at every live placement of its heap, so its count grew with the
live buffers.
The heap form's write of a linked placement walked every link, buffers included, twice: on the
encoding thread (Marks::used, a mark and a Weak a link) and under the submit thread's work lock
(alias::stage, a store a link). Only a texture is ever moved and only a texture's staleness is
read, so a placement now keeps its texture links apart from its buffer links, a write walks the
texture links alone, and a buffer whose bytes meet only buffers' takes no part (uses() skips it,
and the device's count of placements that take part leaves it out). A check still looks at every
link's read before a move, buffers' included. The same textures move before the same writes.
The RTX 3090's discrete-made recording read +7.8% GPU busy with the form (kernmap 71767): this is
the CPU candidate; its gate and the 3090 arm follow.
The dump extension (1944b82e20) writes each texture a listed command buffer's compute
encoders bind; the covered-word test's encoder binds texture #5, so its compare reads two
dumps. The test's count assertion said so; its expected summary line still said 1.
Verified: gate m3-max-71853 at 1944b82e20 failed only this line (1305 of 1306 passed); the
rerun gate is the one named in the land line.
--dump-command-buffers wrote every buffer a listed command buffer's
encoders named and every colour attachment its render passes stored, so
a texture a compute pass wrote showed only through a later pass that
sampled it. A play that parts between two drivers in a render pass that
samples a compute pass's textures could not say which of the two passes
parted first.
dumps::Stores now keeps the compute encoders made and not yet ended,
and each texture such an encoder binds (setTexture:atIndex: and
setTextures:withRange:, a nil one left out) is a part to dump: its first
level and slice, read once the command buffer completed, as an
attachment's parts are, into cbC-objT.bin with the cover "-". A texture
both stored and bound holds each part once, in Part order. An argument
encoder's setTexture:atIndex: is none: its receiver is no compute
encoder. docs/REPLAY-STREAM.md and the module docs say what a dump holds.
Test: a_listed_command_buffer_dumps_the_textures_its_compute_encoders_bind
(one bound texture, a range with a nil, a texture bound twice, a render
encoder's fragment texture and an unlisted command buffer's compute
texture left out).
Verified: clippy -D warnings over the workspace with all features, and
the validation suite, the new test among them (job in the land line).
The known gaps of indirect command buffers now record what an execution costs on NVIDIA's driver,
each figure with its job and card:
- A guest's frame: +13.6% on an RTX 3090 (3.446 against 3.034 ms, the consumer's jobs
m3-max-64069 and m3-max-64113) against -1.5% on a Radeon RX 7900 XTX (4.305 against 4.372 ms,
m3-max-64076 and m3-max-64084).
- The light frame (a timing test at 2,260 quads a command): +69.0% on the 3090 (1,868.8 against
1,105.9 us, job m3-max-71730) against +28.9% on the XTX (719.7 against 558.4, job m3-max-71686).
- The 3090's 735.5 us over direct, split by a probe (job m3-max-71730):
- each execute call's preprocessing, about 28 us a call (about 4.0 on the XTX), 41%;
- per-draw cost inside the executes, 26%;
- the splits and the parts at the bound, 22%;
- tokens, 9%.
- Explicit preprocessing (`vkCmdPreprocessGeneratedCommandsEXT`) gains on NVIDIA (1,896.7 against
1,909.8 us) and loses on RADV (808.1 against 745.1), so it is not taken.
- A command buffer boundary per render encoder added 18.4 to 52.2 us a frame on the 3090 (job
m3-max-71784, the same draws direct, two builds alternated), so no form adds one.
The figures job 64194 stamped (timestamps around each piece) are replaced by the unstamped ones of
job m3-max-71730. Docs only; the docs check (workspace Rustdoc -D warnings and the doc tests)
follows.
The player refused setTessellationFactorScale: ("not played on a render
encoder"), so a recording that sets the scale stopped at its first
setter. The runtime's render encoder has no scale setter: Metal reads
the scale only in a patch draw through a post-tessellation pipeline
state that enables it (tessellationFactorScaleEnabled), and the runtime
refuses every such state at its making (RenderPipelineKind::Tessellation),
which the play counts as a skipped render pipeline state.
render::factor_scale reads the setter's scale: Metal's default of 1
plays as nothing, and any other scale is a skipped render command of
kind TessellationFactorScale, counted in the report's headline with its
first frame and call. This is faithful only while the runtime refuses
every scale-enabled state; once it builds the scale, its encoder takes
the setter and the player passes the scale on. The code comment and
docs/REPLAY-STREAM.md say so.
The recording that met it (m3-max-71779, read in place, no card): 185
scale setters, every one at 1, the first in frame 409; 0 of its 1668
render pipeline records enable the scale, so no state there is refused
for it.
Test: a_tessellation_factor_scale_other_than_1_is_a_skipped_render_command
(1 as a float and a double, 2 and 0.5, and a scale that is no float).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
The player refused every compute pipeline record whose stageInput was not
nil ("a stage input"), so a recording that makes a kernel with a
[[stage_in]] parameter stopped at that state's frame. The runtime takes
the stage input (ComputePipelineDescriptor::stage_input); only the player
lacked it.
translator::stage_input reads the record's stageInput, {layouts,
attributes, indexType, indexBufferIndex}, into the translator's
StageInputDescriptor the way vertex_descriptor reads a vertex descriptor:
layouts and attributes at their indices, a stride of 2^64 - 1 as
MTLBufferLayoutStrideDynamic, Metal's raw step functions, attribute
formats and index type through their enums, and Metal's unset layout for
a buffer an attribute reads that no layout names. Nil stays no stage
input. A raw value the enums lack, or a key the form does not hold, is
the player's refusal. A descriptor the runtime refuses is the runtime's
typed error: a gap or a translation refusal counts as a skipped compute
state in the play's report, any other error ends the play with it.
docs/REPLAY-STREAM.md states the form.
Test: a_compute_pipeline_record_s_stage_input_is_read (the record form,
a dynamic stride, a buffer no layout names, nil, and an unknown key).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
The instruction bench (job m3-max-71736, lavapipe burst_2000, 2,000 one-dispatch command buffers a
run, A acda405b30 against B 867e059aaf alternated A B B A A B) read own_per_run 50,646,700 against
51,286,684, +1.26%, about 320 instructions a commit: each dispatch walked its slots for placements,
and Building and Segment carried the marks and the part inline. Now the heap ids count the
placements with links (HeapIds::any_linked), and a dispatch, a pass's begin, a draw and a blit
look at their resources' placements only while one has links; Building's marks and a segment's part
are boxed, made at the first touch.
A play's counters carry Metrics::heap_moves, the heap textures' moves from undefined before a
write after an alias's write, so a timed recording shows the path ran on its card.
An attachment of the pass the draw is in is in the pass's layout, not its home: a move from
undefined to home in the pass's interruption would leave it there. Its write at the pass's begin
already took its move where one was owed.
Vulkan's memory aliasing asks that an image over bytes another resource wrote move from
VK_IMAGE_LAYOUT_UNDEFINED before it is used. rt moved a heap texture only once, at its making, so a
device that keeps a compression state beside an image's bytes read the alias's state: on the Iris
Xe (ANV, Mesa 26.2.6) a 512x512 RGBA16Float array written through a 2D view after eight aliased
arrays read 8152 of 262144 texels wrong (job m3-max-71690, the test c26698712c).
The form (crate::alias):
- Each heap texture and heap buffer is a Place, linked at placement with the placements of its heap
whose bytes meet its, both ways and weakly; a release drops its links. A placement with no links
pays one test at each use.
- A write of a placement makes its links stale. A stale texture's next write moves its whole image
from undefined to home, in one barrier from every command's writes to every command's reads and
writes. Reads move nothing; a buffer is never moved. A declared write counts as a write.
- Inside a command buffer, encode order is run order: Building's marks keep each touched
placement's state (fresh, stale, untouched) and the segment its commands last read it in. A write
of a stale one moves in place: before a dispatch, a pass's begin or a blit; inside a rendering,
through the pass's interruption.
- A write of an untouched one adds a check at its segment's head; where the segment read one of its
links before, the segment ends first. The submit thread resolves a segment's checks as it stages
it, in the order the device's one queue runs segments (so a command buffer committed out of its
encode order, or held by an enqueue, is decided where it runs), recording the moves owed into a
command buffer of the cb's recorder staged just ahead of the segment's, in its submit info and so
its vkQueueSubmit2; then it applies the segment's writes. A failed record loses the device as a
failed submission does.
- A texture placed over another's bytes is stale from its making, and its making move waits for
every earlier write (ALL_COMMANDS / MEMORY_WRITE in place of NONE).
- Metrics::heap_moves counts the moves, in place and leading.
No upload piece: a heap texture sits on a Private block and Metal gives a heap's textures the
heap's storage mode, so no Metal-valid replaceRegion reaches one (TextureBytesPrivate).
The README's gap line now says what remains: a read of a stale texture, writes rt cannot name, a
declared write taken whole, the making move's effect on a live alias's bytes, the move's whole
image, and a draw's check at the head of its pass's segment.
Tests: src/tests/alias.rs holds the state machine on every device of the cfg (commit order against
encode order, the segment ended before a check behind an alias's read, moves in place, a draw's
write through the pass, apart placements with no check or move); the red test is
heap_alias.rs's array test. Gate and device runs follow in the next commits.
Eight arrays of 1 to 312 layers (256x256 a4 down to 1x1 a8) and a 512x512 array of one layer,
all ShaderRead|ShaderWrite, Private, at offset 0 of one heap: each written through one 2D view of
its first slice with rows_write and read through another with rows_read, in one command buffer and
with the last array's steps in a second. The shapes are a guest's on the device whose run read the
wrong bytes; the six 2D textures of the first tests pass there at base (job m3-max-71636, Iris Xe,
Mesa 26.2.6).
Six textures of different sizes and formats at offset 0 of one heap, each written whole through
a view of its own (rows_write) and read through itself (rows_read) before the next is written:
in one command buffer, and with each write and each read a command buffer of its own. A third
test takes a program's steps in separate serial compute encoders of one command buffer over two
heaps: B0 written, A written through its view, A read while B is written through its view
(invert_texels), C (over A's bytes) written, then C and B read. Each read must be its texture's
last write.
Vulkan's memory aliasing asks for a move out of VK_IMAGE_LAYOUT_UNDEFINED before an image over
bytes another image wrote is used (vkspec 12.11); the runtime records none after a heap
texture's making (README, the textures' gaps). This is the test the move lands with; it is
expected red on a device that keeps a compression state beside an image's bytes, and is run
there first.
A play asked to dump command buffers (--dump-command-buffers) wrote only
the buffers their encoders named, so a draw's output reached no dump. It
now writes, once a listed command buffer completed, each colour
attachment its render passes stored, as cbC-objT.bin beside the buffers'
dumps, with a cover of "-", so compare-dumps reads them unchanged: a
texture an attachment names under MTLStoreActionStore or
StoreAndMultisampleResolve, a resolve texture under MultisampleResolve or
that one, and an Unknown store action as the encoder's
setColorStoreAction:atIndex: decides it. The dump holds the parts the
passes stored (level, slice and depth plane, or the resolve's), one after
another, each laid out as a check reads a texture's first level and
slice; a part the backend cannot read (a multisample texture stored
without its resolve) is an .unread file.
Colour only: a texture of a combined depth and stencil format reads back
one aspect at a time, through a copy with that aspect's blit option,
which this read does not make. The stream doc and the command's help say
so.
The backend gains Backend::read_texture_part; the runtime's backend reads
a part as its check reads level 0 (the CPU's read, or a blit's copy of a
Private texture), the check's read unchanged.
Verified: by the jobs named in the landing report.
With --state-digests yes (default no), a render state's M2V-STATE modules
line ends in 'digest HEX', the state's RenderPipelineState::content_digest,
which two builds share where they translate the state alike, so a states-only
play of each build names the render states a change moves, by stream object
id (the make's begin line), with no draw. The lines go to the standard output
where no --state-log names a file. A compute state's line carries none.
rt_replay gains a device test: three render states of three contents write
three digests of 64 hex digits, a play of its own on two pool threads writes
the same three, and a play without the flag writes modules lines with none.
Verified: not yet (gate and device tests follow).
No Metal counterpart. It is the translator's RenderPipeline::content_digest:
both stages' modules, the layout, the vertex input, the fixed-function state,
the interface, the runtime dependencies, the requirements and the variant
bits, and no version of either crate, computed once per content when its
translation is made and kept beside it (32 bytes). A player that prints it
beside each state make tells which render states two builds translate
differently.
state_answers gains a device test: two states of one content answer one
digest, the translator's own compile of the descriptor answers the same,
and another fragment function answers another. api_signatures gains the
method's row.
Verified: not yet (gate and device tests follow).
29b659121e measured the memory-class line by the RTX 3090's frames 366
and 367 (about 378 s), from two arms that exited 124 at their caps on a
card whose driver then wedged (d876f56b82 added that). The planner
asked for a clean pair instead: whole plays, exit 0, on one card. On
the RX 7900 XTX the integrated-made recording took 257.2 s of compute
(m3-max-71531, all 430 frames) and the discrete-made recording of the
same benchmark 10.7 s (m3-max-71625, all 345 frames). The wedge
sentence goes too: it is a lab artifact of those killed plays, kept as
a row in the bug list, not a property of recordings.
Verified: the docs check follows as a job.
After lane kernmap's two plays of the Intel-made compute recording on
um870's RTX 3090 were stopped at their time limits inside frame 368
(m3-max-71535, 09:28-09:41, and 71553, 09:42-09:57), the card's
telemetry froze from the first sample after the second (09:57:33) and
the driver logged Xid 119 (a GSP RPC timeout, fn 76) at 10:08:36, naming
no process; the node was rebooted. The consumer read its journal and
job log: no guest run touched the card from 08:34:40 until then, and
the driver's out-of-memory group at 09:57 is routine at card open (13
times that day). The planner ruled it a lab artifact of those plays, no
row, written beside the memory-class line.
Verified: the docs check follows as a job.
Lane kernmap played the consumer's GPU compute benchmark recording, made
on an Intel integrated card, on the RTX 3090 (pin R; m3-max-71535 and
71553, P0, both capped inside frame 368, 0 refused). Frames 366 and 367
alone took about 378 s of GPU-busy time, against 257.2 s for the whole
play on the RX 7900 XTX and 74.3 s on the integrated 780M. The
consumer's own guest on the 3090 runs the same benchmark's workloads in
37.1 s of GPU time in all (native 33.4 s), and its recording of the
same run on the discrete AMD card is 1.3 GB, against this one's 25.3
GB: the Shared storage an integrated guest builds on. The planner ruled
the 3090's frames play-only, and that a recording times only on its own
memory class. The replay doc now says so beside the timing verdict
rule.
Verified: the docs check (workspace Rustdoc, -D warnings) follows as a
job.
What changed: a fragment function's quad operations read their quad by
quad instructions, and in a block every invocation runs, with no vote
(the translator commits before this one), so its module's words change
under an unchanged key. Development holds 2295 at 155bbf2712: this is
the next free number.
The private rows whose modules change (5 of the 20 fragment rows with a
quad operation; none in a held recording): 2 whose quad mask was one
OpGroupNonUniformBallot of true are the constant 0xF with no group
instruction, and 3 with reductions go from 20 quad votes to 8, keeping
their 20 quad broadcasts (counted at the whole-quad commit before the
rebase, 3da9220ac9, job m3-max-71505, against development 82d1c62eb5, job
m3-max-71517).
Verified: the gate of this series on 155bbf2712 (job m3-max-71539), every
step green but golden_hashes, whose bless (266 cells under this number) is
due at the next pin; and the jobs named in the commits before.
In a whole quad every lane takes part, so a quad read needs no
participation test: the source lane's low bit picks within each row and
its high bit picks the row, three selects where the chain took four
compares, four ANDs and four selects. Divergent blocks keep the chain.
With the chain, the timing probe's fills kernel was 9.3% slower than
development 82d1c62eb5 on the RTX 3090 (job m3-max-71520, passes 2 and 3)
and 3.6% slower under RADV on the Radeon 780M (job m3-max-71521). With the
three selects (steelbrain/ballotread-whole df043417b2), GPU time per draw,
medians, development 82d1c62eb5 against this form, arms alternated in one
job, the validation layer off:
- RTX 3090 (NVIDIA 620.70.06), passes 2 and 3, job m3-max-71540: masks
-0.1%, scans -0.8%, reads 0.0%, moves 0.0%, fills 0.0%.
- Radeon 780M under RADV (Mesa 26.2.6), job m3-max-71541: masks +0.1%, scans
-38.1%, reads -2.2%, moves -11.5%, fills -10.8%.
The arm is speculated as Metal's backend speculates it (air::canon::speculate),
so the broadcast runs in its branch's block, which every invocation executes:
one QuadBroadcast of lane 0, no QuadAny. The counts the test checks are the
translation's own instructions (QuadAny, QuadBroadcast, QuadSwap, Ballot):
[0, 1, 0, 0], where the vote form held [4, 4, 0, 0] (gate m3-max-71496 of the
whole-quad form read the new counts).
Metal's word: case 7dfa73fb34fd6419c2ba6b82689ff4be49bc5e162e1b0e80b42af7505ba89d32
(quad-broadcast-first-in-a-fragment-arm-metal-speculates, this entry over an
8 by 8 target, sixteen full quads), qualified on the Apple M3 Max under macOS
27.0.1 (and 26.7), metal_output_sha256
70cde064a2915a25e4a97ed846de7f388a5130ccf3fe9c71a7705132cdb962ca
(corpus/observations/metal/shard_052.jsonl): all 64 pixels hold their quad's
lane 0 value, the 12 pixels whose lane 0 takes no arm included (pixel (1, 0)
reads 0.0, lane 0's value, where the first lane that takes the arm would give
1.0). Metal runs the arm on all four lanes and reads lane 0, which is the
whole form's QuadBroadcast of lane 0.
quad_control's QUAD_READERS gains quad_masks_divergent: quad_masks' operations
under a branch on the pixel's x being odd, so quad lanes 1 and 3 take part,
helpers included. The masks test asserts that function's fragment stage holds
quad votes and the whole-block ones none, and prints each function's vote
count; the shuffles test asserts its whole-block functions take no vote. A new
test draws fragment_quad_bitwise over the whole of a 7 by 7 target, so the
quads of its last column and row hang past it, and checks every pixel's quad
AND, OR and XOR of the four pixels' words, those past the target included.
Verified: 0 of the 6 quad_control tests failed on the RTX 3090 (NVIDIA
620.70.06, job m3-max-71540) and on the Radeon 780M under RADV (Mesa 26.2.6)
and AMDVLK 2025.Q2.1 (job m3-max-71541), at steelbrain/ballotread-whole
df043417b2 (this series before its rebase onto 155bbf2712), with
quad_masks_divergent holding 8 quad votes and the whole-block functions none
on each; and on lavapipe at this series' tip in its gate (job m3-max-71539).
A fragment's quad is whole in a block every invocation executes together
(uniform::Uniformity, every stage input divergent): the entry declares full
quads, a quad's helpers run the block as its covered invocations do, and a
discarded invocation runs on as a helper or a predicated lane. So such an
operation's active quad mask is all four lanes: quad_active_threads_mask is
the constant 0xF, quad_is_first is quad lane 0, quad_broadcast_first is
QuadBroadcast from lane 0, a quad ballot gathers each lane's bit by a
horizontal and a vertical QuadSwap, a constant broadcast or shuffle-xor is
its quad instruction, and the other reads, scans and reductions read the
quad's lanes by QuadBroadcast with no QuadAny vote in front. A quad operation
under a branch on the pixel, and every one of an entry Metal runs once per
sample, keeps the votes.
A quad operation under a branch on the pixel keeps its votes, and that is
this form's one cost: the timing probe's quad_masks_divergent kernel (quad
masks under a branch on x being odd) is slower than development's single
ballot. GPU time per draw, medians, development 82d1c62eb5 against this
series' form (steelbrain/ballotread-whole df043417b2), arms alternated in one
job, the validation layer off:
- RTX 3090 (NVIDIA 620.70.06): 387.5 -> 459 us, +18.5% (passes 2 and 3; the
base's first pass is a warm-up outlier), job m3-max-71540.
- Radeon 780M under RADV (Mesa 26.2.6): 1918 -> 2387 us, +24.4%, job
m3-max-71541.
The single ballot gives wrong values under AMDVLK, which leaves a partly
covered quad's helpers out of its ballots; no Vulkan query tells that driver
apart; and no private row holds a quad mask operation in a divergent block.
Verified: the gate of this series on 155bbf2712 (job m3-max-71539), the card
jobs named in the rt test's commit, and the 24 public fragment cases that
call a quad or SIMD-group function through corpus-vulkan against the M3
Max's macOS 27.0.1 observations, this series on 155bbf2712 (at b78fc00c36)
against 155bbf2712 itself: on the Radeon 780M under RADV, 16 match on both
(job m3-max-71560); under AMDVLK 2025.Q2.1, 13 match on development and 16
here, the quad fills, the fills and rotations and one helper-thread case
newly matching, and every other output equal to RADV's but one SIMD-group
fill's, unchanged (job m3-max-71560); on lavapipe, equal outputs on all 24
(job m3-max-71539). No case is worse on any of them. The RTX 3090's run
follows the merge.
What: QUAD_READERS gains quad_reads (quad_shuffle from quad lane q ^ 3 and
quad_broadcast from lane 1 of the pixel's word) and quad_moves
(quad_shuffle_xor by 1, quad_shuffle_down, quad_shuffle_up and
quad_shuffle_rotate_down by 1), drawn as the masks and scans are and held
to Metal's answers and to a fragment stage with no OpGroupNonUniformBallot.
Why: AMD's open Linux driver leaves the helpers out of a shuffle. Metal's
answers for both draws: the same functions in MSL on the M3 Max (macOS
27.0.1), job m3-max-71024, 0 pixels differ from the test's model.
Verified: red at the previous commit's parent and green at this commit,
by the device runs named in the landing report.
What: every fragment quad operation now reads its quad through
OpGroupNonUniformQuadAnyKHR and OpGroupNonUniformQuadBroadcast alone, as
its reductions, scans, ballots and votes do: a shuffle, shuffle-xor,
relative shuffle, rotation, broadcast by lane or fill reads quad lane j's
value by the quad broadcast from j where lane j's quad vote says it takes
part, and the calling lane's own value where the lane it names takes none
(MSL leaves that read undefined). The reads of one block share its four
votes and each value's four lanes, as the block's other quad operations do.
Such a read is no longer a partly live
read, so it takes no ballot of the live lanes. A fill by a constant modulo
whose segment is wider than the quad reads past it and keeps the shuffle
through the live lanes' ballot. Kernels and vertex functions keep their
forms. Nothing of the ballot form became unreachable: vertex functions and
kernels still take each of its paths.
Why: AMD's open Linux driver leaves a quad's helpers out of a shuffle
even under MaximallyReconvergesKHR and RequireFullQuadsKHR. Job
m3-max-71001 (AMDVLK 2025.Q2.1 on the RX 7900 XTX and the Radeon 780M):
quad_shuffle, quad_shuffle_xor, quad_shuffle_down, quad_shuffle_up and
quad_shuffle_rotate_down 4 pixels wrong per draw, quad_broadcast from lane
1 12 of 36, each the answer with the helpers left out; RADV right on both
cards. Metal's answers for these draws: the M3 Max (macOS 27.0.1), job
m3-max-71024, 0 pixels differ.
Product lines: group.rs and mod.rs, code +68 -9, comments +35 -21.
Verified: the compile job and the device runs named in the landing report.
What changed: a fragment's quad operations read their quad through quad
instructions alone: four OpGroupNonUniformQuadAnyKHR asking whether each quad
lane takes part, and four OpGroupNonUniformQuadBroadcast of the value read.
Each operation made its own, so quad_masks' ballot, active mask, is_first and
first lane's broadcast made 16 votes. Now the emitter keeps, for the open
SPIR-V block, the four votes and the four lanes of the last 8 values read
(QuadSeen, held in EmitCx and reached through the Lane). Every operation of a
block runs on the same active lanes, so they share them. Another block starts
afresh, so nothing crosses a branch, a discard or a merge. A ballot of a
predicate keeps its own four votes.
Why: on the Iris Xe (Mesa 26.2.6) the quad form took quad_masks from 4217 to
8203 GPU us in the timing probe (+94.5%), against the 3% bound.
The translator tests' counts follow: fragment_quad_scans and
fragment_quad_bitwise take 4 votes and 8 lane reads (two values' four each),
where they took 16 and 16.
Verified with this tree's compile job and the Iris timing (named in the
landing report).
What: QUAD_READERS, two fragment functions beside quad_votes: quad_masks
writes quad_ballot of x > y, quad_active_threads_mask, quad_is_first and
quad_broadcast_first of the pixel's word, quad_scans its exclusive and
inclusive quad prefix sums. Each is drawn by the triangle that covers x <=
y and by the one across the same edge, so each diagonal quad holds one
helper and then three, quad lane 0 among them. The test checks each
covered pixel against Metal's answer, counts the wrong pixels that hold the
answer with the helpers left out, and holds the fragment stage to no
OpGroupNonUniformBallot.
Why: the helpers are active lanes in Metal (MSL 4.1 sections 6.10.2 and
6.10.3), and AMD's open Linux driver leaves them out of a ballot. Metal's
answers for both draws: the same functions in MSL on the M3 Max (macOS
27.0.1), job m3-max-71024, 0 pixels differ from the test's model and each
draw wrote exactly its covered pixels.
Verified: red at the previous commit's parent and green at this commit,
by the device runs named in the landing report.
What: in a fragment function, quad_ballot, quad_active_threads_mask and
quad_is_first take quad lane j's part from OpGroupNonUniformQuadAnyKHR of
"the quad lane is j" (and of the predicate, for the ballot), and
quad_broadcast_first and the quad prefix sums and products take lane j's
value from OpGroupNonUniformQuadBroadcast under that vote: the form the
fragment's quad reductions already take. Their operation class is the quad
class. Kernels and vertex functions keep the ballot form. Two translator
tests: the operation classes, and fragment_quad_scans and
fragment_helper_threads holding quad votes and broadcasts and no ballot on
every committed profile with quad control.
Why: Vulkan runs quad instructions over a quad's helpers in every entry
(section 9.31), and AMD's open Linux driver leaves the helpers out of a
ballot even under MaximallyReconvergesKHR and RequireFullQuadsKHR. Job
m3-max-71001 (AMDVLK 2025.Q2.1 on the RX 7900 XTX and the Radeon 780M,
pixels wrong in the x <= y draw, then the x > y draw): quad_ballot 12 of
36 and 0 of 28, quad_active_threads_mask 12 and 4, quad_is_first and
quad_broadcast_first 0 and 4, the two prefix sums 8 and 4, each wrong
pixel the answer with the helpers left out; RADV right on both cards.
Metal's answers for these draws: the M3 Max (macOS 27.0.1), job
m3-max-71024, 0 pixels differ.
Product lines: group.rs and mod.rs, code +105 -24, comments +56 -39.
Verified: the compile job and the device runs named in the landing report.
What: one known gap under the render pipeline states. Under AMDVLK
2025.Q2.1 on the RX 7900 XTX and the Radeon 780M, a fragment function's
SIMD-group operations leave out a partly covered quad's helpers, though
the entry declares MaximallyReconvergesKHR and RequireFullQuadsKHR; RADV
is exact; no exact form exists; it is the driver's bug.
Why: job m3-max-71001 (the rt device test's SIMD-group functions at
c894c5b5b3, AMDVLK and RADV on both cards in one job). Under AMDVLK on
both cards, with equal counts, pixels wrong in the x <= y draw:
- simd_ballot and simd_active_threads_mask: 12 of 36, each the answer
with the helpers left out;
- simd_any and simd_all: 12 of the 12 pixels whose answer the helper
decides;
- simd_sum: 12 of 36; the simd prefix sums: 8 of 36;
- the simd shuffles: 4 per draw, each the answer with the helpers left
out;
and in the x > y draw simd_is_first and simd_broadcast_first 1 of 22.
RADV (Mesa 26.2.6) read every word right on both cards. That test is not
committed: on lavapipe simd_broadcast_first differs too and its other
SIMD-group functions are refused (subgroup size 8), so the test that lands
holds the quad functions alone.
At pin T the golden hash table still recorded SEMANTICS 2294. 14
fixture rows (7 fixtures, .ll and .air.ll: kernel_block_read,
texture_ops, txt_level_cube_write, txt_level_queries,
txt_level_read_write and two more) change 206 cells from
Unsupported{IdentityDomains; NotImplemented} to a module hash, plus one
hash cell. That is rtlevel's storage levels under the identity domains
(0e51949ef1). No cell goes from a module to a refusal.
Blessed by ~/.cache/m2v-orch/bless-job.sh at 155bbf2712 on the M3 Max
(job m3-max-71579: inventory 0, golden 0, printouts 0; only
golden_hashes.tsv changed). The patch applies unchanged on
development's tip, whose commits since T touch docs and one player
comment only.
docs/REPLAY-STREAM.md said that only an indirect command buffer, "which
the runtime does not build", would read a pipeline state's resource ID.
The runtime builds indirect command buffers; the player is what does
not: making one is "not played on a device" and executing one "not
played on a render encoder" (new_runtime/mod.rs, render.rs), typed
refusals that end the play. The doc now says so beside the refusal rule,
and names what would read a pipeline state's ID: an argument buffer's
pipeline-state member, which the runtime refuses at the making of a
state whose function reads it (rt README, known gaps). The player's
comment on that ID drops the same stale reason.
Verified: the docs check (workspace Rustdoc, -D warnings) follows as a
job.
The runtime README's known gap for AMD's open Linux driver on the Radeon 780M said only that
Device::import_host_memory of the guest's pages fails in vkAllocateMemory with
VK_ERROR_INVALID_EXTERNAL_HANDLE. It now says why, as a consumer needs to know it: both AMD Linux
drivers on that card (AMDVLK 2025.Q2.1 and RADV 26.2.6) import a pointer to private anonymous
pages only, and refuse shared or file-backed pages, which the guest's memfd mappings are.
Verified: m3-max-71516 (gem10's 780M, both drivers) imported MAP_PRIVATE anonymous pages and
failed with VK_ERROR_INVALID_EXTERNAL_HANDLE for a memfd's shared mapping and for
MAP_SHARED|MAP_ANONYMOUS pages, while vkGetMemoryHostPointerPropertiesEXT offered the same types
for all three. Docs only.
A storage slot written, read or size-queried at a run-time level under the identity domains was a
refusal (Unsupported{IdentityDomains}) and is a module since 0dec15d410, under the same key, so
cached translations of it are stale. The same commit adds PushField::TextureLevelBase to the cached
artifact's codec. Development holds SEMANTICS_VERSION 2294 and ARTIFACT_FORMAT_VERSION 593 at
17473a1a42: these are the next free numbers.
The form's cost on each card, once per device (a VM holds one), base against the written form,
arms alternated in one job per card, the validation layer off:
- RADV on the Radeon 780M (Mesa 26.2.6): Device::new +1,659 us (13,228 -> 14,887 us, +12.5%);
device memory +2,097,152 B (65,536 x 32 B, in the DRM fdinfo totals and the memory budget), host
heap +16 KB (job m3-max-71086).
- AMDVLK 2025.Q2.1 on the Radeon 780M: Device::new +293 us (3,352 -> 3,644 us); device memory
+4,202,496 B in the DRM fdinfo totals, host heap +16 KB (job m3-max-71086).
- ANV on the Iris Xe (Mesa 26.2.6): Device::new +0.28 ms (8,114 -> 8,390 us, +3.4%); host heap
+3,162,128 B (ANV's 48-byte host descriptor per element, allocated at pool creation), device
memory +2,621,440 B in the DRM fdinfo totals, 0 in the memory budget (job m3-max-71073).
- NVIDIA 620.70.06 on the RTX 3090: Device::new +0.6% (99,187 -> 99,761 us); host heap +278,296 B,
memory budget +0 (job m3-max-71091).
The dispatch loop per command buffer on the Iris Xe moved by at most 1.4% (job m3-max-71022).
A run-time-level write or read, or get_num_mip_levels of a storage texture, under the identity
domains pushes the texture's level count (TextureLevels) and, for a write or read, the first of
its level elements (TextureLevelBase). Nothing showed that path ran: a case that matches on
a device could match without it. The new metric counts each recorded dispatch or draw whose push
carries either field. A dispatch or draw takes the fact from the scan its checks already make
once per change (DispatchFacts / Facts::find). No Metal counterpart.
Evidence lines: the conformance replay prints "level fields: CASE on DEVICE: N ..." per case.
The validation runtime executor prints "level fields: CASE: N ..." to stderr. The replay
player's metric list carries level_field_commands.
Tests: storage_levels gains every_device_counts_the_dispatches_that_push_level_fields. One
level-write dispatch counts 1, and one get_num_mip_levels dispatch counts 1 more and stores 4.
The fragment test's three draws count 3. Signature table blessed. REFUSALS.md is unchanged (the
script does not cover Metrics). Before commit: cargo fmt only. The device tests run in the
lane's gate jobs.
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).
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.
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).
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.