4b37878cdaa103cb8b0fe882474cd5961baafafe
2438
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4b37878cda |
RUNTIME 2265: staging queue grows its command-buffer ring to 128 rather than wait on the host past 8
A staging submission that found its queue's 8 command buffers all pending
waited on the host for the oldest, under the staging lock, on whichever
thread submitted: the scheduler's among them, inside a batch's submission
(flush_staging), which held every queue's submissions until the staging
queue ran. On a device whose staging queue is of compute work that can be
as long as the program's kernels run.
Now the staging queue makes another command buffer instead, up to 128
(MOST), and frees those past the 8 it keeps once the host saw their
submissions complete, at the next submission. Past 128 it waits as before.
The fill queue keeps its 8: its batches submit only after they found room.
The doc comment says why 128 and what it costs (ANV below Xe-HP: a 64 KiB
binding-table block per command buffer, 8 MiB at the cap).
Counted: WorkCounts::staging_buffers_grown (made past the 8) and
staging_buffer_waits (host waits for a command buffer to come free, either
queue), classified as submission work in the conformance cost table.
Tests: a unit test of the ring's choice (reuse the oldest complete, free
the other complete ones past 8, grow below the most, wait at it), and a
device test that holds 20 staging submissions on the GPU and checks every
round's command buffer is submitted meanwhile with no host wait, then that
the ring is back to 8 after one more round. The device test passes trivially
on a device without a staging queue (lavapipe).
RUNTIME_VERSION 2265: staging submissions no longer wait on the host for a
command buffer below 128 pending.
Verified (gbkern, at ffd3a51a79 on
|
||
|
|
161e8fe310 |
leading_snapshots: expect coverage only after a pass that measured both readers
On the RTX 5080 Laptop GPU (b5080 entry nvscroll-tip at 3cdbfe9256) the test failed in its
second pass: Took { leading: 2, by_coverage: 0 } where it expected the whole-plane reader to
split by coverage. Its first pass recorded the readers once the pool made their pipeline
(pipelines pooled 1), and such a recording measures nothing (render.rs: a measured reader
records inside its query only where its pipeline was made at the draw), so the second pass
had no count yet. The lane in the same entry shows coverage weighing the same readers
(host pages, full coverage: 7.47 of 8 readers a frame over half, split).
The test now runs three passes and expects the coverage form only in a pass after one whose
coverage queries counted both readers, and asserts that a device that leads and measures
weighed a pass so at least once.
|
||
|
|
1443135ad8 |
RUNTIME 2264: readers after a barrier of a texture without feedback-loop usage take leading snapshots, weighed by area and learned coverage
On NVIDIA's drivers a linear image takes no feedback-loop or input-attachment usage, so a draw that read such a color at its own pixels after a memory barrier split the pass and copied the texture's scissor box (the whole surface for a guest that sets no scissor) before the new instance: in a consumer's autoscroll on an RTX 2080 about 21 readers a present each copied a 3648x2038 surface, ~29 ms of a 45 ms take-to-show. Such a reader now splits the pass with no copy: its snapshot draws record in an instance of their own ahead of the reader's (LOAD/STORE_NONE, empty masks), a "leading snapshot". The device enables VK_KHR_load_store_op_none, else VK_EXT_load_store_op_none, below Vulkan 1.3 (the runtime's instance is 1.2, so STORE_OP_NONE was core on no device); the version comes from the device's properties. A leading snapshot reads the texture at every pixel its draw covers, so over host pages it is not cheaper than the split at every area: on an RTX 5080 Laptop GPU (split_parts, 8 readers a frame over a 2648x1658 surface over host pages) whole-surface readers took 22.98 ms a frame leading against 17.99 split, quarter-surface readers 6.06 against 8.55; the forms cross near half. weigh_snapshot takes whether the reader leads and skips over_bytes for it, so the area rule weighs its first pass and, where the device measures readers (occlusionQueryPrecise), learned coverage decides from the second: a reader keeps the leading form within the existing bound (SNAPSHOT_PIXEL_COST 20: 20% of a 4-byte color) and splits above it. A rebound kept reader weighs with the same flag. New WorkCounts: reading_draws_snapshotted_leading, reading_draws_leading_covered_within / _to_half / _over_half (where the guest's readers fall against the bound). docs/FAST-PATHS.md's row records the 5080 A/B. Also: the split_parts lane (ignored by default, run by name) measures what split readers cost and reads its fixtures from the crate directory the runner names. From steelbrain/nvscroll (81915c28de..3cdbfe9256, 11 commits). Verified on potluck at 3cdbfe9256: clippy gpu (28377), cpu_icd and plain (28379) 0; rustdoc -D warnings 0; api_signatures and api_surface 15/15; lavapipe 478/478 (copy form unchanged there). 5080 A/B nvscroll-ab-233300 (kind t). The tip's 5080 device test and lane (b5080 batch 28393) are pending; the 2080 and XTX runs wait for um790. |
||
|
|
3697a412e9 |
Name each batch submission that holds its thread 5 ms or longer, phase by phase
What: under METAL2VULKAN_QUEUE_TIMES (a default-off diagnostic that already notes queue head and submit-return times), a batch submission that took 5 ms or longer from its start to its vkQueueSubmit call logs one line (id name metal2vulkan-slow-submissions, through the device's message sink, else stderr): its place in its command buffer, its VkQueue slot, the span split into the prologue, the first work's take, the staging queue's flush (its waits for the staging queue's lock and for one of that queue's command buffers counted apart) and the planning and recording, then the call's own time. slow_submissions.rs holds the watch; submit.rs enters the phases; device/staging.rs counts the two waits through a thread-local only while a watched submission runs on the thread. Off, a submission reads one flag; no clock read, no line. Why: in a guest's Feature Matching trace on the RX 7900 XTX, two one-dispatch command buffers spent 23.6 ms and 323 ms between kernelStart (submit.rs's kernel.begin) and their driver call, on the scheduler's thread, holding back every later commit; the trace cannot say which phase. One rerun with this on names it. Verified: not yet run; a lavapipe test (kernel_end_device) holds a submission 30 ms at its first work's take (a new trace::Point::FirstWork) and checks that one line names it with that phase's time, that a straight submission adds none, and that without queue times none is printed. |
||
|
|
1f20452b37 |
RUNTIME 2263: an execution's compute commands order by their records' barriers alone, in either kind of encoder
Metal's reference for MTLIndirectComputeCommand concurrentDispatchThreadgroups (and concurrentDispatchThreads): "Compute commands encoded into an indirect command buffer don't automatically serialize access to resources with other commands in the indirect command buffer. Use barriers to serialize access to resources within a range of commands." and "If dispatchType is serial, the compute command encoder adds a barrier before and after the range of commands. If dispatchType is concurrent, then the compute command encoder does nothing". MSL 6.17.2: "In an ICB, dispatches are always concurrent." The runtime ordered a serial encoder's execution as the encoder's own dispatches: a barrier wherever their uses met (the host step and commit's recording) or between every two commands (the GPU form). Now a command runs after the earlier ones of its range only where its record sets a barrier, in either kind of encoder; the segment's barriers from everything before and to everything after it are the serial encoder's before and after the range (Execute loses `ordered`; ComputeKey loses `ordered`, so a kept chunk runs in either kind of encoder; the GPU form puts a barrier between two commands only where a route may set one in the records, CommandWrites::BARRIER; the tracker's ordered_everything goes). docs/API.md's accepted difference quotes Metal's text. Not a speed-for-accuracy choice (Metal's contract), so no FAST-PATHS row. Also: kept_commands' compute tests note each command's own output window as an apart write (the layer reported write-after-write between disjoint windows); trail_gpu_forms requires a GPU form's scratch in device-local memory only without unified memory (a Private buffer lies in system memory before the carve-out by design on the 780M), fixing the 780M lane failure. From steelbrain/icbbarrier (b3f5e50f94, 7c5e5e60b2, fdfc1e412a; icbinherit). Verified on potluck at fdfc1e412a: lavapipe 275/278 (28026; the 3 failures were lvpfails-owned and fixed by RUNTIME 2261 on development), clippy plain/m2v_gpu/m2v_cpu_icd and rustdoc 0 (28027), negative control 27962 (both new tests fail on the old runtime). XTX and 780M legs: not run (um790 down), owed at the next pin's device legs. |
||
|
|
3805039770 |
RUNTIME 2262: distinct textures sharing one resource key at bytes apart share no memory; private intra-doc links resolve on x86-64
Two members of the false-overlap class that RUNTIME 2257 closed for heap-placed images remained: - A pass drawn in color groups refused a resolve target set in its first group's encoder (RuntimeGap::ColorAttachmentGroups) wherever a draw had read anything with the target's key: check_group_resolve compared ResourceKeys only. A heap-placed target, or one made over a buffer, apart from the bytes the draw read was refused although Metal runs it. First.read is now a per-key list of UseRanges (byte ranges joined where they touch), and the refusal stands only where the target's use shares memory with a noted read. - A texture made over a buffer (Storage::Alias, Owner::Buffer) took the buffer's key with a WHOLE place, so attached_levels, cleared_copy and snapshot_color counted every texture over one buffer as the same image: a pass rendering one and sampling another at other bytes took the attached-read route, and after a load-ordering barrier before the first draw the sampled texture's copy read the attachment's clear (4096 of 4096 texels wrong). Owner::Buffer now carries the texels' ImagePlace (Texels::place, in Buffer::tracked's offsets) and Image::place() returns it. True overlaps keep their routes: the tests' controls refuse a target over the read bytes, and a texture over the attachment's own bytes still takes the attached read and reads the clear. Also: CI's "Private intra-doc links" step (ceiling 0 for every crate) failed on x86-64 Linux with 16 links whose targets exist only under some cfg (runtime 10, metal2vulkan 4, air 2); they are plain code spans or paths that resolve under every cfg now. Doc comments only. From steelbrain/falseov (9e7367e451..b77784c0b4). Verified on potluck: - before the fix, lavapipe (msi): m3-max-28285 at 9e7367e451 failed 3/3 (both targets refused, apart read attached=1); m3-max-28297 with the fix reverted: the barrier case 4096/4096 texels wrong. - after: lavapipe touched filter 175/175 (m3-max-28304); XTX RADV carried m2v_gpu archive 175/175 (m3-max-28303; asserts aliases_buffer() and color_group_passes ran). - clippy -D warnings plain (28314), m2v_gpu (28299), m2v_cpu_icd (28301): 0; rustdoc --document-private-items 0 for all six crates on x86-64 (28311), public cargo doc 0. No new Degradation kind, WorkCounts field or refusal kind; docs/REFUSALS.md unchanged. |
||
|
|
b3d844f9fb |
RUNTIME 2261: a commit returns while its batch waits for a held VkQueue; kept draws carry only into passes of the same sample positions and layer count; the lavapipe and AMD lane failures
Runtime fixes, each with a test that fails before: - A command buffer's queue slot lives apart from its state lock (d159e7a2f1, 78d5a44df2). commit() handed its slot over under the command buffer's state lock, which the scheduler thread held across vkQueueSubmit; that submit waited for a VkQueue someone else held (a compositor sharing the queue), so the program's commit waited as long as the queue was held (gdb, m3-max-28123: the lane's checked-commit tests ended in SendError after 60 s). Test: tests::scheduler_wakes::a_commit_returns_while_the_thread_submits_its_batch_to_a_held_vk_queue (lavapipe, fails before in 20 s: m3-max-28149). - A render encoder at custom sample positions carries no kept draw (1da568fc43): a kept draw's VkPipeline has the positions baked in, and carry_ends never compared the ending pass's, so a draw kept from a pass at custom positions was carried into a later pass of the same shape at the default ones (runtime_lane::sample_positions on the XTX and the 780M, draw_again.rs:1320). - A kept draw carries only into a pass of the same renderTargetArrayLength (430fad72b8): the layered passes' kept draws were carried across layer counts (runtime_lane::layered_passes, both tests, on lavapipe and AMD). The debug check that caught both now names the parts that differ and whether the draw was rebound or carried (8bfeebe929, 3973769b86, 9da59ae9e3). Test fixes (the expectation follows the runtime's documented behaviour): - runtime_lane::degrade_notices::dispatches_degrade_once_per_kind expects a split where the device splits the ragged grid (1b58b69953's partial-threadgroups variant runs it whole elsewhere). - handed_objects x2 and host_memory: a held import's deallocator runs once its command buffer completed, posted to the free thread ( |
||
|
|
a397a8b366 |
RUNTIME 2260: a rate-mapped pass of one piece times its piece
The pieces' GPU times (WorkCounts::rate_map_piece_gpu_nanos) counted only
passes recorded in two or more pieces, so a frame's single-piece
rate-mapped passes were untimed: on the Iris guest frame only about half a
multi-piece pass a frame was timed, and the Offscreen time outside the
pieces could not be split from the counters.
PieceTimes::take now times any piece count above zero, and the executed
pass's recording takes it only for a rate-mapped pass (one of its
executions has a map), so a pass without a map still writes no
timestamps. Two timestamps a pass, where the device times pieces at all.
Test: rate_mapped_pieces' uncut execution now asserts its one piece timed
where PieceTimes::timed_on; verification follows on potluck.
Also: the pieces lane gains the wide frame without a map and each frame's host steps (e640147b9a),
and the pieces device test loads its fixture where the run's manifest lies, so it runs from a
carried archive (1c01beec35; it failed so on the 780M, m3-max-27994).
Why: on the Iris guest's rate-mapped sample (asp78-iris) about 93 ms a frame of the Offscreen
pass was untimed, because rate_map_piece_gpu_nanos timed only passes cut into two or more pieces;
the next Iris run splits the whole pass.
Verified at 1c01beec35: clippy plain exit 0 (m3-max-28152); lavapipe 6/6 rate_mapped device
tests, the uncut pass's one piece timed ("pieces 12 timed 13") (28151); release m2v_gpu archive
builds (28150). clippy under m2v_gpu and m2v_cpu_icd and rustdoc passed on the tip that carried
these same changes.
|
||
|
|
1895fe40d6 |
RUNTIME 2259: a use's range stays 32 bytes: an image's place in its heap counts 64-byte granules
What: tracker::ImagePlace, which RUNTIME 2257 added to UseRange::Image so that images placed apart in one heap (one tracker key) share no memory, held its bytes as two u64s, growing UseRange from 24 to 40 bytes. It now holds two u32 counts of 64-byte granules (PLACE_GRANULE), rounded out (start down, end up), so UseRange is 32 bytes; a place past what u32 granules count (256 GiB) is WHOLE, the key's whole memory. Rounding out only adds bytes, so places whose bytes meet still meet; two that share a granule alone are taken to meet, at most a needless barrier or copy. Why: every use of every command copies and compares a UseRange (EncoderUses::note's map, command_uses_into, the kept uses). The XTX's per-draw bench (walk_costs, exclusive, tip/before alternating, m3-max-27858) put the no-barrier draw path about 1.2 us a draw (8-12%) above the build before RUNTIME 2257, the barriers shape unchanged. This change narrows the range back toward its old size. Whether it recovers the cost is the XTX confirm's question; the commit claims only the size. Verified: tests::tracker 76/76 including a_use_range_stays_32_bytes, clippy plain exit 0, lavapipe heap_placed_reads, heap_placed_targets, attached_levels, color_groups and tracker 82/82 (m3-max-28099). On the XTX (m3-max-28098, exclusive, release walk_costs, tip/before/compact twice and once under perf) the timings were bimodal in every build (frames at ~185 or 250-285 us), wider than the 8% effect, so they settle nothing; the encoding thread's cycles:u profile puts the tip's extra samples in RenderLowering::draw_rebound (51 against 18 before) and State::shadows_to_carry (23 against <6), both copying and walking uses, and the compact build at 17 and 9: one perf run a build, evidence rather than proof. |
||
|
|
12fa641450 |
Tests: a surface plane over declared padding follows its placement answer where the driver refuses the pitch
What: tests::padding_unobserved's surface plane leg asks
Buffer::texture_placement_with_iosurface_plane before making each texture. A
declared plane is the DRM_FORMAT_MOD_LINEAR image at the pitch exactly where the
query answers NotHostPages; elsewhere it must be a shadow the device refused
(Shadow(Refused(_))), never one of the check's verdicts. Undeclared, a shadow as
before. The answer is printed.
Why: the leg skipped only devices that make no modifier images, so it assumed
every other driver takes a DRM_FORMAT_MOD_LINEAR plane with rows 416 bytes
apart. RADV refuses it: on the XTX and the 780M (pin 82 legs at
|
||
|
|
9ebd6abe52 |
Tests: a texture that renders over padded Private rows is a shadow only where no check of renders passed
What: tests::merge_scratch's two_ways_merges_take_few_scratches runs on the shadow policy's device (blit_holds::shadow_device), so its texture over a Private buffer of padded rows is a shadow, the test's subject, on every device. runtime_lane::in_place_textures' pooled_pitched_costs expects its undeclared caches to be shadows exactly where Buffer::texture_placement answers Shadow, and prints that count. Its edit (rendered_descriptor, the answer per cache) went into 3677205866 with the rest of that file; the previous commit's message wrongly says it is in this one. merge_scratch's module doc says the padded Private target is in place where the check of renders passed. Why: both still assumed such a texture is a shadow "on every device". Since |
||
|
|
4df1dd5575 |
Tests: an attached read with no barrier follows the device's snapshot path
What: tests::pass_end_tiles' read over host pages expects a read through a snapshot (WorkCounts::reading_draws_snapshotted) where shadow_standing_device::reads_through_snapshots (now pub(super)) says the device reads the texture so, else through the copy, as before. runtime_lane:: in_place_textures' attached-move test counts each pass's read through a copy or a snapshot (exactly one) and checks the pages by the path counted: through a copy every texel is the CPU's red; through a snapshot the fill's block holds the fill's DRAWN_RED and the rest the CPU's. It is in the validation crate, which sees the public counts alone. Only the pooled_pitched_costs edit (rendered_descriptor) is the next commit's. Why: on the XTX and the 780M (pin 82 legs at |
||
|
|
9ee2fd6bd2 |
Tests: separate depth and stencil's unstored pass clears to zero, so a clear is told from a released stencil
What: tests::unwritten_parts' separate depth and stencil leg gave both of its passes the stencil clear value MARK (0xA5), the DontCare/DontCare pass too. That pass now clears to 0 where its load is not Clear, and the leg runs on a device of each UnstoredDontCarePolicy (Driver, then Cleared). Why: with the clear value equal to the mark, the test could not tell a released texture's stencil from Metal's clear. A device that clears an unstored DontCare load (clear_reach::UnstoredLoads::Cleared: UnstoredDontCarePolicy:: Cleared, or DriverFact::UnstoredClearNoSlower, the Radeon 780M's) loads the scratch image's stencil as its Clear to the attachment's clear value, Metal's answer, which was MARK: every pixel passed the Equal test and the leg reported "the released texture's mark" on the 780M (pin 82 legs at |
||
|
|
7a691f6a52 |
SEMANTICS_VERSION 2107: a kernel's static threadgroup memory length is reported rounded up to 16 bytes, as Metal reports it
ComputePipelineState::static_threadgroup_memory_length answered the plain sum of a kernel's static threadgroup variables (with typed threadgroup objects or the arena, no [[threadgroup(n)]] regions). Metal rounds it up to a multiple of 16 bytes, its threadgroup memory's granularity: `threadgroup uint a[256]; threadgroup uint b;` answers 1040 on the M3 Max (macOS 27.0.1), where the runtime answered 1028 (reims's measurement; their compute-state test pins the difference). The length a kernel with regions reports was already the 16-byte-aligned offset of the first region. Only the reported answer changes: the planner counts the kernel's own bytes in each dispatch's total as before. Test: engine_simd_emulated::the_static_length_is_rounded_up_to_16_bytes_as_metal_reports_it (an arena of 257 words answers 1040). Verified (msi, m3-max-28025): the metal2vulkan suite passes; with the fix reverse-applied the new test fails. |
||
|
|
804d8df68a |
RUNTIME 2258: a device's command-count shards are built on the heap, so a device is made on a 256 KiB stack
A program that made a device on a thread of 512 KiB of stack or less overflowed it on any driver (reims's window render thread: "thread ... has overflowed its stack", confirmed on the Iris at m3-max-27854; the SIGSEGV in assemble of x4route's second device). Line::new's `counts: Arc::default()` built work_counts::Counters on the making thread's stack and moved it to the heap: 172,928 bytes, 166,400 of them CommandTallies' inline arrays of 65 shards of 1,280 bytes. Shards now hold a Box<[Shard<T>]> collected shard by shard, each written straight to the heap (Counters 6,784 bytes); the shards' pointer lies on a 128-byte line of its own that nothing writes once the device is made, so the one extra load a count takes stays a cache hit beside the shard's own load and store. The adders' API is unchanged. Test: tests::small_stack_device makes a device of its own options on a std::thread with a 256 KiB stack, fills a buffer, reads it back and drops the device on that thread. Verified: lavapipe m3-max-27859, the test passes with the fix and with the fix reverse-applied in the same job overflows its stack (SIGABRT); device creation needs more than 1 MiB and at most 2 MiB of stack before, more than 192 KiB and at most 256 KiB after (lavapipe debug, RUST_MIN_STACK sweeps 27833, 27851); RTX 2080 on um790 m3-max-27937: small_stack_device, recorder_shards and command_counts pass; clippy plain, gpucfg and cpuicd and rustdoc exit 0 (27875-27877); the plain runtime suite 1538 passed (27876). |
||
|
|
b31c23f7c0 |
RUNTIME 2257: render targets placed apart in one Private placement heap keep no shadows
A game's render targets placed apart in one tracked Private placement heap (reims gameload G2
rtheap: MSAA colour, MSAA depth and a shadow map) were held as shadows on the Iris and the AMD
GPUs, with attached reads through copies, clears in part and sample moves every frame (+34.9 ms a
frame over native on the Iris guest at pin 77). Four causes, each with a test that fails before:
- C (d1eaec0f47, 792ea614de): a heap's images shared memory wherever their keys met, so a
texture placed apart was taken as attached to another's pass; images now share memory only where
their bytes meet, and the heap's own shadow images use their whole key's memory.
- B1 (6f54af68e2, e56bb982d7): a multisample heap texture takes the device's own size and
alignment answer and lies in its image (the 780M asks at most 64 KiB).
- D (f760b95001): a whole clear of a 2D multisample attachment copies nothing in.
- B2 (317d905449): a heap texture's device answer takes the device's alignment up to the heap's
own (the XTX's MSAA colour answers 256 KiB: 2375680 @ 256K, depth 1179656 @ 128K, shadow map
393224 @ 128K), the host GPU's real value as the owner's rule for device-describing answers
states.
New owned fixture hpr_reads (our MSL; regen-air-fixtures): fragment functions reading a device
buffer; its golden and the compile census are re-blessed at the next pin.
Verified (steelbrain/rtheap at 23fc75a899): release lane heap_placed_targets (320x192, 7
heap-placed targets, Device policy, mean of 10 frames), placed vs device-made: XTX 1.619 vs 0.576
ms before, shadows MsaaColor/MsaaDepth/Shadow, to 0.530 vs 0.594 ms, every shadow count 0
(m3-max-27670); 780M 2.150 vs 0.579 to 0.548 vs 0.599 ms (27671). Metal policy
(exact_answers): XTX 2.033 to 0.683 ms, 780M 2.650 to 1.079 ms, shadows kept as the switch says.
Texels and kernel reads equal the device-made frame on every leg. lavapipe green (27676); XTX
(27687) and 780M (27688) every heap_placed*, attached_levels, tracker, heap and shadow test
passes, the other failures only under the carried archive's compile-time paths and the
shadow_standing layer test fixed separately (
|
||
|
|
4d95375fe2 |
Tests: a layer pass's backdrop read moves no copy where the device reads it through a snapshot
a_layer_pass_reading_its_own_target_copies_in_its_read_alone_after_the_first took its counts from lavapipe alone (m3-max-20039), where the read with no barrier reads the copy taken before the pass and moves its 18x6 texels each frame. On a device that takes the snapshot path (the XTX and the 780M: the snapshot draws' features, a fetch in the pixel interlock, and feedback loop usage on the plane's shadow image), a read over a buffer's bytes takes the snapshot at any area (render/snapshot.rs, over_bytes), so no copy moves and the test failed "moved 0 vs 108" on both AMD GPUs (m3-max-27687, 27688, 27795). The expectation now follows the runtime's own predicate for the device and the texture (reads_through_snapshots: color_write_masks, through_storage, the image's feedback loop usage): from the second command buffer on the read is counted through a snapshot exactly where the predicate says so, and its copy moves 18x6 texels where it reads the copy, none where it takes the snapshot. The line printed per frame names the device, the predicate and the count. Verified: XTX (RADV NAVI31) m3-max-27883 passes, one snapshot read a frame and the copies in skipped against the standing from frame 1; lavapipe m3-max-27900 passes, 108 texels a frame. |
||
|
|
76855fc0ba |
SEMANTICS_VERSION 2106, ARTIFACT_FORMAT_VERSION 522, RUNTIME_VERSION 2256: GPU-written indirect command buffers that inherit the encoder's buffers run on the GPU; write routes reach the indirect command buffers of their own command kind
A GPU-encoded indirect command buffer whose records inherit the encoder's buffers took the host step: the render GPU form refused inherit_buffers (DrawReplayRule::InheritedBuffers) and the compute GPU form had no inherited-bytes path, so every frame read the records back and replayed them on the host (gameload's icb: 8,192 indexed draws, ~44 ms of host step a frame on the Iris against 0.29 ms natively). - Render (da75a4602f..f3745fd69c): a draw replay's variant takes the encoder's vertex and fragment buffers by index as its parent buffers, resolved to device addresses past the parent's record; inline bytes (set*Bytes) are planned at their slots; an unaddressed inherited buffer keeps the host step with its cause named (parent_entries refuses it rather than writing a zero entry). The executor's draw preprocess binds the encoder's vertex buffers. - Compute (7c148c3995..0a68ac5f15): a GPU-written buffer of dispatches that inherits the encoder's kernel buffers runs on the GPU the same way; the new fixture icb_inherited_dispatches (our MSL) and its golden. - Route kinds (2d9f4ac597..2e206952c2): every route of a command buffer joined every indirect command buffer it made resident for writing, so a compute ICB's writer (DISPATCH|RESET) refused the render ICB's GPU form in the same command buffer (DrawReplayRule::Operations): gameload -b's render ICB host-stepped although nothing refused its own shape. A write route now reaches only the ICBs of its command kind (render or compute); CommandWrites carries the kinds (ARTIFACT_FORMAT 522). - host-replayed-indirect-commands is announced once per cause instead of once per device (a660b2fe8d), naming the rule that keeps a pass from the GPU form, as copied-host-pages announces per reason; no new Degradation kind or WorkCounts field. Verified on the branch (steelbrain/icbinherit2 at a660b2fe8d): clippy plain, m2v_gpu and m2v_cpu_icd and rustdoc exit 0 (27886); runtime suite 1538/1539, the one failure the catalogue text RUNTIME 2253 already fixed on development (27884); lavapipe ICB and notice lanes 214/219 with render_inherited_buffers, compute_inherited_buffers, write_routes, written_commands and the beside test (inherited and own buffers: cold (8,8,0), warm (8,8,0,0), pixels as alone) passing, the 5 failures failing the same at the branch's base (27926, 27927); before route kinds the beside test fails as designed, (0,0,8) against (8,8,0) (27764); XTX 90/101 at 60c85035e3 (27853), the 11 failures fixture paths under msi's compile-time path only, all 11 passing on lavapipe (27807). |
||
|
|
1cf0e1910d |
RUNTIME 2255: cubes and BC rows over an IOSurface plane are made where the x86 Macs make them
reims's oracle_surftex found the Radeon Pro 5300M and the UHD 630 making three IOSurface-plane
shapes that the runtime refused:
- a Cube and a CubeArray over a plane of a surface with planes (cases 119, 188-191). These were
refused as Metal's own Invalid; the M3 Max asserts "carriesComplexTexture || numFaces == 1", the
arm64 envelope.
- BC1 64x64 over a 420v luma plane, whose rows of blocks are wider than the plane's row (case 187).
This was refused as NotImplemented(SurfacePlaneShape); the M3 answers nil.
An x86 guest was answered "made" while the host held no object for it. The x86 envelope is the x86
Macs', and they agree, so the runtime now makes them as those Macs lay them out. Measured with
surface_texture_envelope on both x86 GPUs (m3-max-27621, -27622).
Cubes: face k lies at the plane's offset + k x rows x bytesPerRow, rows bytesPerRow apart. The
planner (linear_plan.rs, faces_at_pitch) lays a colour cube or cube array over a plane, at an offset
and bytesPerRow that are multiples of 16, as a 2D array of its faces at that pitch, for the GPU
and the CPU alike. Faces past the buffer go in the texture's tail, announced as SurfaceTexelsTail,
as a 2D array's texels past it do. The image is cube-compatible, as every cube's is. Every other
cube over such a plane (another format, off 16, several levels, rows wider than the plane's) is
NotImplemented(SurfacePlaneShape) instead of Invalid. Over a surface without planes it stays
BufferTextureProblem::TextureType. The CPUs differ: the 5300M's getBytes and replaceRegion take
every face at the first's bytes, and the 630's take them one image on from the surface's byte 0.
The runtime's CPU calls take the GPUs' layout.
BC rows of 8-byte blocks wider than the plane's row keep to it, as the x86 Macs' blits do: the
blocks in the plane's row lie in place; the blocks past it read zero and their writes are dropped.
There is no tail storage: the shadow zeroes them at its first move, and blits, replace_region and
get_bytes clip to the kept columns. InPlaceRefusal::Rows's doc now also covers rows that hold fewer
of a BC texture's blocks than its row. No Degradation kind and no public item were added. docs/API.md
records two accepted differences: the CPU calls follow the GPUs' layout, and a cube's faces past
the plane's rows lie at the plane's pitch. linear_plan.rs, the RuntimeGap and BufferTextureProblem
docs, FAST-PATHS known gaps and REFUSALS.md (regenerated) are updated.
Verified (planerows, 97de630b9f on
|
||
|
|
2bd067d6c7 |
RUNTIME 2254: a command buffer's completion exports as a SYNC_FD sync file
A consumer that composites one GPU's frames on another vendor's GPU has to order the second
device's work after a runtime command buffer. The only semaphore export was
SharedEvent::export_semaphore_fd: a timeline semaphore as OPAQUE_FD, which Vulkan imports only on a
device with the same deviceUUID and driverUUID, so it cannot cross from NVIDIA to RADV. The consumer
waited on the CPU instead, about 3.5 ms a present on its window thread. A cross-driver handle needs
SYNC_FD, which only binary semaphores export.
New (unix only, no Metal counterpart):
- CommandBuffer::add_completion_sync_file(), before the commit: the command buffer's last batch
also signals a binary semaphore exportable as SYNC_FD, after its to-host barrier. That batch never
joins a submission group. A command buffer with no GPU work submits the signal alone, after its
queue's earlier work.
- CommandBuffer::export_completion_sync_file() -> Result<Option<OwnedFd>, Error>, after the
commit. It blocks only until the signalling batch's vkQueueSubmit has returned, never on the GPU.
None means the work already ended, or the driver answered -1; the importer imports -1 or skips
the wait.
- Spec: the export follows the signal's submission (VUID-03254), with copy transference. One export
per command buffer. Event::reserve_vk_signal's doc carries the contract for a reserved signal
that the batch waits on.
- The semaphore goes back to an idle pool of up to 8 per device once the command buffer completes
with its fd exported, and is released otherwise.
Where the host writes the caller's pages after the GPU work (a copied host buffer's merge back, or a
managed two-copy buffer's copy-out), no GPU signal can come after those writes. There the export
waits for completion and answers None, announced by a NEW Degradation: SyncFileAfterHostCopies
(sync-file-after-host-copies, performance). Also new: WorkCounts::sync_files_exported and
sync_files_after_host_copies; RuntimeGap::SyncFileExport, for a device without
VK_KHR_external_semaphore_fd or without binary SYNC_FD export (MoltenVK, an adopted device without
the extension); Problem::SyncFile(SyncFileProblem { Committed, NotCommitted, Exported }).
docs/API.md (catalogue entry), the runtime README, REFUSALS.md (regenerated), the reach table and
api_signatures are updated.
Verified (syncfile, 8f9caba0ae on
|
||
|
|
6ba577a89e |
RUNTIME 2253: the device recovery's announced cost states an indirect command buffer's records as docs/API.md does
RUNTIME 2247 (
|
||
|
|
761bc21c29 |
RUNTIME 2252: overlapping YCbCr planes convert with the device's own conversion, a row at a time
YCbCrSampler::of took the device's sampler Y'CbCr conversion only for planes whose rows of codes do
not overlap: one buffer-image region per plane cannot state a pitch below the row
(VUID-VkBufferImageCopy-bufferRowLength-09101). RUNTIME 2251 made two-plane YCbCr textures over
rows of codes that overlap. On the RX 7900 XTX, where RADV converts G8_B8R8_2PLANE_420_UNORM
itself, the overlapping 66x64 texture went through Metal's fixed-point conversion. The same codes
laid apart went through the device's, so the lane's twin check failed (m3-max-27506: "read() is
the twin's, bit for bit"). Where the device has a native form, that is the only form (owner rule
1), so the layout must not choose Metal's arithmetic.
Such planes now copy into the conversion's image one region per row, each from its own first byte,
and convert on the device like any other. One region per plane remains where a plane's rows are at
least as long as its texels. Chroma rows that overlap (a 4:4:4 format over a 4:2:0 surface's rows)
took the same fallback before and now convert on the device too. The lane test asserts that the
device converts the overlapping texture and its twin alike, prints which form ran, and checks the
twin against the model or the device's bound.
Verified (planerows, 6c16371805 on
|
||
|
|
7e827c1b5e |
RUNTIME 2251: a two-plane YCbCr texture over IOSurface rows of codes that overlap is made, as Metal makes it
A two-plane YCbCr texture can sit over a plane of a surface with planes whose rows of codes are
wider than the planes' bytesPerRow (a texture wider than its plane, or a 10-bit format over 8-bit
rows). Metal makes it. The runtime refused it at creation: linear_plan's overlap_held answered
NotImplemented(OverlappingSurfaceRows), and the guest got nil. An arm64 guest's oracle run met
one: YCBCR8_420_2P 66x64 over plane 0 of a 64x64 '420v' (luma rows of 64 bytes).
Such a texture's texels are its conversion of the planes' bytes (ycbcr.rs), which reads every code
at the planes' rows, so rows that share bytes need no row rule. The refusal was written for a
plain plane's two-region shadow copies, which a converted texture never uses. overlap_held now
holds a two-plane YCbCr texture over a plane of a surface with planes, whatever its usage.
Still refused, now at use and with the precise gap NotImplemented(OverlappingSurfaceRows) (was
NotImplemented(Format)):
- a blit from a buffer into such a texture: Metal leaves no single row's bytes there (the
earlier row's at every shared byte of the 8-bit shape; 2047, then 1919, of 4032 for the 10-bit
one);
- a 4:4:4 texture's stored writes;
- a render pass whose rows of codes overlap (unmeasured).
Over a surface without planes it stays refused at creation (unmeasured). docs/FAST-PATHS.md's
known gaps, the RuntimeGap doc and REFUSALS.md (regenerated) say so. No Degradation kind, no public
item.
Metal's answer (probes/ycbcr_wide_code_rows.m, m3-max-27270, macOS 27.0.1, two processes a shape),
for the 66x64 8-bit shape and a 64x64 10-bit one:
- read() and the nearest sample of every texel equal the same texture over the same bytes laid
apart, bit for bit (0 of 4224 and 0 of 4096 texels differ);
- getBytes reads the luma rows at the pitch;
- replaceRegion writes them in order, the later row standing.
Verified (planerows, 5fdbf147d5 on
|
||
|
|
8b09e7c51d |
RUNTIME 2250: a render-target barrier inside the pass keeps the encoder's kept draws
In the consumer's Launchpad walk on the RX 7900 XTX (lp75-xtx, pin 75), 293 of about 446 draws a
present took every step (about 21.6 us each against 7.6 us for a rebound draw), and RUNTIME 2240's
reader keeping never fired (reading_draws_snapshotted_again 0): a memoryBarrierWithScope
(RenderTargets, fragment -> fragment) came before nearly every snapshot reader (~80 a present
against 77 readers), and every barrier forgot every kept draw, the last one and those set aside.
The barrier changes no state the command buffer holds (pipeline, sets, push constants and dynamic
states survive vkCmdPipelineBarrier; a draw again records into the same command buffer). Now an
RT-only barrier recorded inside the current instance (render_target::between_draws), or one that
records nothing, keeps the kept draws, except those that read the pass's colours other than
through their own snapshots (through copies, at levels apart from the attached ones, or through
memory that shares an attachment: Kept::reads_colors, applied to the draws set aside and to the
last direct draw's kept draw), whose every step would change after it; where a use cannot be
told, the draw is let go. A barrier that splits the pass (its colours put apart there) and every
other scope still forget. New: WorkCounts::kept_draws_kept_across_barrier.
Also: runtime_lane::walk_costs, a release lane bench of the walk's draw mix (3 encoders a command
buffer, each [A, B, RT barrier, snapshot reader, A, B], indexed draws with their own scissors and
moved offsets over host pages, a fence wait and update), with and without barriers, and
walk_reader_forms over the owned fixture wlk_readers.metal (a reader whose texel decides a branch,
split and copied or fetched).
Verified (perdraw6, 2ebea446ac on
|
||
|
|
262d3df12b |
Build the region ranges from explicit Range literals (clippy single_range_in_vec_init)
|
||
|
|
cbd2898434 |
RUNTIME 2249: a recovery's carry of pooled ICB records waits out the setters' unlocked writes; getters hold the overflow slots; reset GPU time counted
RUNTIME 2225 and 2242 let an indirect command buffer's setters write without the lock. RUNTIME
2247 put the records in the runtime's own imported pages wherever the device imports host
pointers, so every carry there keeps the pages, the pointer and the records (Kept; the carry's
forget_keys sends the next named set under the lock), and an unlocked write needs no tracking.
Records that still lie in pooled memory (a device without host-pointer import, or a failed
import) move at a recovery (Lost, every command reset), and an unlocked write could hold their
old pointer across the carry's release: a use-after-free.
- Pooled records only: each unlocked setter call counts itself with one read-modify-write
(decided per ICB at creation, counted_write #[cold]); the carry waits the count out before it
releases the old parts. Own-pages records write as before RUNTIME 2247, behind one branch.
- A getter's read of the slots past the records (overflow) holds their parts, as record reads do.
- WorkCounts::indirect_record_reset_gpu_nanos: the GPU time of each resetCommandsInBuffer
dispatch, timed with the rate-map pieces' timestamp slots (a third kind), read when the command
buffer lets go of what it retained; no sync added; 0 where timestamps are absent or wait for
every queue's.
- set_each's setters run inlined in its loop (#[inline(always)] on set_one): the consumer saw the
set passed by pointer read wide after narrow writes (a store-forwarding stall).
- HOWTO: each live ICB's records are one held import.
Verified (carryrace, 13fd624294 on
|
||
|
|
8c89e236d0 |
SEMANTICS 2100 / RUNTIME 2248: a rate-mapped pass's parted run is drawn only into the regions its blocks reach
A flagged draw's runs (blocks of 64 triangles around the triangles the probe flags) were drawn region by region into every region of the map's plan. With the consumer's rate-map sample on the Iris Xe that was most of the frame: rate_map_piece_gpu_nanos 382 of 441 ms a frame at pin 74 (232 runs into 2074 regions, 83k run triangles). Now the probe ORs each 64-triangle block's bounds, widened as before, into 16 x and 16 y buckets (bind::fan_out::BOUND_BUCKETS, PROBE_BOUNDS_AT, BLOCK_SET, STRADDLE_SET, fn bucket; PROBE_SETS 6 -> 7), and a run is drawn, through the region-copy route as before, only into the regions its blocks reach, as consecutive ranges in table order. A triangle crossing w = 0 is bounded by its part where w > 0: per axis its positive-w vertices' coordinates, plus infinity on each side where an edge crosses w = 0 (the side is the sign of w_a*v_b - v_a*w_b; within 2^-16 or NaN, both sides). A run whose bounds reach every bucket draws into every region, as before. The route, its clip distances and the Equal-depth identity are unchanged. New counters: WorkCounts::rate_map_run_region_draws, rate_map_runs_every_region, rate_map_straddling_triangles. FAST-PATHS row 50 says so with its numbers. Verified (blotch, d141fe9096..b277d4df9e on |
||
|
|
0ee5fb1b9b |
RUNTIME 2247: an indirect command buffer's records lie in the runtime's own pages, so a device recovery keeps them
A device recovery's carry of an indirect command buffer whose records lay in pooled host-visible
memory moved them to new memory and reset every command (a lost device's mapped memory has
undefined contents), where Metal keeps a Shared buffer's records across its GPU's restart. On ANV
(i915), whose held host-pointer imports cost every submission, the runtime's own small buffers
never lay in imported pages, so every ICB took that path. The consumer's test (four senders
setting nil vertex and fragment buffers while the device recovers, Iris Xe) read back a suffix of
a command's sets as 0 in 10/10 runs, at pin 75 and with RUNTIME 2245 alike.
Now the records (Device::records_buffer, FreshPages::Always) and the slots past them lie in fresh
pages of their own at any length, whatever a held import costs, where the device imports host
pointers into the Shared class's best type. The carry imports the same pages again
(Contents::Kept): records and contents pointer as they were, the CPU's and the GPU's writes kept.
Such a buffer is parked and taken again as a pooled one is. Only a device without the import, or
a failed import, keeps the pooled placement and its reset, which the recovery notice counts.
docs/API.md's recovery section says so.
Cost: one held import per live ICB, about 0.35 us a submission on ANV i915 (submit_check.rs's
measured figure), by its pages on RADV; an import at creation 17-43 us where no parked one is
taken (fresh_pages.rs).
Verified (carryrace, 362d920e11 on
|
||
|
|
977c9da12f |
RUNTIME 2246: setTriangleFillMode: 2 (MTLTriangleFillModePoints, Apple-private) draws a triangle's vertices as points
Apple's GL renderer sends setTriangleFillMode:2 for glPolygonMode(GL_POINT) under its Intel and
Apple-silicon caps tables. The value is not in the public headers. Our TriangleFillMode had only
Fill and Lines, so the consumer's raw-value conversion failed and its host died. Measured on
Metal: an M3 Max and an Intel UHD 630 draw only a triangle's 3 vertex pixels (a Radeon Pro 5300M
fills it); our own probe on the M3 (m3-max-26811) draws 1-px points whether point_size is 4, 1 or
unwritten, culls them with CullMode Front, and draws them with Back.
Now TriangleFillMode::Points (2) exists. The generator (scripts/regen-metal-enums) takes a
PRIVATE line for it, with its evidence, and a PRIVATE_DOCS doc comment (metal_enum! accepts
variant attributes); generated.rs stays generated and `--check` passes. The runtime draws it as
VK_POLYGON_MODE_POINT. It needs fillModeNonSolid (refused otherwise:
Feature::TriangleFillPoints) and, on a portability-subset device, pointPolygons
(VkFeature::PointPolygons; MoltenVK withholds it, so it refuses Points). New degradation
TrianglePointSize ("triangle-point-size"): Vulkan sizes the points by the PointSize the vertex
function writes, where Metal draws 1 px. An ICB command still refuses set_triangle_fill_mode, as
before. New lane module runtime_lane::triangle_points.
Verified (fillpoints, 6b9927c402 on
|
||
|
|
71e088b900 |
RUNTIME 2245: an ICB setter's write under the lock reads the records' bytes under it
RUNTIME 2242 ( |
||
|
|
b741f93b9e |
SEMANTICS 2098 / RUNTIME 2244: a rate-mapped pass's region-by-region draws copy each region in the vertex function, scissored, so Equal depth matches the fanned-out route
Under RateMapRegionPolicy::FanOut a draw was drawn two ways: fanned out (a geometry stage's copy of each triangle per region, window position a*x + b*w through one viewport), or region by region (each region through its own Vulkan viewport). The two rounded a vertex's window position differently, so a pass testing depth Equal against depth the other route stored failed along whole surfaces: the consumer's black blotches on lit surfaces in Apple's Modern Rendering sample on the RTX 3090. The depth-Equal repro left 44,666 of 89,483 pixels red on lavapipe whenever the prepass and the Equal pass took different routes; 0 under Exact or on one route. Now on a fanning device the region-by-region draws take a region-copy variant (RegionFanOut::RegionCopies), with no geometry stage. Its vertex function computes region RegionFirst + DrawIndex of the table, stores its position through the region's line and four clip distances by the one emitter the fan-out stage's copies use (pipeline::link::fan_out::region_copy: NoContraction arithmetic, Position and ClipDistance Invariant), and its draw index as ViewportIndex. Each recording sets as many viewports as one multi-draw takes, every one the fan-out's over the render area, with each region's scissor at its index (bind::fan_out::scissors), so off-region triangles are scissored, not clipped. The settle keys the pipeline with the same viewport count (fan_out::copy_viewports). The variant replaces the regions variant, so no pipeline is added per state. A device without multiViewport, shaderOutputViewportIndex and shaderDrawParameters keeps the per-region-viewport route (FAST-PATHS known gap). Exact is untouched. New: bind::fan_out::scissors, WorkCounts::rate_map_region_copy_draws and rate_map_region_copy_recordings, PushField::RegionFirst; cache codec variants (artifact format). Verified (blotch, steelbrain/blotch 1fd68a45c0..16d5c2404f): - lavapipe at 16d5c2404f: rate_mapped_depth_equal + rate_mapped_fan_out 4/4, 0 red in all 10 depth-Equal lines (mixed pairs included), 0 pipelines made at the host step; clippy CPUICD, GPU and plain 0; rustdoc 0. Translator suite at 8ad673ffba 3562/3563, the one failure golden_hashes (re-blessed on development). - 780M and XTX at 8ad673ffba (differs from the tip by the settle fix only): 0 red in all 10 lines. E->E GPU cold/warm: 780M 4.99/4.97 ms against Exact 1.68/1.65; XTX 1.14 ms/650 us against 569/265 us. Creation (shader cache off): 780M 1.32 ms/state (Exact 0.92), XTX 1.30 (Exact 0.68). - Owed: the same numbers at development's tip without this change (the GS fan-out), the clip-distance probe, and the 780M/XTX runs at 16d5c2404f. SEMANTICS_VERSION 2097 -> 2098, ARTIFACT_FORMAT_VERSION 518 -> 519, RUNTIME_VERSION 2243 -> 2244. |
||
|
|
5bf7ae2eae |
RUNTIME 2243: a committing command buffer counts as uncommitted until the scheduler holds its batches
The consumer's Iris walk at pin 73 (appwalk10 w-iris-26) failed one guest command buffer during
login with the runtime's own invariant "a batch's end recorded where the batch does not end"
(command_buffer/submit.rs), read as VK_ERROR_UNKNOWN (-13): the first tagged sighting of the -13
seen untagged three times on the 3090 and the 780M since pin 59.
Cause: a texture's face turn (texture/faces.rs turn_face) and a storage-form switch need the
device's Uncommitted count at 1 and the scheduler holding nothing. Both held for a command buffer
B in commit_now between slot.committed() and scheduler.commit(), where B's end is folded into its
last command buffer (face_swaps.any() false). Interleaving: B encodes an attached-read pass that
copies into the texture's other face G; B commits and folds its end; before B reaches the
scheduler, A opens a pass that turns the texture F -> G; at B's submission record_face_fixes finds
A's record and pushes a back copy G -> F after B's folded command buffer, so work.last() is not the
folded one and the command buffer fails. The same back copy would also have written stale texels
over B's rendering in F.
Now a committing command buffer stays in the Uncommitted count until scheduler.commit holds its
batches (Slot::handed; held.open still drops at committed(), so slot_wait is unchanged): no turn
or storage-form switch lands between the fold and the submission. Only turn_face and
storage_form_switch read the count, and both refuse rather than wait (Unturned::Busy and the
copy-in path; no switch), so nothing waits on it.
Verified (batchend, 42e70c6642 on
|
||
|
|
20d04dbd5e |
RUNTIME 2242: an ICB's setters write through one batch, mostly without the lock; set_render_command and set_compute_command
An indirect command buffer's CPU setters, after RUNTIME 2238's dense table and one hold: every setter write now goes through one per-command batch (one storage pointer, one count of the writes made without the lock), written into in place rather than handing back a ~180-byte plan (which made a first form slower than before). The written flag (SEMANTICS 2097) is set in the one write helper, write_field, by the rule unchanged: every setter write sets it, a write of the reset record clears it. A draw, a dispatch, a set barrier and a cleared barrier the edits' summary already holds, like a buffer slot before, take no lock where the GPU may not have written the buffer, checked against an atomic mirror of the summary set under the lock; a pipeline state the command already names is set again with no lock and no CallHold (an atomic (id, serial, kind) mirror per command; a recovery's carry forgets it, so the next set redoes every check). New public calls IndirectCommandBuffer::set_render_command / set_compute_command (an index and a list of sets, no handle and no Arc clone; index and kind refusals at place 0) and the handle's set_each; borrowed RenderAt/ComputeAt views. docs/API.md says which setter writes take no lock; the carry docs say a write made without the lock does not wait for a carry (as buffer slots' did; a set racing a device recovery may write through the old mapping). Verified (icbset, f403b6e922 on |
||
|
|
a308b1b409 |
RUNTIME 2241: kept draws survive fence updates and waits and resource and heap uses; the calls that let them go are counted
On the consumer's XTX Launchpad walk ~40 inline render encoders a present end keeping nothing
though none of their draws was counted unkept (keepdraws' read of lp72-xtx): every logged call
but a direct draw, a bind, a pipeline state set and a render state set forgets the encoder's kept
draws (render/replay.rs log -> forget_again), and the guest orders its heaps between encoders
with fences (updateFence after the last draw, useResource(s)/useHeap(s) before).
A kept draw, and those set aside, now survives:
- update_fence: it records nothing;
- wait_for_fence where the encoder used no shadowed texture (a wait over a shadowed texture marks
it written, so later commands take its copy again: that wait still forgets);
- use_resource(s) / use_heap(s), but a memoryless use (which fails the command buffer): a use
that changes the residency gives it a new generation, which Under holds, so the next draw takes
every step; a repeat use changes nothing.
Every other logged call still forgets. New WorkCounts: kept_draws_kept_across_{fence,use},
kept_draws_let_go_{fence,use,barrier,store_action,visibility,other} (the kept draw a logged call
let go, by kind), encoders_last_draw_empty.
Verified (keepdraws, 77437d3277 on adaccf2367): lavapipe debug 64/64 over kept_across_calls,
draw_again, carried_draws, snapshot_reader, deferred_calls (26714); the new
tests::kept_across_calls 2/2 (draws after updateFence, waitForFence, a new useResource, the same
use twice, a new useHeap, the same heaps, updateFence, against the same calls plus a forgetting
call: pixels and commands equal; kept across fence 3 and use 5, drawn again 3, unlike_kept_under 2
for the two residency-changing uses; a barrier test let_go_barrier 1, encoders_last_draw_empty 1).
Negative control (26721: a draw again recording its Vulkan draw twice) fails the pixel test (48
vs 36 a channel). clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd and runtime rustdoc 0 (26715).
An XTX run follows on development.
RUNTIME_VERSION 2240 -> 2241.
|
||
|
|
e3ee3d7f5e |
RUNTIME 2240: a draw that reads its own color through snapshots is kept: drawn again, rebound and carried
On the consumer's XTX Launchpad walk ~59% of render encoders end keeping nothing though they would fit the next encoder (WorkCounts::encoders_none_kept_next_fits, RUNTIME 2229), and ~75 draws a present read their own color attachment through a snapshot (render/snapshot.rs), a draw that kept nothing and so took every step each time. A direct draw that reads through snapshots (not in place), pins nothing, and otherwise meets every plain-draw condition (records into its instance as it stood, a pipeline made ahead, one push, one Vulkan draw, whole draw state, its only push hole SnapshotPhase, no write but its snapshots' uses) now keeps a Kept with a reader part (slots, feedback colors, the phase hole, the pipeline's own write masks, its layout). A draw again records exactly what the first did, the snapshot draw (masks 0, phase 1) then the drawing draw (own masks, phase 0), with their barriers and query, re-deriving only what changes with no call (the reader's ordinal, its learned coverage and the area/coverage decision, peeked first; if it would no longer take the snapshot the draw takes every step). A rebind re-derives the reader decision through side-effect-free cores of the functions every step runs (in_place_wanted, snapshot_wanted, area/coverage, snapshot_holds, snapshot_apart), binding::rebind_into rewrites a changed slot's SnapshotTexels source, and record_rebound records the two recordings with their pairs. A carried reader's snapshot conditions are checked at its rebind beside carried_stale (WorkCounts::draws_carry_stopped_snapshot), begin_carried passes its feedback to inline_begin, and a carried draw retains its pipeline objects into its encoder. Set-aside kept readers are exempt from a reader's forget of its colors' readers: their reads go through their own pair, whose first barrier orders every earlier color write. In-place readers, pinning readers and readers recording into a new instance stay unkept. New WorkCounts: reading_draws_snapshotted_again, draws_rebind_stopped_snapshot, draws_carry_stopped_snapshot. A lane bench (runtime_lane reader_costs) measures the CPU per draw of encoders ending in a reader. Expected reach (keepdraws' read of the consumer's lp72-xtx counters): readers never sit in an unsplit inline pass, so this reaches the ~22 fitting encoders a present that are not inline. Verified (keepdraws): clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd and rustdoc 0 at adaccf2367; lavapipe 43/43 (no snapshot path there: pixels only); XTX and 780M debug at e4961c98ee 91/92, the one miss (a carried draw's later draw again) fixed by 8e219f8bad. XTX/780M reruns at the tip, negative control and the release bench are queued and follow on development. RUNTIME_VERSION 2239 -> 2240. |
||
|
|
67fb4a7902 |
SEMANTICS 2097 / RUNTIME 2239: an ICB's blit reset writes only the commands written since the last
An indirect command buffer's records live in Shared host memory by design (the host step reads
them on the CPU, and plain Metal lets the CPU write a Private ICB's commands), so a blit's reset
of a whole ICB was a vkCmdFillBuffer over every record across the link: on the consumer's Modern
Rendering sample (45k commands, 101 MB of records) 56.9 ms of GPU time a frame on an RTX 2080
over PCIe x4, against 0.26 ms for the same fill in device-local memory, while the sample writes
~1.3k commands a frame.
Each command now has a u32 written flag in an optional tail after the records (16 +
capacity*2248 + 4*i; CommandBuffer::initialize and decode unchanged). The lowered encode
operations and copy_command store 1 through the contained wide_at (no tail: the sink; a faulting
operation stores nothing); the CPU setters and edit mark it, and a CPU write of the reset record
(reset_with_range) clears it; a blit copy fills the destination's flags with 1. A blit reset is
one dispatch of the new owned kernel bind::icb_reset_module per run of commands, a workgroup a
command that zeroes a flagged record with 8-byte stores and clears its flag; the overflow clear
stays a fill. The carry copies the whole storage, flags included; a lost carry rewrites the header
and zeroes the flags.
Verified (radvcompile, at 273dbba28c on
|
||
|
|
ed9b745d20 |
RUNTIME 2238: an ICB's per-command pipeline states in a dense table, and one hold a pipeline set
An indirect command buffer's CPU setters cost ~290 ns a command in the runtime alone on lavapipe (the consumer's icb_slots_cost at pin 72: 16384 render commands of 5 fields; a Mac does ~5 ns), the largest frames CallHold's drop, the setters' edit, and a BTreeMap<u32, CommandState> insert per command. Two cuts: - The per-command state is a dense table: a u32 a command indexing a small table of distinct CommandStates, each counted by the commands that name it (set_states.rs); a set checks the last state it set, then a map. A recovery's carry walks the distinct states. An entry goes when its count reaches 0, so nothing is held past what the map held. - A render or compute pipeline set took 4 CallHolds (the setter's, program(), can_encode_indirect_commands(), indirect_command_writes()), 8 mutex takes; it now takes one, and a set of a state the table already names reads no program at all. Also: icb_encode_bench gains a full render slot (pipeline + 2 vertex + fragment + draw) and a compute slot (pipeline + 2 kernel buffers + dispatch) a command. Verified (icbset, msi lavapipe release, one A/B job m3-max-26475, binaries alternated, two passes, host load ~20 so passes drift; median ns a command at 16384 commands): full render slot base 232.7/291.6 -> dense 215.7/253.9 -> + one hold 135.2/185.8 (-42%/-36%); compute slot 212.0/263.4 -> 196.8/217.6 -> 116.6/151.5 (-45%/-42%). ICB, released-program, write-route, recovery and kept tests on lavapipe running (26484) at the branch tip. The batched setter (set_each) and the unlocked action/pipeline setters follow after the ICB reset's dirty flags land. RUNTIME_VERSION 2237 -> 2238. |
||
|
|
a3214f16f7 |
RUNTIME 2237: a skipped inert dispatch still names what it binds, so its command buffer copies Managed buffers in
RUNTIME 2228 ( |
||
|
|
574d199d67 |
RUNTIME 2236: a managed synchronize decides its copy as it is encoded and records it in place
RUNTIME 2231 split the guest's encoder at each synchronize of a Managed buffer into its own deferred segment (Deferred::SyncOut): every command buffer holding one paid an extra continuation VkCommandBuffer and a segment VkCommandBuffer, its batch could no longer fold its end (an extra VkSubmitInfo), and the copy was decided at submission. On the consumer's 2080 Geekbench walk that showed as ~1 extra no-dispatch command buffer per synchronize. Now the copy is decided at encode, from the kept writes of other command buffers plus this command buffer's own writes before the synchronize, and recorded in place with only the written regions; an unwritten synchronize records nothing. The copy is whole where an earlier segment is unknown, the command buffer writes memory no use names, or the buffer was handed out. At submission, settle_syncs_out adds a top-up command buffer just before the part holding the copy, covering only writes from other command buffers noted after the encode, between two all-stage barriers (WorkCounts::managed_synchronizes_topped_up, new). The SyncOut segment is gone (deferred.rs is back to its |
||
|
|
7c96f44705 |
RUNTIME 2235: link a compute pipeline from its function, never read or keep its artifact
A compute or tile pipeline state's creation that found its function in the shader cache directory also read, checked and decoded the pipeline's own artifact (68 KB on the 16,348-word ccb_conv_array kernel: read, XXH64, scan, decode ~11 us plus its file read), and a creation that translated encoded and wrote both. A compute pipeline is its one function relocated, with the layout and interface its link derives from that function, so the link translates nothing and costs less than the artifact (5.9 us on the same kernel). Sources::kernel now takes the memo's live variant, else a binary archive's pipeline, else links it from the compiled function (compile_compute_pipeline / compile_tile_pipeline), and keeps it in the memo weighed by the new translator fn ComputePipeline::footprint. The directory keeps no compute pipeline (EntryKind::ComputePipeline stays for binary archives). ShaderCache's compute pipeline load/store, Looked::ComputePipeline and ShaderCacheStatistics' compute_pipeline_hits/misses (always 0 now) are removed. The new public fn changes SOURCE_DIGEST, so cache directories start fresh. RUNTIME_VERSION 2234 -> 2235: a run's pipelines now come from another path. Also: compute_create_bench times "function decoded + pipeline linked" (test only). Verified (warmskip, at 222d95ea69 on 18060aa638's base): clippy plain 26268, --cfg m2v_gpu 26269, --cfg m2v_cpu_icd 26271 all 0; rustdoc -D warnings 26270 = 0; touched tests on lavapipe 26262 158/158 (runtime suite + validation lane cache, binary_archives, pipeline_records). Lavapipe A/B release (msi 26316, legs B A B A, host busy so ~30% above quiet), creation medians before -> after: CONV memo-1 settled 88.4/88.2 -> 74.0/72.4 us; CONV after a warm pass 194.8/177.8 -> 136.3/137.8 us; SMALL memo-1 32.4/32.0 -> 19.8/26.9 us; CONV warm same device 18.7/18.9 -> 18.8/19.4 (memo, unchanged). XTX before/after pending (26300). |
||
|
|
18060aa638 |
RUNTIME 2234: warm: a refusal for good is kept, and a later pass answers its record at once
A warm pass made every record's creation again at every boot, refusals
included: on the Iris Xe under ANV six Cycles kernels past the stage bound
its driver compiles intact (Unsupported{StageSize}) cost 1.4-2.4 s of
warm-thread work a boot, one record 1397 ms before its refusal. Nothing kept
the refusal: it is decided in the translation, after the shader cache's
lookup missed, and only translations are stored.
Now a warm creation's failure that is a fact of the record on this device
(a typed refusal, Error::Unsupported, or a translator outcome the translator
states permanent for its input; never a missing input, a deadline, a
cancellation, a failed host allocation, out of memory or a lost device) is
kept in the build's directory, named by the record's bytes and the driver's
identity (vendor, device, driver version, pipelineCacheUUID) under the
profile fingerprint and RUNTIME_VERSION (shader_cache/warm_refusals.rs). A
later pass looks the record up there before reading it and answers it as
failed of the same kind at once, counted in the new
WarmStatistics::records_failed_before and announced as before. The
program's own creation still translates and meets the refusal itself.
Tests: warm::a_refusal_for_good_answers_a_later_pass_at_once (a 256 KiB
private array every device refuses: a later device over the directory
answers it with no stage decoded and no lookup; an Invalid failure is made
again by each pass), pass::only_a_refusal_for_good_is_kept,
shader_cache::a_warm_refusal_is_found_by_its_own_driver_only,
warm_refusals' frame test.
Why: on the Iris (ANV, pin 71) every boot's warm pass retried 6 records refused StageSize /
DriverDefect, 1.4-2.4 s of warm-thread work a boot (one record 1397 ms). Verified (warmskip, msi,
lavapipe, at cedc049cf1 on
|
||
|
|
a18db89220 |
RUNTIME 2233: spare command pools trimmed in rounds behind a re-record of the kept barriers (ANV heap growth)
On ANV (TrimmedCommandBufferFailsResubmission) the free thread frees a spare pool's command
buffers without trimming it, and Mesa's common command pool keeps every freed one for that pool's
later allocations; only a trim or the pool's destruction destroys it. Each pool kept as many
command buffers as it ever held at once, for the device's life, summed over every pool and
invisible to HELD: a guest's compute load on the Iris Xe grew the process heap to gigabytes under
vkAllocateCommandBuffers (consumer ledger: growth, then a panic, after Geekbench's Fluid pass).
- A pool counts the command buffers freed from it untrimmed, less those made from it since. Once
the spares hold UNTRIMMED (4096), a trim round is due: as the scheduler next submits a batch,
while its group holds no batch, State::trim_round marks every kept barrier command buffer to be
recorded again before a batch takes it (KeptBarriers::invalidate; a begin clears what it names),
then trims the spare pools holding the most until TRIMMED_AT_ONCE (1024) at least are destroyed.
Where frees are trimmed at once, pools hold none untrimmed and nothing changes.
- A taker takes a spare holding command buffers before an empty one.
- Counted: WorkCounts::spare_command_pool_trim_rounds, spare_command_buffers_trimmed_in_rounds.
- spares.rs docs carry the measured effect, its walk figures scoped to their profiles.
Verified (perdraw5):
- Iris Xe (ANV) 25876, tests::spares_compute_in_flight, base -> with rounds: heap 410 -> 2936 MiB
vs 416 -> 534 MiB; anonymous 434 -> 2965 vs 439 -> 743 MiB; shed 129,361 vs 71,086; 17 trim
rounds destroying 64,714 command buffers. A negative control without the invalidate (e6e83e1e4b)
lost the device at round 2.
- Iris 26157, the kept test: the round destroyed 1214 (pool (3, 1214) -> (3, 0)), 0 of 59 command
buffers failed, 0 recoveries. Negative control 8db880af0a (no invalidate): the same round, then
1 of 59 failed and 1 device recovery: FAIL.
- msi 26150 at 9315937cbc: pure spares and kept-barriers tests 25/25, clippy, --cfg m2v_gpu,
rustdoc -D warnings, API signature/surface 15/15. msi 26162 at the rebased 2aef11f27d (on
|
||
|
|
c7d652ca5e |
RUNTIME 2232: the scheduler loses no wake for a batch held behind an unshared queue or a kept group
A guest's commitAndWaitUntilSubmitted could stay unanswered until the next commit (reims, XTX
RADV at pin 71, 2 of 77 runs under load: "A was never submitted"; the GPU idle; the scheduler
asleep with the batch held for 10 s; an empty commit on another queue released it at once).
Cause (reims's finding, /tmp/xqtest/m2v-finding.md): on a host whose one graphics VkQueue an
unshared queue also holds (RADV, ANV; WindowServer's queues are unshared), batch A behind H was
held by held_for_unshared() while H was in the Flight. QueueSlot::completed publishes `completed`
(fetch_max) before waits.completed takes H out of the Flight. When H completed between those two
steps, the hold read a stale Flight and gated on completed + 1, which nothing meets.
Fix:
- Unshared hold: QueueWaits::hold_ahead reads the published completed value under the waits lock;
Flight::ahead(ran, completed) counts batches at or below it as gone; Room::Hold { after, through }
carries the oldest still in flight; await_unshared_room gates on `through`, fences, and reads
again (completed >= through wakes it at once). No reorder of QueueSlot::completed.
- Kept group (submit_ready, Group::keeps read before gate_on): sets the gate, fences, then reads
again (Group::pending_through), the protocol gate_heads and check_heads use.
- A WAIT_SLICE that ends with a batch held makes a pass, as the module docs promise, counted in
WorkCounts::scheduler_slice_rescues (0 wherever every wake comes). api_signatures and host_ab
updated.
Verified (perdraw5, msi 26135, lavapipe, at 3bd14c83ac on
|
||
|
|
523d32a10a |
A failed submission's and a failed recording's warning end in their id name
reims's sink writes a runtime message's text alone, without its id, so a metal2vulkan-submit-failed or metal2vulkan-recording-failed line could not be found by id in qemu.log. submit_failure::warn now appends " [<id name>]" to the text, as degrade notices end in theirs, for both warnings. The device test asserts the submit-failed line ends in " [metal2vulkan-submit-failed]". docs/API.md says so. Log text only: no version bump. Verified: expected, by the check job dispatched at this commit (clippy plain and m2v_cpu_icd on the runtime, the submit_failure unit tests, the lavapipe device test). |
||
|
|
34e3407522 |
RUNTIME: a failed submission's resource summary reads apart from its list
The lavapipe line read "0 keys of the runtime's own: buffer #1 ...", as if the stated resources were the runtime's own. The summary now ends "and N keys of the runtime's own not stated", and the stated resources follow after "; stated: ". The unit test's expected text follows; run in the next Linux job. |
||
|
|
19ead6a74a |
docs: the failed-submission and failed-recording warnings
API.md's diagnostics paragraph and CommandBufferError::Internal's doc name the two Warning lines a device's sink now hears (metal2vulkan-submit-failed, metal2vulkan-recording-failed): which submissions log one, what the line names, its bounds, and that a successful submission does none of it. Checked against submit_failure.rs's constants and texts; rustdoc runs in the Linux job. |
||
|
|
234ea4de4e |
RUNTIME: a failed submission's line names memory flags itself
ash is built without its debug feature here, so vk::MemoryPropertyFlags has no Debug: the line names each flag (and any bit without a name by its value). Verified by the build job that failed on it (m3-max-26103) and the new unit test memory_flags_are_named_and_an_unnamed_bit_is_given_by_its_value. |
||
|
|
cc9b00f0c8 |
RUNTIME: a failed vkQueueSubmit logs one bounded line naming what it held
Twice on an RTX 3090 a command buffer failed with VkResult -13 and nothing said what its submission held. Every vkQueueSubmit of the runtime's that fails now logs one warning (id name metal2vulkan-submit-failed) through the device's sink, else on stderr: the VkResult, the VkQueue and what submitted; each VkSubmitInfo's waits, VkCommandBuffers and signals, each semaphore by its role with its value and the timeline's value read after the failure (flagged where a signal is not above it, VUID-VkSubmitInfo-pSignalSemaphores-03242, or a value lies past the least maxTimelineSemaphoreValueDifference, -03243/-03244); each VkCommandBuffer by its role (an encoder's, barriers, kept barriers submitted again, first work, end); the Metal command buffers by id and label; and the resources their encoders name, as what owns their memory, with size, storage mode, memory type and flags, no-copy import kind and whether it is released now, detached or gone, and age in the device's submissions since it was made. Bounded: 8 infos, 8 waits and 8 signals each, 32 VkCommandBuffers, 8 command buffers, 32 resources, each list counting the rest. Nothing is read on the success path: the line is built only in each call's error branch, and it reads under its submitter's locks without waiting for any lock another thread may hold (try_lock), but the two resource registries a batch's submission already locks. A recording that fails also fails its command buffer with a raw VkResult (VK_ERROR_UNKNOWN for the runtime's own error, which the command buffer's error drops): recording_error now logs that error (id name metal2vulkan-recording-failed), so a raw -13 says which of the two it was. Tests: tests/submit_failure.rs (an info's lists read back from its chain; the line's words, flags and bounds), tests/submit_failure_device.rs (a blit's batch failed by the test hook as VK_ERROR_UNKNOWN: one warning naming the result, the label, the encoder, the queue's timeline and the buffer with its age). |
||
|
|
2434f48cc2 |
kept_shadowed_draws: expect in-place reads where the device reads in place, a queue per frame
The test failed on both the RX 7900 XTX and lavapipe, with or without the narrow forget. On the XTX it failed at "the reads through copies" (4, not 8). Its four draws of the second target's texels read a color their draws write nothing of, at their own pixels. A device that enabled attachmentFeedbackLoopLayout and fetches no color through input attachments reads that color in place (render/snapshot.rs's in place), with no copy, and such a draw keeps nothing. The test expected the copy on every device. The expectation now follows the device's read path, decided from the device itself (the feature it enabled and framebuffer_fetch::through_inputs of its profile), not its name: - In place: 4 reads through copies and 4 in place (WorkCounts::reading_draws_in_place, now counted with the copies). 4 draws unkept_shadowed in each frame. In the kept frame, 2 draws again (1 with debug assertions), 1 rebound (0), and 1 stopped. - Through copies: as before. On lavapipe it failed at "the apart frame's keeps": 1 draw rebound, not 0. Both frames ran on one queue. The first frame's last draw, kept, was carried along the queue into the second frame's render encoder (render/carried.rs), and the second frame's first draw rebound it. Each frame now runs on a queue of its own. The pixel checks are unchanged. |
||
|
|
d38b5c4ef6 |
RUNTIME 2231: a managed synchronize copies out only the bytes the GPU wrote
On a device without unified memory, synchronizeResource: copied the whole Managed buffer (or a
texture's whole span over one) to its host copy every time. The runtime now keeps the GPU's
writes for each buffer that has been synchronized once (managed_sync.rs: GpuWrites, SyncCopy,
SyncOut), stamped in the scheduler's submission order across all queues. The copy-out is its own
segment (Deferred::SyncOut), decided when its batch is submitted, so it covers the writes of
earlier batches, of earlier encoders in its batch and of its own encoder, including a write
encoded after the synchronize but committed before it. Completion of the command buffer holding
the copy drops only the writes noted before the copy. It copies nothing when the GPU wrote
nothing since the last copy, and still copies the whole buffer where the writes cannot be known:
an untracked buffer; one whose VkBuffer was handed out or whose memory is exported; a buffer's
first synchronize; any batch since the last copy, not yet complete, that may write memory no use
names (State::writes_unnamed); and a synchronize recorded in place (a predicated loop's laying, or
no VkCommandBuffer could be made). Every barrier is still recorded. Pages no import maps copy back
only the regions copied. Textures over buffers take the same path (an image range counts as the
whole buffer). Touches command_buffer/submit.rs (record_syncs_out after record_scrubs) and
command_buffer/mod.rs (the footprint loop skips SyncOut segments), encoder.rs, tracker.rs,
deferred.rs, device/mod.rs. New WorkCounts: managed_synchronizes_unwritten,
managed_synchronizes_whole, managed_bytes_unwritten_skipped. FAST-PATHS managed bullet, API.md
managed section and the runtime README updated. No speed-for-accuracy choice.
Why: on the RTX 2080 the guest's Background Blur spent 0.90 s of GPU time copying out 3.5 GB
over 800 synchronizes (~176 MB a command buffer, the 2080's x4 link), whole resources each time.
Verified (mansync; step codes read inside the jobs):
- clippy --all-targets --all-features -D warnings, workspace: plain 25924, m2v_cpu_icd 25927,
m2v_gpu 25928, all 0; rustdoc -D warnings 25935 = 0 (at b72228629c).
- RTX 2080 (um790) at ac0887e7f5, 25942: 41/41 (managed_copy_device, detached_contents,
kept_padding, device_memory_overflow; hazard tests excluded). Counts (copied, skipped,
unwritten, whole), both Import and Pages: first synchronize (1048576, 0, 0, 1); after no write
(0, 1048576, 1, 0); after a fill in an earlier command buffer (16382, 1032194, 0, 0). Every
byte checked after each step, including a write committed before the synchronize's command
buffer but encoded after it, and a CPU write named by didModifyRange.
- Negative control (throwaway e1542d94c4, 26010): imports copy whole and pages drop kept writes;
both legs fail.
- Release, 2080, examples/managed_sync_out (40 no-copy Managed buffers of 4,399,104 B, 176 MB
synchronized a command buffer), median GPU ms over 20, base
|