What: a drawing state (a mesh one, and a twin of a color group, a single-sample or a factor-scaling
state among them) keeps a chain of programs per generation as a compute state does
(pipeline/carry.rs): its StateShared Deref reaches the program of the generation whose command
buffer's work the thread does, else the last; its ID, uniqueIdentifier, label and sampler numbers
stay. Each state is kept by its generation's carry registry (GraphicsState::kept at the end of a
render or mesh creation, with its color groups' twins); the recovery carries them after the compute
states (pipeline/render/carry.rs): its base variant, and its large-buffer form's, made again from
the pipelines its creation compiled or the live variants of them the new generation holds, no
translation; then, under the new generation's reach (NoticesFor::of_generation), its neutrals, its
predicted first draw's VkPipeline handed to the pool with nothing waiting for it
(make_at_creation(false)), and its depth stand-in copies. Its descriptors, keys, label and twins are
kept; its other variants, plans, settles and routings are made as its draws need them. A failed
making is counted and refused where bound (RemadeAfterRecoveryFailed) through
RenderPipelineState::bound_device, at set_render_pipeline_state (encoder, call checks, indirect
command buffer) and an argument encoder's render word; a tile state's bind now answers its kernel's
failed making the same way. A state is made again only where both generations compile alike
(compiles_alike, the profile fingerprint the memo carry checked already); else its making is refused
as failed. Docs: device/carry.rs, pipeline/carry.rs, MadeBeforeRecovery (render states no longer
listed refused) and RemadeAfterRecoveryFailed, the DeviceRecovered cost (degradation.rs and API.md,
equal), API.md's recovery entry, the runtime README; REFUSALS.md regenerated.
Why: drawing states made before a recovery were refused where bound after it; Metal's go on.
Verified: see the lane run reported with this sha (the test commit before it fails, this one
passes), with the recovery's wall time for 0, 200 compute and 200 drawing states.
What: tests/device_recovery_pipelines.rs gains a_recovery_carries_a_drawing_state (a drawing state
of tob_rect/tob_solid made before a recovery keeps its uniqueIdentifier and label, its notice
counts it made again, its draw after it fills the target with the color, and the lost VkDevice
goes with the state), and the timed test now times a recovery with no live state, with 200 compute
states of 200 pipelines (max_total_threads_per_threadgroup differs, a field of the pipeline key)
and with 200 drawing states of 200 pipelines (source and destination blend factors differ),
logging RECOVERY-WALL, and runs a state of each kind after its recovery.
Why: the compute states of the timed test shared one compiled pipeline (the required threadgroup
size is no field of its key), so the recovery made one variant again; drawing states are carried
next.
Verified: fails before the drawing-state carry (the state is refused where bound, MadeBeforeRecovery);
see the lane run reported with the next commit.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
What: Program::made_again (pipeline/carry.rs) sets call_flat_refused, the
field 979efab2f1 added to Program, to false, as a state's creation does.
Why: the compute carry landed alongside 979efab2f1, which added the field;
development's runtime library did not compile (E0063 at pipeline/carry.rs).
Verified: the field is set as Program's creation in pipeline/mod.rs sets it;
the build runs in the lane that follows.
scripts/api-docs failed on development since 15866645a8: metal2vulkan re-exports the air crate's GenericPointer, whose
doc linked [`Feature::GenericPointer`], the air crate's Feature, which the metal2vulkan reference does not document,
so the page showed the bracketed text the script refuses. It now names it as code, as ConstantRecord's doc names
`Feature::Constant`.
What: runtime_lane::render_merged_indexed's
a_host_step_lists_its_residency_once_for_every_execution makes its device with
HeapAnswerPolicy::Device, the default, in place of the lane's exact answers, and checks that the
heap's textures lie in its bytes (no shadowed-texture notice) before it counts the listing.
Why: the test failed on a Radeon 780M (RADV) and passed on lavapipe: frame 1: 0 listed of 71
resident. Each of its 16 executions took no kept recording for one reason alone, that it may use a
shadowed texture (RenderExecution::keeping: self.shadows non-empty); every other condition held.
The lane's devices take DevicePolicy::exact_answers, so HeapAnswerPolicy::Metal: a heap texture
is held to Metal's answer. The heap's 64x64 RGBA8Unorm ShaderRead textures, which Metal keeps
losslessly compressed, answer 16512 bytes at 128; RADV's image takes 16384 bytes at an alignment of
4096, and no host-transfer or linear image fits 128, so each is a shadow of the heap's bytes in
Metal's tiles (the shadowed-texture notice: "its images take 16384 bytes at an alignment of 4096
of the heap, where the texture answers 16512 at 128"), as docs/FAST-PATHS.md's heap-answer row
documents for that switch. An execution that may use a shadowed texture keeps no recording
(render/executions/kept.rs), so none listed its residency. The runtime follows both contracts;
the test's premise, textures in place, held only where the device's image fits Metal's answer.
Under the default the answer is 16512 at 4096 and the images lie in the heap.
Verified, one run each:
- Before, at development (and at 4f49d542da with debug prints): fails on a Radeon 780M (RADV,
m3-max-23124, m3-max-23215): frame 1: 0 listed of 71 resident. The prints (m3-max-23308,
m3-max-23315, m3-max-23330) showed all 16 executions refusing to keep for shadows alone, the
heap's answer 16512 at 128, heap_texture_lossless_layouts 64, heap_textures_tiled and
heap_textures_refit 0, and the shadowed-texture notice's reason above.
- After, this commit: render_merged_indexed's two tests pass on a Radeon 780M (RADV,
m3-max-23344) and on lavapipe (m3-max-23345); clippy -D warnings with --cfg m2v_gpu on
metal2vulkan-validation and cargo fmt --check are clean (m3-max-23333).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The five commits before this one. A rate-mapped pass draws each command once per region it touches, running the
vertex stage once per region (85-90% of the sample's GPU time on the 780M). The translator now has the variant
VariantKey::region_fan_out {Draw, Probe}: its triangle-class geometry stage runs the vertex function once and emits
one copy per region a triangle touches, up to K copies (K from maxGeometryTotalOutputComponents, at most 16), each
through one full-target viewport with four clip distances standing in for the region's scissor. The probe emits
nothing: per command it writes a flag (a triangle crossing w=0, or touching more than K regions with its bounds
widened by 1/8 px) and an atomic count of the copies the draw would emit, from which a fanned-out draw's piece work
is forecast. The bind layer's BindState.region_fan_out (mode, probe index) selects it; the plan admits only a vertex
pipeline with no tessellation, mesh, amplification, views, compensation, band, synthesized geometry of its own, or
chosen slice or viewport; it binds WriteSource::RateMapRegions (and RateMapFlags and a pushed index for a probe). The
fan-out state, its synthetic bindings and push field are encoded (artifact codec). bind::fan_out is a public
submodule (FanOutState, RegionFanOut). Nothing in the runtime selects the variant yet.
Verified (on the branch at 0e1d7d87ae, msi): clippy of the translator and the runtime, all targets and features,
and rustdoc -D warnings (m3-max-23313); translator suite 3510/3511 (m3-max-23314): the link tests (each class's module
valid on lavapipe, Iris and Pascal; EmitVertex = 3 x copies for a draw, 0 for a probe; the probe's 4-byte GEOMETRY
push; the refusals) and the engine test (the plan states the variant and NeedsVariant on the base; the variant
compiles L3-valid on lavapipe, Iris and Pascal; its plan settles on itself; RateMapRegions, RateMapFlags and the
pushed index written; an amplified pipeline keeps the plain variant). The one failure is golden_hashes, the same 852
cells that fail at the development base itself (m3-max-23331), re-blessed on development; no fan-out row moves.
bind::fan_out moves out of the rate map's module so the surface scan reads it;
the surface table, the signatures and docs/REFUSALS.md name the fan-out's
items and refusals.
The probe writes a pair of words per draw: the flag of a triangle the draw
cannot fan out, and, added atomically, the copies the draw emits of the
triangles it fans out, so the consumer forecasts a fanned-out draw's work from
the work its geometry stage does.
BindState::region_fan_out asks for the variant whose triangle stage fans a
rate-mapped pass's triangles out (or probes which it cannot), with the index of
a probe's flag. The plan states the variant for a vertex pipeline of no
tessellation, mesh, amplification, views, compensation, band, own synthesized
geometry or chosen slice or viewport, and then draws no regions several at a
time; it binds the region table (WriteSource::RateMapRegions) and a probe's
flags (WriteSource::RateMapFlags), and a probe pushes its flag's index to the
geometry stage. The fan-out stage refuses a vertex function that selects its
slice or viewport. Engine test over the owned fixtures: the variant's plan,
its modules' L3, its writes and its push.
The artifact codec names GraphicsState::region_fan_out, FanOutState,
RegionFanOut, SyntheticBinding::RateMapRegions and RateMapFlags and
PushField::RegionProbe (ARTIFACT_FORMAT_VERSION 510). A fan-out variant states
no SynthesizedGeometry fact: its stages are the consumer's way of drawing its
rate-mapped pass, which its graphics state states.
A render pipeline variant keyed by VariantKey::region_fan_out draws a rate-mapped
pass's triangles once: its triangle class's geometry stage finds, per axis, the
region segments a triangle's NDC bounds touch (a bisection over the region table,
bind::fan_out::table), and emits a copy per touched region, mapped from the one
full-target viewport into the region's and clipped to its pixels by four clip
distances. A probe variant emits nothing and flags (at a pushed index) a draw
whose triangle crosses w = 0 or touches more regions than the stage's copies.
Not yet compiled; potluck clippy and tests follow.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The four commits before this one. After a device recovery every compute and tile pipeline state made before it was
refused (MadeBeforeRecovery). The translation memo is now carried to the new generation where both generations'
profile fingerprints match; each compute state keeps a per-generation chain of programs behind its Deref; at the
recovery each state's base variant objects are made from the pipeline its creation compiled, with no translation
(one remade variant shared among the carried states of one pipeline), and its predicted VkPipeline is queued with no
wait (a draw or dispatch before it lands is held, RUNTIME_VERSION 2161). A failed remake is counted in the notice and
refused at bind with RuntimeGap::RemadeAfterRecoveryFailed. Tile states follow their kernel's compute state. A carried
state still holds its program on the lost generation, so the lost VkDevice stays alive while the state lives (as a
carried texture's image does), freed with the state. Docs: carry.rs, pipeline/carry.rs, the runtime README, REFUSALS.
Verified (on the branch, lavapipe, m3-max-23286, CONTROL_OK): both pipeline tests fail at the test commit and pass at
the tip; all 26 recovery tests pass serially, 260 tests of the touched areas at 2 threads; a recovery's wall time on
llvmpipe (debug) 20.8 ms with no live state, 17.0 ms with 200 live compute states of one pipeline. Clippy plain,
m2v_gpu, m2v_cpu_icd and rustdoc (m3-max-23287..23289).
What: tests/device_recovery_pipelines.rs passed a u64 where required_threads_per_threadgroup takes
u32 (it did not compile under the device cfgs); its first test now checks what is true: the lost
VkDevice lives while the carried compute state, which holds its program there, lives, and goes
with it. device/carry.rs, pipeline/carry.rs and the runtime README say a carried pipeline state
keeps its program on the lost generation, and so the lost VkDevice, until it goes, as a carried
texture keeps its image.
Why: lanes 23222/23224/23225 failed to compile the test (E0308 at line 75); the old assertion
claimed the lost VkDevice goes while the state lives, which nothing releases yet.
Verified: cargo fmt; the lane run reported with this sha.
What: a compute state's making again at a recovery takes the variant the new generation's memo
holds live for its pipeline where one does (made there by a state carried before it), and makes
one from the compiled pipeline only where none lives, as its creations shared one variant.
Why: states made from one descriptor share one variant at creation; made again each on its own,
they held one set of shader modules, layouts and VkPipelines each after the recovery.
Verified: see the lane run reported with this sha.
What: a compute state (and so a tile state's kernel) keeps a chain of programs, one per
generation (pipeline/carry.rs): the state object, its ID, uniqueIdentifier, label and sampler
numbers stay, and its Deref reaches the program of the generation whose command buffer's work the
thread does, else the last. Each state is kept by its generation's carry registry; the recovery,
after the textures, makes its program again on the new generation: the base variant's objects
from the pipeline its creation compiled (Variant::of with the compiled pipeline, or the live
variant the new memo already holds), no translation, and the VkPipeline its creation predicted
queued on the making pool with no wait (make_predicted with waited false). The lost generation's
memo of compiled functions and pipelines is carried first where both generations' profile
fingerprints match (PipelineMemo::carry_from), so later variants and creations translate nothing
again. A state whose making there fails stays the lost generation's, is counted by the notice and
refused where bound with the new RuntimeGap::RemadeAfterRecoveryFailed (compute encoder,
argument encoder and indirect command buffer checks, through ComputePipelineState::bound_device).
The notice says how many states were made again and how many failed. An indirect command
buffer's depth/stencil check now matches the state by its line too, as the encoders' do since the
regression fix. Docs: carry.rs, MadeBeforeRecovery, the new gap, the DeviceRecovered cost
(degradation.rs and docs/API.md, equal), the runtime README; REFUSALS.md, reach.tsv and the API
signature table regenerated.
Why: compute and tile states made before a recovery were refused where bound after it; Metal's
go on.
Verified: see the lane run reported with this sha (the test commit before it fails, this one
passes), with the recovery's wall time for 0 and 200 live states.
What: a device test (device_recovery_pipelines.rs). A compute state made before a recovery is
the same state after it (its uniqueIdentifier and label), on the next generation, counted by the
recovery's notice; its dispatch there writes what it wrote before, and the lost generation goes
while the state lives. A second test times recover_for_test with no live state and with 200 live
compute states of as many pipelines (logged as RECOVERY-WALL), checks the notice counts all 200
made again, and runs one of them.
Why: a compute state made before a recovery was refused where bound after it
(MadeBeforeRecovery); Metal's goes on. The recovery's own time with many live states is the cost
the carry adds.
Verified: fails at this commit (the notice counts no state, and the state is refused), passes with
the change after it; see the lane run reported with these shas.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commit before this one (and, before it, a test-only fix: replayed_frames' waiting frame now expects a held
batch that has not taken its step's gate to give way, as held batches do since b46459080d, with a new held case
keeping the positive control). The resident-set search's loop takes two steps an iteration and counts in 32 bits
after a 64-bit narrowing that only a set of 2^32 entries or more enters; translated SPIR-V changes for every module
that resolves loaded pointers. On the 780M (m3-max-23140): the pipeline with 1,065 inlined searches compiles in 32.0
s at 2,845 MiB peak (92.9 s / 8,462 MiB before SEMANTICS_VERSION 2064); GPU time at or under the unrolled search's in
every measured case but M=1,024 divergent, whose spreads overlap.
Verified (on the branch): m3-max-23150 translator 3502/3503 (golden_hashes, 870 cells, re-blessed on development),
lint three ways and rustdoc; search tests at 4f49d542da: 780M (m3-max-23215) runtime 76/76, validation 349/350 (the one
render_merged_indexed, failing the same before, being fixed separately); lavapipe (m3-max-23216) runtime 77/77,
validation 350/350 (replayed_frames failing before on both, m3-max-23124 and 23158, passing after).
The search's loop paid its exit test and back branch at every step, in 64-bit arithmetic: on a
uniform address over sets of 1,024 entries or more that cost 15-17% more GPU time than the 16
unrolled steps it replaced. The loop now takes two steps an iteration and counts the candidates
and their first index in 32 bits.
Nothing bounds a set's count below 2^32: it is a u64 in the binder's root tables
(RootTable::build writes the coalesced set's length), in a consumer's
RootTable::resident_fields, and in the runtime's set of live buffers, keyed by u64 object IDs. So
a set of 2^32 entries or more is first narrowed in 64-bit steps, a loop whose test no smaller set
passes (one uniform compare where every invocation searches one table), to a window of fewer than
2^32 candidates, and the 32-bit loop searches that window. The root is R0 plus the window's first
plus the index in it. No test reaches the narrowing: a set of 2^32 entries needs 128 GiB of
entries.
SEARCH_WORDS charges the two loops, three steps and the window.
Measured on a Radeon 780M (RADV), one run each (m3-max-23140): GPU time in ms of 262,144 threads
each resolving 64 pointers into a set of M kept buffers, each followed by a dropped one; the
unrolled search (16 steps, then the loop), the loop alone (the previous commit), this commit.
Every run 0 wrong threads.
M address unrolled loop this
16 uniform 5.72 4.02 3.92
16 divergent 5.46 4.03 3.51
1,024 uniform 5.98 6.18 5.64
1,024 divergent 7.74 7.44 8.56
66,048 uniform 7.87 9.05 7.39
66,048 divergent 84.3 84.2 84.2
Wall times on this node spread about 20% between runs; the M=1,024 divergent spreads overlap.
The 780M's creation of the pipeline with the most searches (1,065 inlined), unrolled
(m3-max-23016) / loop alone (m3-max-23016) / this commit (m3-max-23140): 92.9 / 62.6 / 32.0 s,
peak 8,462 / 5,846 / 2,845 MiB, 1,741,690 / 1,000,747 / 957,203 instructions, spilled VGPRs
179,037 / 105,970 / 101,900, spilled SGPRs 95,824 / 46,562 / 29,535.
Verified:
- At ce1d81df59, this patch on the first cut of the previous commit (b0c00d31f4): translator
suite and lint (fmt, clippy with all features, with --cfg m2v_gpu and with
--cfg m2v_cpu_icd, rustdoc), m3-max-23150: 3502 of 3503 passed. The one failure is
golden_hashes_match_the_table (870 cells), re-blessed on development.
- Runtime and validation tests that resolve device pointers, resident sets, executions and
replays (nextest filter resident|pointer|walker|indirect|icb|replay|dynamic_root|
device_address|merged|argument_buffer|gpu_execution|kept_command|past_the_old_search), at
4f49d542da: this commit, the replayed_frames test's fix and two commits of debug prints
(m3-max-23215, m3-max-23216):
- 780M: runtime 76 of 76, validation 349 of 350. The one failure is
runtime_lane::render_merged_indexed::a_host_step_lists_its_residency_once_for_every_execution,
which fails the same way without this change.
- lavapipe: runtime 77 of 77, validation 350 of 350.
What: runtime_lane::replayed_frames's cross-queue test (was
a_replayed_execution_holds_only_what_shares_its_resources, now
a_waiting_frame_holds_only_what_shares_a_batch_that_keeps_its_place) expects a presenter that fills
the buffer the held execution's commands inherit to go at once, and adds a fourth case, a presenter
that copies out the target the frame's encoding pass draws, which waits behind that pass's batch.
Why: since b46459080d (scheduler/order.rs, Held batches give way) a batch held for a host step that
has not taken its gate gives way to later commits of other queues, as an x86 Mac's GPU may take a
later commit first. The frame's execution starts a batch of its own that waits for its host step
(CommandBufferShared::host_step); while the frame waits behind the loop on its queue, that step's
gate is not taken (place_of: Place::GivesWay), so the fill of the inherited buffer, which conflicts
with that batch alone, goes first: the test's third case failed deterministically on the 780M and
on lavapipe (went: true). The test's expectation predates the rule; the runtime follows it. The
encoding pass's batch needs no host step and keeps its place, so a presenter that reads the target
it writes still waits: the new case keeps the test's held control.
Verified, one run each:
- Before, the old test at development: fails at its third case on a Radeon 780M (RADV,
m3-max-23124) and on lavapipe (m3-max-23158).
- After, this test at 4f49d542da (this commit on the resident-set search's tweak, a9fe9181ed's
tree, with debug prints): passes on a Radeon 780M (RADV, m3-max-23215) and on lavapipe
(m3-max-23216). On both, the case that waits moved heads_held_for_earlier_commits by 1 and
went after the frame; the other three moved it by 0 and went while the frame waited.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The three commits before this one. A binary archive and a dynamic library hold no Vulkan object, only compile-layer
artifacts and a generation's device handle, so after a recovery a pipeline creation naming one made before it was
refused (MadeBeforeRecovery), as was an archive's add. Both now hold a LineDevice (device/carry.rs): device() answers a
generation handle (the one made on, or last carried to), a creation's archive check matches the archive by its line,
and each add makes its state on the serving generation (at_serving). This is the prerequisite for carrying pipeline
states made from them.
Verified (on the branch, lavapipe, m3-max-23188, CONTROL_OK): the test fails before the change and passes after; all
recovery tests pass single-threaded, as do the archive, dynamic_library and binary_archive filters. Clippy plain plus
rustdoc (m3-max-23189), m2v_gpu (23219), m2v_cpu_icd (23220).
What: the archive and dynamic library recovery test builds its PipelineOptions with the
archive in a struct expression over the default, not by assigning a field after default().
Why: clippy's field_reassign_with_default refused the test under --cfg m2v_gpu and
m2v_cpu_icd (jobs 23190, 23191).
Verified: see the lint run reported with this sha.
What: a binary archive and a dynamic library hold their device as a LineDevice
(device/carry.rs), as a fence or a library does: device() answers the generation handle of the
generation they were made on, else of the one a recovery carried them to last, and the lost
generation's handle goes at its rest. A creation's archive check matches an archive by its
device's line (its root handle), so a creation of any generation lists an archive made before a
recovery; each add makes its state on the generation that serves (Device::at_serving through the
root handle), its used artifacts taken afresh for each run. Docs: both modules, carry.rs,
MadeBeforeRecovery, the DeviceRecovered cost (degradation.rs and docs/API.md, equal), the runtime
README. REFUSALS.md regenerated: unchanged.
Why: an archive made before a recovery refused its adds there (its creation ran on the lost
generation) and every creation that listed it (MadeBeforeRecovery), and both kinds held the lost
VkDevice while they lived; Metal's go on.
Verified: see the lane run reported with this sha (the test commit before it fails, this one
passes).
What: a device test (device_recovery_states.rs). Before a recovery it makes a binary archive
with one compute add and a labelled dynamic library: a metallib of file type 2, one exported
function, built with devtools' metallib writer. After the recovery the archive must take
another add and be listed by a creation that makes its state on the new generation. The
dynamic library must keep its label, and the lost `VkDevice` must go while both live.
Why: both hold only compile-layer artifacts, but each keeps a handle of the generation it was
made on. So an archive's adds and every creation that lists it are refused after a recovery
(`binary_archive::check` compares devices), and each keeps the lost `VkDevice` alive. A
pipeline state's carry remakes it on the new generation, which needs the archives it may list
to serve there.
Verified: expected to fail at this commit (the add after the recovery is refused); the fix
follows.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The four commits before this one. A ragged dispatch of a kernel that uses simdgroups was split into a body and an edge
variant, a second full compile of the same kernel (Blender's Cycles kernels on RADV: concurrent ~11 GiB compiles).
The kernel partition now has three classes, decided from structure alone (barrier execution scope, fence and atomic
scope, simd_/quad_ functions, is_uniform, the simdgroup size, the lane builtins): Oblivious, Simdgroups and Observed;
air.all/any of a bool vector now counts as the thread's own (a BoolReduce false positive). New:
KernelFacts::partition_simdgroups, LoweringInputs and VariantKey::call_threadgroups, RuntimeFact::CallThreadgroups
(Variant mechanism, fact id 97). Under flat_grid + call_threadgroups invocations count by subgroup lane order in the
flattened tiers, so workgroup w is Metal's threadgroup w with its simdgroups; the lane builtins are derived; lanes past
the grid return before the body. The compile refuses the bit without flat_grid, with replay_bindings, or for a module
that would hold a workgroup barrier. The runtime's flat_direct tries the plain flat variant first and, for a one-row
grid in one-row threadgroups, then the call variant (its own refusal flag; None, unremembered, when the threadgroup
size asks for emulated simdgroups). Indirect and replay paths still need an oblivious kernel; a kernel with a
threadgroup barrier keeps the split.
Verified (on the branch): m3-max-23184 (gem10, at 4c5d46f8d9) workspace clippy all features, clippy m2v_gpu on runtime
and validation, rustdoc, 136/137 translator tests (the one a test's use of flat_rmw, fixed after), lavapipe 7/7
(FLAT-SIMDGROUPS VkPipelines [1, 2, 2, 2]; lavapipe's 8-lane subgroups emulate the sum, so it splits); m3-max-23193
(8a46347092) 10/10, a_flat_grid_of_the_call_s_threadgroups_admits_a_kernel_of_simdgroups over every committed
profile; 780M RADV (m3-max-23200) 4/4, VkPipelines [1, 2, 2, 1]: the simdgroup barrier + simd_sum kernel runs flat in
one VkPipeline, every thread's word matching Metal's partition, the partial last simdgroup's sum included;
m3-max-23202 workspace and m2v_gpu runtime clippy clean. No guest kernel was dispatched through this path.
flat_rmw's inserted lockstep barrier makes its partition observed, not the simdgroups' alone,
so it has no flat variant of the call's threadgroups either (m3-max-23192: NotRepresentable on
amd-780m-hawkpoint-radv where the test asked for NotImplemented). The simdgroup barrier with
simd_sum is the case the device test runs.
Its doc still said a Bounded recording past its bound drops the draw or dispatch, which the hold
change removed: a command buffer waits for its makings under either wait. Doc only.
A direct dispatchThreads: whose grid is not a whole number of threadgroups split into an
interior and an edge region, each its own VkPipeline, for every kernel that observes its
threadgroup partition. A kernel that observes it only through its simdgroups (simdgroup
barriers, simdgroup and quad functions, lane builtins) computes the same in any partition that
keeps its threadgroups, so for a one-row grid in threadgroups of one row it can run Metal's own
single dispatch: the flat grid, in the call's threadgroups, with the last simdgroup's lanes past
the grid returned before the body, as Metal's partial simdgroup lacks them. A guest's 4.5 M-word
kernel that observes its partition only through simdgroup barriers took 116 s per VkPipeline on
the RX 7900 XTX; its edge no longer compiles a second one.
Translator:
- partition.rs classifies a kernel as oblivious, simdgroups-only or observed. The decision uses
structure only: barrier and fence/atomic scopes, simd_/quad_ functions, is_uniform, the
simdgroup size, and the builtins thread_index_in_simdgroup, thread_index_in_quadgroup and
threads_per_simdgroup. air.all/air.any of a boolean vector (BoolReduce) no longer counts as an
observation: it is a thread's own vector reduction.
- New KernelFacts::partition_simdgroups.
- LoweringInputs, VariantKey::call_threadgroups and RuntimeFact::CallThreadgroups (Variant
mechanism): with flat_grid, the invocations count their threads by lin (the flattened tiers'
subgroup order), so workgroup w is Metal's threadgroup w with its simdgroups, and the lane
builtins are derived.
- The compile admits a simdgroups-only kernel under it. It refuses the input without flat_grid
or with replay_bindings, and refuses a module that would hold a workgroup barrier (emulated
tier, or a simdgroup barrier at workgroup scope where the subgroup is not the simdgroup).
Runtime: flat_direct tries the flat variant of any threadgroups first. For a one-row grid in
threadgroups of one row, it then tries the call's variant (settle_flat(.., call)), which keeps its
own refusal flag and skips a threadgroup size that asks for emulated simdgroups. Indirect and
replay paths still need an oblivious kernel.
Tests:
- partition classes: each builtin and feature, mixed cases, boolean reductions;
- the artifact's two facts;
- the input's key;
- a_flat_grid_of_the_call_s_threadgroups_admits_a_kernel_of_simdgroups over every committed
profile;
- the device test flat_simdgroups. It covers: lanes in one row (1 VkPipeline); two rows and a
threadgroup barrier (2, the split); a simdgroup barrier with simd_sum (1 where the tier asks for
full subgroups, else 2). Every thread's word is checked against Metal's partition, including
the partial simdgroup's sum.
ARTIFACT_FORMAT_VERSION bump (KernelFacts gains a field) is main's.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The six commits before this one. After a device recovery every texture made before it was refused
(MadeBeforeRecovery). A recovery now carries them: a texture made by new_texture (any storage mode) is made again as
a new texture, its contents lost (its only copy is an optimal image in driver memory; Vulkan leaves device memory's
contents undefined after a loss); a texture over a buffer the recovery carried (no-copy and guest-RAM buffers, fresh
pages, Shared buffers in the runtime's page blocks) is made again over the same re-imported pages, keeping what the
buffer keeps; a texture buffer of new_texture is made again over its carried texels buffer; views follow their
textures. Left and refused as before: heap textures, textures over the caller's VkImage, sparse and shareable
textures, textures over a buffer the recovery left, and their views. The notice counts textures whose contents were
lost by storage mode ("a `Shared`, b `Managed`, c `Private` or memoryless") beside those over carried buffers.
carry.rs says imported memory's content is undefined after a loss: the hung work's writes may land partially; once
the lost import is dropped, the pages are only our memory. FAST-PATHS known gap: a recovery loses new_texture's
contents in every storage mode.
Verified (on the branch, lavapipe, m3-max-23179, CONTROL_OK): both texture tests fail before the change on the notice
and pass after; all recovery tests pass single-threaded; a Shared texture over fresh pages reads back through the GPU
the bytes the host wrote before the recovery; a Shared texture buffer's texels in a runtime page block are the same
buffer object after it, same bytes; the notice counts 1 Shared, 1 Managed, 1 Private lost and 2 over carried buffers;
texture, view, in_place, shadow, heap and faces filters pass. Clippy plain plus rustdoc, m2v_gpu, m2v_cpu_icd
(m3-max-23180..23182).
What: Texture::carry makes a texture buffer of new_texture again over its texels' buffer where the
recovery carried that buffer (texture_buffer_over, the runtime's own ID use), so a Shared one
reads the bytes the buffer carry kept; where the buffer was left it is made new as before.
Remade splits the textures whose contents were lost by storage mode (Shared, Managed, Private or
memoryless), and the recovery's notice says those three counts. carry.rs says how kept bytes are
read: Vulkan makes the content of external memory imported to a lost device undefined (vkspec
5.2.3), read as the hung work's writes possibly landing in part; once the lost import goes, the
pages are only our or the caller's memory. Docs: texture/carry.rs, carry.rs, the
DeviceRecovered cost (degradation.rs, docs/API.md, equal), the runtime README, and a known gap in
docs/FAST-PATHS.md: a recovery loses the contents of textures whose only copy is device memory
(new_texture of any storage mode), textures over carried pages keeping what their buffer keeps.
Why: the consumer asked for Shared textures' contents kept across a reset. A texture of
new_texture of any storage mode has no copy outside its image in the lost VkDevice's memory, so
keeping it would need a CPU copy at a cost to every frame; decided against for now, and recorded
as the known gap. Textures over carried pages already keep their bytes; texture buffers did not.
Verified: see the lane run reported with this sha (the test commit before it fails, this one
passes).
What: a device test (device_recovery_textures.rs). A Shared texture over a buffer in fresh pages
reads, through the GPU, the bytes the host wrote before the recovery. A Shared texture buffer of
new_texture is made over its texels' buffer where the recovery carried that buffer with its bytes
(a block of the runtime's own pages; logged as CARRY-TEXTURE-BUFFER), and reads them. Textures of
new_texture of each storage mode, whose only copy was their image, are counted lost by storage
mode in the recovery's notice. The first texture test now expects that count's wording too.
Why: a texture buffer of new_texture was made again over a new buffer, its carried texels lost
even where the buffer carry kept them; and the notice did not say which storage modes' contents
a recovery lost, which a consumer logs once per recovery.
Verified: fails at this commit (the notice's wording, the texture buffer over a new buffer), passes
with the change after it; see the lane run reported with these shas.
What: `Texture::carry` passed `*call` where the call's name is a `&&'static str` that
auto-deref makes the `&'static str` the makings take.
Why: clippy's `explicit_auto_deref` refused it (jobs m3-max-23061 to 23063, all three
configurations).
Verified: the lint run that follows covers this tree.
What: device_recovery_carry's main test named its `Shared` heap `left`, which a later
`(kept, left)` binding shadows. The heap is now `shared_heap`. device_recovery_textures'
`clear` held its render encoder in a `mut` binding it never mutates.
Why: the texture carry commit's lavapipe build failed on them (job m3-max-23060: E0689 at
device_recovery_carry.rs:282 and 284, and an unused-mut warning).
Verified: the lane run that follows builds this tree.
What: a device's recovery now carries the program's textures made by a call it can make
again (texture/carry.rs). That covers a texture of `Device::new_texture`, a texture over a
buffer the recovery carried (`Buffer::new_texture` and its kin), and a view of either.
- The call is made again on the new generation as the runtime's own texture, which takes no
ID. That texture holds the program texture's parts there: `TextureShared::next`, with a
`carried` flag.
- `Texture::s` picks the parts the work at hand reaches. Inside a command buffer's work it
answers that generation's parts (`NoticesFor::generation`); elsewhere, those of the
generation the texture was carried to last. The buffer carry picks its parts the same way.
- Every read of a per-generation field goes through it: `storage()` (the hub), facts, faces,
usage shadows, storage forms, render shadows, snapshots, memoryless backings and planes in
place.
- The texture object keeps its `ObjectId`, resource ID, label, parent and handles, and its
purgeable state is copied across. Its ID's slot in the new generation's texture table and
heap sets names its parts there (`heap_sets::place`), and leaving the slot walks every
generation's parts.
- Each program texture is kept by its generation's carry registry as it is made
(`Carry::texture`). The call that made it sets how to make it again (`Remake`) and carries
it itself where the take came first (`Device::kept_texture`, `Carry::late_texture`).
- The carry runs inside a `NoticesFor::of_generation` scope for the new generation, so the
buffer it remakes a texture over and a view's parent answer their parts there.
- Left refused, and counted by kind in the notice: a heap's texture or one over a heap's
buffer, a texture over the caller's `VkImage`, a sparse or shareable texture, a texture over
a buffer left, and their views.
- The notice adds ", and N textures whose contents were lost too (they read as new ones), M
textures over the buffers carried and V texture views".
Known gap, documented in API.md, the README and device/carry.rs: a carried texture's images
on the lost generation, and so the lost `VkDevice`, stay until the texture goes. Letting them
go at the lost generation's rest needs a hold of the parts by each call outside command
buffers' work, as `Buffer::held_parts` does for buffers.
Why: render targets and display textures made before a recovery were refused
(`MadeBeforeRecovery`) where they met the new `VkDevice`, while Metal's go on.
Tests: device_recovery_carry's main test now leaves a `Shared` heap instead of a texture as the
object that keeps the lost `VkDevice`. Its held-parts test now expects the texture made by a
call that completed on the lost generation to be carried by its maker. Docs updated:
`MadeBeforeRecovery`, the device-recovered cost (degradation.rs and docs/API.md, kept equal),
the runtime README and the heap docs. docs/REFUSALS.md regenerated (`view` became `view_as`).
Verified: the lane run of the test commit before and this one after is reported with its sha.
What: a device test (device_recovery_textures.rs). Before a recovery it makes a `Private`
render target with `new_texture` (labelled), a view of it, and a texture over a `Private`
buffer. After the recovery the notice must count one texture made again, one over a carried
buffer and one view. Each must be the same texture object on the next generation (its
`ObjectId`, resource ID and label). The texture over the buffer must read the buffer's bytes
there (zero, then what a GPU fill writes). The render target must render in a pass, read back
through itself, its old view and a view made after the recovery. Its parts on the lost
generation keep the lost `VkDevice` until the textures go.
Why: no recovery carries a texture today, so every render target and display texture made
before a recovery is refused (`MadeBeforeRecovery`) where it meets the new `VkDevice`, while
Metal's go on.
Verified: expected to fail at this commit (the notice counts no textures); the carry follows.
109 golden-hash rows move: the modules that resolve loaded pointers through the resident-set search no longer carry
its 16 unrolled steps before the loop (SEMANTICS_VERSION 2064). That change's own run (m3-max-23010) showed
golden_hashes failing for those rows (852 cells). No engine golden, printout or inventory row moves.
Verified: bless on the M3 at cb8e82cf84 (m3-max-23199): golden hashes blessed, engine goldens pass; merged check at
the same sha on msi (m3-max-23198): clippy every crate with --cfg m2v_gpu, api_signatures, api_surface, fast_paths
43/43, rustdoc -D warnings.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The two commits before this one. Texels::padding_owned() answered false for every IOSurface plane, so Padding::of gave
Kept and BufferDescriptor::padding_unobserved never upgraded it: a plane whose texels share a line of memory with its
rows' padding (a consumer's Safari tiles on an Iris, 10472-byte rows in 64-byte lines written back whole) took a
shadow at any pitch (411 tile shadows in one walk, about 1.2 MB a frame). Surfaces were left out because Metal keeps
an IOSurface plane's padding even under kernels; where the buffer's maker declares the bytes between rows unobserved,
keeping and changing them cannot be told apart, so a plane over such a buffer, holding its last row to its pitch with
its rows on lines, now answers Free and so Unobserved. Without the declaration it stays Kept.
Verified (on the branch): lavapipe (m3-max-23145) the new test fails at 5c63c7b696 (the declared plane "a shadow")
and passes at abea616629 (the declared plane "a DRM_FORMAT_MOD_LINEAR image at the pitch", the undeclared one still a
shadow), padding_unobserved 6/6; clippy three ways, rustdoc, api tables (m3-max-23146). Of the walk's 413 tile shadows
184 qualify (10480 pitch); the other 207 (1104 pitch over 61440-byte buffers) end their last row inside a line with
bytes past it.
What: Texels::padding_owned is true for an IOSurface plane's rows where the buffer declares the
bytes between a texture's rows unobserved (BufferDescriptor::padding_unobserved), as for a
buffer's rows: such a plane whose rows, each to its pitch, share no line with bytes past them has
Padding::Unobserved, so a render asks the check of renders over unobserved padding
(Access::UnobservedRenders) and a shader's writes the check that lets the padding change. Without
the declaration a plane's padding stays Kept. The docs of Padding, Padding::of, padding_owned,
Texels::padding, in_place.rs's module docs and BufferDescriptor::padding_unobserved say so.
Why: Metal keeps an IOSurface plane's padding under every command, but bytes the buffer's maker
declares nothing reads cannot tell keeping from changing. A guest's WebGL page on the Iris Xe made
431 surface tiles over padding-unobserved Private buffers shadows (each 'an image whose texels share
a line of memory with bytes beside them'), as the plane's padding asked the check of renders that
keeps every byte, which the Iris fails for rows ending inside a 64-byte line.
Verified: the parent commit's test, lavapipe before and after; clippy three ways and rustdoc (job
ids in the report).
What: an IOSurface plane's texture that renders, 101x48 BGRA8Unorm at 416 bytes a row (rows ending
inside the device's lines) over a buffer of the runtime's memory, with the device's pooled verdicts
set so that renders keeping every byte beside the texels fail and renders over padding declared
unobserved pass: over a buffer declaring padding_unobserved it must be a DRM_FORMAT_MOD_LINEAR image
at the pitch, read right through a blit; over one that does not, a shadow. Printed where the device
makes no modifier image.
Why: a guest's surface tiles over padding-unobserved Private buffers were shadows on the Iris Xe,
as a plane's padding never took the declaration (Texels::padding_owned). Fails before the fix that
follows.
Verified: lavapipe before and after (job ids in the report).
The lane's docs named a region count from a model and a forecast time; they
now state what the lane measured on an Iris Xe (504 ms in 20 pieces of at
most 31 ms) and a Radeon 780M (307 ms in 20 pieces of at most 36 ms), Mesa
26.2.6, and its line prints the plan's regions.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The three commits before this one. Since RUNTIME_VERSION 2155 Fence::device() (and at 2156/2159 a depth/stencil
state's, a library's, a function's and an address pool's) returned the device's root handle, whose raw() answers
whichever VkDevice serves now. A consumer took `new_fence().device()` as the serving generation's handle; after a
recovery its objects made on the lost VkDevice were destroyed through the new VkDevice's handles and crashed in
vkDestroyCommandPool (a consumer's Iris recovery tests, SIGSEGV; they pass at 1125fb62d2). Those five objects now hold
a LineDevice (device/carry.rs): a root handle for their own checks plus a chain of generation handles each
generation's carry registry keeps. device() again answers a generation handle, the one the object was made on or a
recovery last carried it to, as a buffer's does: a handle a caller took keeps meaning its generation and keeps that
VkDevice alive while held. The objects themselves hold nothing of a lost generation (its link let go at its rest), so
the lost VkDevice still goes while they live. The internal checks take root_device() (encoders' fence and
depth/stencil checks, sparse fences, dynamic libraries, function handles, pipeline additions, compute creation from
a function, pool slots): 2155-2159's carries are unchanged.
Verified (on the branch, lavapipe, msi m3-max-23170): the new test fails at the test commit (the fence's device a
root: generation_serves) and passes with the fix: a VkCommandPool made through fence.device().raw() inside
with_loader_word, a recovery, the handle still answering the lost VkDevice while the root answers the new one, the
pool destroyed through the same handle, the lost VkDevice gone once the taken handles drop; all 21 recovery tests
pass single-threaded. Clippy plain and rustdoc (m3-max-23171).