d3389d7cbb2b37a74e22bbb4e9264439d6c39366
580
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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). |
||
|
|
3de483d86f |
RUNTIME 2459: Joined completions: a command buffer marked to join the next groups under Exact
CommandBuffer::set_completion_joins_next marks a command buffer, before its commit, as one whose completion may be seen with the next one's. Under CompletionPolicy::Exact, on a device whose merge check holds and whose queues are not relayed, a marked command buffer's batches wait in the scheduler's group as every batch does under Grouped. The first batch of the VkQueue behind them that is not marked goes last in that group, which then goes at once (GroupEnd::Closed, WorkCounts::group_ends_closed), so it is seen complete at its own end and never held back. Its submission check runs with the marked ones' (check_heads), so they are found ready together. No group is kept past its pass under Exact (Alone::Unkept, WorkCounts::batches_held_alone_unkept): a kept group can reach the GPU after the work ahead of it ended, which would delay the unmarked one behind it. Everywhere else (Grouped, no merge, relayed queues, the encoder trail, batches that never group) the mark changes nothing. Why: on the Iris Xe, ANV on i915 lists every VkDeviceMemory in each execbuffer, about 170-190 us of driver time a vkQueueSubmit at the consumer's import count, and the consumer cuts each guest command buffer into about 12 parts committed under Exact, one kernel submission each. In its walk the GPU sat idle about 1.5 ms per waited guest buffer between parts already committed, behind a backlog of those calls. The consumer will mark every part but the last of a cut whose completion nothing observes. Grouped-completion's notice, docs/API.md's catalogue, FAST-PATHS row 38, the runtime README, CompletionPolicy::Exact's doc, api_signatures and REFUSALS say so. Tests: runtime_lane::joined_completions (marked parts group and a group is closed by the last; checked parts too; a no-op where the device's own check finds no merge; unmarked parts go alone; an unmarked command buffer is seen complete while the long one behind it still runs, the marked one before it complete by then), on lavapipe with the merge assumed. Joined completions: the cost table's length, and the order test's first work done before The conformance cost table's SHARED list holds 36 rows with batches_held_alone_unkept. In the order test the marked command buffer took the new buffers' first work, which no batch in a group takes, so it went alone and nothing grouped: the buffers' first work now runs before it. Verified: clippy and lavapipe lane job m3-max-36769 showed the failure (grouped 0 with grouping true); the rerun is the next job. Verified at 8e6c37c263: m3-max-36784 (msi) clippy --workspace --all-targets --all-features 0; m3-max-36785 (msi, lavapipe, --cfg m2v_cpu_icd) joined_completions + grouped_submissions + alone_batches 21/21 (marked parts under Exact with the merge: 7 command buffers in 2 submissions; unmarked: 7 submissions, 0 grouped; lavapipe's own merge check, not Holds: 0 grouped; an unmarked buffer is seen complete at its own end). The Iris merge check answers Holds (m3-max-36725: 9.6 us in one call of 4 against 26.4 us apart). Release-mode lavapipe, clippy --cfg m2v_gpu and m2v_cpu_icd and rustdoc run after the merge. |
||
|
|
e10f3529c2 |
FAST-PATHS: the Iris Xe reads imported host memory at about 2.2 times device memory's GPU time
A known gap, the device's: under ANV (Mesa 26.2.6, i915) a compute kernel's reads of constants over imported host pages cost per read, by host pointer or udmabuf dma-buf alike. Measured on the Iris Xe (reads_k probe, one pass, rings of 64): 256 threadgroups with 1,024 uint4 reads per thread took 325 us per dispatch from device memory against 714-740 us from a pointer import or a dma-buf import (jobs m3-max-36557, m3-max-36652). 4 KiB and 64 KiB rings cost the same, uniform and storage views cost the same, and no recorded command count differed between placements. The dma-buf route ran (dma_buf_imports 4, no pointer imports). The only lever would copy guest constants into device memory, which zero copy excludes. |
||
|
|
83b3b67f30 |
RUNTIME 2457: Predicated loops: a rebind while a loop without work apart runs again is taken
A predicated loop's check (Deferred::Loop) answered false in Deferred::resolved_at_its_calls, so the commit's steps_hold kept the pages of every buffer over host pages its command buffer used until it completed, and a rebind of one meanwhile was refused Invalid(Rebind(EncodedUses)) for as long as the loop ran on, which Metal does without bound. The check's host step reads only its unit's halt word, in the command buffer's upload arena. Each run again submits the laying's VkCommandBuffers again as they were encoded (Piece::Raw), the predicate word's VkBuffer or address and the body's sets taken at encoding, over the pages the laying's event group took at its first submission, which Submitting::submit keeps in State::retained until the command buffer completes; the batch the check holds keeps it from completing before the loop ends. Only the work the laying left apart is recorded again at each run: a host step's resolves the buffers its encoder named then, and work on the GPU alone records over the buffers as they lie then. So a loop's check is now resolved at its calls where its laying left no work apart (LoopCheck::leaves_work_apart). A rebind after the laying's submission is taken and every run again keeps the old pages, as Metal's loop reads the pages its submission found. A rebind before that submission is taken too, and the laying's encoders, which keep no log to be encoded again from, fail their submission EncodedUseRebound (announced), as every other compute encoder that predication reaches past does. A laying that left work apart keeps holding as before. The docs say so: deferred.rs, rerun.rs, rebind.rs (the module doc, RebindProblem::EncodedUses, Buffer::rebind_bytes_no_copy), the commit's steps_hold comment, the runtime README, and FAST-PATHS's two known gaps (the refusal now names a loop whose laying left work apart; the rebind between submissions names a loop's laying rebound before its submission). docs/REFUSALS.md does not move. The test is tests/rebind_loop_check.rs: a no-copy buffer holds a DoWhile's word and its body's input. A rebind while the loop runs again is taken, the loop runs again after it, ends on the old page's word alone, and its body wrote the old page's input; a rebind before the laying's submission fails the command buffer EncodedUseRebound, announced, its output unwritten. Verified: m3-max-36621 (msi, lavapipe, --cfg m2v_cpu_icd) at 30a7bfaa4e: rebind_loop_check 2/2 (running: rebind Ok, loop ends on the old page's word, old input; before submission: rebind Ok, EncodedUseRebound announced); rebind_*|pending_rebind|host_step_*|rerun_*|predicat* 29/29; control (development's Loop arm) fails both with Err(Invalid(Rebind(EncodedUses))); m3-max-36628 clippy --all-targets --all-features 0. clippy --cfg m2v_gpu / m2v_cpu_icd, rustdoc and the validation lanes run after the merge. |
||
|
|
9dc0a6a6ef |
Docs: name no workload of a consumer's benchmark
docs/FAST-PATHS.md's unshared-isolation row and a spares test's doc named two workloads of a guest compute benchmark; they now say 'one workload' and 'a guest's compute workload'. The repository names no consumer app, benchmark or workload. No behaviour change. Verified: git grep for the benchmark's and its workloads' names finds none after the change. |
||
|
|
e63ecb9405 |
RUNTIME 2453: Host pages: a buffer inside a no-copy buffer's own dma-buf import dedicated to nothing is bound in it
What: Device::bind_in_import now binds a no-copy buffer whose pages a live import of dma-bufs holds all of inside that import, as it does inside an import of the pointer, where the import is one VkDeviceMemory dedicated to nothing (a no-copy buffer's own dma-buf of one chunk, a piece of a shared file's import, a guest RAM chunk's). The new VkBuffer is made for the import's handle type (VkExternalMemoryBufferCreateInfo DMA_BUF, from bound_memory), its alignment and memory type checked as before, and the holding import is kept imported for good (HostImport::pages(ReadApart::Inside), as for a pointer import). Still refused: an import the driver took only dedicated to its buffer (DmaBufPages::dedicated_to_buffer, NVIDIA 615's retry) and several chunks bound to a sparse buffer (no memory); those pages stay a copy, or an import of their own beside dma-bufs. Before, every dma-buf import but a guest RAM chunk's refused, so such a buffer was a copy (copied_over_live_imports) whenever it came with no dma-buf source, or a second import beside it. The Vulkan rules: VUID-vkBindBufferMemory-memory-02985 (a buffer bound to imported memory names the import's handle type in VkExternalMemoryBufferCreateInfo::handleTypes, which host_buffer does from bound_memory's External(DMA_BUF)); VUID-vkBindBufferMemory-memory-01508 binds only the dedicated buffer where VkMemoryDedicatedAllocateInfo::buffer was not VK_NULL_HANDLE, which holds only for the dedicated retry, still refused; VUID-vkBindBufferMemory-None-10739 (offset a multiple of the alignment) and -memory-01035 (memory type) as checked before. Why: on the Iris, with a platform mapping a view of guest pages through one dma-buf, a guest heap's region takes a 2 MiB no-copy buffer imported through that dma-buf, and the 256 KiB buffers placed in the heap's pages, handed over by their pointer alone, became copies of the pages over the live import: 582 copy ins compared a second, each the copy's whole 64 pages (155 MB/s), 10.7 MB/s copied in, commit_nanos 43.7 -> 120.5 ms/s. With the views mapped from their files the same buffers were bound inside the pointer import (buffers_bound_in_import), with no copy. dma_buf_buffer_imports_dedicated was 0 there: every such import was dedicated to nothing. Docs: bind_in_import's doc no longer says a buffer's own dma-bufs' memory is that buffer's alone; dma_buf.rs's module docs, import_from_source's and chunks_buffer's `sole` contract and DmaBufPages::dedicated_to_buffer say a buffer over part of the pages binds inside an import dedicated to nothing and in none dedicated to its buffer; FAST-PATHS's NVIDIA dma-buf gap says the same. Test: tests/dma_buf_beside.rs's without_pointer_imports_a_buffer_inside_a_live_dma_buf_import_is_bound_in_it, on a device made without VK_EXT_external_memory_host: a first no-copy buffer over 4 pages of a memfd with a dma-buf source, then inside it a second with no source and a third with one, each bound inside ([0, 0, 0, 0, 1] of copied over live, beside, inside live, pointer imports, bound inside) where the first's import is dedicated to nothing (else a copy, and beside or a copy); the GPU reads the CPU's bytes through each, a CPU write before the commit reaches a copy through the second, a fill through one and a copy through the other in one encoder are ordered either way, and after the first's release the second's fill reaches the file's pages and reads through the third. Verified: m3-max-36423 at e377c24dce, clippy -D warnings (runtime and translator, all targets and features) 0 and rustdoc -D warnings 0. Lavapipe tests, the negative control, the cfg clippy and PHOENIX run after the merge. |
||
|
|
aa272cd706 |
Rebind: record the refusal while a dispatch's host step is left as a known gap
A compute encoder can leave a dispatch to its host step (Deferred::Dispatch, indirect_dispatch.rs): an indirect dispatch off the GPU's own path, or any dispatch while an indirect stage-in region is set. The host step reads the arguments once the work before it completed, and resolves the buffers its encoder named as it records. Deferred::resolved_at_its_calls is false for it, so the commit keeps the pages of every buffer over host pages the command buffer used until it completes. A rebind of one meanwhile is refused with Invalid(Rebind(EncodedUses)), where Metal's replace before the submission reaches the new pages. Encoding the encoder again (the reverted 947c110e49) would not reach this path: the rebind is refused before any encoding again. So the behaviour stays, and is now recorded: - rebind.rs's module doc lists the dispatch among the commands that keep a committed command buffer counting as uncommitted until it completes, with the refusal; - the doc comments of RebindProblem::EncodedUses and of Buffer's and Heap's rebind_bytes_no_copy name the committed case; - Deferred::resolved_at_its_calls names its false arm (an execution, a dispatch left to its host step, a loop's check); - the runtime README's rebind sentence names the committed case; - docs/FAST-PATHS.md has a known-gaps entry. HOWTO does not state the rebind's refusal, so it is unchanged. The test is host_step_reads.rs's a_rebind_while_an_indirect_dispatch_s_host_step_is_left_is_refused_until_completion. On a device without device addresses (shaderInt64 withheld), it dispatches [4, 1, 1] threadgroups from a no-copy page behind a shared-event gate, and rebinds the page before the signal over one holding [2, 1, 1]. It asserts: - the rebind is refused with Invalid(Rebind(EncodedUses)); - the command buffer completed with no error; - the host step ran; - the dispatch ran the encoded page's 256 threads; - a rebind is taken once the command buffer completed. Degradation kinds added or removed: none. |
||
|
|
8562b28fe4 |
RUNTIME 2446: Shadows: a split merge on the host copies no piece; its kernel skips their columns
A merge on the host past shadow_merge::HOST_WHOLE_BYTES split: its host step stored the pieces of each row in lines beside the texels, and its kernel the rest. To keep the kernel off those lines, the GPU copied the pieces' kept bytes into an arena region and their changed bytes over them in the kept part: two vkCmdCopyBuffer calls of one region per piece. On the Iris Xe (ANV) that work cost about 7 to 9 us a region, growing with the rows, not the bytes: about 0.6 ms for 34 rows (m3-max-35898) and about 15 ms for 1024 (m3-max-36118: a BGRA8 1023x1024 render target over host pages drew in 17.57 ms a command buffer as a shadow against 1.26 ms in place, its host step 0.28 ms of it). Now the kernel takes a column window (bind::ShadowMergeModule: two more push words, PUSH_BYTES 24; shape_within, shape the whole row): a word outside the columns is neither read nor written in either store form, and counts as unchanged in its block. A split merge pushes the words between each row's pieces where every row's pieces lie at the same places in it (shadow_merge::columns: whole words, the same head and tail each row; rows whose pitch is no multiple of the line differ, and those merges go on the host whole). It records the changed copy and its dispatches alone, with no save, no mask, two fewer barriers and no arena region; the host step reads each piece's kept and changed bytes in the scratch's two parts, which nothing writes after the changed copy. Removed: HostMerge::saved, ShadowMerge::saves, ShadowCopy::merge_saves, the merge's region in EncoderCore::merge_on_host, MergeDrain::_region, and the split's copy uses of the kept part. The bound stays 1 MiB; its doc comment states the measured costs. Linear merges push the whole row. Tests: - bind::shadow_merge's a_region_merged_within_columns_leaves_the_words_outside_them: 70 rows of 6 words, columns 1 to 4, every word changed; words outside the columns keep the current buffer's, in both store forms, and a window of every column equals shape. - shadow_runs' merges_on_the_host_go_whole_up_to_the_bound_and_split_past_it also asserts shadow_merge_words_examined: every word of the whole merge's rows; for the split, the words between each row's pieces alone (height * (row bytes - line) / 4). - shadow_write_lines' cost test gains a 4K shape: 3839 RGBA16Float texels a row, 2160 rows 30720 bytes apart. The merge module is under no golden table (golden_hashes covers the fixtures' translations). api_signatures: PUSH_BYTES, shape, and the new shape_within. Degradation kinds added: none. Landing note: msi m3-max-36189 at 4b09425f2d (same tree): clippy metal2vulkan + runtime, all targets and features, CLIPPY=0. The API tables, the module tests, rustdoc, clippy m2v_gpu / m2v_cpu_icd, the lavapipe control (development's whole-row kernel fails the split test's words-examined count) and the touched suites, PHOENIX and the Iris re-time follow on development. |
||
|
|
7fa39e82e5 |
RUNTIME 2445: Scheduler: a committing pass that ended at its own handlers wakes the scheduler's thread before running them
What: where a commit_and_submit pass ends right after its own command buffer's last batch with
batches left, it marks the state for the thread's pass (State::dirty) under the lock. Right after
the lock is free, before the completion turn it owes and before its handlers, the committing
thread wakes the scheduler's thread (wake_thread, Woken::Host). That pass reports no left_over,
so the end of submit_at_commit does not wake the thread again; passed_over() is still checked.
The thread passes while the committing thread runs its handlers; the batches it submits take
later Turns tickets, so their handlers still run after the committing command buffer's.
Why: in PHOENIX m3-max-36098 (the guest-shaped SubmissionHandlers leg after RUNTIME 2442), the
time from an early end to the next kernel submission made by the scheduler's thread was
p50 27 / p90 278 / p99 986 / max 1273 us (212 samples). The left batches waited for the
committing thread's handlers and the wake after them. The usual wake (wake_for, inbox.nudge)
skips the wake while the committing thread is still counted as the passer, and pass_once_then
never looks again. The scheduler's thread is never gated by a counted passer: it waits only for
the lock.
Tests: submission_turns' a_committing_pass_ends_at_its_own_submission_handlers_{exact,grouped}
now let the scheduler's thread go once the committing command buffer's handler has started. That
handler waits, up to two seconds, for the three later command buffers' submissions
(CommandBuffer::submit_returned_time), and all three are made before it ends (none without the
wake). The handler-order assertion stays. The test's messages lose the runs of spaces an edit
left in them.
The check also requires no sleep-slice rescue (WorkCounts::scheduler_slice_rescues moves by 0): the first control with the wake removed (ctl/complat2f 86baad51c4, lavapipe m3-max-36134) passed the timed check, because a 100 ms WAIT_SLICE let the left batches go within the handler's two-second bound.
Verified: msi m3-max-36132 at 46c7eedd4a (product code as landed): build, runtime clippy plain and --cfg m2v_gpu, unit, sigs EXIT=0. The tightened check at the tip and its control (m3-max-36157), the suites, clippy x3, rustdoc and the PHOENIX legs (m3-max-36158) follow on development.
Degradation kinds added: none.
|
||
|
|
c602b94223 |
RUNTIME 2444: Host pages: remove the lend of free padding to the copies; such render targets are shadows
What: a texture that renders over host pages whose rows end inside a line, with
free padding, whose renders failed, no longer takes its image in place when the
class's copies failed too. Removed: in_place::lent_to_copies and lends, the lend
branch in in_place() (it now asks each access's own verdict and nothing else),
unlent_words and the shadowed-texture notice words it added,
degrade_line_write_back and line_write_back_reason, the storage form move's lend
count and notice, Degradation::LineWriteBack ("line-write-back") with its
docs/API.md catalogue entry, the device test lent_dma_buf_targets, and the
validation lane's LINE_WRITE_BACK list. copies_verdict stays: through
InPlaceChecks::decided it now decides only whether a shadow's copies back and
merges into such pages are spliced (shadow_splice::splices). FAST-PATHS's
host-pages row and the Iris known gap are edited in place.
Why: the lend loses CPU writes Metal keeps. Both Macs kept render padding over
buffer rows (m3-max-35486 and 35487: clear-and-store and draw changed 0 bytes;
only the UHD 630's kernel changed any), and the lend's render passes write the
rows' last lines back whole on the Iris. Its stated reason was that the shadow
lost the same bytes. That no longer holds: the shadow splices its copies back
and merges on the host on such devices, and on the Iris (m3-max-35898) its
clears and draws put back 0 bytes against the copy control's 5,941 in 300
rounds. Under the user's contract rule a form that loses writes Metal keeps is
deleted, not kept behind a switch.
Guest cost, bounded by counts: the guest's Iris Forward+ boot (reims run 35408
at
|
||
|
|
3348b469c2 |
RUNTIME 2442: Scheduler: a committing pass ends right after its own command buffer's last batch where that one has submission handlers
What: where a commit_and_submit pass submits its own command buffer's last batch and that command
buffer has submission handlers, the pass ends there. It takes no check, and leaves whatever else
is ready to the scheduler's thread, which the committing thread wakes as before (left_over ->
Woken::Host). The committing thread then runs its own handlers once the lock is free, before any
later batch's submission. New WorkCounts::scheduler_passes_at_commit_ended_early counts the
passes that so ended with batches left. A test-only hold point, trace::Point::AtCommitPass, comes
before a committing thread's pass.
Why: PHOENIX m3-max-35993 (the guest-shaped submit-cost leg, a trace of Turns waits by the
holder of the ticket waited behind) found one kind of wait. A segment that a committing pass
handed off waited behind that pass's own ticket: 0.12 a frame, p50 3449 us, max 4586 us. The
handler runs only after the pass's later submissions, which are costly in that leg. Every
segment after it in the one hand-off context waited too: submission return to own handler
p99 3410 us on the handler threads. The scheduler's handed segments never waited in Turns, and
committing threads never waited behind handed segments.
Tests: submission_turns' a_committing_pass_ends_at_its_own_submission_handlers_{exact,grouped}.
The scheduler's thread is held after a pass. A commit_and_submit is held before its pass while
three ready command buffers are committed after it: one on another queue, one behind it on its
own, one behind the first on the other. Its handler runs inside its call with one kernel
submission made (without this change, after all four). The pass submitted one batch and counted
one early end. The handlers run in submission order, each queue's in commit order.
Verified: msi m3-max-36060 at 0c131eff3a: build, runtime clippy plain and --cfg m2v_gpu, unit, sigs EXIT=0 (api_signatures: WorkCounts::scheduler_passes_at_commit_ended_early). Control m3-max-36061 (early return removed, lavapipe): both checks FAIL under Exact and Grouped ("submitted 4 batches, ended early 0; handlers ... [ours 4, ...]"); the other 12 submission_turns tests pass. Lavapipe suites, clippy x3, rustdoc and the PHOENIX submit-cost leg (36069) follow on development.
Degradation kinds added: none.
|
||
|
|
f3390be7f0 |
RUNTIME 2441: Scheduler: a committing thread's pass keeps only its own command buffer's submission handlers; gated completions post with one look
What: commit_and_submit's own pass (and the pass the lowering thread makes for one left for a
render encoder's end) keeps inline only its own command buffer's submission handlers, which run
on the committing thread inside the call, in their turn, as before. Every other command buffer's
handlers whose last batch the pass submits go to the device's handler threads right after that
submission, as one segment with its Turns ticket; the committing command buffer's ticket is taken
as its batch goes, so submission order holds. Both of submit_plain_ready's places that take
handlers (a submitted last batch and one held in the group) go through keep_or_hand_off.
A transition to Completed or Error whose transition to Scheduled is still owed is posted behind a
gate only where its submission handlers have not run (gate_for_handlers); otherwise plainly. The
gated post pushes the item behind the gate and opens the poster's closing under one lock with one
look for a thread (Contexts::post_gated), where post_behind and open made one each. FAST-PATHS
records the hand-off's own cost (19.1 wakes a frame).
Why: on PHOENIX, in the guest-shaped submit-cost leg after the scheduler-pass hand-off
(RUNTIME 2437), a submission's return to its own handler was p50 991 / p99 5231 us where a
committing thread ran it (978 handlers), against p99 380 on handler threads: a committing pass's
handlers waited for the rest of that pass's submissions. The gated post's second look for a thread
cost 4.4 wakes a frame.
Tests (submission_turns): a_committing_pass_keeps_only_its_own_submission_handlers_{exact,grouped}
(fails at control C2 m3-max-35888, the hand-off reverted: the earlier command buffer's handler ran
on the test thread); a_gated_completion_is_posted_with_one_look_for_a_thread_{exact,grouped} (fails
at control D m3-max-35877, post_behind + open: [(true,2)] against [(true,1)]). The check takes the
device's queue plan.
Verified: msi m3-max-36014 at bd810397db: build, runtime clippy plain and --cfg m2v_gpu, unit
44/44, sigs, lavapipe suites 126/126 (encoder_holds TextureWrite passes). Workspace clippy x3,
rustdoc and lvpval 30/30 at the pre-rebase tip 2d09ed2392 (m3-max-35927). PHOENIX m3-max-35923
(suites at df21628b0f): handler-thread wakes per frame 50.2 -> 48.37 (post_behind + open 8.9 ->
post_gated 6.72); seen to seen-handler p50 11, p99 3658 us.
Degradation kinds added: none.
|
||
|
|
528379dad5 |
RUNTIME 2439: Merge on the host whole up to 1 MiB of rows; count host steps
On the Iris Xe (RPL-P, ANV) the split merge's own GPU work (two buffer copies of the pieces beside the texels, three barriers and the kernel's dispatch) cost about 0.6 ms a command buffer for the guest's 34x34 RGBA16Float target (m3-max-35898: draw minus clear 0.69 ms, against 0.10 ms when the merge went on the host whole), while the host step's word loop costs about 0.30 ns a byte (4.97 ms for a 1920x1080 target's 16.6 MB, half its texels changed). So the split pays only past about 2 MB of rows. A merge on the host whose cut rows hold at most HOST_WHOLE_BYTES (1 MiB, half the break-even) now goes on the host whole again; larger ones split. A merge none of whose rows' lines holds a byte beside its texels still goes by its kernel alone, as on any device. The whole merge is also the exact form for the unmeasured case (a CPU write to a texel the commands left in a line whose other bytes they changed), so the known gap now applies only where the kernel stores: past the bound, and where no row's line holds a byte beside the texels. Both forms keep the measured padding contract, so there is no switch and no FAST-PATHS row. WorkCounts::shadow_host_steps counts the host steps that ran for encoders' copies back spliced and merges on the host: against command_buffers_submitted, the GPU-to-CPU round trips a command buffer pays, for a walk to read before any deferral of them. Tests: - shadow_runs::merges_on_the_host_go_whole_up_to_the_bound_and_split_past_it: over pages 16 bytes into a page, a 512x512 BGRA8Unorm target (1 MiB of rows) compares every byte of its rows on the host, and a 512x513 one each row's first and last lines alone; each one host step. - shadow_write_lines: the contract test's draw merges now compare every byte of their rows; the cost test alternates its verdict arms round by round, so clock drift and order weigh on both alike (the 1080p gap 35898 showed, equal in Clear and Draw, with the same work recorded in both arms by every count); a new test prints, for a render target whose rows end a texel short of a 4096-byte page (1023x256 and 1023x1024 BGRA8Unorm), under the device's own check and default policy, over pages imported by pointer and as dma-bufs: every host-page class's renders and copies verdicts for those row ends and its memory flags, the form the texture takes with its notices, and the median per command buffer of a clear-and-store and of a draw. Degradation kinds added: none. Verified: msi m3-max-35933 at f763e15338 (same tree): CLIPPY=0, CLIPPY_GPU=0, API=0 (15/15), release archive built. PHOENIX, lavapipe and the Iris run follow on development. |
||
|
|
438fdd4eee |
RUNTIME 2438: Merge on the host only the lines beside a texture's texels
A shadow's merge in place into host pages, on a device whose stores write back the lines they end in (the Iris Xe under ANV) or whose check has not answered, went on the host whole: the host step compared and stored every byte of the merge's rows. On the Iris that cost 12.7 ms a merge for a 1920x1080 RGBA16Float draw (17.7 ms a command buffer against 3.7 ms by the GPU kernel), and the guest's scene has about 73 such shadows. The merge now splits as the splice of a copy back does: - Its kernel stores the changed words of each row's bytes in the lines that hold the texture's texels alone (ShadowMergeStores::Words, never whole blocks). - The host step merges only each row's bytes in the lines that also hold a byte of no row of the texture's: the bytes between the rows and around them (shadow_splice::beside_texels; at most a row's first and last line). - Before the kernel the GPU copies those pieces' kept bytes into a region of the command buffer's arena, then their changed bytes over them in the kept part, so the kernel finds them unchanged and stores none of them; the host step compares the region's bytes with the changed part's. - The host step compares 4-byte words and stores a changed word with one AtomicU32 store (the changed word where all four bytes differ, else the word as it holds it with those bytes changed, as the kernel's Words form does); bytes outside whole words go one by one. - A merge none of whose rows' lines holds such a byte (rows that start and end on lines, as the 1920x1080 plane's 15360-byte rows do) goes by its kernel alone, with its fetch view and kept image where it has them. A merge not cut to its texels' rows stays on the host whole. The measured contract is the padding: row_padding_writes found the M3 Max, the 5300M and the UHD 630 keeping CPU writes to the bytes between and around a texture's rows under clears, stores and draws, and over IOSurfaces under kernels. No probe measured a CPU write to a texel the commands left inside a line whose other bytes they changed, while the command buffer runs; the kernel now stores into such lines, so that write may be put back on the Iris. FAST-PATHS's known gaps record it, beside the measured contract. WorkCounts::shadow_merge_bytes_on_host counts the bytes the host steps compared. Buffer::own_pages_flags gives a buffer's memory type flags, which the cost test prints for a buffer made as the host scratch is, beside the host loop's time over plain heap memory and over that memory (1920x1080, half the texels' red and blue changed). Tests: - tests::shadow_splice (pure): the pieces equal the rows' bytes in lines beside the texels, found byte by byte, over 9 shapes and 6 page phases (wrapping among them); the host loop stores the differing bytes alone at every alignment. - tests::shadow_write_lines: each draw merge's host step compares 16 bytes a row (the row's last texels, in its padding's line); the cost test's 1920x1080 draw no longer merges on the host. - tests::shadow_runs: the rebind test of host merges puts its pages 16 bytes into a page, so every row's first and last lines hold bytes beside its texels, and asserts the bytes compared (a line a row). Degradation kinds added: none. Also (65db6f5b40): the old device-local query, left with no callers, is gone; the probe prints the scratch's memory flags by name. Verified (fplend): msi m3-max-35872 at a5289d8132 (same tree as 65db6f5b40): clippy 0, clippy --cfg m2v_gpu 0, api_signatures + api_surface 15/15, debug and release archives built; 35850: tests::shadow_splice 5/5 (host pieces against a byte-by-byte answer over 9 shapes x 6 page offsets; the CPU word loop at every alignment). PHOENIX, lavapipe, rustdoc and the Iris run follow. |
||
|
|
2feb4e70f1 |
RUNTIME 2437: Scheduler: hand a pass's submission handlers to the device's handler threads as it goes on
What: the scheduler thread's passes no longer run the submission handlers of the command
buffers they submit (or hold in a group, or make Scheduled behind a host step) at the end of
the pass. Each time the pass is about to look for its next batch, it hands the handlers taken
so far, as one segment with its Turns ticket, to the device's handler pool (one context of the
"metal2vulkan-handlers" threads, made at the first hand-off), and goes on submitting. The
segment runs there in its turn, so submission order holds across passes and with
commit_and_submit's own pass, which still runs its handlers inside the call on the committing
thread. A pass that settled a switch of storage forms keeps the handlers it took from then on
and runs them itself after the switch ended, as before, since the switch must end before those
command buffers are Scheduled.
The blocking wait in run_scheduled (a Finished that found Scheduled owed waited on a pool
thread for the submission handlers) is gone: such a Finished is posted behind a context gate
(finish_after_handlers), its place kept, holding no thread, and the thread that ran the
handlers opens the gate; the Finished then runs the owed Scheduled first. So no handler thread
waits for a submission handler, and the pool's cap cannot be exhausted by such waits.
A held group is cut short for another queue's submission handlers (Alone::Handlers) only where
the pass keeps them (a settled switch): handed-off handlers hold back no pass.
Why: in the guest-shaped submit-cost leg on PHOENIX, a command buffer's submission handlers
started 1683/5299/5776 us (p50/p99/max) after its own vkQueueSubmit returned, behind the rest
of the pass; 4561 of 5280 command buffers were seen complete before their own submission
handler ran, and seen -> seen handler was 1.4 ms p50 / 5 ms p99 against Metal's 0.28 ms p99.
Tests: submission_turns gains a_pass_s_submission_handlers_run_while_it_goes_on_{exact,grouped}
(a handler of an earlier submission starts before the pass's later submission returns plus the
pause) and completions_before_their_submission_handlers_hold_no_handler_thread_{exact,grouped}
(6 queues with owed Scheduled on a pool of 2 threads, all complete within a bound; test hook
contexts::TEST_LIMIT). waiter_submits::Held now holds the scheduler thread with a test hook
after the pass that handed off its command buffer's handler (trace::hold_after_hand_off,
Point::HandedOff), since a submission handler no longer runs there. Tests and lanes that held
the scheduler thread in a submission handler hold it in a submission check instead
(unsubmitted, host_memory's deallocator lane); queue_order's take-up probe notes from the
check, which still runs on the scheduler thread; commit_and_submit's held-check test asserts
the orders that hold (A's handler before B's, B's check before B's handler) instead of one
interleaving; the submission_handlers lane expects the handler threads; grouped_submissions'
cross-queue handler lane counts X and Y's one submission once all completed.
Docs: add_submission_handler names the threads (inside commit_and_submit: the committing
thread; otherwise the device's handler threads), README, RUNTIME-PORTING, FAST-PATHS (the
grouped-completion row's handler rule, the commit cost entry), scheduler, inbox, group,
submit, contexts.
Also: the completion_latency guest-shaped leg times each submission handler from its own
submission's return; the unsubmitted check and the deallocator lane hold the scheduler thread
where an empty opener runs no submission check.
Verified (complat): msi m3-max-35809 at 0e0c55e4e8: build, clippy -D warnings (runtime, plain and
--cfg m2v_gpu), unit 44/44, signatures, lavapipe suites 122/122, all 0; gem10 35797 at 4aa9c2ac29:
workspace clippy x3 and rustdoc 0. Negative controls (msi 35811, lavapipe): with the blocking wait
back, completions_before_their_submission_handlers_hold_no_handler_thread fails under Exact and
Grouped (5 of 6 never completed with 2 handler threads); with no hand-off,
a_pass_s_submission_handlers_run_while_it_goes_on fails under both. PHOENIX suites and the
submit-cost leg before/after follow.
|
||
|
|
be720853a5 |
Name no consumer benchmark in comments, tests or docs
Eight comments and docs (dispatch_chain, compute_instantiated, spares_compute, unshared_hold and its tests, FAST-PATHS) named the guest compute benchmark a workload came from, and two named a consumer's job labels. AGENTS.md keeps consumer apps and benchmarks out of the tree; the shapes and numbers stay, described by what they are (a guest compute benchmark's super-resolution workload, its fluid simulation). Verified: git grep finds no such name; cargo fmt. Comments and docs only. |
||
|
|
518d6d8443 |
RUNTIME 2432: Shadows: merge on the host over host pages on devices that write lines back
What: a shadow's merge in place into a no-copy buffer's host pages, on a device whose check of those pages failed, or has not answered, the copies or the shader writes of texels whose rows end inside a line (the same rule as the copy back's splice), now goes on the host. Its keep and the copy of the texels the commands left go into two parts of a Shared scratch (ScratchKind::ShadowHost; the fetch view is not used, so the changed texels are always copied). The encoder records only that copy, and a host step of a batch of its own (Deferred::ShadowSplice, now carrying HostWrite::Splice or ::Merge) compares the parts eight bytes at a time and stores each byte that differs into the pages with atomic byte stores. Such a texture joins no run of passes (render.rs), so each pass merges as its encoder ends. Devices where both checks passed keep the kernel merge. Why: the Iris probe (m3-max-35510) showed the merge kernel's stores losing CPU writes to padding bytes in the line that holds each row's last texels, as the copy back did. A CPU store changes only the bytes it stores, so the bytes the commands left, and every byte the CPU writes meanwhile, stay. Metal keeps those bytes (conformance probe row_padding_writes.m). Where the merge stays on the GPU (FAST-PATHS known gaps): merges recorded between a pass's instances, before a tile dispatch, into a held command buffer, at a segment's end, merges through a copy, and the runtime's own Shared memory. New WorkCounts fields: shadow_merges_on_host, shadow_merge_host_nanos. Tests: shadow_write_lines now asserts the Draw rounds (keep + merge) put back no byte and go on the host under unanswered verdicts, and follow the measured verdicts in the second test. A new test, costs_of_a_write_back_spliced_or_not, prints the median command-buffer time of a copy back and a merge for 34x34 and 1920x1080 RGBA16Float, with verdicts unanswered and passed. Degradation kinds added: none. Verified (fplend): msi m3-max-35675 at bdb1e2cbae clippy (runtime, all targets/features, -D warnings) 0, touched unit tests 3/3, api_signatures + fast_paths 34/34; msi 35689 clippy --cfg m2v_gpu 0. PHOENIX suites (35711), lavapipe, rustdoc and the Iris cost run follow. |
||
|
|
9ea0a9c1f6 |
RUNTIME 2431: Shadows: splice a copy back into host pages on devices that write lines back
What: a shadow's copy back (Step::Back) of a 2D texture's image, or of a texture buffer's staging buffer, into a no-copy buffer's host pages is spliced where the device's check of those pages (DmaBuf or Pointer) failed, or has not answered, the copies or shader writes of texels whose rows end inside a line (Access::Copies or Access::Writes of RowEnds::InLines, Failed or Pending). The GPU copies only the columns that fill whole lines of memory (nonCoherentAtomSize): one region a slice where its rows are a multiple of a line apart, else one a row. Each row's head and tail columns go by the GPU into a line-aligned region of the command buffer's arena, and a host step of a batch of its own (Deferred::ShadowSplice, after the work before it completed) copies them into the pages a byte at a time, as the CPU's stores go. The encoder notes the truth's writes after the step. A copy whose texels fill whole lines alone copies back as before; a device where both verdicts passed copies back as before. New count WorkCounts::shadow_copies_back_spliced. Why: on the Iris Xe (ANV) a copy of texels into a buffer's rows writes back the 64-byte line holding each row's last texels whole, putting back older values over the CPU's writes beside them. The lane's probe (m3-max-35510) lost 3,539 to 14,319 bytes a kind in 300 command buffers through a shadow's copy back and merge, where Metal keeps every such byte (row_padding_writes.m). This breaks Metal's contract on the guest's bytes; the merge is the next change. Where the copy stays (docs/FAST-PATHS.md, known gaps): a copy back between a render pass's instances or before its tile dispatch, into a held pass's command buffer, at a segment's end recorded at a commit or a host step, of rotated, two-plane, tiled or heap depth/stencil textures, and into the runtime's own memory. Tests: tests::shadow_splice (the cut run as GPU and CPU over a map of host bytes: every texel once, no GPU byte in a shared line, every shape of texel, width, pitch and phase); tests::shadow_write_lines (the probe made a device test: the guest's 34x34 RGBA16Float target over dma-buf pages, buffer and plane forms, a clear's copies back put back no byte the CPU wrote beside them and are spliced; and a copy back spliced exactly as the device's measured verdicts say). Degradation kinds added: none. Verified (fplend): msi m3-max-35614 clippy 0, tests 0, signatures 0; 35623 clippy m2v_gpu 0; lavapipe 35625 clippy m2v_cpu_icd 0, 216 passed, rustdoc 0; PHOENIX 35632 (um790) in-place + shadow suites 287/287, shadow_write_lines 2/2: under the measured verdicts (Copies and Writes Passed) 0 spliced; under HostPageTexturePolicy::Shadow (no check, verdicts Pending) every copy back splices (+300 in 300 rounds, 0 bytes put back). The Iris run follows. |
||
|
|
8b70cf1ca7 |
FAST-PATHS: what listing a render target's sibling formats costs its compression
The view bullet now states the measured cost of cdcd787fb8's listing of
a render target's channel-order sibling formats (BGRA8Unorm and
BGRA8Unorm_sRGB of an RGBA8Unorm texture) in its image's format list,
which lets a pass render into such a view of the image in place.
Measured with tests::reordered_list_compression (ignored probe, carried
archive of
|
||
|
|
b034129644 |
RUNTIME 2426: Grouped: count each batch that went alone by why, and unshared queues' batches
Under CompletionPolicy::Grouped a batch refused a place in a group while no group
was held went alone and was counted nowhere: group_ends_* count only groups that
held a batch. So the consumer's steady Launchpad walks (batches_grouped 0,
group_ends_drained 1 a window) could not say why nothing grouped.
Each batch on a VkQueue whose batches group that goes in a kernel submission of
its own now counts once, by the first reason in group::Alone's order
(WorkCounts::batches_alone_* and batches_held_alone_*): an unshared queue's
batch, a binary wait or signal (a completion sync file), a sparse update, pieced
work, a fence, an unknown or too long expected run, first work or a wrapped image
with no group held, a committing thread's submission; or, held in a group that
went holding it alone, what sent that group (at most one earlier submission in
flight, an unshared queue's hold on the VkQueue, a head waiting for the GPU,
another queue's handlers, a waiter, kept with none joining, a batch that could
not join, or other). Group::keeps answers why it does not keep. And
batches_of_unshared_queues counts unshared queues' batches on every device, so a
walk under either policy gives their share.
The validation lane's alone_batches checks one batch per reason it can make
deterministic (unknown run, at commit, one pending, a completion sync file, an
unshared queue, beside an unshared queue) on a device that groups, and none
counted elsewhere; steady_presents (ignored, a measurement) runs a steady
present shape with an unshared compositor queue and prints the spread.
Conformance classes the counts that follow what the host had seen complete as
not the case's own. API signatures blessed.
Also 4d71df7f28 (a type alias for clippy) and 5e04b74b48: FAST-PATHS: grouped submissions' measured lateness, the unshared exclusions and the alone counts
Row 38 edited in place, docs only. It now states:
- the measured cost of the fast form in the consumer's guest walks on RADV at
|
||
|
|
c053f814b1 |
RUNTIME 2418: The in-import dma-buf class takes the dma-buf class's copies verdicts
The check's DmaBufInImport class makes its pages exactly as DmaBuf's
(dma_buf_pages, plus the gate that its buffer lies in one import dedicated
to nothing), and a copies round puts no image over the pages: its copies
rounds repeat DmaBuf's over pages made alike. At its copies turn it now
takes DmaBuf's copies verdicts for both row ends, and runs no rounds of its
own, where DmaBuf's were measured this run or known before (passed or
failed) and both classes' noted memory flags are known and equal, the
same-memory-type rule of RUNTIME 2417's crossing; otherwise its own rounds
run as before. The note names the source verdicts and the flags
("DmaBufInImport copies: DmaBuf's verdicts, Failed and Passed for rows on
lines, its pages made as DmaBuf's in memory of property flags 0x..: no
rounds of its own"). A shared failure is a proof for pages made alike; a
shared pass is one draw of the rounds' race fewer, which errs to the shadow.
CHECK_VERSION 22: a record of 21 may hold the in-import class's own copies.
Tests: tests::in_place's unit test of shared_copies (shared where measured
and memory alike; the control: coherent against cached either way, either
memory unknown, a row end unchecked or pending, every other class: none);
tests::in_place_check's device count (the shared note once and no rounds of
its own where the rule holds, the dma-buf class's verdicts taken; printed
with both classes' memory and the check's wall time).
Also 00ba762437 (test only): the lent targets' test prints every host class's memory on a device made
with VK_EXT_external_memory_host too (LENT-TARGETS-POINTER lines).
Verified in the lane (m3-max-34930, msi, at 937274ec72): runtime clippy --all-targets --all-features
-D warnings plain, m2v_cpu_icd and m2v_gpu exit 0; touched tests 39/39; gpucfg archive built.
On the Iris Xe (RPL-P, m3-max-34910 at 00ba762437): lent_dma_buf_targets passed; Pointer, Fresh,
DmaBuf and DmaBufInImport check pages all lie in memory of flags 0xf. Still to run: the PHOENIX
check wall time base against tip, and the Iris count test with the in-place suite.
New Degradation kinds: none. CHECK_VERSION 21 -> 22: every device runs one fresh in-place check.
|
||
|
|
b63bfbfac7 |
RUNTIME 2417: A render target's lend takes copies' failures through memory of one type
On the Iris Xe walk, a game engine's renderer made 73 RGBA16Float render targets with free rows' padding over a no-copy buffer's dma-buf pages, and each was a shadow: their renders failed for rows that end inside a line, and the dma-buf classes' copies' verdict they lend that padding by (`in_place::lent_to_copies`) was not failed in the recorded check, while fresh checks fail it. A class's rounds catch a copy's line write-back only as often as the CPU's writes race it, so the verdict hangs on a race. The lend's copies verdict (`in_place::copies_verdict`, through `InPlaceChecks::decided` at every decision site) now takes another host class's copies failure, its reads passed, where the class's own kept every byte or was unchecked, but only where the check's pages of both lay in memory of a type of the same VkMemoryPropertyFlags as the driver reports them: a write-back measured through memory of other flags says nothing of this memory. Each class's memory flags are noted by the check and kept in its record (CHECK_VERSION 21, eight words more). A shadow that renders with free padding over host pages names the copies verdict it took in its shadowed-texture notice. The line-write-back reason and docs (FAST-PATHS host-pages row and the Iris known gap, API.md section 1 and the catalogue, the kind's rustdoc) say so. Tests: the unit test of the rule on the exact shape (same memory in place, coherent against cached apart in both directions a shadow, unknown memory, reads not passed, own-memory classes, own failed or pending kept, the record's memory words); and a device test over a no-copy dma-buf buffer (tests::lent_dma_buf_targets) whose control notes the pointer class in memory of other flags and keeps the shadow. Also 6e1f7b369d: the lend's memory flags are compared and printed as raw bits (ash's MemoryPropertyFlags has no Debug impl here; clippy's chunks_exact_to_as_chunks). Verified in the lane (m3-max-34875, msi, at 6e1f7b369d): runtime clippy --all-targets --all-features -D warnings plain and --cfg m2v_cpu_icd exit 0; tests::in_place, tests::degradation*, tests::texture_placement 38/38. Still to run: the device test on the Iris, PHOENIX and lavapipe in-place suites, a sabotaged-build negative control, clippy m2v_gpu, rustdoc. New Degradation kinds: none. CHECK_VERSION 20 -> 21: every device runs one fresh in-place check. |
||
|
|
8d617591f8 |
RUNTIME 2409: In-place textures over dma-buf pages: the image bound in the buffer's own import
A texture in place over a no-copy buffer's dma-buf pages no longer always asks the pages' source for a new dma-buf and a dedicated import of its own. Where the pages lie in one import dedicated to nothing (no sparse buffer over several imports, no import the driver made dedicated to the buffer), its DRM_FORMAT_MOD_LINEAR image whose plane lies at offset 0 at the texels' pitches is bound in that import at the texels' offset, beside the buffer (vkBindImageMemory's memoryOffset): no udmabuf, no import, no new GPU mapping. Every fact is asked of the driver: the image requires no dedicated allocation (VUID-vkBindImageMemory- image-01445), the format query takes dma-bufs for it outside one (not DEDICATED_ONLY), its alignment divides the offset (-None-10735), its size fits the pages' placement (-None-10737) and its memory types take the import's. An import dedicated to the buffer binds no image (-memory-10926): DmaBufPages now notes that. A new check class, PagesClass::DmaBufInImport (CHECK_VERSION 20), measures that image; the check's textures of each dma-buf class take that class's image alone (a thread-local of the class the check runs). texture/route.rs takes the new class where its verdicts take the texture, else DmaBuf's; a shadow waits on DmaBuf's verdict while both pend. Where the making refuses the image in the import, it falls back to today's image where DmaBuf's verdicts take it. A pending move re-routes the same way. Binding in the import reads it apart: it is kept imported for good, as an image in a pointer import's is. A rebind remakes such an image in the new pages' import by the same order. RADV requires a dedicated allocation of every such image, so its check leaves the new class unchecked and it never takes the route. New WorkCounts field: dma_buf_images_in_import. No new Degradation kind. The route-(b) device tests (parked images, plane offset, import cycles, a texture's residency) fail the new class's verdicts first, so they keep measuring today's image on any device. A new device test (tests/dma_buf_in_import.rs) counts the route and its negative control. Also: 4c3cbe2f1d and 37d2a750ce (the probe, dma_buf_linear_bind: a linear and a modifier image for dma-bufs bound in the pages' existing import, the dedicated answers, a re-import arm), 5a40c2ef7b (docs: API.md, HOWTO.md, FAST-PATHS.md, host_residency.rs module docs). Why: the owner asked how to remove the per-texture dma-buf. Probe answers (Mesa 26.2.6): RADV on the Radeon 780M refuses LINEAR images for dma-bufs (NOT_SUPPORTED x15) and requires a dedicated allocation of every DRM_FORMAT_MOD_LINEAR image (m3-max-34443), so there it never fires. ANV on the Iris Xe takes both images outside a dedicated allocation, bound in the existing import byte-exact; first use of an 84 MiB texture 1.37 -> 0.21 ms (m3-max-34453). Verified in the lane (m3-max-34571, gem10, at 5d5dee7901): clippy -D warnings -p metal2vulkan-runtime --all-targets --all-features, plain and m2v_cpu_icd. Still running when landed: the lavapipe in-place and dma-buf suites with the new count test (m3-max-34593), clippy m2v_gpu, PHOENIX, and the Iris count test with its negative control. API: adds the field WorkCounts::dma_buf_images_in_import (additive; api_signatures blessed in the lane). |
||
|
|
873c255ded |
RUNTIME 2407: Grouping bound: a queue's expected run follows its command buffers' own GPU times
What: the group bound (GROUP_RUN, 16 ms) reads a per-command-queue estimate of its own
(QueueGen::group_run), with the same rule as before: raised at once by a longer run, halved
toward a shorter one. It is fed at each command buffer's completion in place_gpu_times:
- from its GPU duration by its timestamps, the value the long-queue mark already reads;
- where the device answers GPU times from the host, from those placed host times.
Device::flies goes back to the Flight for a VkQueue an unshared queue holds only, so the unshared
hold's Expected and its feed are as they were before 37b1ca8563.
Why: 37b1ca8563 fed the bound from the host's view of each batch's run as its VkQueue's oldest.
That view holds other VkDevices' work on the GPU and the host's latency. Under nextest's parallel
suite on the Radeon 780M (m3-max-34541, at bf0ca5902a), the warm fills' commit-to-completion
times read 0.6 to 825 ms. Queues read past 16 ms, grouping stopped, and five grouping tests
failed. The hazard the bound guards is our own kernel job's length. A command buffer's two
timestamps bracket its own work, and other clients' work does not lengthen them.
Docs: group.rs and the grouping FAST-PATHS row say where the estimate comes from. With
gpu_times_from_host it follows host times, which hold other clients' work too, so under contention
there a queue's batches may stop grouping.
Test: scheduler_held_wakes::a_late_completion_of_short_gpu_work_leaves_its_queue_grouping. A warmed
queue's fill has its completion held unpublished 40 ms (Point::Publish) while its GPU work is
short by its timestamps, then the queue's next group must be kept. Under the host-view estimate
that run reads 40 ms and no batch of the queue would join a group.
Fix forward for RUNTIME 2405 (
|
||
|
|
2a13f503ce |
FAST-PATHS: the grouping row measures its run bound on the Radeon 780M
frame_costs_over_imports, release with --cfg m2v_gpu, before (
|
||
|
|
5021e3b4ac |
RUNTIME 2405: Grouped submissions: a group's summed expected GPU run stays within 16 ms
What: a batch joins a held group only where its queue's expected run is known and keeps the group's expected runs, summed, within GROUP_RUN (16 ms). Otherwise the group goes first (GroupEnd::Long, WorkCounts::group_ends_long), and the batch leads the next group where its own run is known and within the bound, else goes alone. The expected run is unshared_hold::Expected, which was fed only on a VkQueue an unshared queue holds. It is now fed on every VkQueue whose batches group: Device::flies enters each batch there in the Flight. The hold's decisions still read the Flight only where other queues' batches are held back. Why: the driver runs a group as one kernel job, and Linux's amdgpu ends a job past its 2 s default timeout with no error the device reports. On a Radeon 780M a single 3.2 s command buffer was ended and the one behind it dropped. Four batches that each finish alone could cross the timeout merged. With the bound, merging adds at most 16 ms of the others' expected work to any job. 16 ms is the owner's line for an intolerable wait, and it also caps how late grouping makes a member's completion seen (the FAST-PATHS row said about 20 ms behind a 20 ms batch). A queue none of whose batches was seen complete has no expected run, so its batches go ungrouped until one completes. Tests: - tests::group_run: the admission rule (unknown, alone, a full group of quarters, 12 + 5 ms, overflow). - runtime_lane::grouped_submissions::a_queue_s_batches_group_within_their_run: on a grouping device with one VkQueue, behind running work on another queue, a fresh queue's batches group none, a warmed one's group, and none after a 40 ms command buffer of its own. - The grouped lane scenarios, and submit_check_device's paths test, warm each grouping queue with one completed fill first. The behind-running-work tests measure the fills' rate on a queue of its own, so the B queue's expected run stays its first fill's. - Every place that sums the group ends counts the new end, and frame_costs prints it. Docs: group.rs and unshared_hold.rs module docs, the grouping FAST-PATHS row (its bound and its cost line), and WorkCounts::group_ends_long. Verified in the lane (m3-max-34508, tip 37b1ca8563): clippy -D warnings with m2v_cpu_icd, runtime and validation, all targets and features. Still running when landed: lavapipe tests (group_run, the grouped lane, unshared_hold, submit_check_device, kernel_end_device, commit_and_submit, queue_share_device, frame_costs), clippy plain and m2v_gpu, rustdoc, and the 780M before/after. Expected, unverified: conformance cost records' grouping counts (not the cases' own, never gated) may drop in cases that commit on fresh queues. API: adds the field WorkCounts::group_ends_long (additive; api_signatures blessed at landing). |
||
|
|
1acb205fb0 |
RUNTIME 2403: Runtime: a command buffer whose timestamps read unavailable after its queue passed it fails as Metal's victim
What: in complete_seen, a command buffer that would complete with no error, but whose own timestamps read unavailable (Stamped::Read(None)) once its queue's timeline passed its last batch, now fails with GpuRecoveryVictim. Its GPU times read 0, the new WorkCounts::unrun_command_buffers counts it, and nothing counts against its queue. Its host-page logs hear of it as of a failed command buffer. Why: Linux's amdgpu ends a job past its timeout (2 s by default) with no error RADV reports. On a Radeon 780M (Mesa 26.2.6, Linux 7.3.3) a 3.2 s fill was ended, and the command buffer queued behind it on the same queue never ran, yet both completed with no error. Read-only from Mesa 26.2.6: - radv_device_check_status checks only OpAbortKHR; - syncobj waits pass no fence error; - VK_KHR_device_fault reports only GPUVM faults and shader aborts (radv_device.c:2145). The timestamps are the documented signal. A signal's first scope holds "all commands that occur earlier in submission order" (Semaphore Signaling), and "a query is made available by the operation of ... vkCmdWriteTimestamp" (Queries). So a query read unavailable after the signal was never written. The completion turn already reads both queries with availability: the check adds no Vulkan call, one comparison. Docs: gpu_time.rs, the GpuRecoveryVictim and WorkCounts docs, the runtime README's lost-device section, and two FAST-PATHS known gaps: - work a driver drops is found only where the command buffer writes timestamps (not with host GPU times, MoltenVK on Apple's GPUs, a family of no timestamp bits, no free slot, or an adopted device); - amdgpu's 2 s default job timeout fails a single command buffer that Metal's longer watchdog runs. Test: tests/dropped_work.rs injects the unavailable read (completion::trace::unstamp_of), with no GPU hang. A command buffer whose stamps read as written completes and counts 0. The injected one fails as GpuRecoveryVictim with GPU times 0 and counts 1. The queue's next command buffer completes and its fill lands. Verified in the lane (m3-max-34463): clippy plain, m2v_cpu_icd and m2v_gpu and rustdoc of the runtime; lavapipe 35/35 incl. tests::dropped_work (injected unavailable stamps fail the command buffer as GpuRecoveryVictim; the queue's next command buffer completes), gpu_time, device_recovery, completion and stall. API: adds the field WorkCounts::unrun_command_buffers (additive; api_signatures blessed at landing). |
||
|
|
4a06ce915d |
SEMANTICS 2129, RUNTIME 2399: Heap storage reads by the formats' own read bits on a device without the feature
A compute pipeline that reads a read_write argument-buffer texture was refused
Unsupported{ArgumentBufferTextures, needs ShaderStorageImageReadWithoutFormat}
on a device without shaderStorageImageReadWithoutFormat (ANV on Gfx12.0, the
Iris Xe), so the guest's work waited on a nil pipeline. Vulkan 1.3 and
VK_KHR_format_feature_flags2 enable the SPIR-V capability
StorageImageReadWithoutFormat, and a read of a view without a format is then
valid wherever the view's format has STORAGE_READ_WITHOUT_FORMAT_BIT (spec
19.9.3, VUID-vkCmdDispatch-OpTypeImage-07028). The slot path already took
that route; the heap path checked the feature alone.
- declare_heap takes a storage (and storage texel buffer) read by the
feature or by the formats' bits (DeviceProfile::storage_reads_by_format_bits),
and on such a profile needs the read bit of the class's neutral, which a
null handle reads.
- The binder keeps each storage view as before (writes unchanged). On such a
profile, a member whose view's format lacks the read bit is held for its
writes and flagged (new entry flag FLAG_STORAGE_UNREADABLE, bit 28: the
texel-class field narrows to the 12 bits its indices use), and a storage
read through its handle reads the null element, as a nil texture's read
does. A member of one of Metal's read-write tier formats, whose read
Metal's contract defines, is refused without the bit instead.
- handle_entry_flags takes the profile (the flag is the device's).
On the committed Iris profile every Metal read-write tier format has the
read bit; RGB10A2, BGR10A2, RG11B10Float, BGRA8 and the 16-bit packed
formats do not (Mesa's isl: no Gfx12.0 typed reads).
A read-write tier format whose view lacks the bit is not refused at the member (binding runs for
every shader-writable texture of the runtime's device-wide heap, so a refusal there dropped the
texture's writes on a profile such as roadmap-2022, job m3-max-34236): lower::texture::slot::
declare_heap refuses the function that reads a heap storage class where any tier format would be
held in that class through a view without the bit, naming each view's bit; the member is held for
its writes, flagged. Docs: API.md accepted difference, FAST-PATHS known gap and device-gap row,
REFUSALS.md.
Verified in the lane (m3-max-34272): clippy -D warnings for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation, all targets and features; nextest over the heap, handle, storage, profile,
fast_paths, without_format, texel_class and tier tests plus api_signatures, refusal_surface and
api_surface: 317 passed. A synthetic Iris profile with RGBA16F's read bit cleared refuses the
reading kernel naming that format; the committed Iris compiles it. The lavapipe lane with the
feature withheld and the Iris run follow from the lane.
|
||
|
|
d3b1dbdbe0 |
SEMANTICS 2128, RUNTIME 2398: Buffer views read at their bind offset where a pushed word lengthens every thread's payload
On ANV (Mesa 26.2.6) on the Iris Xe RPL-P, a compute function that reads a client push word gets a longer per-thread payload (the base workgroup id moves 17 registers further), and a light kernel runs about 2.2 times as long: 120.2 us against 55.7 us a dispatch on the same module with the push read removed (raw Vulkan chains, jobs m3-max-34063 and m3-max-34038). The 780M (RADV) shows no such gap (m3-max-34031). The runtime's storage views read their SlotBindOffset residual on every access, so every kernel paid it there. A measured DriverWorkaround row, PushReadsLengthenThreadPayload, on that driver and GPU: - the translator declares SpecKey::RangeAtBindOffset for storage views too on that profile (access plan's storage_at_bind; the pulled vertex fetch of a shared slot folds its residual under the same key), so a key at 1 reads no push word once the driver folds it; - the binder sets a storage view's key only at bind offset 0, where the runtime tells offset 0 apart at the slot (StageTable::zero_offset_views, class ZERO_OFFSET_CLASS), and only where instantiation's range starts there (starts_at_bind), so the bytes before a bind offset stay reachable through the range from the buffer's start at every other offset; - the runtime keeps the zero-offset slots beside the uniform ones (AtBindViews), leaving out a slot once it is bound at another offset, and reads views at their bind offsets on that profile (reads_views_at_bind), the uniform views' existing form included. Every other profile declares no new key and its modules are unchanged; its stage tables leave zero_offset_views 0, so its shapes and plans are as before. Also a FAST-PATHS known gap: on the Iris Xe, kernels over exportable or host-pointer-imported memory run about 2.2x (125.53 and 122.95 us against 55.73, m3-max-33760), cause unobserved; zero copy stays. Tests: engine_access (a storage view's module at key 1 reads no SlotBindOffset, at key 0 it does, answers on the interpreter; no key on the other profiles), the binder's offset-0 rule and class, the committed profiles' form choice, and a runtime device test of a storage view at offset 0 and past it. Verified in the lane: touched tests in msi jobs 34174/34198 (engine_access, bind::, fast_paths, api_signatures, the runtime pipeline and argument_table tests); lavapipe m2v_cpu_icd 21/21 (34190: uniform_bind_offsets and the new storage test, answers at offset 0, past it and at 0 again); clippy plain 0 (34198), m2v_cpu_icd and m2v_gpu 0 (34200); rustdoc 0 (34213). golden_hashes reads stale only for intel-irisxe-rplp-anv (re-keyed: 1788 cells, fingerprint 6d95bb254f9f9d66 -> 2f820bef4bfb9669); no cell under an unchanged key moved. The table is re-blessed on development. |
||
|
|
7049627f79 |
RUNTIME 2395: Managed no-copy buffers: the caller's promise of zero bytes is zeroed on the device, not copied in
What: `HostMemory::with_zero_from(offset)`, a runtime extension with no Metal counterpart. The caller promises that a no-copy buffer's bytes from `offset` to its length read zero when it is made (a buffer its program made with no bytes, or with fewer than its length). A `Managed` one on a device without unified memory then makes its GPU copy's bytes from `offset` to the length as zeros the device writes in its own memory (one word-aligned vkCmdFillBuffer registered before the making's copies in, `Buffer::zero_device_copy_first`). Only the bytes before the offset, and the rest of the last page past the length, are copied in from the pages, so no import is held for the zeros. New counters: `WorkCounts::managed_device_copies_zeroed`, `managed_bytes_zeroed`. Nothing else takes the promise: a buffer that lies in its pages, a copied host buffer's first read, heaps, rebinds, recoveries (the pages' `made_of` parts keep no promise), `did_modify_range` and `synchronize_resource` behave as before. Why: on a discrete GPU behind a 4.8 GB/s link, a compute workload's 131 ms GPU job was the making copy of six new `Managed` buffers (631 MB across the bus, 12 MB of it named by `did_modify_range`), and a 72 ms kernel wait for the imports preceded it. A guest's buffer made with no bytes holds zero pages, which the consumer knows and the runtime cannot. How verified: tests::managed_copy_device's zero-promise legs (through an import and over pages no import maps): no promise, and a promise at the length, copy the pages in whole (negative control); a promise from byte 0 over zero pages copies in and stages nothing, counts one zeroed device copy of the buffer's bytes, reads zero, and a later did_modify_range copies in as ever; a promise from an offset inside a word over pages that hold other bytes copies in exactly the bytes before it and reads zero from it, which only the device's fill can have written. A buffer in its pages reads them under the promise. The device runs are in the lane's jobs (lavapipe, which has unified memory, runs only the in-place leg; the XTX runs the two-copy legs). |
||
|
|
18b14cca39 |
line_beside: a write beside a plane over Private memory keeps its bytes under the plane's writes
On the Iris Xe (ANV), whose GPU writes back the whole 64-byte line its writes end in, a plane's texture at 0x20 of a Private buffer is in place for RenderTarget and ShaderWrite while another GPU command may write the bytes beside it in the plane's first and last lines. A device test (tests::line_beside, under the GPU cfgs) puts two commands with no dependency between them in one command buffer: a render pass's clear and store, or a kernel's writes, of an R8Unorm plane at 0x20 (a buffer laid by aligned_byte and a plain one; tight rows of 1920 and padded rows of 1000 at 1024; tracked and untracked), and a blit copy or kernel stores into bytes 0x0-0x1f and the bytes after the plane's last texel to the end of its line; it reads the buffer back. A control leaves the second command out and must count every one of its bytes lost. docs/FAST-PATHS.md's Iris known gap now says the line write-back holds over the runtime's own memory as over host pages (the check's Pooled, ExportedFd and ExportedDmaBuf classes fail renders for rows that end inside a line, m3-max-33545), and that another GPU command's bytes in the line are kept. Verified: Iris m3-max-33919 (ANV, Mesa 26.2.6): 0 bytes lost in all 32 cases x 3 rounds, the controls counting exactly the left-out bytes ([32, 64], [32, 32], [32, 24], [32, 56]), 0 wrong; lavapipe m3-max-33912 the same; clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings under --cfg m2v_gpu (33920), --cfg m2v_cpu_icd (33921) and plain (33926). The doc commit had cargo fmt only; tests::fast_paths runs on development. |
||
|
|
94f9436cd8 |
partial_threadgroups: the heavy kernel is 10,000 steps, asserted large by the runtime's measure
On ANV (Mesa 26.2.6, the Iris Xe of RPL-P) the heavy kernel's 40,000-step chain took the driver about 52 s to make with 8 values live (Iris job m3-max-33783: the first ragged grid done at 53.76 s, one VkPipeline) and more than 120 s with the test's 400, and the test makes seven pipelines of it, so it ran for minutes there. Its compiler took about 3.2 MB of stack for that chain (3,216,936 bytes measured), about 80 bytes for each value; the runtime now makes every driver compile on a stack with that room (RUNTIME 2392), so the chain's length no longer stands in for the stack guard, which tests::small_stack_device and the relay's and the pool's unit tests cover. STEPS is now 10,000, and the test asserts the premise that keeps it heavy by the product's own measure: each state it makes is large (`ComputePipelineState::whole_on_partial`, the module at `compile_memory::COUNTED_WORDS` SPIR-V words or more), so a smaller chain cannot pass the test vacuously. LARGE_STEPS (8,000, window 8) already meets that measure, so 10,000 holds it with room. docs/FAST-PATHS.md records the driver's time and stack as a device gap, with what the runtime does about the stack: the pool's threads start with 8 MiB, and a call asked for on a thread with less than 4 MiB of stack left is made on a thread of the runtime's started with 8 MiB. Verified: an msi job's clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and the ledger tests, and an Iris job running tests::partial_threadgroups (the heavy test prints its ANV times) and tests::small_stack_device from this commit's archive. Verified at a96a3ef68d: m3-max-33936 (msi) clippy -D warnings for metal2vulkan-runtime (all targets, all features) plain, --cfg m2v_cpu_icd and --cfg m2v_gpu; metal2vulkan tests::fast_paths 34/34. Running at landing: the heavy test and small_stack_device on the Iris (m3-max-33948). |
||
|
|
209f11b467 |
RUNTIME 2383: rate maps: the GPU routes a fanning pass's own draws (step 1)
- Rate maps: the GPU routes the encoder's own draws of a fanning pass - rate-map GPU routes: the rebound recording takes no route; the routed-draw count through the device's counters - rate_mapped_pieces_encoder: the small triangles' commands drawn as the encoder's own draws - Rate maps: the GPU routes' docs, the depth test's flagged draw between fanned ones - rate_mapped_pieces_encoder: the draws the GPU routed, fanned out and drew through the region-copy variant - CountDraws: the indirect-count draw's recording is record_draw - rate_mapped_depth_equal: the GPU routes the encoder's draws as the host step's probe decides them In a rate-mapped pass that fans out (RateMapPolicy FanOut, the default), the encoder's own draws were routed by the host step only for executions; the GPU now routes them: a counts kernel (bind/fan_out/route_counts.rs, built through the translator's public API) reads each draw's lead instance probe and writes indirect counts, so each draw either fans out per region or draws through the region-copy variant, as the host step's probe decides for the same draws. Its kernel is made at first use; a cold frame, whose variants are still being made, falls back to the region-copy route alone. Exact (RateMapPolicy::Exact) routes nothing on the GPU. WorkCounts gains rate_map_gpu_routed_draws, rate_map_gpu_fanned_draws and rate_map_gpu_copied_draws (for the lanes; blessed in api_signatures.tsv). FAST-PATHS rate-map row updated. No new Degradation kind. Verified: msi m3-max-33521 at the lane tip 4ee726aa13: clippy (translator, runtime, validation; all targets, all features) 0; translator route_counts, fan_out, api_surface, api_signatures, fast_paths 62/62; runtime fan_out, every_command_the_runtime_records_is_routed, work_counts, upload, owned_kernel 10/10; lavapipe rate_map device tests 24/24. rate_mapped_depth_equal (each pass two ground halves with a w-crossing triangle between): 0 red pixels in every leg under Exact and FanOut; the warm FanOut encoder frame routed 6/6 draws on the GPU (2 fanned, 4 region-copy), the same as the host step decides for them executed. Pending: clippy m2v_gpu/m2v_cpu_icd, rustdoc, the Iris A/B. |
||
|
|
d62e1d2bd9 |
RUNTIME 2382: a heap's decoded-format texture on a shadow route keeps a decoded twin
Under DevicePolicy::exact_answers (HeapAnswerPolicy::Metal) a heap's PVRTC or ETC2 texture on RADV PHOENIX misses Metal's answer (its BC1 carrier image takes 4096 B @ 4096, Metal answers 128 @ 128 or 2048 @ 128), so it lies in memory of its own as a shadow of the heap's bytes (MemoryShadow; Shadow or Tiled where those serve). heap_texture_at gave a decoded twin only to the Direct, HostTransfer, Linear and Hidden routes, so its sampled view fell to the carrier, which has no sampled usage, and every kernel read and sample was refused, Unsupported(Format) (8 of 8 cases in m3-max-33467), where Metal samples it and the device can decode it. A heap's PVRTC, ETC2 or EAC texture on a shadow route (not over the caller's host pages, not detached) now gets its decoded twin. ShadowCopy::record_gated records the shadow's decode (ShadowCopies::decode) after a copy in that moved texels, and only then (record_moves answers whether it moved any); the pass is set at making (Image::decode_after_copies_in) and its kernel is made in ShadowCopies::prepare at first use, so no making compiles. WorkCounts::shadow_twin_decodes counts the decodes. 4:2:2 heap shadows stay twinless; heaps over the caller's host pages stay the documented copies-alone gap. Docs: decoded_twin.rs, pvrtc.rs, etc.rs, degradation.rs, docs/API.md, docs/FAST-PATHS.md (heap shadows of decoded formats are no longer for copies alone). New device test runtime_lane/heap_carried_reads.rs. Public surface: WorkCounts (for the lanes) gains shadow_twin_decodes, blessed in api_signatures.tsv. Verified: PHOENIX m3-max-33568 (carried binary of the lane tip d5bf9cac82): heap_carried_reads, a_carried_heap_texture_reads_its_bytes_with_no_commit, pvrtc_texels_read_as_metal_s and etc_texels_read_as_metal_s pass. Under HeapAnswerPolicy::Metal all 8 cases shadowed; a use takes 1 copy and 1 decode, a second encoder in the same command buffer 0 and 0; kernel reads, samples, blit out and getBytes equal the texture outside a heap, and samples follow a blit and a replaceRegion. Under HeapAnswerPolicy::Device: not shadowed, 0 copies, 0 decodes, equal. Without the fix (33467 at the test commit) all 8 reads were refused. lavapipe (msi 33535): the 4 tests pass. Clippy x3 running in 33569. |
||
|
|
5813fe6743 |
RUNTIME 2381: a render target whose copies lose its padding lies in place
On the Iris Xe (ANV), a render target over host pages whose rows end inside a 64-byte line (nonCoherentAtomSize) failed the in-place check's renders: the clear and store, and draws, write back the line holding a row's last texels whole, so a CPU write to the padding in that line can be lost. Such textures were shadowed (733 in reims's walk: RGB10A2 66x66@512 572, RGBA16F 55, R8 49, A8 49, BGRA8 3). But the shadow keeps nothing more: its copy back writes the same lines, and on this device a plain buffer copy, a copy of texels into a buffer's rows and a kernel's stores all write back that line too (Iris probe, job m3-max-33417: clear+store 15/15 rounds changed padding bytes, draw 15/15, product shadow copy back 14/15, buffer copy 15/15, kernel stores 6/6; every changed byte in the row's tail line, none past it; rows on lines 0). The check gains an access, Copies: a blit copies a zero texture's texels into the class's buffer's rows while the CPU writes beside them (every shape but the 3840x2160 surface; no rounds over the runtime's own memory). A texture that renders over host pages whose rows' padding is free (not declared unobserved), whose renders failed for its row ends, now takes the verdict of renders that let that padding change where the class's Copies failed for those row ends too (pending while they are), announced as Degradation::LineWriteBack (line-write-back, Precision). Copies failures carry across classes as the other GPU writes do. The check notes each class and access's rounds' time. CHECK_VERSION 19. Docs: FAST-PATHS host-pages row and a known gap for the Iris line write-back (nonCoherentAtomSize 64; buffer copies, texel copies, kernel stores, passes); API.md section 1 and the catalogue entry; the in-place lane's VERDICTS 98 -> 112 and a lane test with the kind's site. Verified: msi m3-max-33510 at the lane tip 47b06c9f0d: clippy (runtime + translator, all features, all targets) 0; runtime tests 29/29 (the decision, a_texture_that_renders_lends_its_free_padding_ where_the_copies_change_it_too, carry, degradation_catalogue, degradation_sites, texture_placement); translator api_signatures, fast_paths, api_surface 34/34; --cfg m2v_gpu archive of runtime + validation built (33511). Pending: negative control 33520, lavapipe 33512, the Iris proof. |
||
|
|
da6cc554bb |
SEMANTICS 2125, RUNTIME 2376: Rate maps: a region-copy recording draws one row, its region its first's segments plus DrawIndex
A recording through the region-copy variant drew a box of several rows, so its vertex function found its region as `first + (DrawIndex / c)·nx + DrawIndex mod c`: it read the table's count of columns, divided by it and by the box's columns, and only then read its region's terms. Now each row of a box is its own recording (in parts of at most a multi-draw's draws), and `PushField::RegionBox` holds the row's first region's segments `[x0, y0]`: the vertex function draws the region of segments `(x0 + DrawIndex, y0)`, dividing nothing and reading no table word before its region's own, the row's `y0` the same at every vertex. A row is recorded a region at a time where a sample may lie on a pixel's left edge (`folds` answers that axis alone: a row's top and bottom edges are its scissor's). The pixels and positions are the route's as before: the same copy arithmetic of the same region, under the same viewport, its row's scissor holding the regions' pixels. A whole-table draw is 34 recordings where it was 2 (rate_map_region_copy_recordings). The docs, the FAST-PATHS fan-out row and the boxes test say rows; the docs drop the cost claim the Iris A/B disproved. Kept though neutral on the Iris: the shorter vertex function (42 instructions, 428 estimated cycles, 8 sends -> 37, 258, 7) did not move the per vertex-region cost, which lies in the fixed function after it (four user clip distances tested on every copy; 2073 of 2074 rejected there). Verified: m3-max-33295 (msi, at 72bd8baa20): clippy of the translator and runtime (all targets, all features, -D warnings) plain, m2v_cpu_icd and m2v_gpu 0; translator 47/47 and runtime fan_out 6/6 unit tests; lavapipe 24/24 rate-map device tests. m3-max-33355 (ef59a08250, docs): clippy plain and Rustdoc 0. Iris (ms01) m3-max-33332: 24/24 rate-map device tests (region_boxes direct [3 draws, 39 recordings] against indirect [3, 624], 0 texels differ; depth_equal 0 red). Negative control m3-max-33327: the base's divided region restored, the SPIR-V divisions assertion fails (4 vs 0). Iris A/B m3-max-33262 (warm, no INTEL_MEASURE): whole-table commit frame 671.1 -> 670.9 ms, Exact 505.7 -> 498.7 ms; per sub-draw 1.068 us + 0.3626 ns x V -> 0.926 us + 0.3697 ns x V. |
||
|
|
135df83657 |
RUNTIME 2357: Textures over buffers: an image over a buffer's texels may take its whole placement; an unobserved buffer lies on the linear image alignment
Intel's driver for the UHD 630 on Windows (101.2145) rounds a small linear image's VkMemoryRequirements size up to its 4096-byte alignment: BGRA8 73x8 at a pitch of 320 has a 2560-byte subresource and a 4096-byte image, 16x16 1024 -> 4096, RGBA16F 88x8 6144 -> 8192. The in-place check (linear_plan::aliases) bounded the image's size by the buffer's VkBuffer bytes from the texture's first, so a texture over a padding-unobserved Private buffer of exactly its rows was a shadow, and a buffer placed on 256 bytes failed the image's 4096 start too. The room an image over a buffer's texels may take is now the buffer's own placement from its byte 0 (Buffer::memory_room: bytes no other resource is placed in), in texture.rs's two aliasing checks and the two-plane YCbCr check. A buffer whose maker declares its padding unobserved is placed on the device's linear images' memory alignment (Device::linear_image_alignment: one probe image's alignment, a 64x8 R8G8B8A8_UNORM linear image, kept for the device), its start and size whole units of it; the recycler's BufferMaking keys on that alignment, and a device recovery's carry places such a buffer so again. Where the alignment is 256 or less (RADV, lavapipe, MoltenVK), every placement met it already and nothing changes. Cost: at most alignment - 1 bytes more for each such buffer on the UHD 630, plus the start's padding. Still a shadow: an image the driver sizes past its alignment's rounding, R8 4096x1 over 4096 bytes taking 16384 on the UHD 630 (FAST-PATHS known gaps), and on that driver textures over buffers that do not declare their padding unobserved where the image is larger than the placement or starts off 4096. Tests: padding_unobserved's a_texture_whose_rows_fill_an_unobserved_buffer_is_in_place makes a 73x8 BGRA8Unorm texture at the device's own linear pitch over a Private padding-unobserved buffer of its rows alone and asserts the placement lies on the alignment, the texture is the image over the buffer, and no shadow is counted. Docs: BufferDescriptor::padding_unobserved, the runtime README entry, FAST-PATHS known gaps. Checks: on the UHD 630 (Windows, m3-max-32630, at the same diff before its rebase), padding_unobserved's new test passed: 73x8 at a pitch of 320 over 2560 bytes, 4096 of room on 4096, an image over the buffer, 0 shadowed. At cb7660c625: clippy plain, m2v_gpu and rustdoc 0 (m3-max-32602); lavapipe touched set 153/153 and m2v_cpu_icd clippy 0 (m3-max-32603). |
||
|
|
f4c9902c63 |
FAST-PATHS: the cold Shared making's range on this tree is 95-97 ms
The previous commit gave 92-97 ms; m3-max-32595's two runs of this tree made the cold round in 97.0 and 94.6 ms. |
||
|
|
9ee682344f |
FAST-PATHS: the 16 KiB allocation's measured cost
A 16385-byte buffer's VkBuffer requires 32768 bytes where 16400 did, on RADV PHOENIX and lavapipe (m3-max-32595, m3-max-32558). On the Radeon 780M, release, exclusive, the base (d2ee5bca5b) and this tree run twice each in one job (m3-max-32595): 1000 buffers of 16 KiB + 1 to 4 MiB required 763.3 MB against 754.8 MB and took one more 64 MiB block in their second round; making them took the same time within the runs' spread, Shared ones cleared on the host and Private ones' first fills alike. |
||
|
|
a1175662e7 |
RUNTIME 2355: Textures over buffers: a buffer of 16 KiB or more holds Metal's allocation, a heap's buffer its heap
A texture over a buffer whose texels run past the length was always a copy: a shadow image or a staged texture buffer whose bytes past the length lay in a tail of its own. Metal's texels there are the allocation's: a buffer of 16 KiB or more holds its length rounded up to 16 KiB (allocatedSize), zero when made, and a heap's buffer reaches its heap's end, whose bytes are the heap's. Now a buffer the device makes in the Metal address space with a length of 16 KiB or more takes that allocation (buffer.rs's metal_allocation): its VkBuffer and placement are its length rounded up to 16 KiB, which its first fill clears with the rest (Buffer::clear_first: the host's clear of a Shared or Managed buffer, the device's fill of a Private one), with no command of its own. A texture keeps in place the bytes the buffer's memory holds for it (Buffer::texel_reach: the allocation, a heap's buffer's heap to its end, a no-copy buffer's length), so such a texture is made as one inside the length is: an image over the buffer's memory where the device makes one, a texture buffer viewed in place. The shader-visible ranges, robustness, copy reach (a blit past the length is still refused) and exported sizes stay at the length. Heap, no-copy, wrapped and exportable buffers, and every buffer under 16 KiB, take their length; past what the memory holds a texture keeps its tail, as before. The runtime has no buffer allocatedSize; a heap's size and a heap texture's allocated_size are unchanged. The tails conformance cases now lie in place: their comments say so, and the texture buffer case drops its staged-texture-buffer allowance, which no device can fire there any more (its view starts at 16384). Tests: buffer_tail_device's last-texel case lies as over a buffer that holds it inside its length, with no tail; a new case over a 20000-byte buffer (64x128 packed, ending at 32768) reads zero in the padding as made, lies as inside the length, lands a kernel's writes past the length in the buffer's memory, takes no copy where it is an image over the buffer, and refuses a blit past the length; the heap case lies in the heap, its kernel writes landing in the heap's other buffer; a new case over a heap's second buffer keeps its texels past the heap's end in a tail; the no-copy and 4096-byte cases keep their tails. Docs: buffer_texture.rs's Tails, linear_plan.rs's Length, docs/API.md's accepted difference and StagedTextureBuffer entry, and a FAST-PATHS cost-of-matching-Metal entry for the padding. Checks: the jobs that compiled and ran this commit are named in the lane's report. Evidence (lane jobs): m3-max-32551 (msi): clippy runtime+conformance -D warnings 0; 2632/2632 runtime+conformance; fast_paths + api_surface 34/34. m3-max-32578 (lavapipe) at the tip: touched 56/56 (buffer_tail_device incl. the allocation, heap and heap-end cases, texture_placement_device, linear_plan, buffer_texture, degradation_catalogue); runtime+validation partition 1/4 1572/1572. VkMemoryRequirements on lavapipe for a 16385-byte buffer: 32768 (alignment 64). The padding is cleared by the buffer's existing first fill (no new command). allocatedSize: no buffer API; heap sizes unchanged. The PHOENIX run, the release creation bench and lavapipe partitions 2-4 follow in the lane. Conformance: buffer-tails cases now in place; the M3 venue's cost records for buffer-tails-* re-bless on development. Lane commits: d2ee5bca5b (bench), a8f3796f59, ee54952340 (heap cases in a placement heap). |
||
|
|
b7053280de |
RUNTIME 2346: 4:2:2 textures over IOSurface planes: an image of their texels, decoded from the pairs in place
A GBGR422 or BGRG422 texture made over a buffer's bytes (Buffer::new_texture_with_iosurface_plane,
a CoreVideo 2vuy or yuvs plane, over a Shared buffer or a no-copy buffer's host pages) had no
decoded twin: twins are attached only to textures whose image is their own for good, so every
dispatch or draw that read or sampled it was refused, with a "needs R8G8B8A8_UNORM SampledImage"
line naming a format every device samples.
Such a texture is now an R8G8B8A8_UNORM image of its texels, the converted shadow a two-plane
YCbCr texture over planes already is (ShadowSource::Converted, its conversion now an enum of the
planes' and the pairs'): its copy in, before the first command of a command buffer that reads it
and after a command wrote the bytes, is one dispatch of the new bind::chroma_convert_module that
reads the pairs where they lie, at any byte of their VkBuffer, through one storage-buffer binding,
and writes Metal's texels (ChromaDecode, exact) through the image's R32_UINT view. Copies, blits
and CPU calls keep moving the plane's bytes. Where the device converts the pairs' format with
Metal's reconstruction (MoltenVK), the copy in is that conversion instead: the plane's rows copied
into the pairs' image, sampled through the conversion (chroma_sample_module) into a scratch,
copied into the image; announced decoded-texel-precision at the copy in's planning. The set binds
the buffer's VkBuffer, so the planning makes it again after a rebind gave the buffer another one,
and each command buffer holds the set it took. The placement query answers OtherShape. A plane
the window cannot take (past maxStorageBufferRange, a last word past the buffer, rows that share
bytes, texels past the buffer; with the device's conversion, a first byte or rows off 4 bytes)
keeps the carrier, its reads refused; FAST-PATHS records it as a known gap.
Per frame, per texture (w x h texels): before, no read ran at all; the texture was an R8G8_UNORM
carrier of the plane, 2 bytes a texel. Now no byte is copied: one dispatch reads the w*h*2 bytes
of pairs in place and writes w*h*4 bytes of texels (1920x1080: 4147200 read, 8294400 written).
Memory: one R8G8B8A8_UNORM image, w*h*4 bytes (1920x1080: 8294400), in the carrier's place; with
the device's conversion also the pairs' image (w*h*2) and the scratch (w*h*4), and per copy in a
w*h*2 copy in and a w*h*4 copy out. Announced carried-decoded-twin (an existing kind) with that
cost. No new Degradation kind, no new WorkCounts field.
A carrier's binding without a twin is now refused NotImplemented(Format) naming the texture's
format (pvrtc::holds_for_copies), not a need of the twin's view format.
Public surface: metal2vulkan::bind::{chroma_convert_module, ChromaConvertModule} added
(api_signatures.tsv blessed, api_surface table); docs/REFUSALS.md regenerated (one more
binding_view site of Format).
Tests: the in-place kernel against ChromaDecode's decode under the interpreter (both orders, first
bytes off a word, odd sizes, rows apart); a carrier's binding refusal (binding_view unit test);
a device test of both formats over a Shared buffer and over host pages reading Metal's measured
bar values (an Apple M3 Max, macOS 27.0.1) and Metal's decode of a random frame written on the
CPU before the next command buffer, OtherShape from the placement query, and the device's
conversion counted and announced where it converts. Verification jobs follow in the lane report.
Evidence (lane jobs): msi m3-max-32240 at 94f603bf35, --cfg m2v_cpu_icd on llvmpipe: 130/130 touched tests, clippy -D warnings 0;
the device test fails without the fix (placement not OtherShape, the read's dispatch refused). PHOENIX gem10 m3-max-32260
(archive m3-max-32241): all 4 cases (GBGR422/BGRG422 over a Shared buffer and over host pages) "Metal's texels, exact"
for the M3's measured bars and a random CPU-written frame; ycbcr_device, ycbcr_refresh, twin_reads 7/7. MoltenVK (device form)
run on the M3 follows.
Lane commits: 735234d5f4, d59f44baa6, 94f603bf35.
|
||
|
|
a9dce911e7 |
Known gaps: drop the first commit's translation; held_step_order's numbers from a release build
|
||
|
|
9aadbdf281 |
held_step_order: time Scheduled from the commit's return; hold the commit call to a frame
command_buffers_behind_a_waiting_step_read_scheduled failed 3 of 3 on the Radeon 780M (PHOENIX) inside the whole device suite (m3-max-31782): the long command buffer's commit returned 405.95, 23.66 and 10.50 ms after its call, and the test bounded the call plus the scheduler's pass to `Scheduled` by 10 ms together. Scheduled itself came 19.6, 1.6 and 2.3 ms after the commit returned: the ordering the test is for held. What holds the call (probes m3-max-31832 and m3-max-31876, gem10's 780M idle, step marks in the commit path): no pipeline wait (commit_pipeline_wait_nanos 0) and no lowering; Recording, Deferred::prepare of the host-step pass. Its first commit translates the variants the step draws with on the program's thread (DeferredPass::settle: the step's buffer forms and the fan-out's, the route's replay variant; record_on_gpu's decision and, once a device, the notice's rules past its cause): 24.1 / 23.7 ms cold, 49.8 in an earlier run. A later commit finds them made: 1.0 ms (2.4 in the earlier run), about 30 lookups of 5 to 35 us, no single repeated item. The suite on the host's cores stretched the same work about tenfold. The translation cannot move earlier (whether the pass is a host step and its route are decided at the commit) nor off the program's thread (the device keeps only what the program's calls make, in its order). So the test's one bound mixed two properties. Now: - `Scheduled` is timed from the long commit's return, still within 10 ms (the long work ends 100 ms or more after it); - the commit call is asserted apart, by its own clock (WorkCounts::commit_nanos), within a frame's 16 ms in one of the runs at least (the later runs are warm), the test's own work_counts() snapshot outside the timed span. docs/FAST-PATHS.md's known gap is rewritten to what is measured (the first commit of a host-step pass translates its step's variants, why it stays there), and CHANGELOG's known-failing line with it. Verified: see the lane's report (PHOENIX 5/5, negative control with a sleep in the commit path). |
||
|
|
d9236a8a11 |
Known gaps: a commit held past 16 ms on a Radeon 780M; a teardown wait past 16 ms on an RTX 2080
Two latency tests fail on some GPUs at the 0.2.0 release candidate, recorded where a user reads open gaps (docs/FAST-PATHS.md, Known gaps) and in the 0.2.0 CHANGELOG entry, at the owner's call to document them as failing and release: - tests::held_step_order::command_buffers_behind_a_waiting_step_read_scheduled: on the Radeon 780M (Phoenix, m3-max-31782, exclusive) the long command buffer's commit returned 405.95 / 23.66 / 10.50 ms after its call over the test's three runs (bound 10 ms); pin 97's XTX printout shows the same shape (315.68 -> 12.59 -> 17.11 ms). The ordering the test is for held in every run. - tests::teardown_threads::a_running_queue_switch_check_leaves_the_device_to_the_program_s_thread: on an RTX 2080 (620.70.06) it failed 3 of 3 alone (m3-max-31777): the teardown waited 33.1 / 23.3 / 19.8 ms for the check, 19.6 / 22.0 / 18.4 ms of it the check's objects' release; it passes on the RTX 3090, RX 7900 XTX and Radeon 780M. That host's driver calls on the 2080 ran several times slower than usual during the measurement (cause open). Docs only. |
||
|
|
b585744208 |
Boxed draws: the constant's numbers count the three draws the patches frame still fanned out
GEOMETRY_TRIANGLE_WORK's doc (
|
||
|
|
5983bb3e72 |
RUNTIME 2324: Boxed draws: a fanned-out triangle's geometry stage is worth 24 vertex-regions, not 180
The boxing rule (RUNTIME 2318) took GEOMETRY_TRIANGLE_WORK = 180 from the pieces lane's bands frame, whose 22-by-10-pixel triangles cost 132 ns each fanned out on an Iris Xe: mostly their fragments, which every route shades, not the geometry stage boxing saves. Its 61 boxes on the patches frame (2-pixel quads, about 18 regions a box) lost on every device measured, the pass's warm piece: Iris Xe (Mesa 26.2.6) 4.64 ms fanned, 9.21 / 9.06 ms boxed (m3-max-30553) Radeon 780M (Mesa) 6.47 / 6.46 ms, 13.57 / 13.57 ms (m3-max-30687) RTX 3090 (620.70.06) 2.80 / 2.77 ms, 3.01 / 3.00 ms (m3-max-30686) On that frame, whose fragments cost little, a fanned-out triangle cost 15.4, 21.5 and 9.3 ns, a boxed vertex-region 0.59, 0.87 and 0.19 ns: 26, 25 and 49 units. The constant is the least, 24.7, rounded down, so a draw it boxes costs no more than its fan-out on each of the three; a lower constant only boxes fewer draws than 180 did. The doc and docs/FAST-PATHS.md's row carry the numbers. tests::rate_mapped_boxed_draws: the 120-by-40 strip across ten regions (50 units a triangle, the patches frame's boxes about 55) is now fanned out, and a patch across four regions' corner is boxed in its place, so the test still boxes a draw across region borders: counts [1, 0, 3, 4, 4]. At 180 the strip is boxed and the counts fail. tests::rate_mapped_boxed_rule checks the rule on the patches frame's average draw: 18 regions fanned out, 4 boxed. The lane's patches frame no longer asserts that it boxes a draw. RUNTIME 2324: an unchanged artifact's rate-mapped draw that boxed at 180 fans out at 24. |
||
|
|
8a374ba0e5 |
RUNTIME 2318: Rate-mapped draws whose triangles lie in few regions are boxed, not fanned out
At a host step under RateMapRegionPolicy::FanOut, a probed draw the probe flags nothing of goes through the fan-out variant, and so does a flagged draw's fanned part. Its geometry stage emits a copy of each triangle per region it touches. On the pieces lane that stage costs a fanned-out triangle what 371 to 739 vertex invocations for one region cost. On an Iris Xe that is 130.7 ns a triangle, against 0.352 ns an index-region through the region-copy variant. On a 3D renderer's frame there (tm91-iris), about 68 of the 125 ms of rate-mapped pieces a frame tracks the probed and fanned geometry, which is 383 fanned draws a frame. Such a draw is now boxed when that holds no more work: drawn through its region-copy variant into the boxes of the regions its triangles reach by the probe's bounds (fan_out::run_boxes of Probed::reach, a part's from its own blocks), as a run is. - The rule: rate_mapped_pass::boxes_cheaper, regions x (vertices + REGION_DRAW_WORK) <= GEOMETRY_TRIANGLE_WORK x triangles (a direct draw; a strip's triangles counted at vertices / 4). - GEOMETRY_TRIANGLE_WORK = 180: about half the least that a fanned-out triangle cost against a vertex for one region on the four devices measured (Iris Xe 371-500x, Radeon 780M 739x, RX 7900 XTX 570x, RTX 3090 654x; the constant's doc has the numbers). The rule is device-independent, keyed to no app, map or shader. - No new pass, variant or readback. fan_out_asked asks for the region-copy variant (settled at commit already) and the recording takes the boxes (RenderLowering::boxed_reach). Pixels: the routes already share a pass and put a vertex at one window position. A pixel lies in one region, whose copies keep the draw's order of instances and primitives in either route. The bounds are widened as the probe's are, so a box holds every pixel a copy would cover: the same pixels and depth wherever today's routes agree. A boxed draw rides whole in its piece, as a fanned-out one does; its work is no more than its fan-out's. Counts: WorkCounts::rate_map_boxed_draws and rate_map_boxed_vertex_regions (CopyRoute::Boxed). A boxed part is not a run, so rate_map_region_runs and rate_map_parted_region_triangles leave it out. Test: tests::rate_mapped_boxed_draws, 6 commands blended at half alpha: - boxed: a 10-pixel patch, a 120x40 strip across region borders, a patch of two instances, and a patch without indices; - fanned out: a whole-target grid and one wide quad. It checks probes 1, flagged 0, fanned 2, boxed 4, region-copy draws 4, and boxed vertex work under the whole table's. The pixels equal the encoder's bit for bit. Under Exact nothing is boxed. Also (2f82e025be): The pieces lane draws each command's own patch: rate_mapped_pieces_host_step_patches; (01d8344d2a): A command's settle at commit boxes no draw; the boxed test's counts keep their function's name. Verified (lane ratemap3, msi m3-max-30513 at 01d8344d2a, llvmpipe): rate_map|fan_out 26/26, the new rate_mapped_boxed_draws among them (probes 1, flagged 0, fanned 2, boxed 4, region-copy draws 4, boxed vertex work 10752 against the whole table's 997056; pixels equal the unboxed execution; nothing boxed under Exact); rate_mapped_fan_out, region_boxes, pieces and depth_equal unchanged. Landed (main) at once: clippy x3 (m3-max-30514), the Iris A/B and the hand negative control run after landing. RUNTIME 2318: what a run records and draws changes. No Degradation kind. API: two WorkCounts fields added (rate_map_boxed_draws, rate_map_boxed_vertex_regions); api_signatures.tsv blessed. A consumer building WorkCounts by struct literal must name them. |
||
|
|
497e1f4ec0 |
SEMANTICS 2116: NVIDIA's float denormals under the 16-bit float controls are the device's, noted
What: a new DriverWorkaround, FloatDenormalsKeptUnderHalfControls, with rows for NVIDIA's driver on the RTX 3090 and the RTX 5080 Laptop GPU (the GPUs its MetalFloatDenormals rows name). In an entry that declares the 16-bit float controls (narrow::controlled_modes) on such a profile, the float operations the deviation covers record PrecisionNote::DeviceDenormals and the module requires no VkProperty::MetalFloatDenormals. An entry that declares no float-controls mode keeps the deviation, and so does every other driver. Why: runtime_lane::driver_deviations::fused_pairs_answer_metals_nans_and_denormals failed on the RTX 5080 Laptop GPU (615.71.09) and the RTX 3090 (620.70.06) at pin 93b. The same 33 of 4,096 words in each fixture kept a denormal where Metal answers zero (thread 0x11: 1e-20 * 1e-20 gives 0x116c2; thread 0x29: the smallest denormal times 2^30 gives 0x04000000). That held for the lone product a * w as much as for the fused pairs, so the fused pairs are not the cause. The fixtures compute half in 16 bits, so their entries declare RoundingModeRTE, DenormPreserve and SignedZeroInfNanPreserve for 16 bits. The deviation's probes (nan_denormals, nan_denormals_fast) declare no mode and flush on the same GPUs. Vulkan leaves 32-bit denormals to the implementation when no 32-bit mode is declared (the NVIDIA profiles report independence ALL), and NVIDIA states no shaderDenormFlushToZeroFloat32. So the device's answer stands (owner rule 1), scoped and noted; nothing is flushed in the shader. RADV on the Radeon 780M (Phoenix and Hawk Point, Mesa 26.2.6) declares the same modes there and passed the test at pin 93b, so it keeps the deviation. MoltenVK states no shaderDenormPreserveFloat16, so its entries declare no 16-bit mode. The device test now decides "Metal's" per kernel (requires_property), as the float_denormals tests do, and asserts DeviceDenormals where the kernel does not require the property. The new unit test float_denormals_under_the_half_controls_are_the_devices_where_its_driver_keeps_them checks the 5080 Laptop GPU, the 3090, the desktop RTX 5080 and the 780M against fmx_fma_precise, fmx_fma_fast and nan_denormals. It fails without the rows. Docs: the workaround's doc, the DEFECTS and MetalFloatDenormals table docs, the deviation and property docs, PrecisionNote::DeviceDenormals, docs/API.md's device-denormals entry, docs/FAST-PATHS.md's denormal row, the signature table. SEMANTICS_VERSION 2116: NVIDIA modules' notes and requirements change. No new Degradation kind. Landed (main) at once, before its check: the lane's check (clippy plain and cpu_icd, the touched unit tests, the two denormal device tests on lavapipe) and the NVIDIA device proof run after landing. |
||
|
|
1858a2fb34 |
RUNTIME 2316: Rate-mapped passes count their region-copy and fanned-out vertex work by box size
What: new WorkCounts fields - rate_map_whole_copy_vertex_regions, rate_map_own_copy_vertex_regions, rate_map_run_vertex_regions: vertices x regions drawn through the region-copy variant into the whole table, by the encoder's own draws, and by a host step's runs; - rate_map_fanned_vertices, rate_map_fanned_box_vertex_regions: vertices fanned out through the geometry stage, and those times the regions of their probe-bounded boxes; - rate_map_fanned_vertices_boxed_16, _64, _256: fanned-out vertices whose boxes hold at most that many regions. render::fan_out::Probed::of also ORs every block's bounds (its reach). FAST-PATHS' FanOut row, docs/API.md and rate_mapped_pass.rs list them. Why: on Iris a whole-table region copy costs about 16x a geometry-stage fan-out a triangle, and the consumer's 127 ms a frame of rate-mapped GPU time cannot be split between the encoder's own whole-table draws, runs and fanned draws from today's counts. A plain sum cannot say how much fanned work lies in small boxes, which a cheaper route for few-region draws would take. How verified (lane ratemap3, msi m3-max-30401 at 7a17a61829): render::fan_out unit tests 6/6; rate_map device tests on lavapipe 19/19, with exact counts in a_host_step_fans_out_the_commands_the_probe_does_not_flag (encoder frame: own == whole == (5 x 3072 + 9) x table regions; host step: no whole-table work, fanned vertices exact; under Exact all zero); clippy -D warnings plain, cpu_icd and gpu; api_signatures --check clean. RUNTIME 2316: what a run records changes. No Degradation kind, no behaviour change. |
||
|
|
057b794f5b |
SEMANTICS 2115 / RUNTIME 2315: rate-mapped region copies record a box of regions per multi-draw
What: a draw through its region-copy variant recorded its regions 16 at a time (the device's
viewports). Each recording set 16 scissors, pushed its first region and stored DrawIndex as
ViewportIndex. On a guest frame the host step made about 4.7k such recordings a frame (Iris and
RTX 3090), while the GPU sat idle waiting for the step.
The variant's four clip distances already keep each copy to its region's pixels, as a fanned-out
copy's are kept; the per-region scissor only culled. Now:
- The vertex function draws region first + (DrawIndex / c)*nx + DrawIndex mod c from a pushed
box (PushField::RegionBox, renamed from RegionFirst, now [first, columns]).
- It stores 0 as ViewportIndex, the recording's one viewport, so it writes every output the base
variant wrote.
- The recording sets one viewport and its box's union scissor.
- A direct draw records a box as many regions at a time as one vkCmdDrawMultiEXT takes
(maxMultiDrawCount - 1), its rows in order. A run records one recording per box its bounds
reach; any other draw records the whole table in one or a few.
- Indirect draws keep one region a recording, under that region's scissor.
- The variant still needs shaderOutputViewportIndex and shaderDrawParameters; it no longer
needs multiViewport.
Exactness: a border between two regions of a recording holds no pixel centre and no sample at
Vulkan's standard sample locations (at least 1/16 px inside a pixel, up to 8 samples), while each
copy's clip distance there is zero up to rounding. A box is recorded one column (row) at a time:
- in a pass whose custom sample positions put a sample on a pixel's left (top) edge;
- on a device without standardSampleLocations;
- in a 16-sample pass.
See render/fan_out.rs, folds.
A box's recording and the recordings of each of its regions alone run one pipeline that writes
the same outputs. They differ only in their dynamic viewport and scissor values and the integer
region each draw selects (Vulkan's Invariance appendix, Rules 2 and 4). The agreement between the
encoder's region-copy vertex function and the host step's fan-out geometry stage stays the
existing FAST-PATHS known gap, checked by running: no new near-equivalent, no new accepted
difference.
SEMANTICS_VERSION 2115 (the variant's module and push layout); ARTIFACT_FORMAT_VERSION 523 (the
PushField tag); RUNTIME_VERSION 2315 (what a region-copy draw records). Docs: rate_mapped_pass.rs,
render/fan_out.rs, bind/fan_out.rs, the translator's region-copy plan and store, docs/API.md, and
the FAST-PATHS fan-out row and known gap. docs/REFUSALS.md regenerated unchanged; api_signatures
blessed. No new Degradation kind, no WorkCounts field.
Tests:
- render/fan_out/tests.rs: run boxes, box recordings, box scissors, the fold rule.
- tests::rate_mapped_region_boxes (device test): the same two passes drawn directly (boxes) and
indirectly (one region a recording, its own scissor), additively blended into RGBA16Float with
a ground plane, border-crossing slivers and off-screen and w-straddling triangles, then an
Equal pass, compared bit for bit, with the recordings counted.
Verified (lane ratemap2):
- msi m3-max-30288 at 9240cc0ea6: clippy -D warnings, all targets and features, plain, cpu_icd
and m2v_gpu, exit 0; rustdoc -D warnings exit 0; translator touched tests 226/226; runtime
33/33; lavapipe 13/13.
- rate_mapped_depth_equal: 0 failing pixels in every pairing under Exact and FanOut. Without
the ViewportIndex store, FanOut's mixed-route pairings had 2853 of 89483 (m3-max-30235).
- rate_mapped_region_boxes: direct 3 draws in 3 recordings against indirect 3 in 624, 0 texels
differ, Equal-pass mismatches [0, 0].
- Negative control (each clip distance widened by one pixel): rate_mapped_region_boxes fails,
25464 texels differ, Equal-pass mismatches [11019, 0].
- The Iris GPU-time A/B (ms01, m3-max-30315, exclusive) is running; the consumer's renderer run
at the next pin is the workload proof (rate_map_piece_gpu_nanos a frame on Iris).
Landing note: docs/API.md merged by hand with RUNTIME 2314's probe-parts sentence (both rewrote one
paragraph), and rate_mapped_pass.rs's Fan-out now says the probe runs in parts (RUNTIME 2314).
|