cb033efbcfc2379f81b3f8eef8ae6d7b5d9fda22
6243
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cb033efbcf |
RUNTIME 2476: A bind state sets aside 15 pipeline states, so a carry holds 16 kept draws
SET_ASIDE goes from 7 to 15. It bounds both the render bind state's set-aside array (LiveBind) and the compute one's (LiveDispatch), and it bounds a carry to SET_ASIDE + 1 kept draws. In guest walks, WindowServer's desktop steps turn over 25-60 pipeline states a frame. Launchpad's command buffers draw through a median of 12 states each (p90 46). Passes of more than 8 states are 1.2-2.0% of passes but 13-22% of draws in Finder and Launchpad. At 8, a pass of state k after 8 or more others finds no kept draw carried and takes every step. Docs that named 7/8 now name 15/16: live_bind.rs, render/carried.rs, render/draw_again.rs, compute/live.rs. Tests that named the bound: carried_draws' passes-of-states test now runs 16 states and expects 15 carried aside; compute_set_aside's doc says sixteen states and 32 KiB. draw_costs gets 20 plain states, so `--states 16` runs and the default pass1/pass17 shape still carries no kept draw. With 15 set aside, all of the old 12 would carry. No FAST-PATHS row names this bound. Verified (release build, msi lavapipe, encoding thread pinned to the P-cores; jobs m3-max-37724 and m3-max-37730, base and after built in one workspace). Instruction counts are the thread's user-space instructions. draw_costs pass1/pass17, figures per pass (pass1 less the draw that pass17 gives), base -> after: states 2: instructions 75978 -> 76208 (+0.3%), cycles -2.2% states 4: instructions 76278 -> 76478 (+0.3%), cycles -1.0% states 12: instructions 90656 -> 77339 (-14.7%), cycles -17.4% states 16: instructions 89686 -> 77547 (-13.5%), cycles -17.1% pass1's draws_rebound_carried at states 12 went 568 -> 9204 of 9216, and at states 16 0 -> 9200. Counts at states 2 and 4 are equal in both builds. dispatch_chain's guest compute shape (5 encoders of 1 dispatch per command buffer, 3 states, --binds tex), 3 interleaved pairs: instructions per dispatch went 45787 -> 45738 (median, -0.1%), thread CPU 5221 -> 5111 ns. Memory bound. size_of went up, render LiveBind 20808 -> 41224 bytes and compute LiveDispatch 4688 -> 8784. Each is boxed, so encoders move a pointer. Holders, each capped by the runtime: - render: 4 device spares (SPARE_LIVE_BINDS); at most one per uncompleted command buffer (its open render encoder's, or the carry it holds for its next render encoder; an opening takes the carry); at most 16 per queue held past commits (queue::CARRIES). - compute: 4 device spares (SPARE_LIVE_DISPATCHES); at most one per uncompleted command buffer (its open compute encoder's, or the one parked in it). A queue holds at most its max command buffer count of uncompleted command buffers (64 for newCommandQueue). Per queue at that default the inline worst case is: render (64 + 16) x 20808 = 1.59 MiB -> 80 x 41224 = 3.15 MiB compute 64 x 4688 = 293 KiB -> 64 x 8784 = 549 KiB and per device, on top of that, the spares: render 81 -> 161 KiB, compute 18 -> 34 KiB. Beyond size_of, each slot also has its boxed BindState and the lists that use grows; those were not measured. compute_set_aside caps a compute slot plus its BindState at 2 KiB. Unbounded by the runtime, as in Metal: how many queues a program makes and each queue's max command buffer count. Checks at the lane tip d074d4ea47 (msi): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings plain and m2v_cpu_icd 0 (m3-max-37735), m2v_gpu 0 and rustdoc 0 (m3-max-37736); lavapipe carried_draws, compute_set_aside and draw_again 48/48 (m3-max-37735). The state counts per pass and command buffer are the consumer's Iris walks (passstates, m3-max-37560/37561). |
||
|
|
da80ece1d1 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
8bcaf69f1d |
RUNTIME 2475: Compute dispatches instantiate over the commands their bind state kept
What: BindingPlan::instantiate_dispatch_into writes a dispatch's commands over a kept DispatchCommands, every field set as instantiate_dispatch sets it, the vectors keeping their storage: each region's specialization (spec_key_into, region_specialization_into) and push write's bytes, the argument table's bytes, the ranges, extents, holes and uses. instantiate_dispatch is that method over no commands. The regions a dispatch plans take no list of each axis's pieces (`Pieces`, numbers alone). In the runtime, compute::Instantiated keeps its commands as storage when a value they may read moves, and a direct dispatch that instantiates writes over them where nothing else holds them (the memo entry they were taken into is replaced first: a dispatch that instantiates settled anew); builds with debug assertions instantiate afresh and compare. WorkCounts::dispatches_instantiated_in_place counts them. Why: a guest's compute encoders bind their buffers at moving offsets, one dispatch an encoder, so their kept commands never serve again (reims's Iris walk: 96.6% of dispatches instantiated anew). Profile (msi lavapipe, dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, calling thread): instantiate_dispatch 5.6% of its CPU, about 600 ns a dispatch, of it translator instantiate 3.4%, regions 1.6%, region_specialization 1.1%; about fifteen allocations each instantiation. The commands read the buffer bindings that move, so no memo of them is exact for this shape: the cut is the work of making them. Verified: tests::bind::dispatch's instantiating_over_kept_commands_gives_a_fresh_instantiation (more regions, fewer, none, another state, the key's storage kept); compute_instantiated's encoders_of_moving_offsets_instantiate_over_the_kept_commands (five encoders of one command buffer: 5 instantiated, 4 in place, each writing at its own offset), on lavapipe. Checks at the lane tip d52118ce95 (msi): clippy -D warnings --all-targets --all-features for metal2vulkan and the runtime, plain (m3-max-37686), m2v_cpu_icd (37688) and m2v_gpu (37689), all 0; rustdoc -D warnings 0 (37689); the translator bind::dispatch, plan::compute and graphics tests 42/42 (37686); the runtime compute, dispatch and encoder tests on lavapipe in a debug build, so every in-place instantiation was compared with a fresh one, 244/244 (37688). gem10 lavapipe m3-max-37685: dispatches_instantiated_in_place 0.80 a dispatch on the tex-moved row, every instantiation; that run's timing was unusable (rows the change does not touch moved more than the cut); one interleaved timing run follows. With: dispatch_chain: an encoder's dispatch binds as its command buffer's dispatch index says (aac8651f23): at development the encoders shape never moved offsets or swapped textures. |
||
|
|
ff32d9a89e |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
d4a111c357 |
RUNTIME 2474: Compute dispatches clone no device handle: shadow planning returns early, record borrows
What: a compute dispatch no longer takes a handle of its own of the device. - EncoderCore::plan_shadows returns no copies at once for a command that uses no shadowed texture in an encoder that used none (ShadowSync::is_empty, where Shadows::before changes nothing and plans nothing); where it plans, it reaches the device through the command buffer's handle, borrowed apart from the shadows and leases the merges take. - EncoderCore::shadow_copies returns at once for no copies (nothing recorded, barriered or spliced). - compute::record reaches the device through the command buffer's handle at each use (core.device()) instead of cloning it; the pushed set-zero count is added after command_reaching_pushed rather than inside its closure. Why: every Device clone and drop is two SeqCst read-modify-writes, on the Arc<DeviceShared> strong count and on Holds::program, lines every thread of the device writes. The three clones were ~80 of the ~111 such RMWs per command buffer of 5 compute encoders x 1 dispatch (msi, locked-instruction samples), and two threads encoding at once each pay the other's writes. A probe of exactly these three borrows (msi P-cores, lavapipe, exclusive): thread CPU per dispatch spawned alone 3598 -> 3538 ns, two threads on one queue ~4290 -> 4238, on two queues ~4288 -> 4135. How verified (lane walkshare): msi P-cores, lavapipe, release, exclusive, thread CPU per dispatch (5 dispatches a command buffer), mean of 2 runs, before m3-max-37602 (5126f153ca) and after m3-max-37631 (c55c8666d9): alone on the calling thread 3341 -> 3226 ns (-3.4%), alone spawned 3621 -> 3466 (-4.3%), two threads on one queue 4306 -> 4039 (-6.2%), on two queues 4250 -> 4046 (-4.8%); per command buffer two walks on one queue 21.5 -> 20.2 us. The lavapipe compute, dispatch, encoder and shadow suites 143/143 (m3-max-37603). Clippy plain 0 (m3-max-37644) and m2v_cpu_icd 0 (m3-max-37646) at 06b683f292; m2v_gpu clippy and rustdoc follow on development (m3-max-37645). With: dispatch_chain --queue-each (each encoding thread a queue of its own) and --spawned (one encoding thread started each run, as several run), measurement flags only; shadow planning passes the borrowed device on as it is (clippy needless_borrow). shadow_copies keeps its own device handle on its work path (copies to make, rare), where what it takes from the device lives across calls on the encoder. |
||
|
|
24a0613783 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
ebfc82f564 |
RUNTIME 2473: A dispatch left to its host step holds what its tables bind from its call
A rebind racing a compute encoder whose dispatch is left to its host step
failed the command buffer EncodedUseRebound (the threaded run's host-step
family, intermittently; the consumer's answer table ends the VM on that
kind). The cause: ComputeCommandEncoder::defer_dispatch cloned the encoder's
ArgumentTable into the ArgumentDispatch and never retained it, so the encoder
held none of the buffers the table binds (only the arguments or stage-in
region buffer that copy_arguments copies). At the commit, steps_hold keeps the
command buffer's holds until it completes, which is what the rebind.rs docs
promise ("counts as uncommitted until it completed: a rebind meanwhile is
refused"), but the bound buffer was not among them. The host step's own core
held the buffer only while it recorded (Holds::new at the step's start; the
segment core's Holds drop at end_segment). So a rebind could:
- overlap the step's recording: its hold then found the publish closed past
its start, Taken::raced, and the segment's submission failed;
- or land between end_segment and the segment's batch submission: failing_at
found the pin moved.
Both fail as ReboundAt::Segment(HostStep). 2468's gate covers only the
encoder's own calls, and 2470's hold to submission is the else-branch of
steps_hold, so neither reached it.
The fix: defer_dispatch retains the encoder's table into its core
(ArgumentTable::retain), as a recorded dispatch's record() does. That keeps
the bound keys and holds each buffer over host pages among them, and
steps_hold keeps those holds until completion. So a rebind from the
dispatch's call on is refused (EncodedUses, Unreplaced::Held), never failing
the command buffer later.
- Both defer forms take it. dispatch_resident's Direct form (an indirect
stage-in region set) and dispatch_indirect_resident's Indirect form both
reach defer_dispatch, whose first statement is the retain.
- The hold is taken inside the dispatch's call, which is gated
(ComputeCommandEncoder::logged -> begin_call -> CallGate, every compute
encoder from its open). No rebind's publish overlaps it, so it never finds
a race.
- Cost: nothing for an encoder that leaves no dispatch to its host step. For
one that does, one retain per deferred dispatch, as a recorded dispatch
pays.
Deadlock audit, by lock: ArgumentTable::retain takes the table's `retained`
lock, then retain_into -> touch_keys -> Holds::hold takes rebinds.buffers. That
is table.retained -> buffers, the order record() already takes at every
recorded dispatch (compute.rs, tables.table.retain(core)). The predication
state lock taken just after for the host gate is a temporary, released
before. Nothing waits on the new hold: a rebind finds `pending` and is
refused, so no cycle can form.
Side effect, closer to Metal: the bound resources join the encoder's used
keys from the dispatch's call (used_resources, ended_encoders,
CommandBuffer::used_resources for detach_backing). Before, they were listed
only once the host step recorded. Metal knows a dispatch's resources at the
call. A detached buffer bound to such a dispatch now pins Detached at the
encoder, as a recorded dispatch's binding does.
Control: the previous commit's
a_rebind_while_a_host_step_records_a_dispatch_of_the_buffer_is_refused.
With: Rebinds: a control of a rebind while a host step records a dispatch of the buffer (1b5b6553a6, test only).
Checks at the lane tip 2fed4f8f75: clippy -p metal2vulkan-runtime --all-targets --all-features 0 and the m2v_cpu_icd test build in m3-max-37590 (msi); the control and the rebind, host_step, indirect, predication and pending suites on lavapipe, the threaded test 20 times, the negative control, clippy m2v_gpu/m2v_cpu_icd and rustdoc follow on development.
|
||
|
|
7092110549 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
7055ff84c5 |
RUNTIME 2472: Compute encoders move as one pointer, and a core ends in its box
ComputeCommandEncoder held its whole state (888 bytes) by value, so its open's return, each move by a caller (a consumer that boxes it copies it into the box), and end_encoding's self each copied it whole. Its state now lies in a box of its own (Body), and the encoder is that one pointer, as the render encoder already boxes its lowering. A core's end read the whole core out of its box onto the stack (EncoderCore::unboxed_apart in end_encoding) and passed it by value to end_with_replay, which took it apart again. end_with_replay now takes the boxed core, takes it apart where it ends, and hands its emptied box on: with a compute encoder's bind state to the command buffer's park (compute::Parking, then Parked), else back to the device's spares. The same Vulkan commands; no API change. Verified: tests::encoder_moves asserts the encoder is one pointer (it was 888 bytes against the old bound of 1 KiB). With: Compute encoders: fields through the body box everywhere; end_with_replay over a boxed or held core; end_with_replay: take the held core through one plain reference until it is taken apart. Why: a compute encoder was 888 bytes moved by value through open, the caller's Box::new and end, and its core was read out of its box whole at its end (reims decodecost: large-value memcpy 4.0% of the decoder thread). Now a move copies 8 bytes and the core is taken apart inside its box. Measured (lane encbox, msi lavapipe, dispatch_chain --dispatches 5 --groups 64 --only encoders, release, base/tip alternated twice, m3-max-37522): encode per encoder 4613 -> 4465 ns (-0.15 us), end 1102 -> 1013 ns; thread CPU 6645 -> 6488 ns. Below the 0.3 us bar for a perf claim; kept as a built, structural, measured-positive change. Checks: clippy plain, m2v_cpu_icd, m2v_gpu (-p metal2vulkan-runtime, all targets, all features) 0 in m3-max-37545; tests::encoder_moves asserts the encoder is one pointer; the lavapipe compute/encoder/render/blit suites (m3-max-37547) and rustdoc follow on development. |
||
|
|
db7a122086 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
ea9feeb12f |
RUNTIME 2471: A variant refusal is kept in the device's memo: asked once a device, said once in the log
What: the device's memo of compiled pipelines now keeps the compile layer's Unsupported refusal of a function under that function's FunctionCompileKey, the key its compiled function is kept under. Sources::function answers a later ask of the same key from it, translating nothing. A dispatch's variant answered this way gets no pipeline creation log line (Variant::compile asks Sources::refusal_kept), so the log says each such refusal once a device. Only Unsupported is kept, which the translator holds permanent for its input on the device's profile (Error::is_permanent_for). A deadline, a cancellation, a failed allocation or any other error is never kept. The entry sits in the memo's one LRU under its byte and entry bounds, weighed at what it holds, and a recovery's carry_from takes it with the rest. Why: each compute state already remembers its own flat, folded, replay and partial-threadgroups refusals (Program's *_refused flags). But a state made again of the same function starts with clear flags, and the memo kept successes only. So every new state's first indirect or ragged dispatch asked the compile layer for the refused variant again: one declined line and one refused translation per state. A guest that makes many states of one kernel logged the line thousands of times. Which form a dispatch runs, and what it answers, are unchanged: the state still records the refusal and takes the same other form. Test: tests::declined_once (lavapipe or GPU cfgs). A child process with the log on makes 4 states of one threadgroup-barrier kernel, 4 indirect threadgroup dispatches each, and checks every dispatch's words. The parent asserts 1 refused translation (a test-only counter in sources.rs) and 1 declined line. Checks (lane declineonce): lavapipe tests::declined_once in m3-max-37374: 4 states of one kernel, 4 indirect dispatches each, every word checked: 1 translation refused, 1 declined line (the control without the memo follows); clippy -p metal2vulkan-runtime all targets all features 0 plain (m3-max-37377), m2v_cpu_icd (37374), m2v_gpu (37379). Compute pipeline suites (m3-max-37387) and rustdoc follow on development. |
||
|
|
74e0d61851 |
rebind_reach: made_once is unused since the unit test asserts the refusal
m3-max-37369 (msi): clippy under --cfg m2v_cpu_icd and --cfg m2v_gpu at 5bfab2beaa failed on the unused import; rustdoc -D warnings passed. |
||
|
|
6904306929 |
Re-bless at SEMANTICS 2139: golden hashes, the new fixture's rows and printout, the census
m3-max-37348 (M3, at
|
||
|
|
cda5fd8f02 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
3a3d31c374 |
RUNTIME 2470: Rebinds: a rebind before the submission of an encoder no rebind encodes again is refused
A rebind between a command buffer's commit and the submission of its last event group, of a buffer an encoder of it named that keeps no log (a compute encoder its unit of command predication reaches past, a loop's laying, a render encoder opened while no buffer over host pages existed), failed that submission EncodedUseRebound: the commit let go of its holds, and nothing encodes the encoder again. The consumer's answer table ends the VM on that kind. Now the rebind is refused instead (EncodedUses), and the command buffer runs over the pages it was encoded over. - State::keep_replays also answers whether an encoder that keeps no log (not one its commit fails, which runs nothing) named a buffer over host pages, by its own commands or by work it left for later not recorded on the GPU alone (State::unlogged_names_a_pin). - Where so, the commit keeps the command buffer's holds (State::held_to_submission) instead of letting them go: Holds::hold_to_submission moves each from Entry::pending to a new Entry::unsubmitted under one lock of `buffers`, so no rebind falls between. They go as the last event group's first batch is submitted (State::first_submission, State::later_group), or at completion; a rebind after that keeps the old pages for the submitted work, as before. - replace and the rebind's first check refuse while `unsubmitted > 0`, counted as their own reason: WorkCounts::rebinds_refused_unsubmitted. - Cost: nothing new for a command buffer whose encoders a rebind encodes again (one pass over its ended encoders' flags at the commit, inside keep_replays). A host-step command buffer keeps holding to completion (steps_hold), unchanged. Deadlock audit, by lock: - Commit: hold_to_submission takes `buffers` under the command buffer's `state` lock: state -> buffers, the order encode_moved's Submitting and the commit's own clear of its holds already take. - Submission: the holds go under the scheduler's lock and `state`, after the `Submitting` guard (`buffers`) was dropped; each Holds' drop takes `buffers` alone: scheduler -> state -> buffers, the order the submission's judging already takes. Never under `buffers` itself. - Completion: moved out of `state` and dropped after its lock, with the submitted holds. - Nothing waits on them: a rebind finds `unsubmitted` and is refused; no wait is added anywhere, so no cycle can form. Tests (lavapipe): rebind_races gains a control (the predicated family committed behind an unsignaled shared-event wait, rebound before the signal: refused, completes over the old page, refused-unsubmitted 1), and the threaded run asserts no command buffer fails EncodedUseRebound. Tests that asserted the old outcome of such a rebind now assert the refusal and a completion over the old pages: pending_rebind, rebind_loop_check's rebind before the laying's submission, tile_rebind_making_wait's unlogged tile pass, and validation's rebind_reach test of a unit's encoder that laid its first step. The validation lane no longer has a test that announces encoded-use-rebound (degrade_notices says so). Docs: rebind.rs module docs (ordering rule, a predicated loop's laying), Buffer::rebind_bytes_no_copy, RebindProblem::EncodedUses, the encoded-use-rebound catalogue entry and its declaration, runtime README; api_signatures blessed. Follow-ups in the same landing: Rebinds: a state's reset takes held_to_submission fresh too; Rebinds: clippy (append, take) in the hold-to-submission moves. Checks (lane rebindsafe2): clippy plain (runtime, validation) 0 at 5bfab2beaa in m3-max-37364; lavapipe runtime tests 356/356 at a0fc57f283 (m3-max-37354: rebind, detach, host_page, host_step, indirect, predication, pending, holds, encoder_fold, deferred_calls), the new control refused with refused-unsubmitted 1 and the threaded run asserting 0 EncodedUseRebound. Validation lavapipe (m3-max-37365), rustdoc and the cfg clippy runs follow on development. |
||
|
|
4806a79c68 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
c8484ddf0f |
SEMANTICS 2139: An attribute read only into a gated-off output is not read
What: canon's unobserved_code kept every value-only instruction that a surviving
one reads. The returned struct's insertvalue chain stays because the return reads
it, so an insert into the field of an output a function constant gates off (or of a
field a later insert sets again) kept its inserted value alive, and with it the
value's whole computation and the parameter it read. Such an insert now inserts
`undef` in place of a value the observation does not observe (unread_inserts), and
kept_reads follows only its aggregate, so the computation and the parameter's read
go. lower::users::params_used, and with it pipeline::compile::declared_attributes,
then leave out a vertex attribute that reaches only a gated-off varying, and the
vertex projection no longer refuses a descriptor without it.
Why: a render pipeline was refused InvalidDescriptor(VertexAttribute { attribute: 1 }).
Its vertex function reads attribute 1 through one phi into a varying whose
air.function_constant predicate is false in the pipeline's constants. Metal reports
that attribute inactive and makes the pipeline from a descriptor without it. A live
attribute the descriptor lacks stays refused, as Metal refuses it.
Oracle (m3-max-37322, Apple M3 Max, macOS 27.0.1, validation layer off and on), the
new owned fixture fca_vertex_unread_attribute: constant false: attribute 1 active 0,
a descriptor of attribute 0 alone makes the pipeline, texel (64, 128, 191, 255);
constant true: attribute 1 active 1, that descriptor is refused ("Vertex attribute
color(1) is missing from the vertex descriptor"), both attributes draw
(191, 64, 64, 191).
Tests: tests::engine_unread_attribute (six committed profiles: gated off links
with attribute 0 alone and every stage passes L3; gated on refuses
VertexAttribute{1} without it and links with both); the runtime device test
tests::unread_attribute (the same three states, drawn, pixels compared with
Metal's). The lane's job reports and its negative control are in the tip report.
With 9a15486547: Owned fixture: an ungated vertex attribute that reaches only a gated-off varying.
Checks (lane deadattr): clippy plain (-p metal2vulkan-air -p metal2vulkan -p metal2vulkan-runtime, all targets, all features) 0 in m3-max-37340. Oracle m3-max-37322 (M3 Max, macOS 27.0.1, validation off and on): constant off, attribute 1 inactive and a descriptor of attribute 0 alone makes the pipeline; constant on, that descriptor is refused ("Vertex attribute color(1) is missing"). The air and translator suites, the negative control and the lavapipe draw (m3-max-37341) follow on development; golden and census re-bless on development.
|
||
|
|
e2922ae77c |
rebind_races: the two RUNTIME 2465 controls race blits, as compute calls are gated now
With compute calls gated, the hold control's dispatch refuses the rebind (its call is under way) and the publish control's dispatch waits for the held publish to close, which the test itself holds: both hung in m3-max-37299 (lavapipe, msi), the hold one because the expect panicked inside the scope before letting the paused thread go. They now run blits, which log every call and are encoded again after a race: a copy from the buffer held at its hold, and a copy from the texture over the buffer during the held publish. The hold control lets the paused thread go before it checks the rebind's answer, so a failure fails instead of hanging. Verified: m3-max-37299 at ec3cbb49c7, 313 of 315 filtered lavapipe tests passed (rebind, detach, host pages, host step, indirect, predication, pending, holds), the new gated control and the six-family threaded run among them; the two hung are these. The next job runs them. Why now: on development since RUNTIME 2468 both controls hang (m3-max-37299: the hold control's dispatch refused the rebind and its expect panicked inside the thread scope while the paused thread waited; the publish control's dispatch waited for a publish the test itself held). Verified (lane rebindsafe2): m3-max-37319 (msi lavapipe) all 4 rebind_races tests pass, the gated control refused EncodedUses, the six-family threaded run 0 wrong outputs; m3-max-37318 clippy m2v_cpu_icd and m2v_gpu cfgs 0. Test code only: no RUNTIME bump. |
||
|
|
4db18374c0 |
Re-bless the authored compile census at SEMANTICS 2138
The census (m3-max-37276, at
|
||
|
|
f10ecb62cf |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
08e584e114 |
RUNTIME 2469: Scheduler: undo the burst linger (cut 2 of RUNTIME 2467); passing holds stay
What: removes the scheduler thread's stay-awake through a burst of commit_and_submit calls
(Burst, BURST_WINDOW, Inbox::pass_each's linger, the wake within a burst), its docs in
CommandBuffer::commit_and_submit, the runtime README and the scheduler and inbox module docs,
and its tests (tests::inbox's lingering-pass test, tests::commit_and_submit's back-to-back burst
test, and tests::scheduler_wakes' sleep of BURST_WINDOW between isolated commits). The
scheduler, the inbox and those tests are again as they were before RUNTIME 2467. Kept from
2467: the passing holds' signal only where a making waits (resource_ids.rs) and dispatch_chain's
latency, busy and idle lines.
Why: the hand-off misses its condition, that commit -> submission inside a burst gets no worse
at p99. Commit-call time per command buffer fell (RADV PHOENIX 34.4 -> 14.7 us, msi lavapipe
9.1-10.0 -> 4.3-6.3 us). But commit -> kernel start inside a burst rose at p99: msi lavapipe
11-12 -> 20-28 us (steady state 7.6-8.2 -> 9.9-14.3 us); RADV PHOENIX under
CompletionPolicy::Grouped 34 us -> 1.06 ms and commit -> GPU start 181 us -> 1.25 ms, where the
thread's passes kept burst batches in groups that the committer's would have sent alone; and
with two committing threads on an oversubscribed host (gem10, load 22 on 16 threads) 96 us ->
1.45 ms, where a lingering thread that is preempted while counted holds every commit left to
it.
Verified: the lane's potluck job (build, clippy, the touched lavapipe tests), named in its report.
Why undone: RUNTIME 2467 cut the commit call 34.4 -> 14.7 us per command buffer on RADV PHOENIX, but raised commit-to-GPU-start p99 there from 181 us to 1.25 ms (the scheduler thread's own passes held burst batches in groups under Grouped), and two-thread p99 under host oversubscription from 96 us to 1.45 ms (a lingering thread preempted while counted holds every commit left to it). Cut 1 (passing holds) and the bench stay.
Verified (lane walkcpu): m3-max-37306 (msi): build 0, clippy plain 0, lavapipe touched suites 71/71 (commit_and_submit, scheduler_wakes, inbox, left, resource_ids, passing_holds, waiter_submits, submission_turns). The seven files are identical to
|
||
|
|
3271b20cf8 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
5acd27cd0d |
RUNTIME 2468: Rebinds: a call of an encoder the runtime cannot encode again never races a rebind
After RUNTIME 2465 a rebind racing an encoder call on another thread is detected and the encoder encoded again; one the runtime cannot encode again (a compute encoder its predication unit reaches past, one that left a GPU-written indirect dispatch to its host step, a render encoder that keeps no log) failed EncodedUseRebound at submission instead, which a consumer's answer table treats as fatal. The protocol: those encoders' calls are gated, so no publish overlaps one. - Rebinds gains `calls` (gated calls under way). A gated call begins (`Holds::begin_call` -> `CallGate::enter`): calls += 1, then reads `open`; where a publish is open it backs off and waits for it to close (`wait_published`), before it reads anything of a buffer over host pages. - A rebind's publish now opens before its replace (`Rebinds::quiet_calls`): open += 1, then reads `calls`; where a call is under way it waits for the calls to end (`drain`/`drained`), up to CALLS_DRAIN (2 ms), and is refused past it (EncodedUses, Unreplaced::Calls), never failing the encoder later. The four accesses are SeqCst (a store-buffering handshake: of a rebind and a call that meet, at least one reads the other's rise), so each gated call reads the buffer wholly before the publish (holding it, which refuses a rebind until its commit) or wholly after its close. Chosen over the registry lock: the call side costs two atomics and takes no lock. - Which encoders: every compute encoder, and a render encoder that opened with no log. A compute encoder can become unreplayable mid-encoding (the call that records predication, a loop's record, an unbalanced record that leaves work out, a later encoder of its unit that lays a loop, a dispatch left to its host step), after earlier calls ran: a gate that started at that transition would leave those earlier calls racing. So the gate covers a compute encoder from its open. Blit encoders always log, and render encoders with a log, stay re-encodable and pay nothing new. A device with no buffer over host pages pays one Relaxed load per gated call (`any`). - Nesting: a thread-local depth, so a call an encoder's call makes of its own public calls (a blit's unlogged calls, a loop's copies) never waits. - WorkCounts: rebinds_refused_calls_in_flight (the retry rate), encoder_calls_held_by_rebind, and encoders_raced_unreplayable (raced encoders committed with no log: each fails EncodedUseRebound; zero now). Deadlock audit, extending 2465's, by lock: - `drain`: taken by a rebind waiting for the calls (no other runtime lock held: rebind_host_pages holds no lock across replace) and by a gated call's end, which holds none of the runtime's at its end. Nothing is taken under it. - `buffers`: `unopen` takes it alone to lower `open` and notify `closed` (so a waiter between its check and its wait cannot miss it); a gated call's back-off waits on `closed` under it, holding at most its render deferral's `lowerer` lock (lowerer -> buffers is the order holds already take). No publish step takes `lowerer`; the rebind's `lower_all` runs before the publish opens. - The rebind's wait for calls is bounded (2 ms), so a gated call under way that waits on a thread held at a gated begin (a render end waiting for its lowering) ends in a refusal, not a deadlock. A gated call waits only as it begins, never under way, and the publish waits for nothing an encoder holds (2465's audit), so every begin's wait ends when the open publishes close. Docs: the Safety text of Buffer::rebind_bytes_no_copy and Heap::rebind_bytes_no_copy, the rebind.rs **Other threads** bullet and RebindProblem::EncodedUses state the new outcome: refused, never failed later, for the gated kinds. api_signatures.tsv gains the three fields. Tests (src/tests/rebind_races.rs): a pause-point control (a predicated dispatch, Unlogged::Predicated, held at its hold while the main thread rebinds: the rebind refused, the command buffer completes over the old page, refused-for-calls 1); the threaded run gains a predicated family and a host-step family (an indirect stage-in region, Unlogged::Segments), and asserts encoders_raced_unreplayable == 0. Follow-up in the same landing (cc0b4592a3): Rebinds: the refusal reason carries no pages (clippy: field never read). Unreplaced::Held and Unreplaced::Calls no longer give the new pages back: replace drops them once the registry's lock went (unopen drops the guard first), as the caller's map_err dropped them before. Also the docs of the encoded-use-rebound notice (degradation.rs, docs/API.md) and the runtime README say which encoders still fail it after a race (a blit or logged render encoder whose commit failed it, or whose encoding again a call that answers otherwise refused) and that gated calls never race. Verified: m3-max-37298 (msi) clippy at ec3cbb49c7 failed on exactly these two fields; the next job checks this commit. Checks (lane rebindsafe2): clippy plain (runtime, all targets, all features) 0 at cc0b4592a3 in m3-max-37302; lavapipe rebind/detach/host-page/host-step/indirect/predication/pending/holds suites with the gated control and the six-family threaded run in m3-max-37299 (ec3cbb49c7, same library code), the gate-off negative control, clippy GPU/CPU-ICD cfgs and rustdoc follow on development. |
||
|
|
80d1e277d0 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
e016e264c6 |
host_residency: the excess release loop lints clean where parked images are not built
Excess has its Parked variant on unix alone (RUNTIME 2464). Off unix the
release loop's let group = match excess { Excess::Group(group) => group }
is a single infallible arm, which clippy's infallible_destructuring_match
refuses under -D warnings: the runtime crate's clippy failed on Windows
(host_residency.rs:1200, job m3-max-37264 on the UHD 630 node, native
gnullvm, --cfg m2v_gpu --all-targets --all-features), as CI's clippy for the
Windows targets does.
A parked image is now released by a cfg(unix) if-let before the group is
taken, and Excess::group gives the group (None for a parked image), so the
loop is the same code on every target and unchanged in behaviour on unix.
Verified: Windows clippy in the job named in the lane's report.
Checks (lane d32s8): Windows clippy (runtime, all targets, all features, GPU cfg, x86_64-pc-windows-gnullvm) 0 in m3-max-37272 (it failed at development in m3-max-37264); msi m3-max-37281: Linux clippy plain 0, lavapipe host_residency and dma_buf_parked_images 10/10. Unix behaviour unchanged, so no RUNTIME bump.
|
||
|
|
2bafb6537a |
SEMANTICS 2138: Fragment simdgroup lane: run it on Cluster32 tiers, refuse it only below 32 lanes
What: a fragment function that reads [[thread_index_in_simdgroup]] on a profile
without DriverDeviation::MetalFragmentSimdgroups was refused Unsupported{SimdWidth}
on every tier but Direct. It is now refused only on Tier::PartialFragment (fragment
subgroups narrower than 32). On Tier::Cluster32 (a 64- or 128-lane fragment stage,
e.g. RADV on Polaris, wave64 only) the lane is the subgroup lane's low five bits.
Why: the guest is told an Apple GPU's width, 32 (threadExecutionWidth 32,
[[threads_per_simdgroup]] the constant 32), and its shaders are built for 32-lane
simdgroups. On Cluster32 each aligned 32 lanes of the device's subgroup is one
simdgroup. The function's simdgroup operations already ran there, and the emitter
already gave the lane as L & 31 (group::Lane::metal), the same cluster the shuffles
and ballot words use. So the device lacked nothing; the refusal was ours. The lane
is the device's grouping, which Metal allows, and records the existing
PrecisionNote::FragmentSimdgroupGrouping as before.
Tests: engine_simd's fragment-lane test also runs on wave64() (the committed RDNA3
description narrowed to 64 lanes) and requires every lane form to compile there on
Cluster32 with the note, the low-bits mask and L3. Without the fix it is refused and
the test panics. Device test fragment_simdgroup_lanes_are_metal_s accepts the
SimdWidth refusal only where the fragment stage's sizes are all below 32, so on a
wave64-only device it fails without the fix; it also prints the stage's sizes.
Docs: the note's text in docs/API.md and PrecisionNote, the doc comments in
lower::simd. SEMANTICS_VERSION 2137 -> 2138. REFUSALS.md regenerated, unchanged.
Checks (lane simd64): msi m3-max-37237 clippy plain 0, tests 88/88 (engine_simd, public_fixtures_engine, fast_paths, device::tests::subgroup); m3-max-37255 clippy GPU and CPU-ICD cfgs 0, rustdoc 0. The RX 550 run (m3-max-37259) follows on development.
|
||
|
|
a8b791bd12 |
completion_latency: the completion sync file calls compile on unix alone
CommandBuffer::add_completion_sync_file and export_completion_sync_file live
in command_buffer/sync_file.rs, which is cfg(unix). The guest-shaped leg's
commit closure (RUNTIME 2430) called them on every target, so the runtime's
lib test did not compile on Windows (error E0599 at completion_latency.rs:1670
and :1674, job m3-max-37226 on the UHD 630 node, development
|
||
|
|
ac2de74dee |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
b01ec7ceeb |
RUNTIME 2467: Scheduler: awake through a burst of commit_and_submit calls; passing holds signal only where a making waits
What: - Scheduler (scheduler/mod.rs, inbox.rs): a commit_and_submit within BURST_WINDOW (100 us) of the one before wakes the scheduler's thread after its own pass; the thread then stays counted as the inbox's passer while the last commit_and_submit came within the window, spinning on the inbox, so later commits of the burst post and return, left to it, and its next pass takes them in commit order. submit_before_waiting, a waker's poke for what is not in the inbox, and a stop end the burst. An idle device's thread spins not at all; a burst costs that thread's CPU for its length and one window more. - Passing holds (resource_ids.rs): the last hold to end signals only where a making waits. - dispatch_chain bench: back-to-back command buffers, encoding threads on one queue, commit-to-start latency, CPU per second busy and idle. - Docs: commit_and_submit and the runtime README describe the burst. Why: a guest's decode walk commits small command buffers (5 compute encoders of 1 dispatch) 35 to 76 us apart on its critical path, and each commit_and_submit made the scheduler's pass inline on the committing thread (Inbox::pass_on inside the commit). Left to an awake scheduler thread, the commit call returns early. Verified (lane walkcpu): - msi lavapipe (m3-max-37234), commit call per command buffer of 5 encoders x 1 dispatch: 64 back to back 9.2 -> 4.5 us; two threads on one queue 11.5-12.6 -> 5.1 us, commit-to-submit p99 61 -> 42 us. About 95% of a burst's commits went to the awake thread. Scheduler thread CPU idle 0.0 ms/s before and after; in a burst 34 us per command buffer. - Isolated commits (2 ms apart) still pass inline: passes_at_commit 1 per command buffer. - Open: commit-to-submit inside a burst, p50 4.5 -> 5.6 us, p99 15-23 -> 29-37 us; the lane is splitting the burst's head from the rest to find the cause. - clippy (plain at b8a81d328d, m3-max-37217; GPU and CPU-ICD cfgs at 675023517e, m3-max-37223), rustdoc (37223): 0. - New tests: inbox linger unit test; device test of 48 back-to-back commits on 1 then 2 threads (handlers keep per-queue commit order, at least a quarter left to the awake thread); passing holds unit test (1000 holds, no making: 0 signals; 2000 raced rounds: every making goes on). |
||
|
|
11e7a30c94 |
Start stamp test: the batch's first work is checked by its span alone, not by a copy-in counter
What: a_command_buffer_s_gpu_span_holds_its_batch_s_first_work no longer asserts WorkCounts::managed_bytes_copied_in >= FIRST on a device without unified memory. The leg prints whether it made the Managed buffer's copy in instead, and the module doc names managed.rs (the runtime's own Managed buffers) rather than managed_copy.rs (Managed no-copy buffers). Why: that counter counts only copies into Managed buffers over the caller's pages (Buffer::copy_in_from counts where caller_copy() is some); the test makes a Managed buffer of the runtime's own, whose copy in nothing counts, so the assertion failed on every device with two copies before the check the test exists for. On the RX 7900 XTX (RADV), m3-max-37158 ran the leg before and after RUNTIME 2466: 0 bytes counted both times, failing at the counter, while its times showed the fix: before, span 0.001 ms of 41.292 ms added (kernel end to GPU start 41.688 ms); after, span 41.023 ms of 40.884 ms added (kernel end to GPU start 0.127 ms). The span check that remains fails before the fix and passes after it on those numbers. Verified: the numbers above from m3-max-37158; the changed test's run follows on development. |
||
|
|
6386a12a6b |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
35ac917d6f |
RUNTIME 2466: GPU start: written before the batch's first work, and at the top of the pipe on every driver
What: a timed command buffer's first batch with first work (new resources' first moves and zero fills, Managed copies in, staged copies) writes its start timestamp in that work's command buffer, after an execution barrier from every command before and before the work; and every start is written at the top of the pipe, where batches ordered by their ends wrote it at the bottom. Why: GPUStartTime must say when the GPU began the command buffer's work. In a traced Geekbench-like compute pass on an RX 7900 XTX (RADV, Mesa 26.2.6), the gfx ring's drm_sched jobs placed on the trace's clock (the job trace drifts 39.8 ppm against it, fitted per pass) showed command buffers whose start lay in the last tenth of their own job: spans of 1 us on jobs of 4.5 to 36.5 ms. Two causes. (a) The first work is inserted ahead of the start, and the start, at the bottom of the pipe under by-ends ordering, waited for it: managed copies in of the guest's did_modify_range ranges were 0.25 to 6.98 GB per workload. (b) With no first work too (prefixed starts, 237 first-work batches of 7486), about 1700 command buffers read their bottom-of-pipe start late; a Radeon 780M showed the same. That GPU time counted as "submitted, GPU not started" in the consumer's split: 4.06 s of its 5.90 s on the XTX. Ordering (every driver path): the first work's start follows an execution barrier ALL_COMMANDS -> ALL_COMMANDS, whose "first synchronization scope includes all commands that occur earlier in submission order" and "second synchronization scope includes all commands that occur later in submission order" (vkCmdPipelineBarrier), the timestamp write among them. A start at the top of the pipe where batches are ordered by their ends is held by the earlier batch's end barrier, Barrier::to_all (src ALL_COMMANDS, dst ALL_COMMANDS and HOST), by the same clause. Where batches are not ordered by their ends the starts were at the top already and are unchanged; a start after a barrier planned before the first encoder stays at the bottom, after that barrier. Whether Metal's span holds a Managed copy in on a Mac with a discrete GPU is not measured (the 5300M oracle can say). Verified: compile and device runs pending (tests/start_stamp.rs). Also folded: the test of a command buffer's GPU start against its own long work and its batch's first work (e86e9d356e). |
||
|
|
4933e7cba9 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
372cf95641 |
RUNTIME 2465: Rebinds: an encoder call that races a rebind on another thread is encoded again
rebind_bytes_no_copy (Buffer and Heap) may now run while other threads encode and
commit command buffers that use the buffer or heap. Before, the Safety contract
excluded that; this lifts it.
The windows found:
- W1: an encoder call reads a buffer's pages before it holds the buffer. A
dispatch builds its bind state, a draw its tables, and a blit reads the
VkBuffer for a copy run that records in a later call. A rebind can land
between that read and the hold. The hold then pins the new pages while the
commands name the old ones.
- W2: what lies over the bytes (aliasing images and their views, texel views,
the heap sets' elements) is made over the new pages only after `replace` has
let go of the registry's lock. A hold in that gap pins the new pages over
half-made state.
- W3: the render lowering thread does the same reads, later.
- W4: an encoding again (`replay.rs`) can run under a concurrent rebind of
another thread. This one is a live defect under today's contract: a commit's
rate-map or split re-encode, and one rebind's turn racing another buffer's
rebind.
- W5: a texture made over the bytes during the call stays excluded.
The change: detect, then encode again. Nothing waits on the encode path.
- Each rebind's publish runs from `Rebinds::replace` to a new
`Rebinds::published`. `published` is the close, after `renew_over`. It is
tracked by a per-device count of closed publishes (`published`), a count of
open ones (`open`), and `Entry::publishing` / `Entry::published`.
- Every encoder call loads that count as it begins (`Holds::begin_call`: one
Acquire load of an AtomicU64). The sites: compute and blit `logged`,
`end_encoding`, the five predication calls, render `Lowering::logged`, the
deferral's `at_call_unit`, the replay dispatcher and `open_render`, which
reads the count before it reads the attachments.
- A hold or pin finds the call raced when the entry's publish is open, or
closed after the call began. A raced Taken counts as rebound
(`Submitting::rebound`), so the commit encodes its encoders again before the
first submission (`State::raced_again`), as for a rate-map reset.
- `reencode` loops: when an encoding again itself raced, it waits until no
publish is open (`Rebinds::wait_published`, a condvar on `buffers`) and
encodes again.
- The close marks again the command buffers committed while the publish was
open, so their raced encoders are encoded again over finished state.
- An encoder the runtime cannot encode again whose call raced fails
EncodedUseRebound at its submission. These are the existing list: a compute
encoder its predication unit reaches past, one that left a GPU-written
indirect dispatch to its host step, a blit or render encoder opened while no
buffer over host pages existed, one whose commit fails it, and one with a
call that answers otherwise. A rebind that no encode overlaps changes
nothing for them.
- New WorkCounts::encoders_raced_rebind counts the encoders marked stale this
way.
- `blit_at` holds the buffer before it reads its VkBuffer, because a copy run
records in a later call.
- `replace` refuses a second rebind of a key whose publish is open
(EncodedUses).
What the publish window covers:
- Inside it: `live_buffers.rebound`, the alias leave/hold/place, the image
swaps and parking, the texel views, `forget_stale` and `renew_over`.
- Moved after the close: dropping the read twins (`drop(twins)`), dropping
the old pages (`drop(old)`, which reaches vkDestroyBuffer/vkFreeMemory and
the deallocator), `release_held_back`, `heap_sets::retire` and the
encodings again.
- What a later pin judges against: the old pages' twins and the stand-ins.
- Not covered: the import of the new pages and the images made again over
them before `replace`. These are the rebind's own and are invisible to
other threads until `replace`.
Deadlock audit, by lock:
- `rebinds.buffers`:
- `hold` and `pin` take `buffers`, then the cell's `pages` (`lying`), and
hold nothing across them.
- `replace` takes `buffers` -> `waiting` (`mark_waiting`) and `buffers` ->
`pages` (`cell.replace`).
- `published` takes `buffers` -> `waiting`. `mark_reencode` is an atomic.
- No thread holds `waiting` or `pages` and then takes `buffers`.
- The existing `state` -> `buffers` order (`encode_moved`'s `submitting`)
is unchanged. Neither publish step takes a command buffer's state lock.
- `wait_published`: its callers hold only the command buffer's `reencoding`
turn. These are the commit (after its state and slot locks are gone) and a
rebind's or commit's `reencode`. No publish step takes a `reencoding` lock
or waits for one. A publish waits for nothing: these take no lock an
encoder holds across a hold:
- `live_buffers.inner`;
- `aliases`;
- the image swap and view locks (`Image::swap_in`);
- HostPages `parked`;
- `rebinds.stale`;
- the texel views;
- `heap_sets`: `passing_hold` and `heaps`, whose writes are deferred while
`heaps.holds > 0`, with no wait.
So every wait ends as soon as the open publishes close.
- The test pause points (`rebind::pause`, cfg test) stop at the hold, with
no runtime lock held, and in the publish after `replace` has let go of
`buffers`.
Docs:
- The Safety text of Buffer::rebind_bytes_no_copy and
Heap::rebind_bytes_no_copy states the new contract and outcomes. Still
excluded: another rebind or a detach of the same buffer or heap, a texture
made over its bytes, and a resource placed in the heap, during the call.
- The rebind.rs module docs gain an **Other threads** bullet.
- Also updated: the EncodedUseRebound declaration and its docs/API.md
catalogue entry (the cost text is unchanged), the `renew_over` doc and the
runtime README.
- api_signatures.tsv gains the new field.
Tests (src/tests/rebind_races.rs, device tests):
- A pause-point control at the hold: a dispatch that read the bound buffer
before its hold, with a second buffer keeping the old import. Expected: the
new page's output and one raced encoder.
- A pause-point control in the publish: a dispatch reading a texture over the
buffer.
- A threaded run: four families (a dispatch of a texture over K, a draw with
K as a vertex buffer, a blit copy from K, and a dispatch bound a call
before) against a rebinding thread. Each output must be wholly one page of
those K lay in meanwhile, or EncodedUseRebound.
Hot path: one Acquire load per encoder call (begin_call) plus one compare
under the lock the hold already takes. Per-call numbers follow in the bench
commit or report.
Also folded: the threaded run reports the pages its outputs read and each wrong output's reason
(060e8219f0); and a publish's close counts as a move (buffer::host_cells_settled), so a binding read
during the publish (a texel view for one) is not kept under the post-replace count and reused
by a later encoder that did not race; debug checks (check_reading, compute check_whole,
KeptSpaces::of) hold off where a call may have raced (rebind::call_may_have_raced, debug only)
(0c7a7a5c98).
Verified (lavapipe, msi): m3-max-37154 at 0c7a7a5c98: clippy plain and --cfg m2v_cpu_icd 0;
rebind*, pending_rebind, degradation*, argument_table, live_bind 41 passed; the hold and publish
controls raced 1 and completed; the threaded run (4 threads x 25 command buffers: a dispatch over
a texture over the buffer, a draw with it as vertex buffer 1, a blit from it, a dispatch bound a
call before) read every output wholly from one page, 0 EncodedUseRebound, 63 rebinds made, 1,537
refused (EncodedUses), 5 encoders raced, 11 encoded again. Negative control m3-max-37156 with
Entry::raced forced false: the hold control fails (the dispatch read the pages the buffer left).
|
||
|
|
d3389d7cbb |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
49b25c189c |
RUNTIME 2464: Parked dma-buf images released at the next pass where held imports tax submissions; each whole guest RAM import said with its time
A parked image (an in-place image over a no-copy buffer's dma-buf pages, kept for the next texture over the same pages) is one more imported memory on every kernel submission's list on RADV and ANV on i915. On the Radeon 780M that costs about 0.46 us a submission (m3-max-36970: 167 against 6 listed memories, 86.8 against 13.7 us a submission), 0.53 ms a second at the 1,150 submissions a second of a guest's desktop. Held 2 s (released by the first pass at least 2 s after the park, passes every 0.5 s), an untaken park cost 1.06 to 1.32 ms of vkQueueSubmit time, while a take saves its texture's making: on the 780M 0.13 ms (7.9 MiB) to 2.6 ms (84 MiB) over 2 MiB pages, 0.73 to 24.3 ms over 4 KiB pages (texture_shadow_bench, m3-max-37048, medians). In a guest's desktop walk on the 780M, 443 of 2,098 parks were taken; at 2 s the parks cost about 2.0 to 2.5 s of submit time, which pays only where a take saves 4.5 ms or more on average. Where Device::pointer_imports_tax_submissions holds, the residency thread now releases a parked image at its first pass after the park (held 0 to 0.5 s, 0.25 s on average); elsewhere, where a held import costs no submission, the 2 s window stays. The cap of 64 parked images stays. Expected, not measured: takes come soon after their park (a guest wrapping the same surface again a frame or two later), so most still hit; an untaken park then costs about 0.13 ms instead of 1.2 ms, and a desktop walk at the cap holds about 10 parked images instead of 64. The proof is a guest's desktop walk on the 780M before and after: dma_buf_images_taken against dma_buf_images_missed, dma_buf_images_parked_released, and batch_submit_nanos per submission. Tests: dma_buf_parked_images now forces the import tax: with Fails, a pass right after the park keeps the image; with Holds, the next pass releases it (fails without the change: the 2 s window keeps it). texture_shadow_bench's in-place arm parks its image in a warm-up within its own cycle, outside its times and counts, so its texture still takes one: the other arms between two of its cycles run longer than a pass. Documented in host_residency.rs, dma_buf/parked.rs and docs/HOWTO.md. No new Degradation kind; not an accuracy choice, so no FAST-PATHS row. Also folded: Guest RAM: say each whole import, with its time; bench it at 2, 4 and 8 GiB and across a recovery A device that imports a resident guest RAM whole as its use begins now says so once on its message sink (id name metal2vulkan-host-ram, Info): the bytes and chunks imported, those left to the copies, the imports' time and the first listing's (the submission of no work it waits for). A consumer then sees the one-time wait at setup in its log, and at each recovery of the device, whose carry makes the use again on the new device before it serves, so the new device imports the RAM whole in turn on the recovering thread. Tests (host_ram_whole.rs): the resident RAM says the line once, naming its bytes and its one chunk; the RAM with a hole says nothing; a recovery imports the resident RAM whole again before recover_for_test returns, and says so again. The ignored whole_ram_bench runs 2, 4 and 8 GiB RAMs, each on a device of its own, each with a hole and then resident, the resident one recovered, printing the device's lines. Documented in host_ram.rs (the module docs and use_host_ram) and docs/HOWTO.md. Guest RAM recovery test: read the chunks of the generation that serves a_recovery_imports_a_resident_ram_whole_again_before_the_new_device_serves read the RAMs through the root handle, whose own generation the recovery lost, so it found none and passed without asserting (m3-max-37099: "the new device does not import the RAM whole ([])", while the same run counted one chunk imported ahead in the recovery and heard the second line). It reads them through Device::current now, the generation that serves. The docs give the 780M's measured whole-import times at 2, 4 and 8 GiB (m3-max-37099): the imports 0.05, 0.08 and 0.1 s, the first listing 0.43, 0.63 and 0.51 s. And: whole_ram_bench times the first commit after the chunks' imports apart (dbc707372d); one doc line rewrapped (0d19c052f8). Verified: at ae6ae7876a clippy x3 (m3-max-37116 CLIPPY_GPU=0; m3-max-37117 CLIPPY=0, CLIPPY_CPU=0, DOC=0, 20 host_ram unit tests, lavapipe host_ram_whole/dma_buf_parked_images/host_residency 13 passed: the parked check kept with the tax forced Fails, released with Holds). PHOENIX (m3-max-37099, at c894bbdb13): whole import 2/4/8 GiB: imports 56/77/102 ms, first listing 441/633/511 ms, use_host_ram 532/759/690 ms; recoveries 507/768/716 ms; the lazy first commit today 429/639/510 ms. |
||
|
|
3f9cf43310 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
2921fb24da |
draw_costs: one thread run's answer is a named type
Clippy's type_complexity refused thread_run's return type and its callers' Vec of them (job m3-max-37074, all three configurations). A ThreadRun alias names the tuple. Verified: in the landing's check job. |
||
|
|
df87983bb7 |
RUNTIME 2463: Render draws: the restarted list and the error and notice makers out of line, cold
What: draw_resident's restarted-list arm (the index rewrite and gather requests, 205 source lines) is its own #[cold] #[inline(never)] method, restarted_list; Device::degrade, degrade_copied_pages, degrade_host_step, degrade_where and tell, and error.rs's vulkan, invalid, nil and internal are #[cold]. Same commands, barriers and answers; only where the code lies changes (draw_resident 130.7 -> 127.4 KB of machine code). Also folded: draw_costs gains a guest shape of a few render encoders with set_bytes and each thread's CPU a draw (17126bfe04), the encoding thread's own CPU apart from unnamed threads (afa24f4074), and --calls counting each call's cycles and cache misses (7249f6930b). Why: on a Zen 4 host a one-draw render pass ran at IPC 0.79 against 1.7 inside a long pass, the same on RADV and lavapipe (gem10, m3-max-36911/36975). The misses are instruction fetches: per pass about 8.3k L2 instruction misses against 1.2k data, over 806 distinct 4 KiB code pages (more than the L2 iTLB's 512), no function above 7.5% of them (m3-max-37017, -37041). This change is measured neutral (m3-max-37061, lavapipe, release: pass1 instructions 112,257 -> 112,123, L2 misses 10,590 -> 10,577; cycles within the node's noise) and kept as correct and neutral; the lever left is the layout of the path's code across pages, a build setting of the program. Verified: see the landing's check jobs. |
||
|
|
be905fd899 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
0da1b0a342 |
RUNTIME 2462: Guest RAM: a resident, kept RAM takes chunks past 512 MiB, all imported as its use begins
On a device whose every held import costs each kernel submission (RADV, ANV on i915), a listed guest RAM's chunks stopped at LONGEST_LISTED_CHUNK (512 MiB), our own constant: an 8 GiB guest listed up to 16 chunk imports in every submission (the consumer's Iris Xe desktop: 15 live, about 4.7 ms/s at 0.35 us each and 1114 submissions/s). The cap bounds memory alone: a chunk's import pins every page of it, and udmabuf allocates the pages of the guest's memfd that the guest never touched. A RAM the VMM preallocated has every page allocated already, so there the cap bounds nothing. ram_plan now asks listed_chunks_of: where the cap would cut a range into more chunks than the source's and the device's limits do, the chunks are kept (releases_idle_chunks false), and every page of the RAM is resident as the use begins (every_page_resident: mincore over the ranges, a chunk at a time, stopping at the first page missing), the chunks run to those limits (4032 MiB on RADV and on ANV, whose maxStorageBufferRange is 4 GiB less one byte: an 8 GiB RAM in 3 chunks) and the plan is whole. A whole plan's chunks are all imported on the calling thread before Device::use_host_ram returns (Device::import_whole, counted as chunks imported ahead), then one internal submission of no work is made and waited for: the first kernel submission that lists a chunk just imported waits while the kernel writes its page tables, and every other submission of the device waits with it (the VM's page-table lock), so that wait falls in the use's start, before the guest's work, never inside a later submission. Vulkan used: the chunk import as before (vkAllocateMemory with VkImportMemoryFdInfoKHR) and vkQueueSubmit with a fence, waited for. A RAM with a hole, or one too long to keep, keeps the cap and its lazy imports as before. listed_chunk_bytes now gives the limits' length alone; the cap moved into listed_chunks_of. The module docs, use_host_ram's, Plan's, the imported-ahead count's, HOWTO section 6 and the FAST-PATHS "Idle dma-buf imports are released" row say so. Tests: listed_chunks_are_as_long_as_every_limit_takes_in_whole_64_mib (the limits' length); a_resident_kept_ram_takes_chunks_past_the_cap_imported_whole (the rule, residency asked only where the cap cuts the RAM; fails without the change, which answered the cap); and a_ram_is_resident_once_every_page_of_its_file_is (mincore, a memfd with a hole then written). The device tests tests::host_ram_whole (a 640 MiB resident RAM: one chunk imported as the use began; one with a hole: 512 + 128 MiB, none imported) and the ignored whole_ram_bench (a consumer's 8 GiB RAM in 16 chunks of 512 MiB each imported against 3 imported whole: the use's time and a submission's vkQueueSubmit time). Also folded: the probe tests::listed_memories with the test-only census Memory::blocks_by_kind (7120ba7212), and the unit tests' clippy fix (9efafb7742). Verified: clippy x3 at 9efafb7742 (m3-max-37010 CLIPPY_GPU=0, m3-max-37011 CLIPPY=0 + 20 host_ram unit tests, m3-max-37012 CLIPPY_CPU=0); rustdoc m3-max-36994 DOC=0; lavapipe host_ram 120 passed (m3-max-36995). PHOENIX (m3-max-37009): a touched 640 MiB memfd took one 640 MiB chunk imported ahead (use 126.2 ms); with a one-page hole [512, 128] MiB, none ahead. 8 GiB bench: 16 chunks listed -> 3, vkQueueSubmit 11.6 us a submission resident against 971.7 us averaged over 300 with the lazy chunks (first-listing stall included); use_host_ram 459.7 ms (89.0 ms imports). |
||
|
|
8167cc60de |
commit_and_submit: the order test drains its queue every 50th commit, as the checked one does
What: submission_handlers_keep_commit_order_across_commit_and_commit_and_submit now makes every 50th commit a commit_and_submit that first waits for the commit before it to complete, as checked_command_buffers_keep_commit_order_across_commit_and_commit_and_submit does. Why: the test asserts some submission handlers ran on a committing thread. Each commit() wakes the scheduler's thread, whose pass is often still under way at the other thread's next commit_and_submit, which then makes no pass; and on a driver whose batches group, a committing thread submits only where its VkQueue runs at most one earlier submission not seen complete, which the two threads' backlog may never leave it. On the Radeon 780M (RADV) inside the touched suites' run it failed: 0 of 1000 handlers on a committing thread, 1 pass at commit, 0 batches (m3-max-36934, debug, 76 tests in parallel). Run alone in release it passed 10 of 10 with 12-17 of 1000 on a committing thread, with RUNTIME 2461's fix and without it alike (m3-max-36983): the margin, not that fix. After a drain the scheduler's thread is idle and the VkQueue runs nothing, so the commit_and_submit makes its pass and submits alone. Verified: in the jobs named in the lane's report. |
||
|
|
2ccc3e9c38 |
Re-bless the golden hashes and the authored compile census at 9ae7edf748
What: SEMANTICS 2137 ( |
||
|
|
9ae7edf748 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
ba311896eb |
SEMANTICS 2137: Iris: a loop-uniform read-only slot stays a storage view (undo SEMANTICS 2136)
What: reverts |
||
|
|
4f081c3490 |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
e6900ca020 |
Iris constant twin doc: state the per-encoder evidence, not one walk's totals
What: DriverWorkaround::PushReadsLengthenThreadPayload's doc (device/profile.rs) said a storage twin of a kernel's uniform view took 145.8 to 150.2 s of GPU time over a walk of guest compute workloads that took 137.4 s without it. It now gives the mean GPU time an encoder from the runtime's encoder times in two walks without the twin against four with it. Comment only; no code, version or answer changes. Why: the 137.4 s total came from one walk (m3-max-35702, scratch 68e39640e9). The second walk without twins, m3-max-36778 at |
||
|
|
24ccfe58db |
Re-pin the runtime sources at the landing tip
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. |
||
|
|
d6152c3247 |
RUNTIME 2461: Scheduler: a pass at commit asks whether a batch's host step is due, not whether it holds segments
What: scheduler::plain(), which decides what the pass of a committing thread
(commit_and_submit) and of a thread about to block may submit, left every batch that holds
segments to the scheduler's thread as a host step (LeftAtCommit::HostStep). It now asks the
command buffer whether a step is due (needs_host_step), as the thread's own look does
(holds_back, check_heads, gate_heads, place_of).
Why: BatchSync::segments is a gate alone: since
|
||
|
|
3bc091f20a |
Re-pin the runtime sources at the landing tip
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. |