scripts/regen-air-fixtures/regen-air-fixtures.sh fragment_rog on the M3
(potluck job m3-max-13255; Metal 32023.922, SDK 27.2); TOOLCHAIN now
records the fixture under that toolchain. rog_discard loads acc[0]
after its discard.
(cherry picked from commit b603645a19547e9f4430b2bc588716797cce6a5a)
The closure that lists the used parameters returns an iterator whose
filter borrowed the set through the closure; it now moves a reference
to the set in, so the iterator outlives no borrow of the closure.
(cherry picked from commit d6cfe6dbfe3f5e7bb52c879ba0b6df47e16e12c8)
Three choices read a fragment function's declared parameters where the
specialized body's uses decide, which a Metal probe
(dead_ordered_and_unattached_reads.m, M3 Max, macOS 27.0.1) separates:
- A raster order group on a parameter the body never uses orders no
access. lower::fragment::rog::declared interlocked such a function
(and refused it RasterOrderGroups on a device without an interlock,
and kept it from the coverage loop); it now counts only used
parameters, the layouts they reach, and a color output whose
attachment a used color input reads. Metal makes and draws dfr_color,
dfr_buffer and dfr_output with the read dead as with it live.
- In a pipeline of more than one color group, color_group::entry refused
a raster order group on any parameter; it now refuses one on a
parameter the body uses (and on a color output, as before).
- A [[color(n)]] input without an attachment is Metal's pipeline error
whether or not the body reads it ('Shaders reads from a color
attachment whose pixel format is MTLPixelFormatInvalid', dead and
live). Since fetch_inputs counts only used inputs, a dead one beside a
pipeline without its attachment compiled. pipeline::compile's
color_inputs_attached refuses it, InvalidDescriptor(ColorAttachment),
against the pipeline's own attachments (a color group's present
colors), before the group renumbers it. stage_io's zeroed_output keeps
refusing a declared color input of a zeroed color, which is no
pipeline Metal makes.
The reading of a used parameter is one function, lower::users::params_used
(the compile's params_used and the dispatch's used_params were copies).
SEMANTICS_VERSION 2012: such functions compile without an interlock,
pipelines of groups compile where they were refused, and the dead
unattached input is refused where it compiled.
Verified: see the test commit's negative control; this commit's run
follows.
(cherry picked from commit 0acde1e4312f218273c244423f76333dd1704c76)
rog_discard named a raster order group on a buffer it never read, and
stood for an interlocked discard. A group on a parameter the body never
uses orders nothing, so it now reads the buffer after the discard
(in.color * acc[0]), keeping it an interlocked discard. The companions
follow from scripts/regen-air-fixtures on the M3.
(cherry picked from commit 6a2e4a3c955d10ac2fe3c7715e56e743d78a4d13)
Over dfk_dead_rog, against the Metal probe dead_ordered_and_unattached_reads.m:
- tests::engine_dead_reads: a raster order group on an input the body
never reads (dfr_color, dfr_buffer, dfr_output) compiles without an
interlock on lavapipe, moltenvk-m3, moltenvk-m3 without interlock and
(dfr_output) vk12-floor, as Metal draws them; live, each interlocks
where the device has the pixel interlock and is refused where it has
neither. A color input without an attachment (dfr_lacks beside color 0
alone) is InvalidDescriptor(ColorAttachment) at index 1 dead and live,
as Metal refuses both pipelines.
- tests::engine_color_groups: dfr_color and dfr_buffer dead over five
colors on devices of four compile in both groups without an interlock;
live, group 0 is the limit refusal.
This commit adds the tests alone, the negative control at the base
(development e51d85e18d).
(cherry picked from commit 10574778f72ae78164052aba2828215a8a8ccd1c)
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_rog on the M3
(potluck job m3-max-13240; Metal 32023.922, SDK 27.2); TOOLCHAIN
records the fixture under that toolchain. dfr_color's, dfr_output's and
dfr_lacks' reads compile to a select on the loaded constant, dfr_buffer's
to a branch around the buffer's load.
(cherry picked from commit 64ef2bad2517eea662c9cd985e8edc102afa858e)
A Metal probe over dfk_dead_rog's functions (source repeated, with
cg_cover): a color input in a raster order group, a const device buffer
in one, a color input of an output in one, and a color input of a color
the pipeline lacks, each made with its function constant false (dead)
and true (live), drawn once over an 8x8 pass. It prints whether the
state is made and, for each color, how many texels are the closed
form's. Measurements follow in a later commit.
(cherry picked from commit 8294732003b73ccf97f6f9d2c62ee3a34ff31e70)
Owned MSL for cg_cover's interface: a color 0 input in raster order
group 0 (dfr_color) and a const device buffer in group 0 (dfr_buffer),
each over five colors; a color 0 input written back to a color 0 output
in group 0 (dfr_output); and a color 1 input beside a color 0 output
alone (dfr_lacks). Each read sits in the arm of a branch on a bool
function constant. The companions follow from
scripts/regen-air-fixtures on the M3.
(cherry picked from commit 049f1b4176e5b515042f28c13cc86c4ccbafbbe9)
SEMANTICS 2011 (e51d85e18d): the new owned fixture engine/dfk_dead_group adds its golden cells, inventory rows and air_input printout; the census follows the new product fingerprint.
Its product fingerprint follows development's versions at e51d85e18d. Blessed on the
M3 (s37-pl.sh censusbless --bless).
(cherry picked from commit a96b41bf2409299f21b72547821a5e78083b5f9c)
SEMANTICS 2011 (e51d85e18d): the new owned fixture engine/dfk_dead_group adds its golden cells, inventory rows and air_input printout; the census follows the new product fingerprint.
Blessed on the M3 (s37-pl.sh bless: bless_engine_inventory, the air_input printouts,
bless_golden_hashes, then the check step).
(cherry picked from commit be753120be7560baec839dd8504459647ae7ad6f)
docs/API.md's color groups paragraph lists what each group's draw would
read from another group as the pipeline's limit refusal; a
[[color(n)]] input of another group is that only where the specialized
function reads it, as pipeline::compile::color_group::entry now decides.
(cherry picked from commit 1df7b9589dc6bda472d3faaa14bf432677647658)
The color groups lane gains a dead read scene over dfk_dead_group:
dfg_branch and dfg_gated, specialized with their read of color 4 dead,
draw a pass of colors 0 to 4 as Metal's closed forms (tint and its
swizzles), in two groups on the device restricted to four (one group
pass past the first, no twin) and in one where the device draws every
color at once. On the restricted device dfg_branch specialized live is
the pipeline's limit refusal, as before.
(cherry picked from commit c9d8b0718565dcc2d9b2caf10b5410e50b6ebdb4)
What: pipeline::compile::color_group::entry refused, in a pipeline of
more than one color group, every [[color(n)]] input of another group
the specialized fragment entry declares, used or not. A function whose
read of such a color its constants make dead (a branch on a bool
constant that Metal's compiler turns into a select, folded by SCCP)
was the pipeline's limit refusal on a device of four color attachments,
though it reads nothing there and the variant compiles as a plain
writer of its group's colors. It now refuses only an input an
instruction of the specialized, canonicalized body uses (params_used,
the reading fetch_inputs and the lowering take); an unused one is
renumbered past the group's colors as before. A raster order group on
a color input is still refused in a split, used or not.
SEMANTICS_VERSION 2011: such pipelines compile where they were refused.
Verified: see the test commit's negative control and this commit's
run of tests::engine_color_groups.
(cherry picked from commit d10372c768e96b10e960810b9eec87c891a694d4)
tests::engine_color_groups gains a test over dfk_dead_group: five colors
on a device of four (lavapipe and moltenvk-m3 narrowed to four, and
vk12-floor) draw in two groups, color 4 in the second. Specialized with
the read of color 4 dead, each group's variant of dfg_branch and
dfg_gated must compile as a pipeline of its group's attachments that
reads none, passing L3; specialized live, group 0's variant must be the
pipeline's limit refusal. Misses are counted by kind before failing.
This commit adds the test alone, the negative control at the base
(development 4d187515d7).
(cherry picked from commit f41511c12bc63a3cdb31b2f92f4de585a32da3b9)
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_group on the
M3 (potluck job m3-max-13159; Metal 32023.922, SDK 27.2, LLVM 21.1.8);
TOOLCHAIN records the fixture under that toolchain. dfg_branch's branch
compiles to a select on the loaded constant.
(cherry picked from commit 032fcf3bc3849aa395f323ac6562636165d42475)
Owned MSL: a fragment function of five colors that reads color 4 in the
arm of a branch on a bool function constant (dfg_branch), and one whose
color 4 input the constant gates (dfg_gated), for cg_cover's interface.
A device of four color attachments draws the pipeline in two groups,
color 4 in the second. The companions follow from
scripts/regen-air-fixtures on the M3.
(cherry picked from commit 1ff9b1320844b578b812da5db51715697d8d1fa9)
SEMANTICS 2010 / ARTIFACT_FORMAT 498 / RT 2000 at 67db4d8274: heap decodes of raw-held textures now carry DevicePackConversion (golden cells of float heap readers move); the mesh point-size note only for point output (SEMANTICS 2009); the census follows the new product fingerprint.
Its product fingerprint follows development's versions at 67db4d8274. Blessed on the
M3 (s37-pl.sh censusbless --bless).
(cherry picked from commit f0cb5a64c765a08b41a7ccb518a45e6e4f9a5207)
What: the two commits before this one (heapnote, steelbrain/heapnote 1ab403b671):
a heap texture read, sample or gather that decodes a raw-held texture records
PrecisionNote::DevicePackConversion as a note conditional on the new
SpecKey::HeapRawTextures(Stage), set by the binding plan from the textures a
command makes resident or binds; the runtime announces it at such a draw or
dispatch (an announcement: RUNTIME_VERSION 1999 -> 2000). SEMANTICS_VERSION is
2010 (the branch's 2008 bump, resolved above development's 2009) and
ARTIFACT_FORMAT_VERSION 498 (a new SpecKey variant). The pin follows.
Verified (heapnote): negative control at base (gem10 job 13076): the float read
on amd-780m-hawkpoint-radv lacks the note; touched tests 104/104 (13082); plain
clippy, rustdoc and the core suite 5342/5342 (13096); heap_extended_reads lane
9/9 with m2v_cpu_icd clippy on lavapipe (13145) and 9/9 on the Radeon 780M (RADV
PHOENIX, um790 job 13192), its new test announcing the note at a dispatch holding
BGRA10XR and not at the pipeline's making or an RGBA8Unorm-only dispatch;
m2v_gpu clippy (13196). Generators and api-signatures --check unchanged at
landing. Golden tables and the census move for float heap readers: re-blessed on
development next.
A float or half read, sample or gather through an argument buffer that
decodes a texture the heap holds by its raw texels alone (BGR10_XR,
BGRA10_XR, R10Unorm_X6, RG10Unorm_X12 and the bfloat formats; the
heap_raw routine) converts by the device's arithmetic, as a slot's decode
of the same texel does, but recorded no PrecisionNote: a reader of the
module alone saw no near-equivalent, against AGENTS.md's "allowed only
when the artifact records it".
The decode is planned in one place now, texture::heap_raw::plan, which
both the read (select_read_as) and the emulated sample or gather
(heap_raw_sample) call. It records DevicePackConversion as a specialized
note with one clause on a new bound-value key, SpecKey::HeapRawTextures
(stage): a texture the stage's handles can name is held raw. The binding
plan gives the key from the command's heap members (resident or bound
textures, as for HeapYCbCrTextures), so the note is in the module's
notes, holds under precision_notes_bound exactly where the command can
name such a texture, and the runtime announces it at that draw or
dispatch (degrade_bound_values) and never at the pipeline's making. A
stage that records the note outright for another conversion keeps it
outright. Heap accesses that reach no such texture (queries, integer
reads, storage reads, samples the function does not emulate) record
nothing.
NoteOn::HeapTextures is renamed HeapYCbCr beside the new HeapRaw.
bind::heap::raw_held is pub(crate) for the plan. The heap set's own
announcement naming the texture (heap_sets::RawRead) stays.
SEMANTICS_VERSION 2008 (heap-reading modules gain the note);
ARTIFACT_FORMAT_VERSION 498 (a SpecKey variant). api_signatures blessed;
REFUSALS.md regenerated (unchanged). docs/API.md's catalogue and the
runtime's Degradation docs say where the note is recorded and announced.
Tests: heap_decodes_record_the_device_pack_conversion now also asserts
the one HeapRawTextures clause; the new
a_heap_decode_s_note_holds_where_its_command_can_name_a_raw_texture checks
the plan's key and the bound note on every committed profile; the lane
a_heap_decode_s_stage_note_is_announced_where_its_command_can_name_a_raw_texture
checks the runtime's announcement under announce_each.
(cherry picked from commit 1ab403b671f18773a10c8572ffbe0a73b56f5bbc)
A heap read, sample or gather that decodes a texture the heap holds by
its raw texels alone (extended-range, padded and bfloat forms of
ExtendedRange::HEAP_READ) converts by the device's arithmetic, as a slot's
decode does, but records no PrecisionNote::DevicePackConversion. The new
test translates a float and a half read, a nearest sample and a float
gather of such a heap group (each must record the note), and a width
query, a uint read and a mip-filtered sample (no decode, no note), on
every committed profile with a sampled heap.
Expected to fail here (the decodes record no note); the fix follows.
(cherry picked from commit 17921ada610252bd986fb095e84b10d68fe3347c)
What: the five commits before this one (smallfix, steelbrain/smallfix f0e090d94d):
- a mesh function records PrecisionNote::DevicePointSize only where its mesh
topology is points (translation changes: SEMANTICS 2008 -> 2009; the branch's
own bump collapsed into deadfetch's 2008 on its rebase);
- the CpuBlockDecode notice's cost text says what twin_decode.rs does (an
announcement's text: RUNTIME_VERSION 1998 -> 1999);
- docs: visibility venues, DeviceSampling's subnormal coordinates (FAST-PATHS,
API.md, 27 known-gaps rows), SharedEvent::reserve_vk_signal's queue rule;
- conformance tile states state maxTotalThreadsPerThreadgroup (8 recordings
re-recorded on the M3, answers unchanged); one oracle message's spaces;
- the loader's instance extension list read in one call (room for 64,
doubled on VK_INCOMPLETE).
The runtime-sources pin follows.
Verified (smallfix): um790 job 13171: 25 translator tests (mesh test, fast_paths
ledger), 22 runtime degradation/catalogue/keeper tests, 41 conformance tests
pass; negative controls: the mesh test fails at engine_mesh.rs:643 with the fix
reverted; workspace rustdoc -D warnings ok. M3 job 13144: conformance and
validation clippy, qualification_contracts pass. um790 jobs 13183/13186 at
f0e090d94d: m2v_gpu and m2v_cpu_icd clippy over metal2vulkan, runtime,
conformance, validation; listed_extensions and keeper tests 5/5. Loader scans per
device-making process (um790, lavapipe, VK_LOADER_DEBUG): 11 at base, 5 with the
first read change; the one-call read's negative control and caller table are
pending (job 13193). Generators and api-signatures --check unchanged at landing.
Not run: the full suites and the census (development's checks).
5c0c2236ad read the list once per instance creation, but through ash's
two-call read: a count call, then the list call. Each
vkEnumerateInstanceExtensionProperties is a loader scan of its driver and
layer manifests, which loads each driver it finds. On a host with NVIDIA's
driver package and no NVIDIA GPU, reims measured 0.25 to 0.7 s per scan
(~/.cache/rvg-m2v-handoff/loader-scans, 11-07), and its ask was one call
into room for the list, again with more room on VK_INCOMPLETE.
ListedExtensions::of now does that: one call into room for 64 extensions
(a loader lists 20 to 26 on our hosts), then twice the room while the loader
answers VK_INCOMPLETE. A process's runtime scans fall from 4 to 3: one list
read, the device's vkCreateInstance and the keeper's.
Verified: tests::listed_extensions counts every call of a fake loader. An
instance's making makes 1 (it made 2 at 5c0c2236ad, as ash's read takes
two), and a 96-extension list past the first room takes 2 calls and is read
whole.
(cherry picked from commit f0e090d94d64040144dae867cad7e3a2a00f943c)
Two test-only fixes.
The conformance suite's tile states left maxTotalThreadsPerThreadgroup at
Metal's 0 unless a case limited them. A tile state of no limit is answered
from Metal's compiler history: Metal keeps a tile pipeline it compiled and
answers a later descriptor of the same function that differs only in
requiredThreadsPerThreadgroup with the first one's limit, in the same process
or a later one (measured on the M3 Max, macOS 27.0.1; the validation oracle's
tile pipelines state their limit for that reason since ORACLE_ABI 49). So a
re-record could take another pipeline's answer. TilePipelineSpec now carries
an explicit u32 limit, as ComputeLimitsSpec does, and both sides set it. Every
state that meant Metal's own maximum states METAL_TILE_THREADS (1024), which
the M3 Max answers for no limit. tile-state-thread-limits' first state is
state-limited-1024 (it was state-unlimited, same answer), and the device-gap
ruling for a limit below Metal's applies where the stated limit is Metal's
maximum.
The eight recordings whose descriptor moved are re-recorded on the M3 Max
(macOS 27.0.1, 26A434; three runs each, plain and validated legs). Only
their input digests and that renamed state change: every answer is the one
recorded before, max_total_threads_per_threadgroup 1024 included. Cost and
time records are kept as they were.
The validation oracle's "permits N" refusal had a run of stray spaces from a
string literal's indentation. The message is one line now, and
qualification_contracts asserts it whole.
Verified on the M3 (macOS): clippy of metal2vulkan-conformance and
metal2vulkan-validation with all targets and features is clean, and
a_threadgroup_wider_than_the_pipeline_permits_is_refused passes with the
exact message. `conformance record` wrote the eight recordings.
(cherry picked from commit 91be83754b4ac765759b679cb872a321eec9dfbe)
Three corrections, each checked against the tree:
- runtime/src/visibility.rs said Metal's visibility-result behaviour was
measured on an M4, which is not one of our venues. The conformance
suite's visibility cases record Metal's answers on an Apple M3 Max with
macOS 27.0.1 (recordings/visibility-*.json); the doc now names that venue.
The 5300M and UHD 630 answers it cites beside it are unchanged.
- docs/FAST-PATHS.md's DeviceSampling row (and docs/API.md's device-sampling
entry) said Metal reads any subnormal coordinate as the zero of its sign
before addressing. That holds for a normalized coordinate (measured on the
M3 Max on R32Float, PrecisionNote::DeviceSampling's documentation); a
negative subnormal pixel coordinate addresses texel -1, as the M3 Max's
recording of pixel-samplers-subnormal-border answers (the border at
-2^-149, -2^-140 and -2^-127, known-gaps.tsv). Both now say so, and the 27
known-gaps.tsv rows that quoted the old reading quote the new one.
- SharedEvent::reserve_vk_signal's Safety text lacked the same-VkQueue rule
that Event::reserve_vk_signal states. A shared event's command-buffer waits
are held on the host (event_timeline.rs: a settable timeline never hands
a wait to Vulkan), but a command buffer that signals the event after the
reservation waits on its VkQueue for the reserved index before its own
signal (EventTimeline::signal's `after`, the order wait in
command_buffer/submit.rs), so the caller's signalling submission must not
go behind it on one VkQueue, and a texture copy on the first VkQueue behind
it waits for the signal too. The rule is now stated, scoped to those
signalling command buffers.
Verified: rustdoc and the runtime's degradation_catalogue test over the
edited text; no behaviour changes.
(cherry picked from commit 12bac3fafd3d3e66dc0b88d01231dd30e2694ffb)
The cpu-block-decode notice said the call waits for the decode where a
command buffer that may read the texture is submitted and not yet complete,
or the texture is untracked. The call has waited for no GPU work since the
decode moved to the device's decode thread (texture/twin_decode.rs): it waits
only for room, while 256 MiB of written blocks wait for the thread (a 4:2:2
carrier's partial-row write also reads its rows back first), and the
scheduler holds the first command buffer that may read the texture, every
command buffer where the texture is untracked.
The declaration's rustdoc, its announced cost and docs/API.md's catalogue
entry now say that. A test ties the stated bound to the queue's QUEUED_BYTES
(made pub(crate) for it), so the text follows the constant.
Verified: tests::degradation::the_cpu_block_decode_cost_states_the_calls_
only_wait and tests::degradation_catalogue (the catalogue states the cost).
(cherry picked from commit f128722f1b2197f52833080eca738fd498cf6ce5)
A mesh function that writes a vertex's point size recorded
PrecisionNote::DevicePointSize whatever primitive its mesh outputs. The
rasterizer reads a vertex's size for points alone, so a line or triangle
mesh's size draws nothing on any device, and the runtime already announces
the note only at draws that rasterize points (7715a47be3). The note is now
recorded only where the mesh type's topology (air.mesh_type_info) is points,
a structural test, so the artifact carries no note its draws can never meet.
Apple's compiler refuses [[point_size]] in a triangle mesh's vertex, so the
case arises only for AIR not compiled from MSL. The test derives the
triangle mesh from the owned fixture's point mesh (mesh_outputs_points) by
its topology word alone.
SEMANTICS_VERSION 2008: an artifact's precision notes change. docs/API.md's
catalogue entry and the note's rustdoc say which mesh functions record it.
Verified: engine_mesh::a_mesh_point_size_is_noted_only_where_the_mesh_
outputs_points on every committed mesh profile with the largest point set
below Metal's: the point mesh is noted, the triangle mesh is not, both store
the size; the test fails with the topology check reverted.
(cherry picked from commit adc0435c64495e2f3a3355becf055941fc529fc3)
SEMANTICS 2008 (4d187515d7): the new owned fixture engine/dfk_dead_fetch adds 76 golden-hash cells (0 moved), 4 inventory rows and its air_input printout; the census follows the new product fingerprint.
Blessed on the M3 (s37-pl.sh bless: bless_engine_inventory, the air_input printouts,
bless_golden_hashes, then the check step).
(cherry picked from commit 9f5e7e55221cfb111408a5e0784cf282cc2c0f7b)
What: device/create.rs and device/keeper.rs changed (the cherry-picked commit
before this one): an instance's making reads the loader's instance extension
list once and the keeper asks the loader nothing. The pin follows; no
RUNTIME_VERSION bump: the extensions enabled, every answer, announcement,
record and submission are the same; only the number of loader calls drops
(4 per process's first device -> 1, 3 per later instance -> 1).
Verified (smallfix, um870 job m3-max-13113): clippy of metal2vulkan-runtime
(all targets, all features) clean; tests::listed_extensions (a counting fake
loader: 1 read, the three extensions still enabled) and tests::keeper pass.
Pending on the branch: its negative control, rustdoc, m2v_gpu/m2v_cpu_icd
clippy and the release timings on lavapipe and um790. Generators and
api-signatures --check unchanged at landing.
The making of an instance asked the loader for its instance extension list
once per question: portability enumeration, debug utils and layer settings,
three vkEnumerateInstanceExtensionProperties calls, and the drivers' keeper
asked a fourth time for portability on the process's first device. Each such
call makes the loader scan its driver and layer manifests again and ask each
driver it finds; reims measured about 7 s per process on a host with several
manifests.
Now the making reads the list once (ListedExtensions) and answers every
question from it, and the keeper takes portability from the extensions the
device's instance enabled (the runtime enables it exactly where the loader
listed it), asking the loader nothing: four reads per process's first device
become one, and three per later instance become one.
Verified: tests::listed_extensions builds a fake loader that counts the reads
and refuses the instance; it reads 1 at this commit (3 before it, the
negative control).
(cherry picked from commit a58d2cd51a2fbe17326ce09c8a718ffec5d43776)
clippy -D warnings under --cfg m2v_gpu and --cfg m2v_cpu_icd flagged
chunks_exact(4) with a constant size (gem10 job m3-max-13089); as_chunks
gives the same texels.
(cherry picked from commit 94dd2382170212f76e685add4fa427c211a9c5b8)
runtime_lane::framebuffer_fetch::dead_reads draws dfk_dead_fetch's
dfk_branch and dfk_scaled, specialized with the read dead, over a 16²
BGRA8Unorm target blended one over one minus the source alpha, on the
device the cfg selects under the validation layer. On every device the
translator's pipeline for the descriptor has no storage and no input
attachment and color 0 keeps the blend; a pass of two draws stores
Metal's texels (each channel within one code asserted, the exact ones
counted), takes no storage form for the target
(WorkCounts::storage_forms_taken), splits no instance for interlocked
writes and announces none of the fetch's notices. On a device with a
fetch form the live specialization's pipeline takes that form
(asserted), and its pass's notices and counts are printed as the
contrast, one DEAD-FETCH line per function.
(cherry picked from commit fb39956c6942324fdb34330a9e725098d7058359)
What: the render pipeline's framebuffer-fetch state (pipeline::compile's
fetch_inputs) named every attachment the specialized fragment entry
declares a [[color(n)]] input for, used or not. The lowering then put
each such attachment the function writes through its first output in
the interlocked storage form (fetch::plan reads the state's attachments
as colors the pipeline moved there), so a function whose read the
function constants make dead (a branch on a bool constant, a fast-math
product a zero constant makes +0) still took the pixel interlock and,
for a blended attachment, computed the blend in the shader, its color
left out of the subpass. It now names a color input only where an
instruction of the specialized, canonicalized body uses it, the reading
the lowering itself plans parameters by: a dead read is a plain color
write that the device blends.
The used-parameter walk is one helper (params_used), which the vertex
attributes and the kernel stage-in attributes already did inline.
tests::engine_moved_writers' unread-color-input test pinned the old
form (smw_unread, a declared input it never reads, took the storage
form as compiled); it now checks that such a writer takes no storage
form under either write mask, color 0 stays a color attachment, it
states no store before the tests, and every draw that moves no color
runs it as compiled. The fixture's comment says so.
SEMANTICS_VERSION 2008: such pipelines' modules, graphics state,
facts and precision notes change.
Verified (debug, homelab-gem10-1): tests::engine_dead_fetch at the base
(6962601ac4, job m3-max-13077) failed: 48 of 114 dead pipelines took the
storage form with color 0 out of the subpass (dfk_branch and
dfk_scaled, blended and unblended, on all 12 interlock profiles;
dfk_gated, whose input the constant removes, never did).
(cherry picked from commit d9160036035a456a5371d5e80fe1f070a28a1e85)
Each dead pipeline's difference from a pipeline without a color input
(a storage form, an input attachment, color 0 missing or without the
pipeline's blend) is collected by kind and printed before the test
fails, so a run states how many dead reads took a fetch form, not only
the first.
(cherry picked from commit 6962601ac4a4e86f6316e2defed401728aea797d)
tests::engine_dead_fetch compiles the owned fixture dfk_dead_fetch's
three fragment functions (the read behind a branch on a bool constant,
scaled by a half constant under fast math, gated with its input) behind
dfk_vertex, color 0 BGRA8Unorm blended one over one minus the source
alpha or unblended, on every committed profile. Specialized with the
read dead, each pipeline must have no storage and no input attachment,
color 0 an ordinary attachment carrying the pipeline's blend, and pass
L3; specialized live, each reads color 0 in the device's fetch form
(storage under the interlock, an input attachment under
rasterization-order access) or is refused where there is neither.
This commit adds the test alone, the negative control at the base.
(cherry picked from commit 5f6a494dd747029b6e8f910b6a135b1692dd73a1)
scripts/regen-air-fixtures/regen-air-fixtures.sh dfk_dead_fetch on the
M3 (potluck job m3-max-13074; Metal 32023.922, SDK 27.2, LLVM 21.1.8);
TOOLCHAIN records the fixture under that toolchain. The branch on
dfk_reads compiles to a select on the loaded constant, and dfk_scaled's
product to an fmul fast of the loaded half constant.
(cherry picked from commit ac3447ff8745c1aad462d99472b16ec3109ab7bb)
Owned MSL: three fragment functions that read color 0, the read behind
a branch on a bool constant, scaled by a half constant (a fast-math
product a zero constant makes +0), and gated with its input by the bool
constant, beside a fullscreen vertex function. The companions follow
from scripts/regen-air-fixtures on the M3.
(cherry picked from commit c77c87b4ff1eb43eeb8a2f3a9b3c9e56fc1911ca)
What: the spare command pools now hold at most 4,096 command buffers across all pools,
counting pools that are out (taken, being freed, beginning a primary ahead). Over the
bound, the oldest spares free their command buffers on the free thread; if that is not
enough, the pool given back frees its newest past the bound. RUNTIME_VERSION 1997 -> 1998
and the runtime-sources pin follow.
Why: on the Iris Xe (ANV below Xe-HP, Mesa 26.2.4) each command buffer that records a
binding table takes a 64 KiB block of a 1 GiB pool: 16,384 per device, and the next
recording fails with VK_ERROR_OUT_OF_DEVICE_MEMORY. The spares held 9,716-9,771 before the
failing frame in all 6 failed loaded runs of checked_frames_merge_once.
Verified (exitcrash, at 9ddb267dbd on 8636a26f43):
- loaded Iris, the iris-flakes shape: checked_frames_merge_once 0 of 76 vs 6 of 79 at
base; runtime suite 16/16 loops; teardown threads 0 of 6,528.
- new device test, spares held after three big command buffers alive at once: 4,096 on
lavapipe, M3 MoltenVK and Iris; with the bound disabled 12,417 / 12,675 / 12,417 (fails).
- Iris cost, the test alone, 5 runs each: spares max 4,096 vs 7,787-7,793; frees on the
free thread 220 vs 14-17; test time 13.6-14.0 vs 13.6-13.9 s.
- tests::spares 14/14 on the three venues; lavapipe runtime suite 2025/2025; clippy and
rustdoc clean. Generators and api-signatures --check unchanged at landing.
Not run: the full gate and the other venues (development's checks).
The module docs now state what the bound of 4,096 costs where it was measured. The numbers
come from tests::linear_runs::checked_frames_merge_once run alone on ms01's Iris Xe (Mesa
26.2.6), five runs each way, alternating, in a debug build. The base runs used development's
spares.rs; the fix runs used 8ab6915d69. Probe branch, not for landing: steelbrain/iris-held-
probe, job m3-max-13123.
- Spares held at most 4,096 against 7,787 to 7,793.
- Pool frees ran on the free thread 220 times against 14 to 17.
- Command buffers allocated: 12,559 in four runs and 9,864 in the fifth, against 10,193 in each.
- The test took 13.6 to 14.0 s against 13.6 to 13.9 s.
Verified for the bound (8ab6915d69), each with a negative control (past_held answering nothing,
so no bound):
- tests::spares::device::command_buffers_alive_at_once_leave_the_spares_holding_at_most_held:
the spares held 4,096 at the fix and 12,417 at the negative control on lavapipe (job
m3-max-13065), 4,096 and 12,675 on the M3 Max through MoltenVK (m3-max-13070), and 4,096 and
12,417 on the Iris Xe (m3-max-13071).
- The unit test the_spares_and_a_pool_given_back_hold_at_most_held_command_buffers passes at
the fix and fails at the negative control on all three.
- All 14 tests::spares tests pass at the fix on all three.
- The runtime suite on lavapipe (--cfg m2v_cpu_icd): 2,025 of 2,025 passed (m3-max-13073).
- Clippy -D warnings (plain and --cfg m2v_gpu) and rustdoc -D warnings for the runtime are
clean (m3-max-13068).
The loaded Iris run (m3-max-13072, iris-flakes-run shape, 30 min) put two loops of
checked_frames_merge_once and one of the teardown-threads test beside the runtime suite looped
under --cfg m2v_gpu:
- Checked frames: 0 of 76 runs failed (38 and 38), against 6 of 79 (39 and 40) at the base in
the same shape (m3-max-13027).
- Runtime suite: 16 of 16 green, 2,019 tests each, 110 to 116 s against 111 to 116 s at the
base.
- Teardown-threads test: 0 of 6,528 failed.
(cherry picked from commit 9ddb267dbd2ccf8942ac1a78ee3fee44fdc4f01d)
A command buffer keeps what its recording took of the driver's device-wide pools until it is
begun again, reset or freed, and the spare command pools kept each pool's peak over its recent
uses with no bound across pools. On ANV below Xe-HP each command buffer that records a binding
table takes a 64 KiB block of the device's 1 GiB binding-table pool, so a device holds at most
16,384 of them, and the next recording fails with VK_ERROR_OUT_OF_DEVICE_MEMORY with no driver
message. tests::linear_runs::checked_frames_merge_once failed so on ms01's Iris Xe (6 of 79 runs
beside the runtime suite, job m3-max-13027): its frames of 707 and 1,413 render passes, each a
command buffer whose pool kept its peak, left the spares holding 9,716 to 9,771 command buffers
in every failed run (2,786 to 7,747 in sampled passing runs) before the frame that failed. A
probe on the same Iris Xe (job m3-max-13053, twice): one command buffer of render passes, each
a primary and a secondary beside a cleared depth target, failed at the end of its 8,087th pass
with the spares holding 424, 2 x 8,086 + 212 = 16,384.
A give-back now counts the spares, the pool given back, and what each pool out of the spares
held as it went out (taken by a command buffer, out for frees, or beginning a primary ahead:
CommandPools::out, kept under the spares' lock). Past HELD (4,096) the oldest spares that hold
any shed all their command buffers on the free thread as an idle spare does and go back as the
oldest; where that is not enough, the pool given back frees its last made past the bound, a
secondary kept, never the primary begun ahead (past_held, CommandPool::past). On ANV the frees
do not trim, as before, so kept barriers stay valid. HELD leaves three quarters of the binding-
table pool to the command buffers committed and in recording.
Tests: tests::spares::the_spares_and_a_pool_given_back_hold_at_most_held_command_buffers (the
policy, no device) and tests::spares::device::
command_buffers_alive_at_once_leave_the_spares_holding_at_most_held (three command buffers of
2,112 blit encoders alive at once, each in a pool of its own). docs/FAST-PATHS.md records the
remaining ceiling: one command buffer of about 8,000 such passes still fails on ANV below Xe-HP.
Verification follows in the next commits' messages and the report: build and clippy, the
spares tests on lavapipe, the M3 and the Iris Xe with a negative control, and a loaded Iris run.
(cherry picked from commit 8ab6915d698cdaf29e2aa8bfd50c77cd8922d507)
runtime_lane::kept_variants::the_least_recently_released_variants_go_first made 64 public
kernel states and expected the first made again to have gone past the bound. With KEPT at 256
(63ccc9da0d) all 64 stay kept, so the first took its variant back and the test failed ("the
first went past the bound") in the M3 lane at 63ccc9da0d. The premise moved, not the product.
The test now makes 512 states, twice the bound, each a specialization of the owned engine
fixture's kernel unspecialized_guarded with its function constant optional_count at 0..511:
each value is its own compiled pipeline (the compile key holds the constant values), so the
states need no public corpus, are cheap to compile on every driver, and can be raised past a
later bound by changing MANY alone. MANY's doc names the bound it is twice of.
No other premise of a bound of 16 remains: the file's LINEAR (16, 16, 256) is a texture's
width, height and row pitch; the runtime's own kept_variants tests read KEPT.
Verified: see the lane runs reported with the tip (M3 MoltenVK and lavapipe, with MANY at 64
as the negative control).
(cherry picked from commit 6c0b4f7853a3fc98c1d9494e8f0deb29a9cdf3af)
491 recording(s) whose bounds moved. Pin 33 at 63ccc9da0d: cost --check on the M3 (job 13018) moved 130 gated counts. 126 went down:
RUNTIME_VERSION 1997 keeps 256 released variants (was 16), so within a round, which runs the whole set on one
device, a case takes back the variants an earlier case released (shader modules, pipeline layouts, variant
pipelines, pooled dispatch pipelines, and command buffers that made them). The 4 that went up are
device_memory_allocated, +4 or +8 MiB each (pass-bytes-srgb-decode-all-bytes, indirect-mesh-commands-object-
threadgroup-lengths, texture-pairs-storage-crossings, sparse-tails-by-texture-type): RUNTIME_VERSION 1995's 68 MiB
blocks of images (were 64 MiB).
Measured on the M3 (s37-pl.sh rebless: cost --runs 8 --write over the whole
set, then cost --runs 8 --alone --write over the changed cases).
(cherry picked from commit b1acd456f0d20e73b1c286d6e30e333d40e0a424)
Its product fingerprint follows development's versions at 63ccc9da0d. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit e7e5067da205aa05c836e617b9d9569dc6c387f8)
The landed kept-variants change (exitcrash, steelbrain/kept-bound d6202a9741, 8 commits) changes what a
run of an unchanged artifact does:
- pipeline/kept.rs holds 256 released variant instances (was 16), so a state made again within the
working set takes its Vulkan objects and pipelines back with no driver call. The consumer's arm64
guest (macOS 26.6.2, CoreAnimation's RenderBox) made 8455 repeats of 255 keys per cold boot at about
1 ms each, 98% of it in this runtime; an LRU replay of that boot's log holds 157 repeats at 16, 8308
at 128 and all of them at 256 (largest reuse distance 223).
- A sampler refused at the device's SamplerLimit first evicts the least recently released kept instance
that holds samplers, then retries (in a program's call only).
- settle_device_maps settles graphics pipeline libraries first, then modules, layouts and sampler sets,
so an evicted instance's samplers are freed in the same settle (a linked pipeline held its layout and
its samplers past it; found by the sampler test on lavapipe).
Verified by exitcrash, release builds, base = the tests at KEPT 16 with the old product files:
- tests::kept_variants::released_states_made_again_take_their_variants_back and
a_sampler_past_the_limit_evicts_a_kept_instance_first fail at base and pass at the fix on M3 MoltenVK
(13002), lavapipe (12978) and the 780M RADV PHOENIX (12999).
- Repeat create median, base -> fix: M3 142-151 -> 26-29 us; lavapipe 73-107 -> 31-40 us; 780M 87 ->
35-38 us (trivial functions, made on the creating thread).
- Memory per kept instance (trivial functions): lavapipe 333 KiB RSS, 780M 1022 KiB GTT, M3 792 KiB
physical footprint; at 256, about 83 / 256 / 198 MiB.
- fmt, clippy (plain, m2v_gpu, m2v_cpu_icd), rustdoc, and the runtime kept/sampler/memo tests 133/133
at 8667e0874c (msi 12986); later commits are kept.rs doc text only.
Pin recomputed with pin-compute.py; signatures --check and the generated docs unchanged.
Job m3-max-13002 ran three more benches on the M3 (MoltenVK, release):
815.9/23.4, 815.4/22.9 and 814.4/24.1 KiB of physical footprint per
state while the kept set fills and evicts. That is 792 KiB per kept
instance, matching the 794 KiB of the warm run in 12964. The 158 KiB of
the first run (12943), whose functions Metal compiled cold, is the
outlier. The Bounded line now gives 792 KiB, about 198 MiB at the bound.
In the same job, at tip 85a8f6a915, both device tests fail at the base
(KEPT 16, no eviction) and pass at the fix. A repeat took 28 us at the
median against 147 us at the base, and 26-27 us at the full bound.
(cherry picked from commit d6202a9741d7881e11dc4e8223586cd0bd6031ce)
The kept_variants bench on a Radeon 780M (RADV PHOENIX, job
m3-max-12999, two runs alike) reads 1022 KiB of GTT per kept instance
while the kept set fills, and none while it evicts. That is about 256 MiB
at the bound for pipelines of trivial functions. In the same job both
tests fail at the base (KEPT 16, no eviction) and pass at the fix; a
repeat took 38 us at the median with the fix against 87 us at the base.
(cherry picked from commit 85a8f6a91551286de99be1d9802269dc87102d82)
The module's Bounded line now records what a bound of 256 costs and
saves:
- Hit rate: over the guest's 8455 repeats, 16 instances held 157, 128
would hold 8308, and 256 hold all of them. This is an LRU replay of the
boot's key sequence, read in place.
- Memory per kept instance, from kept_variants' release bench (slope
while the kept set fills minus slope while it evicts):
- lavapipe: 333 KiB resident, three runs alike (m3-max-12939, 12960,
12978);
- MoltenVK on the M3: 158 KiB physical footprint in a run that compiled
the functions cold (12943), 794 KiB in a warm one (12964).
- A state made again from a kept instance: 26 to 40 us median, with 64 or
256 kept. Where its VkPipeline was made again (base, KEPT 16): 73 to
151 us. The deque's linear scan does not show at 256, so it is not
indexed.
(cherry picked from commit 2ae24f246570076e79561f0f3ed74d4030ef5192)
On lavapipe the sampler test still failed at the fix (job m3-max-12960).
A diagnostic build (m3-max-12968) showed the kept instance evicted while
the live sampler count stayed at the limit. Where the device links render
pipelines from graphics pipeline libraries, the evicted instance's linked
pipeline is the device's (libraries.rs) and holds its layout, and the
layout holds the samplers it bakes (shared_layouts.rs). settle_device_maps
settled the libraries last, so the layout and its samplers outlived that
settle and the retried sampler was refused. MoltenVK links no libraries,
which is why the test passed there.
settle_device_maps now settles libraries, then modules, layouts and
sampler sets. This also changes kept_or_create's settles: an evicted
instance's linked layout now goes in the same settle instead of the next
program call's.
(cherry picked from commit 8667e0874cda03bd1c282dbee1fb1d02db45bd78)
On lavapipe (job m3-max-12939) the sampler test failed at the fix with
SamplerLimit when making the second state. The first state's kept
instance was not there yet: its creation hands a making to the pool
(pipeline/predicted.rs; the fragment has a texture slot), and that making
holds the variant until it is made. A diagnostic run on lavapipe
(m3-max-12947), with other creations in between, evicted the kept
instance at the limit as intended.
The tests now wait for the device's pipeline pool to hold no piece
(uniform_bind_offsets::idle) after each release, so the variant's release
has reached the kept variants' queue.
(cherry picked from commit 81e905fba89c158ce7c7153cd9e30a3f73e2518e)
A guest's RenderBox made 8455 repeated render states on one cold boot,
each about 1 ms inside our creation, because pipeline/kept.rs held only
16 released variant instances. The distinct keys between a key's use and
its next use were p50 51, p90 74 and max < 256, so every instance was
gone before its key came back (157 of 8455 within 16).
- KEPT 16 -> 256, the guest's whole working set. The memory per kept
instance and the cost at the bound are measured by kept_variants'
bench and go in the module's Bounded line next.
- Each kept instance holds its immutable samplers, counted against the
device's limit. A sampler the device refuses at the limit now evicts
the least recently released kept instance holding any
(Kept::evict_for_samplers), settles the device's maps
(evict_kept_for_samplers), and is made again. This covers a layout's
sampler set (objects::sampler_set) and a sampler state's sampler, after
that state's own spares (SamplerState::vk_sampler). The eviction runs
only in a program's call, where the kept queue is applied in the
program's order; elsewhere the refusal stands as before.
- kept_or_create's four settles are now settle_device_maps, which the
eviction shares.
Tests: kept_variants' two device tests (ec425422d3, 93eb5a8938). Not run
yet.
(cherry picked from commit 4cb4b1e642b49e9021daac5a7275259f447e116b)