ddb4bcbfaafcde0217787f5dc6e2e09a29d151d0
1363
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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). |
||
|
|
2163335121 |
RUNTIME 2393: a dma-buf source is asked once per texture after its standing refusal
A texture over a no-copy buffer's pages imported as dma-bufs tries its image in place with each
of its plans (wider usages first, its own last) and asks the caller's source for each plan's
pages. On RADV PHOENIX (Mesa 26.2.6) an RGBA8Unorm ShaderRead texture tries four, so a source
that refuses pages past udmabuf's list_limit was asked four times for the same pages
(texture_shadow_bench, m3-max-33878: source calls 4.00, refused 4.00 a texture); a consumer's
trace logged 1,620 such refusals over 765 textures, 367 ms in all.
The runtime cannot infer that one refusal answers a wider range: a source may accept exactly a
range it keeps a dma-buf of, or a wider one split otherwise. So the source marks it: a new public
DmaBufStandingRefusal (a runtime extension), returned as its io::Error, stands for every range
that holds the refused one for the rest of that texture's making. bind_dma_buf_image reads it into
DmaBufRefusal::Source { stands }, and in_place_image refuses each later plan whose request holds
such a range with that refusal, its unbound image released, the source unasked. Plain errors
behave as before: each plan is asked.
Documented in DmaBufSource's and DmaBufStandingRefusal's rustdoc, docs/HOWTO.md's dma-buf section
and the runtime README; api_signatures blessed (the type, new, Display, Error). REFUSALS.md
regenerated, unchanged.
Test: tests/dma_buf_standing_refusal.rs, on a device that imports no host pointer: a source of
plain refusals is asked once per plan, a standing one once, and one that refuses plainly then
gives the pages makes the texture in place on the second ask.
With it, a test-only release bench (ignored, --cfg m2v_gpu, Linux with /dev/udmabuf), tests/texture_shadow_bench.rs: an RGBA8Unorm ShaderRead texture over a no-copy buffer of a sealed memfd's pages, in place over one dma-buf against a shadow over more runs than one udmabuf lists, used by one or two dispatches that read or sample every texel and dropped, at four sizes, with a blit and a Private sample as references, printing host, GPU and CPU time, submission counts and the WorkCounts of each part. Its source marks its list_limit refusal as standing.
Verified: compiled in m3-max-33918 (msi, release lib-test archive under --cfg m2v_gpu). Running at landing: lavapipe (dma_buf*, no_pointer_import, host_residency, texel_rows, texture_placement) in 33918, clippy x3 next, and a PHOENIX run of the new test and the bench (the 4 -> 1 asks on RADV expected, unverified). The bench's numbers (PHOENIX m3-max-33878 um790, 33898 gem10) came from 2fe80f0a64 and d06fa76b74.
|
||
|
|
c2206c14b0 |
RUNTIME 2389: Device::import_shared_dma_buf imports a shared dma-buf ahead and keeps it while a handle lives
A runtime extension (Metal has none). A guest's buffers over pieces of one shared file of guest RAM were each imported as their own dma-buf import and freed with the buffer, so a compute loop that made and dropped no-copy buffers paid an import and a free per command buffer, and on RADV each import maps its pages at once (the next submission's CS waits for the page-table job). Device::import_shared_dma_buf(file, options) (unix) imports the whole dma-buf on the caller's thread, or joins the device's live import of it, and returns a SharedDmaBufImport; while a handle lives, the file's entry in the device's map keeps the import, so buffers over its pieces join it instead of importing again, and it is freed once its last buffer, heap and handle have gone (one kept import per file a live handle names, per generation). The class comes from `options` as a no-copy buffer's (Private, Memoryless and undefined options refused, Invalid StorageMode); the import takes the type a no-copy buffer of that class would get first, so pieces join it. Refusals use the existing kinds (Unsupported HostMemory, OutOfMemory). A device's recovery lets go of the lost generation's kept holds and seeds the new one's map, whose first buffer imports the file again; nothing is imported on the recovering thread. A device without a dma-buf importer keeps nothing (Debug: imported false). The handle imports whether or not the device's buffers over those pages take the dma-buf route: on a device that takes the pages' pointer it is one listed dma-buf a submission for nothing. WorkCounts::dma_buf_shared_imports_kept gauges the kept imports; the handle's import counts in dma_buf_imports. Docs: rustdoc, dma_buf.rs Shared files, HOWTO dma-buf section, the runtime README extensions and unix-only lists. REFUSALS.md: the StorageMode site moved to host_class, which the no-copy call and this one share. Public surface: Device::import_shared_dma_buf, SharedDmaBufImport (Send + Sync, consumer_auto_traits) and WorkCounts::dma_buf_shared_imports_kept, blessed in api_signatures.tsv. Verified: m3-max-33745 at the lane tip 856a1fabae: clippy plain, m2v_gpu, m2v_cpu_icd 0; rustdoc 0; lavapipe runtime suite 2836 passed. Device tests (lavapipe): three buffers made and dropped in turn take imports 1 / joined 3 with the handle, imports 3 / joined 0 without; a handle keeps a live buffer's import; recovery imports nothing and the next buffer's import stays kept; Private refused. Churn bench, PHOENIX (RADV 780M, release, interleaved, 450 command buffers an arm, a8f297bf11, the same code but the count): no handle 1 import + 1 free a command buffer, call median 820-907 us, GPU start median 3026-3037 us; handle kept 0 imports, 0 frees, 1 join, call median 25-69 us, GPU start median 104-145 us. |
||
|
|
4ee4deb737 |
RUNTIME 2385: a heap's 4:2:2 texture, a shadow of the heap's bytes, keeps a decoded twin
A heap's GBGR422 or BGRG422 texture lies as a shadow of the heap's bytes in Metal's rows (its answer is Metal's measured rows: 512 @ 16 for 16x16, 8192 @ 16 for 64x64), and heap_texture_at excluded 4:2:2 textures from the decoded twin RUNTIME 2382 gave other carried formats' shadows, so every kernel read and sample of one was refused, NotImplemented(Format) (56 refusals on PHOENIX and on lavapipe, m3-max-33636 / 33625), where Metal reads it and the device can decode it. heap_texture_at drops the 4:2:2 exclusion: the shadow keeps the twin with_decoded_twin chooses for the device, through the device's conversion of the pairs where it converts them (rule 1), else Metal's decode, one whole-image pass recorded after each copy in that moves its rows, its kernel made at first use. A 4:2:2 heap texture cannot lie apart from the heap's bytes (held_to_metal sends rows to Shadow or refuses with HeapTextureMemory; Unaliased is for one-plane and two-plane formats only), so every 4:2:2 heap texture over device memory now keeps a twin; one over the caller's host pages, and a detached heap's stand-in, stay twinless and refuse reads. Docs: chroma_pairs.rs contract, decoded_twin.rs, degradation.rs CarriedDecodedTwin (doc and cost: "moves the blocks or rows"), docs/API.md; first_use's lines say "decode passes set at the making N, their kernels made at first use"; the HEAPDECODE line names a missing twin "none". Verified: PHOENIX m3-max-33671 (carried archive of the lane tip 4976a40be3): 5/5 (heap_carried_reads with GBGR422 and BGRG422 16/64 Private/Shared under both heap answer policies, new_resources_wait_for_ no_gpu_work, a_carried_heap_texture_reads_its_bytes_with_no_commit, four_two_two_heap_textures_take_ metal_s_size_and_layout, a_texture_held_for_copies_a_kernel_s_handles_reach_is_announced_once): every 4:2:2 case shadowed, a use 1 copy and 1 decode, a second encoder 0 and 0; kernel reads, samples, samples after a blit and a Shared replaceRegion, blit out and getBytes equal the texture outside a heap; route: Metal's decode (RADV and lavapipe convert no 4:2:2 pairs; the device-pair route in a heap shadow ran on no device). lavapipe msi 33635: the same 5. Control (test commit alone): PHOENIX 33636 and lavapipe 33625 fail with the 56 refusals. Clippy plain, m2v_gpu, m2v_cpu_icd and rustdoc 0 (33635); runtime lib tests in 33672. |
||
|
|
df0e7ec05e |
RUNTIME 2384: a fence update keeps its encoder group; the group orders after it by the narrowest barrier
A guest compute benchmark's encoders each update one fence and wait for one (reims, 780M,
|
||
|
|
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. |
||
|
|
369835f951 |
RUNTIME 2380: the submitting thread's CPU time is read only where queue times are noted
RUNTIME 2379's WorkCounts::batch_submit_cpu_nanos and submit_long_call_cpu_nanos read CLOCK_THREAD_CPUTIME_ID twice on every submission call on every driver. That clock is a system call on Linux, not a vDSO read: 459 ns a read against the host clock's 19 ns (thread_clock_bench, Ryzen 7 7840HS, Linux 7.3, fastest of 3 rounds of 1M reads, m3-max-33486), so 0.9 us a call always on, against a whole NVIDIA submission call of ~12 us. The thread's CPU time is now read only where the device notes queue times (METAL2VULKAN_QUEUE_TIMES, the existing default-off diagnostic); the CPU fields read 0 elsewhere and their docs say so with the measured cost. The wall-time fields, the long-call counts included, stay on. The long-call bench turns queue times on and gains its unfenced arms (one VkCommandBuffer against 47); thread_clock_bench measures the reads. Verified: msi m3-max-33490 at the lane tip 57e916e1c6: clippy (all features, runtime + translator) 0, clippy --cfg m2v_gpu 0, lavapipe kernel_end_device + submit_stalls 16/16 (the queue-times device test checks the CPU time stays unread when not asked and is counted once asked). |
||
|
|
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. |
||
|
|
b6081e2c7e |
Runtime tests: a device of the queue plan is made again while the driver lacks room for it
On the RTX 2080 (job m3-max-33317, 31 queue tests at 16 threads) the driver refused 10 of the 12 queue_share_device tests' devices their queue plan, and the runtime made them with its least plan's 3 VkQueues; the tests passed on one shared VkQueue, so what they claim about the plan's queues went untested. The runtime's own device tests had no wait like the lane's (ef66c46a5f): on NVIDIA each VkQueue is a channel, the 2080 holds about 210 across processes (11 devices of the plan's 18, job m3-max-19615), and the suite's 16 processes ask more. src/tests/plan_room.rs's device_with_room makes such a device again, the one made dropped first, while the driver refuses it for want of resources (Error::DeviceRefused) or it took its least plan (DeviceShared::least_plan), with pauses doubling from 0.25 s to 2 s up to 120 s in all, each a PLAN-DEVICE-ROOM line naming the answer and the wait. Any other error returns at once; past the bound a refusal is returned and a device still of its least plan fails its test, so a test of the plan's queues runs on them or not at all. No lock and no cross-process coordination. Every plan-device maker in the runtime's tests goes through it: blit_holds, caller_queue_writes, commit_and_submit, completion, completion_wakes, draw_again, hand_out_waits, queue_limits_device, queue_share_device (5), reserved_queues, scheduler_held_wakes, scheduler_wakes, store_out_device and video_interop. Left as they are: the least plan's own tests (least_queue_plan, reserved_queues' a_device_made_with_its_least_plan_reserves_what_its_plan_spares), which stand the driver's refusal in with refuse_next_devices; many_devices, a GPU hazard that fills the GPU on purpose; host_ram_first_fill_bench's ignored release benchmarks. Test: plan_room::a_plan_device_refused_once_is_made_again_of_the_plan_s_queues refuses the first making with the stand-in and asserts the device helped back is of the plan's round robin and presenting queues (from queue_plan over its families), not its least plan; a plain making answers the least plan (NVIDIA) or a refusal (lavapipe, RADV) there. docs/VALIDATION.md says the runtime's tests wait too. Verified: cargo fmt; build, clippy and the tests in the lane's jobs. |
||
|
|
760f8d045b |
Runtime lane: a device the driver refused for want of room is made again once other processes may have let it go
The 2080 legs of round
|
||
|
|
2332ae096e |
RUNTIME 2368: Host RAM copies: a kept plan's table goes into a buffer of its own at its first reuse, which each reuse binds
Each copy by a kept plan uploaded the plan's table into its command buffer's arena: 8100 entries of 16 bytes for a layer, past the arena's 32 KiB so a chunk of its own (a new Shared buffer) and a 130 KB copy, 22.5 us of a 74 us call at 1 chunk and of 191 at 128 (probe m3-max-32988, steelbrain/dl2-probe4, not landed), for bytes the plan held and never changed. KeptPlan keeps them in a buffer of its own (table_kept, a OnceLock), made at its first reuse by KeptPlan::table_buffer: the arena's class (Shared, default cache, untracked, by unzeroed_buffer_with, so the GPU reads it from the same memory), written once before any command reads it and never again. record_dispatches takes the table as bytes to upload (the full path, as before) or as that buffer (Table::Kept), which each command buffer that binds it retains, so a plan the LRU or the RAM's end lets go of frees it once they complete. Two encoders' first reuses at once keep the one set first. A plan never reused makes none. The tables count in MOST_PLAN_BYTES already, so the device memory kept is at most that and each buffer's rounding. A recovery carries the RAM's use to a new RamOnDevice on the next generation (RamUseCell::carry), whose plans start anew, so no old generation's table is bound. New counter WorkCounts::host_ram_copy_tables_kept; api_signatures.tsv blessed; the module docs, KeptPlan's and HOWTO's say what memory the plans keep. Tests (device): a_plan_keeps_its_table_in_a_buffer_from_its_first_reuse (planned, first reuse keeps it +1, later reuses +0, bytes each time); a_kept_table_a_command_buffer_bound_outlives_ its_plan (command buffers held by a shared event bind it, eight other copies push the plan out, the bytes after the signal); a_recovery_starts_a_ram_s_plans_and_their_tables_anew (recover_for_test: the first reuse after keeps a table of its own). Verified: m3-max-33015 (msi, at 612f09e48a): the runtime crate on lavapipe 2811/2811, clippy cpu-icd, plain and gpu configurations clean, Rustdoc clean; the API tests 15/15 (m3-max-33048), whose recovery test printed no skip line. Medians (m3-max-33017, msi, before/after interleaved, us per call): one chunk, copy alone 60.6/59.6 -> 44.4/41.6, the copy after a fill 58.1/58.2 -> 44.3/41.6; 128 chunks about 10 us lower on average, within the runs' spread. |
||
|
|
85a91d182c |
RUNTIME 2367: Queue plan: a device made with its least plan reserves what its plan reserves, no more
The 2080 round 9ce951f521-1115-0907 failed
reserved_queues::a_device_with_no_queue_to_spare_reports_the_reserved_queue_absent:
"11 asked, 11 reserved; no message", where queue_plan(families, u32::MAX)
spares 10 (NVIDIA's graphics family of 16 less the round robin's floor of
four and presenting's two). Asked for 11, the plan takes 4 + 2 + 10 plus the
staging and fill queues, 18 VkQueues; the driver refused that for want of
channels (um790's kernel log: "kchannelAllocMem_GM107: Could not create
Channel" 19 times at 10:01 and 13 at 10:02, while the 780 s run that ended
10:04:38 was at the test), and made_within_resources took least_queue_plan:
queue_plan_within(families, options.reserved_queues, {1, 0}), a round robin
of one and reserved min(15, 11) = 11. 11 is what only that path gives.
So a device short of resources gave the caller more reserved queues than the
same device given them, and skipped the reserved-queues-absent message,
though the least plan's notice and the runtime README say it keeps the
plan's reserved queues. least_queue_plan now reserves as many as the
device's own plan (within options.queue_limits) reserves; its round robin
of one always leaves room for them, so no fewer either.
Tests:
- queue_limits::the_least_plan_reserves_what_the_plan_reserves: every
family shape, reservation (0 to u32::MAX), limit and cached flag; fails
without the fix on NVIDIA's shape asked for 11 (11 against 10) and on a
family of 24.
- reserved_queues::a_device_made_with_its_least_plan_reserves_what_its_plan_spares:
the plan refused through refuse_next_devices(1), the device asked for
spare + 1 takes its least plan (its notice heard, round robin 1) and
reserves spare, reporting the rest absent; refused where the least plan
takes no fewer (lavapipe, RADV).
- The test sink records each message's id name with its text, so the
least plan's notice is matched by its code.
Docs: the degrade catalogue (docs/API.md), LeastQueuePlan's rustdoc and the
runtime README's "A driver short of resources" say the reserved count is the
plan's.
Also: queue_share_device's pinned test takes a stay the sharing rule
explains, as its siblings do (test only).
Verified (msi, m3-max-33039): clippy plain 0; lavapipe reserved_queues,
least_queue_plan, queue_limits and the pinned test 16/16. The 2080 run
follows on development.
|
||
|
|
ab139e4b6e |
RUNTIME 2366: Runtime FALLBACK repro bundle at a creation refusal (default-off diagnostic)
What: metal2vulkan-runtime writes the FALLBACK repro bundle the command line writes for its own failures when it refuses a library or pipeline creation, where METAL2VULKAN_REPRO_DIR names a directory (unset, nothing is written). - The CLI's bundle writer moves into the library as the hidden crate-root module metal2vulkan::repro (feature serde), shared by the binary and the runtime. A bundle's directory is named by its content (metal2vulkan-repro-<16 hex>), written under a temporary name and renamed, so an identical failure is written once, across threads, processes and runs. The CLI's own bundles keep their files (input, profile.json, the descriptor files, repro.sh, repro-command.txt, failure.txt); only the directory's name changed, so a bundle written before still replays. - The CLI takes --device FILE in place of --profile: the JSON of a DeviceDescription and DevicePolicy (ReproDevice), which builds the runtime's own compile device. - The runtime hooks each creation where its refusal returns: a library of a metallib, a function's lookup, every compute and tile state (ComputePipelineState/TileState::create_adding: creations, added binary functions, archive adds) and every render state (GraphicsState::create_reflecting). It bundles Unsupported, NotImplemented and Compile refusals but a cancelled compile and a name the library lacks (Metal's own nil); never Invalid/Nil/MetalError. The bundle holds the library's bytes, device.json, the request as the CLI's options and descriptor files, and failure.txt with the call, the refusal and what the command does not replay. That list comes from a full destructuring of the compute, tile and render descriptors (and the stage functions): a new descriptor field fails to compile in repro.rs until it is replayed or listed. - Bounded: at most 32 bundles and 256 MiB per process; past either nothing more is written and one line says so. Written on the refusing thread; the call returns the same refusal; a write failure is said once. Each bundle is named in one line through the device's message sink (id name metal2vulkan-repro). The runtime's metal2vulkan dependency gains serde. - Not bundled: mesh states (no CLI mesh path), a dispatch's or draw's later variant, driver VkPipeline makings, Metal-source libraries. Docs: env_vars registry, README CLI, docs/HOWTO.md section 4, the runtime README's Errors section, the CLI help. Tests: runtime CPU tests of the bounds (a tally with the seam's limits); a lavapipe/GPU device test (ob3_stage_input with no stage-input descriptor: one bundle with the expected parts and command, device.json rebuilding the runtime's compile device by profile fingerprint and answering the same refusal, none for a second identical refusal or a missing name, none without a directory); CLI tests replaying library-written runtime bundles (compute, and render with a vertex descriptor) through repro.sh to the same FALLBACK, and --device compiling what --profile does. Verified at ae56b195e9 (msi, m3-max-32986): metal2vulkan cli, api_surface and api_signatures 25 passed; runtime repro tests 9 passed; clippy -p metal2vulkan -p metal2vulkan-runtime all targets, all features 0. Lavapipe (m3-max-32978): repro_device writes one bundle that the CLI replays to the same refusal; a second identical refusal writes nothing. |
||
|
|
0b6f72ac29 |
RUNTIME 2362: Scheduler: a copy queue's command buffer keeps commit order behind a held batch
What: a head on a queue made for copies (Device::new_command_queue_for_copies) no longer
goes before an earlier-committed batch of another queue it conflicts with because that
batch gives way. The order's comparator (scheduler/mod.rs is_behind) treats a held batch
that gives way as one that keeps its place when the head's queue keeps commit order
(Standing::commit_order, from CommandBufferShared::keeps_commit_order: the queue's kind,
set by the copy queue's constructor). Such a head waits behind it in the scheduler when
tracker::ordered says the two conflict, whether the held batch waits for its pipelines'
making, a host step or its checks. Once the held batch is submitted, the tracker orders the
copy after it on the GPU: the copy engine's VkQueue waits for the other VkQueue's timeline,
or a barrier where they share one. There is no wait on the host. A copy that shares nothing
with the held batch still goes. Unchanged:
- plain queues keep the give-way exactly as before (order.rs, Held batches give way), so the
Iris Xe compositor case is untouched;
- a held batch ON a copy queue stands to a later plain queue's commit as any held batch does
(the rule is the head's);
- a batch held for an event value or a binary semaphore's signal the program has not given
holds back no copy (Stops).
Why: the copy queue's documented promise is that a copy reading what another queue's
command buffer committed before it wrote waits for that command buffer on the GPU. A
command buffer of a blit and a new pipeline's first dispatch, held for the pipeline's
making, gave way to a copy committed right after it on the copy queue. The copy ran first
and read the bytes from before the blit: the consumer's copy queue on an RTX 2080, and a
plain second queue on MoltenVK, round 0 only, always the new pipeline's first dispatch. The
give-way rule (
|
||
|
|
5ba7afd9d4 |
RUNTIME 2360: Shader cache: no default directory makes a memory-only device, never a failed one
With no caller directory and no home (USERPROFILE on Windows, HOME elsewhere), default_directory answered Err and CacheSetup::of turned it, and any failure to open the default path, into Error::ShaderCache, so every device creation and adoption failed. Metal never fails device creation over its shader cache, and the default is the runtime's choice, not the caller's (owner rule 2). - The Windows default is %LOCALAPPDATA%\metal2vulkan (the local application data folder, read from the environment; no new dependency). XDG_CACHE_HOME and USERPROFILE are no longer read there. - default_directory takes its environment as a closure (CacheSetup::of_in), so a test feeds its own without touching the process's. - Where the caller names no directory and the default does not exist or cannot be made or written, the device keeps its cache in memory alone: the Store has no directory, every lookup is absent, every write is refused with no filesystem call, the scans do nothing, and writers ask has_directory first so nothing is encoded for it (a translated function still is: its encoded length weighs it in the memo). The device says so once as it is made, as the existing degrade notice ShaderCacheEntryNotWritten naming why; each entry it does not write counts in write_failures. The driver's pipeline cache data is not read back, and the device checks' verdicts are not encoded. - A directory the caller names that cannot be used is still Error::ShaderCache. - Device::shader_cache_directory answers Option<&Path>: None for such a device. Docs: the shader_cache module docs, ShaderCacheOptions::directory, write_failures, Error::ShaderCache, the degradation's declaration and its docs/API.md entry, the runtime README (Windows default, error table), HOWTO, create.rs's list of environment variables. api_signatures re-blessed; docs/REFUSALS.md regenerated (a refusal's site function renamed). Tests: tests::shader_cache's default-directory and no-directory-store unit tests (plain gate), and the lavapipe/GPU device test shader_cache_no_directory: a device made with an empty environment and no caller directory is made, has no directory, makes four render states with two functions translated once, writes nothing, and its notice is heard once. Verified (msi): m3-max-32796 clippy plain 0, 67/67 shader_cache and degradation tests, api_signatures 0, clippy x86_64-pc-windows-gnullvm 0; m3-max-32797 (lavapipe) clippy m2v_cpu_icd 0, 61/61 shader_cache and in_place_check, including the no-directory device test. |
||
|
|
8ba1fd7d67 |
RUNTIME 2358: Host RAM copies: a repeated copy takes the plan kept of it, where its buffer, the device's figures and its imports are the plan's
A copy by dispatches spent most of its encode on work that depends only on its runs, its
buffer and the imports it reads through: cutting the runs into pieces, the chunks' ranges,
the pieces' places in the imports, the table and the dispatches. A consumer repeats the same
copy (a surface's same runs) every frame.
Such a copy's plan is now kept per RAM per device (RamCopies, which ChunkKeys becomes):
direction, runs' form, buffer key (object id, device generation, length), the runs, the
blit_at VkBuffer and byte, the device's figures (window, alignment, workgroups, array), the
span and total, the chunk ranges and joined ranges, the import serials in order with the
chunk-to-imports map, the table and the dispatches. The next copy with the same key (runs
compared element by element, no hash trusted) takes the table and dispatches where:
- blit_at gives the same VkBuffer and byte (a rebind or a new VkBuffer plans anew);
- the device's figures are the same;
- every chunk takes at once (copy_take Now for all; else the full path stages it);
- copy_imports gives the same imports, by serial number, in the same order, with the same
map. RamChunk now carries a serial from a process-wide counter, never reused, so a chunk
released, given back or imported again has a new one. Plans keep numbers, not Arcs.
Every step a copy takes each time still runs: blit_at, copy_wrote, the takes, copy_imports,
the upload, the binds, the uses and the counts. Where the plan does not hold, what it took
(blit, takes, imports) goes to the full path, which takes none twice: a chunk released
between the takes and the imports plans over the imports it got.
Bounds: 8 plans and 4 MiB per RAM per device, the one taken longest ago dropped first; a
plan over 4 MiB is not kept. Counter: WorkCounts::host_ram_copy_plans_reused.
stages() is split into takes() and Takes::staging() so both paths share the takes;
record_dispatches() is the dispatch tail both paths record through.
Tests: unit, the bounds; device (lavapipe): a repeated copy takes its plan and a run
changed, the other direction, another buffer offset, another buffer, a rebound no-copy
buffer each plan anew; a chunk let go of (idle, given back) makes the next copy plan anew
and the one after take the new plan; a new use of the RAM plans anew; a kept plan's copy
is ordered after a fill of its buffer and after a scatter into its pages in the same
command buffer.
The plan also holds the buffer's host pages weakly and compares them by
identity: lavapipe gave a rebound buffer's new VkBuffer the destroyed
one's handle value (m3-max-32579), so a handle match alone cannot see a
rebind. The plan names no VkBuffer; the binds take the live one on every
call. The pages copy's kernel is looked up only where a copy goes by
dispatches, as before. The layer bench says how many copies a kept plan
recorded.
Measured (release, msi lavapipe, m3-max-32581, before
|
||
|
|
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). |
||
|
|
0ca24685d7 |
RUNTIME 2351: Textures over buffers: Metal's allocation bound counts the last texel, a heap's size and a no-copy buffer's pages
A texture over a buffer whose texels run past the length was answered nil where its rows' padding ended past the length rounded up to 16 KiB. The M3 Max (macOS 27.0.1, the consumer's limits runs, every buffer kind and length bisected) makes more: - A 2D texture and a texture buffer count to their last texel, not the last row's padding: a 2D R32Uint 64x64 from 256, rows 512 apart, over 20000 bytes is made with its last texel at 32768 (rows' end 33024); a texture buffer of 32768 R8Uint texels at a bytesPerRow of 36864 over 20000 bytes is made. Arrays keep their rounded slices' end. - A heap's buffer is bounded by the heap's size, counted from the buffer's start, whatever its length or place in the heap (4 MiB heap: made to 4194304, nil at 4194305). - A no-copy buffer is bounded by its pages: its pointer's offset in its 16 KiB page plus its length, rounded up to 16 KiB, from its start (16384 bytes starting 4096 short of a page's end: made to 32768). BufferFacts now carries the buffer's allocation (own, a heap's size, a no-copy buffer's page offset), filled from Buffer::heap, host_backing and contents; BufferFacts::allocation_end gives the bound. Buffers under 16 KiB keep no bound (the M3 Max answers nil past 128 KiB there, the x86 Macs make every end measured), and an array whose last texel lies inside the length is still made: no new refusal. Such a texture stays a copy, as before at the old bounds: a 2D texture or array is a shadow image whose copies in and back go through its tail (texture/route.rs Route::Past -> TextureShadowReason::PastLength, announced shadowed-texture), a texture buffer's functions view its tail (into_texture_buffer, staged-texture-buffer). The texels past the length live in the tail, zero when made; the caller's bytes past a no-copy buffer and a heap's other bytes are never read or written. Tests: tests::linear_plan::a_texture_ends_where_metal_s_allocation_of_its_buffer_does (each kind's and form's M3 boundary, made at it and nil one past; the made rows past the old bound fail before this change); device tests in buffer_tail_device (a heap's buffer to its 64 KiB heap's size, a no-copy buffer at page offset 12288 to 32768, a padded 2D texture to its last texel): made, every path reads and writes right, the buffer's CPU write inside the length is read through the texture, shadow copies counted, no other memory touched, one row more Metal's nil. docs/API.md's accepted difference, REFUSALS.md regenerated. Evidence (lane jobs, msi): m3-max-32369: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0; linear_plan|buffer_texture 34/34 incl. tests::linear_plan::a_texture_ends_where_metal_s_allocation_of_its_buffer_does (the M3's boundaries per kind and form, made at E, nil at E+1). m3-max-32370 (lavapipe): 13/13 buffer_tail_device + allocation tests incl. a heap's buffer to its heap's size, a no-copy buffer to its pages, a 2D texture whose last texel ends at the allocation: every path (get_bytes, blit, kernel) reads as made, writes coherent with the buffer's bytes inside the length (shadow copies counted: such textures are shadows / staged texture buffers through their tail), neighbours untouched, one row more Nil(PastAllocation). Negative control and the PHOENIX run follow in the lane. Lane commit: 263219d515. |
||
|
|
f851c07e52 |
SEMANTICS 2123 / RUNTIME 2349: Texture buffers past maxTexelBufferElements bound through views of their parts
Metal makes texture buffers of up to 2^28 texels on every Mac; one texel
buffer view holds at most the device's maxTexelBufferElements (2^27 on ANV
and lavapipe, 2^26 on MoltenVK), and the binding of a wider one was refused
(BindError::TexelBufferTooLarge).
The consumer now states with a texture buffer's binding the views its texels
take (BoundTexture::Buffer::parts, bind::texel_buffer_parts: 1 within the
limit), which its shape carries. A slot whose function only reads, writes,
updates by an atomic or asks the width of the texture buffer, on a device that
indexes texel buffer arrays NonUniform, states RuntimeFact::TexelBufferParts;
where the shape binds more than one part there, the plan asks for the parts
variant (VariantKey::texel_buffer_parts). Under it the slot is an array of
the parts' texel buffers: texel i is texel i - k*P of part
k = min(i / P, parts - 1), P the device's limit rounded down to its texel
buffer offset alignment (bind::part_texels), and the width (parts - 1) * P
plus the last part's. texel_ranges writes one range per part at its array
element (DescriptorRange::element), and the runtime views each.
Each part is the device's own view in the format one view takes, so a read
converts its texel as the one view does: no precision note. A texture buffer
one view holds keeps one view, no variant and its key. The families row
TextureBufferWidth is exact where the parts reach 2^28.
Still refused (TexelBufferTooLarge): a slot read through a sampler or used beyond read/write/atomic/width; a device
without NonUniform indexing of that kind of texel buffer array; formats with several texels a block. Argument-buffer
texture buffers past the limit stay the heap neutral (unnamed-texture-unviewable). New: WorkCounts::texel_buffer_parts_bound,
RuntimeFact::TexelBufferParts (appended), bind::part_texels / texel_buffer_parts, BoundTexture::Buffer.parts,
TextureShape::Buffer.parts (serde default 1), VariantKey/LoweringInputs.texel_buffer_parts (hashed only when non-empty),
DescriptorRange.element. SEMANTICS_VERSION bumped: input once refused now translates.
Evidence (lane jobs, msi): m3-max-32343 at 628264de17: clippy --workspace --all-features --all-targets -D warnings 0;
41 metal2vulkan tests incl. golden_hashes_match_the_table (every fixture's SPIR-V unchanged on every profile: one part is
byte-identical), the binder test (an under-limit slot: no parts entry, empty variant, layout counts 1), the interpreter
parts test (robust and unrobust), api_surface / api_signatures / refusal_surface; families::states_follow_their_sources;
lavapipe texture_buffer_width_device (R32Uint limit+64 texels: both sides of the limit and the last texel read and written,
past the end reads 0 and writes dropped, texel_buffer_parts_bound +3) and buffer_tail_device. Without the fix the device
test fails at bind: TexelBufferTooLarge{elements 134217792, limit 134217728} (m3-max-32140). ANV (2^27) is down; the XTX
(2^29) never parts.
Lane commits: 9fbf7d3c14, 7f7f3ad95e, 9a745ffb3c, 740e9e43dd, 628264de17.
|
||
|
|
45e6784e91 |
RUNTIME 2348: ICB records the GPU never wrote are read in place, not staged
On a device that places indirect command buffer records by first use (no unified memory, a staging queue), a host access of records in device-local memory was staged whenever a command buffer held them or the buffer was Private: the records it read were copied down through the staging queue and waited for, counted, and staged-indirect-records announced. That held even where the GPU never wrote the records, though then the host's buffer holds exactly what device-local memory does. The XTX conformance replay of development |
||
|
|
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.
|
||
|
|
ef64727c7a |
RUNTIME 2345: Host RAM: a first gather over bytes some use may write is staged in a part of its own, never through imports made or waited for on the encoding thread
stages() staged a gather over chunks the device's thread imports only where no use but a copy's read may write its host bytes (RamOnDevice::written_over). That holds for the whole copy as soon as one chunk it touches had a scatter recorded (copy_wrote, never cleared) or a buffer over host pages lies over its bytes, so a first fill over a fresh RAM after any download into one of its chunks took the imports' path: for_copy imported each chunk not imported yet on the encoding thread (the ahead plan imports no range alone). A consumer's decoder waited 1.73 s for 124 such imports on an RTX 3090 (each pins 64 MiB of fresh pages). Such a gather is now staged as one over a chunk that takes no import is when written: in a part of its own (Staging::after_the_gpu), its host step after the work before it in its command buffer completed, on the steps' thread. Its encoder keeps no log (an encoding again through the imports would start no part, so its parts would not be the first's). Docs: copy.rs, deferred.rs, docs/HOWTO.md. Tests: host_ram_copy_device::a_first_gather_over_chunks_a_scatter_wrote_waits_for_no_import (a scatter then a gather in one encoder over two chunks not imported, the thread's imports held in flight): the gather is staged, waits for no import, imports no range, reads the scatter's bytes; two later fills of its pages (a later encoder, a later command buffer) land after its read. Benches (ignored, release): host_ram_first_fill_spread_bench, host_ram_layer_encode_bench. Evidence (lavapipe, msi): negative control m3-max-32190 (the test against the parent's copy.rs fails: not staged, 600 ms waiting on two paused imports); with the fix all 92 host_ram tests pass (32190); clippy cpuicd -D warnings clean and the extended test pass at the tip (32210). First-fill bench after a 1-page download: before staged 0, 121 chunks imported on the encoding thread, call 1369 us (32174); after staged 1, 0 import waits, 0 chunks imported by the copy, call 328 us (32210). The 3090 run follows. Lane commits: e70fea0886, f50ee551c3, 9e74f43df1, ab6d8af756. |
||
|
|
43bb61c60e |
RUNTIME 2344: Runtime: a command queue on the copy engine, and buffer copies merged into runs
Device::new_command_queue_for_copies() answers a CommandQueue whose command buffers submit to the device's copy engine (the staging queue's family of transfers alone), or None where the device has none to give (MoltenVK, lavapipe, RADV by default, a copy engine of one queue, an adopted device). Its VkQueue is the copy engine's third queue where it has one, else the fill queue's, whose submissions then take that QueueSlot's lock: NVIDIA's copy engine has two queues, staging's and fill's, and staging must wait for no work in flight. The slot is the last of the device's VkQueues, after presenting's; its family stays out of image sharing (buffers already share it as the staging queue's family, so no ownership transfer is recorded). Its command buffers take blit encoders alone, and of their commands buffer copies, fills and fences: other encoders and blit commands are refused (Invalid, Problem::CopyQueue(CopyQueueProblem::Encoder | Command)), as is a caller's VkBuffer not concurrent with the copy family (Buffer). A copy batch takes buffers' fills alone from first work. Barriers on its VkQueue name the copy family's reads (Barrier::record_reading), not the primary family's, which a family of transfers alone may not name beside ALL_COMMANDS (VUID-vkCmdPipelineBarrier-dstAccessMask-02816). A blit encoder's consecutive copy_from_buffer_to_buffer calls between the same two VkBuffers that its order needs no barrier between are recorded as one vkCmdCopyBuffer of many regions (copy_run.rs), on every queue; counted as WorkCounts::buffer_copies_merged. Batches on the copy slot are counted as WorkCounts::copy_queue_batches. Verified: not yet built (first build job follows). Also in this landing: - Copy queue: docs, and the device test's None answer checked against the device - Copy queue: keep the copy queue's place alive while the families are counted Evidence: lavapipe 425/425 (m3-max-32049), clippy m2v_cpu_icd and m2v_gpu -D warnings (32049, 32053); XTX m3-max-32073: default RADV answers None; RADV_PERFTEST=transfer_queue: 1 batch on the copy engine, 63 of 64 row copies merged, sync file signalled, bytes right, refusals typed, validation layer silent. The derived API table and docs/REFUSALS.md were re-derived on the merged tree (winport's #[cfg(unix)] gates landed beside copyq). |
||
|
|
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). |
||
|
|
7ba0cd9fe6 |
RUNTIME 2343: GPU times placed by a calibration still beyond 20 us are announced and counted
A calibration pair is read again while the smallest deviation so far
states more than 20 us (`gpu_time::SETTLED`), four readings at most
(`least_deviation`). Where the least of four still stated more (93 and
125 us on the RX 7900 XTX under full parallel suites: a reading's
deviation holds the time its thread spent off the CPU), the runtime
placed the command buffer's GPU times by it, inside the command
buffer's life, with up to that error, and said nothing. Owner rule 2:
a near-equivalent is recorded and announced.
`GpuClock::span` now answers `Placement::Loose { deviation }` where the
pair places both times inside the life and its deviation exceeds
`SETTLED` (a pair outside the life is still set aside as before).
`Placement::read` gives the notice for every placement the first read
of a command buffer's GPU times announces, counting a loose one:
- new kind `Degradation::LooselyCalibratedGpuTimes`,
`loosely-calibrated-gpu-times`, class Precision, announced once per
device at the read (the site `uncalibrated-gpu-times` uses), its
reason stating the deviation; not `uncalibrated-gpu-times`, whose
cost says the times are placed by the completion, where these are
the pair's, the duration exact;
- new `WorkCounts::loosely_calibrated_gpu_times`: command buffers
whose times a read found placed so, counted at the read that
announces, so the count is nonzero exactly where the kind was
announced.
Tests: `tests::gpu_time::a_pair_still_beyond_the_settled_deviation_is_
announced_once_and_counted` feeds `least_deviation` a fake source of
four readings above 20 us (Loose, the kind with the deviation in its
reason, each read counted, announced once) and settled ones (Iris
Xe's 165 then 7.6 us; 20 us exactly: Calibrated, nothing), and a loose
pair outside the life (Disagreed, the uncalibrated kind, not counted).
The lane's `gpu_times` expects the kind exactly where counted, and holds
the count nonzero exactly where `calibration_deviation_most` exceeds
the slack (no disagreement); `read_kinds` adds it where counted
(mesh_draws), `disagreeable_kinds` allows it (first_use); a site const
`LOOSE_GPU_TIMES` takes it. The conformance cases that read GPU times
(`command-buffer-facts`, `empty-command-buffers`) allow its notice:
the host's load decides it, and every value still compares exactly.
docs/API.md's catalogue lists the kind; api_signatures.tsv blessed.
|
||
|
|
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. |
||
|
|
ec0be064d0 |
RUNTIME 2342, SEMANTICS 2122: Texture buffers read through argument buffers sit in texel-buffer heap classes
A pipeline whose argument buffers hold texture buffers was refused with ArgumentBufferTextures (NotImplemented, no location): the translator's heap layout (lower/texture/slot.rs declare_heap) had no set-1 class for a texture_buffer member, so SPIRV-Cross-shaped tier-2 argument buffers (descriptor sets as [[buffer(n)]] structs with texture_buffer, texture2d and sampler members) could not be made, on any device. - Set 1 gains texel-buffer heap classes: UNIFORM_TEXEL_BUFFER for read, formatless STORAGE_TEXEL_BUFFER for read_write and write. The class follows the facts' texture type. - DescriptorCaps gains update_after_bind_uniform_texel_buffer and update_after_bind_storage_texel_buffer; where a device lacks them a typed needs_any_of names the missing features. Non-uniform texel-buffer indexing and the without-format read/write needs are checked as for images; link counts STORAGE_TEXEL_BUFFER with the images against the update-after-bind limits. - New public bind::heap::HeapElement::TexelBuffer(vk::Format). - The runtime writes each live texture buffer's texel view at its resource ID, with a neutral texel view at element 0; a gone texture buffer's Texels stay alive until its tickets clear. A texture buffer whose bytes cannot be viewed in place (staged, tail-viewed, offset off minTexelBufferOffsetAlignment, past maxTexelBufferElements, swizzled, or a non-direct format) reads the neutral and is announced through the existing UnnamedTextureUnviewable. No new Degradation kind. - docs/REFUSALS.md and api_signatures.tsv regenerated. Test: runtime_lane::argument_texel_buffers::a_texture_buffer_in_an_argument_buffer_is_read_in_both_stages (an owned fixture in SPIRV-Cross's shape): vertex and fragment read a texture_buffer member of a set-0 argument buffer, the fragment also samples a set-1 texture2d through the sampler beside it; every pixel must equal texel[1] + texel[4]*tint + albedo. Verified: lavapipe with the validation layer, m3-max-31658 at 6626eeaff3: pass. Control m3-max-31636 (the fixture and test at the base, without the fix): fails with exactly the ArgumentBufferTextures NotImplemented refusal. |
||
|
|
1b5a527f5e |
RUNTIME 2340: Scheduler: a host step at its gate whose batch's uses are known keeps its place
What: since |
||
|
|
734e1cac02 |
RUNTIME 2339: Bind a slot read at its residual over a range its bind offsets share
What: bind::instantiate::shared_range gives a descriptor-form slot of a Bounded window that its functions read at the residual one range for a run of bind offsets of the bound buffer: the padded buffer from 0 where it fits the view's maximum range (and 4 GiB), else the block of half that maximum its window starts in, to the maximum past the block's start; its SlotBindOffset residual the rest. A window of at most half the maximum never straddles its block's range; a longer one, or one at or past the padded end, keeps descriptor_range's range. planned_range takes it for every Bounded storage view (no function reads one at its bind offset alone), and for a uniform view where the new BindState::uniform_views_at_residual says the consumer reads every uniform view at its residual: its keys all take their residual forms. The runtime states it where pipeline::reads_views_at_bind does not hold (every device today: no driver carries DriverFact::ConstantOffsetUniformReadsPreloaded), through AtBindViews, at each bind state that states the view base alignment (render, compute twice, tile dispatch). Shapes, plans and keys are unchanged; the flag is not part of the shape. Why: a constant reference at a buffer index (constant float4 &) is a uniform view of a 16-byte Bounded window, whose range started at the bind offset with residual 0. Every offset-only rebind (a consumer's staged setVertexBytes: setVertexBuffer at the next 256 bytes of an upload chunk) then wrote another descriptor: rebind_into, push_set and the driver's vkCmdPushDescriptorSet at every draw (reims-vgpu's Iris: +538 ns a draw against a device pointer, +93 inside the push and +99 under record). The range at the bind offset serves only keys reading the view at the bind offset alone, which no device takes today: the shader already adds the residual. Now such a draw keeps its set-0 writes (writes_kept) and pushes only its residual, as a device pointer's draw does. Metal and Vulkan: each read inside the window reads byte lo + (bind - lo) + m = bind + m, the bytes it read before, through the same instructions. A read outside the window, which Metal leaves undefined, reads the buffer's bytes inside the range. The range starts at 0 or a block multiple, a multiple of the base alignment (VUID-VkWriteDescriptorSet-descriptorType-00327/00328), stays within the view's maximum (00332/00333) and the padded allocation (VUID-VkDescriptorBufferInfo-range-00342); a dynamic descriptor's offset is its start as before (VUID-vkCmdBindDescriptorSets-pDynamicOffsets-01971). Verified: by the jobs that follow (unit tests of shared_range and planned_range, the lavapipe runtime test constants_moved_along_one_buffer_keep_their_set_zero, the release medians of runtime_lane::constant_offsets before and after). With (bench and tests): 78463d1e1d The moved-constant set-0 test counts every second draw again as taking every step in builds with debug assertions; 5e7d715629 The moved-constant set-0 test lists which of the second pass's draws were rebound; 99a3459dc6 The moved-constant set-0 test moves the vertex constant alone, as constant_offsets does; a9c4b07790 The moved-constant set-0 test names what the second pass's draws did where some were not moved; 5e938c75c5 The moved-constant set-0 test draws the bench's shape; a bounded storage window's dispatch test binds the shared range; 69e598a6b5 Drop the stale copy of the range-from-bind-offset test; round-trip the new BindState field; ea4602012c cof_device reads its float4 at the instance's element; cd6492fd41 constant_offsets also draws over chunks in host pages, under the consumer's policy; 4d6e17bb89 constant_offsets takes the AIR library trait into scope; 1221f53ce0 Time draws that rebind a constant reference by offset against a device pointer. Compiled in m3-max-31548 (msi: clippy, lavapipe uniform_bind_offsets/draw_again/general_form/inline_continues/ kept_shadowed_draws 48/48). The set-0 test fails at the base (16 writes pushed, want 0; 31536). Release counts (31392): set-0 pushes per constant draw 1.00 -> 0, push constants 0 -> 1.00. The new fixture's golden rows re-bless on development. |
||
|
|
5fcd8be7de |
RUNTIME 2337: A pass's first draw that samples a color the pass clears reads its copy cleared to the clear, with no barrier too
A draw that samples a texture its own pass renders reads the texture's shadow, a copy taken before the pass's load actions (texture/attached_reads.rs). In a pass that clears the color, a first draw that sampled it with no barrier read the texels from before the pass at every pixel it read: the M3 Max's answer, while both x86 Macs read the clear there (probe ownread: no draw before it, so the load and the draws before it wrote only the clear). The copy was cleared to the clear (Texture::cleared_copy, vkCmdClearColorImage) only after a memory barrier before the pass's first draw. The Macs disagree, so Metal's answer is either; the macOS guests are x86 ones, and a clear of the copy costs less than a copy of the texture. RenderLowering's draw now takes the cleared copy for every draw that samples a color the pass clears before any draw of the pass recorded, wherever Texture::cleared_copy holds (a whole single-sampled 2D texture of one level and slice that one color renders in place), with a barrier before it or none; the draw keeps nothing to draw again, as after the barrier. A pass that loads the color, and every read outside cleared_copy, read as before. Tests: attachment_reads' no-barrier lane becomes a_first_draw_with_no_barrier_reads_its_pass_s_load, Load and Clear over both target kinds, the texture of its own image taking the cleared copy (attachment_read_clears) and reading the clear where the pass clears; check() counts a cleared copy as taking no split's place with no barrier. framebuffer_fetch gains a_first_fetch_after_a_clear_reads_the_clear (a fetch after a Clear reads the clear, not the texels from before the pass). The conformance rows pass-start-barrier-*-sample with no barrier accept the clear too, as the -read rows did. docs/API.md's accepted differences and attached_reads.rs's docs say which Macs answer what. Verification: the jobs that compile and run it are reported with this sha. With: 645f1c3323 snapshot_reads' first test makes its readers' pipelines before the counted pass; af0a44cc6d The render lanes and inline-split tests read their fixtures where the test runner names the crate; 8b5cd6dfb4 attachment_reads' first-draw lane lets a target over a buffer's bytes take the cleared copy too (test-only). The user's GitHub issue 17. Compiled in m3-max-31319 at 8b5cd6dfb4 (clippy x3; lavapipe lanes, the first-draw lane, the fetch-after-clear lane, the 14 pass-start-barrier conformance rows exact and default; the negative fails). |
||
|
|
7b1725eb34 |
RUNTIME 2336: Lay no more of a predicated loop's copies than keep its waiting host steps within 16
On RADV, runtime_lane::predication::every_dispatch_form_runs_in_each_pass_past_the_copies ran 40-77 s alone and passed its 60 s wait for one command buffer under the suite. The cost is the runtime's, not the test's breadth: each piece of work a host step records after the GPU's work before it (an indirect dispatch of a kernel that observes its partition, an indirect command buffer's execution inside a block) is its own batch, a round trip to the host (submit, wait for the GPU, record, submit) in every run of a loop's laying, whether its copy's pass runs or skips. A loop was laid down as 64 copies (16 inside another), bounded only by its commands (LAID_BUDGET), so the test's inner DoWhile of 20 + 1 passes inside a DoWhile of two laid 1024 copies of its body: measured on lavapipe at the base (msi job m3-max-31287, a timing probe), its command buffer's first run recorded 4097 host steps and made 8195 submissions (6145 and 12291 on the device without device addresses, whose step form records six such pieces a pass), where its 21 passes ran 84 (126); the DoWhile of 100 passes 257 (385). That command buffer was 94% of the test's 21,772 submissions, and each costs a GPU round trip, a few milliseconds on RADV. copies_of now bounds a loop's copies by a second budget too: the work apart whose host step waits for the GPU (Deferred::gpu_written) that its copies lay down, at most WAITED_BUDGET (16), counted as LAID_BUDGET counts commands, from the first copy's, inner loops' copies included (Predication::waited, Looping::waited_at). A loop of no such work keeps its 64 or 16 copies. A loop that ends before its copies pays at most 16 round trips for the copies it skips, and one that runs past them one more round trip, its check, per 16. The run-again path, unchanged, takes any count of copies down to one. Tests: every_dispatch_form_runs_in_each_pass and the failing test assert each loop's first run records at most 16 host steps and the check (257 and 4097 at the base: the negative control); the 100 passes no longer run again exactly once. docs/API.md and docs/RUNTIME-PORTING.md name the new bound. With abd0662e9f: the budget trades nothing for accuracy, so it has no FAST-PATHS row. |
||
|
|
5efe2f1d73 |
Test queue limits count the program's live command queue handles
The runtime tests' default queue limits count the queues the program holds, not live ones The check that fails a test needing the queue plan counted live queues (QueueShared). A command buffer holds its queue's QueueShared, and the runtime's threads let a completed one go a moment after its wait returns. So a test that let a queue go and then made two more could fail or pass by timing. The check now counts the command queues the program holds a handle of: - each QueueLine counts, under cfg(test), the command buffers alive whose `commandQueue` it is; - a queue the program made is held where its strong references outnumber those command buffers plus the caller's upgrade (QueueLine::held_by_the_program, Line::program_queues_held); - a command buffer takes its count before its handle of the queue and drops it after, so a count in passing reads one fewer, never one more. The product's count of live queues (WorkCounts::command_queues_live_most) is unchanged. The device test a_default_test_device_fails_where_its_work_needs_the_plan now keeps a command buffer of a queue it let go before making the third. The live-queue count panicked there; the held count does not. The message reads "while the program holds 2 of its command queues". docs/VALIDATION.md and TEST_QUEUE_LIMITS' doc say the same. The command buffer's count among its queue's is a guard held for its drop: _counted Clippy (-D warnings) refused 3d6e4e5957's field `counted`, never read: the field exists for its Drop, which takes the command buffer's count off its queue's. Named _counted, as a guard held for its drop. The test limits' check runs where the program makes a queue, not where a recovery places one again With the held count, a recovery's queue that took its place on the new generation counted itself and the program's other queues. So device_recovery's a_loss_holds_the_hang_s_queue_until_the_recovery and work_held_unsubmitted_at_a_loss_fails_as_its_victims_in_queue_order (two queues each) failed on lavapipe at 577d649100. The rest of the suite passed: 2741 of 2743. The check now runs in Device::command_queue, for a new round-robin or unshared queue of the program's, before its place. A queue placed again after a recovery was counted where it was made. Verified: job 31249 at 1f69cb2e0c: clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; queue_limits, queue_limits_device and device_recovery on lavapipe three times (22/22 each); the runtime suite on lavapipe 2743/2743; a negative control (the old live count) fails at the third queue. Test-only (cfg(test)). |
||
|
|
fdea9b585a |
RUNTIME 2333: On a device whose image uses miss buffer writes in one VkCommandBuffer, an end-recorded render pass joins after byte writes and splits only where its images meet them
A render encoder whose pass records at its end joins a group after byte writes, split before its pass where it meets them On a device where DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer holds (the RTX 3090), State::join_fold let a render encoder join no group whose earlier encoders wrote bytes. Every render encoder after a compute or blit write of any buffer then began a VkCommandBuffer of its own: a chain of dispatch, draw and copy took 7 VkCommandBuffers where it took 1 elsewhere (render_fold at pin 96). The defect is narrower: an image use after a buffer write over the image's memory in one primary. The join now stands on that device as on any other, and the split goes before the pass where the pass uses such an image: - Each draw a pass recorded at its end notes its uses apart, into its secondary (EncoderCore::record_aliased); where one uses an image whose memory meets the bytes noted written in the VkCommandBuffer (the group's FoldOrder::byte_writes and the encoder's own), the encoder owes a split (AliasWrites::noted_apart). - The first command it then records into the VkCommandBuffer, a shadow's copy before a later draw or the steps and pass at its end, whose uses hold the attachments', goes in a new one where it owes one or its own uses meet the writes (AliasWrites::meets). An unordered encoder's shadow copy now takes the check too (EncoderCore::shadow_command). - A pass whose first instance records inline still joins no group (Fold::admits): its draws record from the first on. render_fold's counts go back to one VkCommandBuffer for the chain on every device (no lane's pass uses an image over written bytes). heap_textures gains the render analogue of the measured lane: a blit's copy into a tracked heap's buffer, then a render encoder's draw reading the texture over those bytes (recorded at its end), its pass loading and storing that texture (at its end), and a draw reading it in a pass recorded inline, each asserting every texel is the copy's, the join, and a split where the fact holds for the two recorded at their end (none for the inline one). The render functions are an owned fixture, examples/heap_draws.metal. A texture reached through a heap made resident (useHeap:) is a read of the heap's bytes, which meets no write; alias_split.rs says so. Verified: cargo fmt; the fixture's regen check (metal-as round trip, LLVM 21 llvm-as). Clippy, the runtime and validation suites and the device runs (the 3090 with a negative control, a non-splitting device) follow. alias_split: a write after a draw noted apart, over its image, splits before the pass; use_heap guard lanes The draw-time check of the narrowing (a render encoder whose pass records at its end joins a group after byte writes) checked each draw recorded apart only against the writes noted by the time of the draw. A command recorded into the tail after that draw, but before the pass (a shadow's copy, or an emulated mesh or tessellation dispatch writing guest bytes), adds writes the draw's images were never checked against. The draw still runs after them, inside the pass the encoder records at its end, in the same VkCommandBuffer: the defect the split guards (DriverFact::ImageUsesMissBufferWritesInOneCommandBuffer, the RTX 3090). AliasWrites now also notes the memory the images of the commands recorded apart use (`apart`). That list is per encoder and bounded like the writes: at most 32 keys, each key's ranges joined into one, and past that every range meets. note() sets the owed split where a new write meets one of those images. The check is now order-free: every image a pass's draws use is checked against every write recorded before the pass. begun() clears the writes and the debt but keeps `apart`, since those draws still run after whatever the new VkCommandBuffer records before the pass. The draw-time check and the write-time check share one bounded range set (`Noted`). UseRange::image_bytes gives an image's place as shares_memory takes it. The draft's scope sentence about useHeap: was wrong (devlegs agrees). A texture of a heap made resident is its own Used::Texture token. bind's used_uses lists it for any function that reads a texture, and resident_uses_into gives it a Texture::bound_use image use. Two heap_textures lanes now guard that path. In each, a blit writes the heap buffer, then something reads the texture over those bytes only through an argument buffer, with use_heap and no setTexture: - a draw of a pass recorded at its end (read_argument_fragment); - a dispatch (read_argument_kernel). Each asserts that every texel shows the write, that the encoder joined the blit's group, and that the split count is > 0 exactly where the fact holds. The lane enum is TextureUse now (it covers a dispatch), the function blit_write_then_texture_use. The fixture heap_draws.metal gains the two argument-buffer functions (regenerated with scripts/regen-air-fixtures). Verified: cargo fmt; the fixture regen (metal-as round trip, LLVM 21 llvm-as). The unit test a_write_after_a_draw_noted_apart_over_its_image_splits_the_next_command fails without note()'s new check. Builds, clippy and the device runs (with a negative control on the 3090) follow in jobs. Verified: job 31175 at ceb7e56415: clippy -D warnings (runtime and validation, all targets and features), the alias_split unit tests 6/6. Job 31177 on lavapipe (--cfg m2v_cpu_icd): 25/25 (the blit-write lanes, a_buffer_write_shows_in_an_overlapping_texture, the 13 render_fold lanes at the non-split counts). Job 31176 compiled the --cfg m2v_gpu archive. The 3090 tip and negative control and the 780M (31189) and the 5080 entry are pending. |
||
|
|
3625b90721 |
SEMANTICS 2121 / RUNTIME 2331: A kernel's unit-axes variant, taken once made, never waited for
A kernel's unit-axes variant: the translator and the binding plan
In a threadgroup of one thread along an axis (Metal's threads_per_threadgroup 1
there), every thread's thread_position_in_threadgroup on that axis is 0 and its
thread_position_in_grid is its threadgroup's position, partial threadgroups
included. A kernel whose emulated simdgroups are walked predicated only because
such a position steers a synchronization (a simdgroup sum in a loop whose trip
count reads gid.y, the shape of a depthwise convolution dispatched in 8x1x16
threadgroups) pays the predicated walk's live flags and votes for nothing.
- lower::simd::uniform tracks per-lane masks for vectors of up to 8 lanes, and
takes the lanes of thread_position_in_threadgroup and thread_position_in_grid
on the unit axes LoweringInputs::unit_axes names as uniform.
- A kernel walked predicated (divergent::barriers, workgroup::check) states
RuntimeFact::UnitAxes { axes: 0, relief }: bit m-1 for each mask m of axes
under which fewer of its synchronizing blocks stay divergent (one analysis
for all three axes, then the six others only where that one relieves).
- VariantKey::unit_axes compiles the variant; its module states
UnitAxes { axes, relief: 0 }.
- BindingPlan::unit_axes_variant offers the variant to a dispatch whose
threadgroups have one thread along relieving axes, where the plan's own
variant runs it; the variant's plan sends any other dispatch back
(dispatch_variant, NeedsVariant).
SEMANTICS_VERSION 2121: a predicated kernel's artifact states a new fact.
No new Degradation kind.
Test: engine_simd_unit_axes (lavapipe's profile, CPU interpreter, 8/16/32
lanes): predicated without the variant, unpredicated with it, Metal's words
in both; the variant traps at two threads along y (Vulkan's barrier rule), unit
x relieves nothing, and a kernel steered by x is offered no variant for unit y.
The runtime takes a kernel's unit-axes variant once it is made, never waiting
A direct dispatch whose plan offers the unit-axes variant
(BindingPlan::unit_axes_variant) takes it only where its translation is
done and each of its regions' VkPipelines is made (pipeline/unit_axes.rs).
Otherwise it settles on its plain variant, which gives the same answers,
and the variant is begun: its translation as a piece on the pipeline pool,
kept by the state (piece_holds.rs), at the first such dispatch; its objects
and pipeline notices on the program's thread at the next (no piece announces
a notice), with its regions' makings handed to the pool as any dispatch's
are. Nothing waits for the translation or a making. A dispatch planned
meanwhile is kept neither in the state's latest plans nor in its encoder's
memo, so a later one asks again. A refused translation or a failed making is
remembered, the plain variant then running those dispatches; the state tracks
at most VARIANTS such variants at once, and they live among its VARIANTS
others.
The dispatch that begins it is recorded for a later process's warm pass,
which compiles the variant and makes its regions beside the plain variant's.
The one-row and emulated-simdgroups variants are still compiled on the
encoding thread when a dispatch first asks (ComputePipelineState::settle ->
variant -> Variant::compile); this path does not follow them.
WorkCounts: unit_axes_variants_begun, unit_axes_dispatches,
unit_axes_meanwhile. No new Degradation kind. docs/API.md section 3 and the
bind module's docs state the rule and the variant; api_signatures.tsv
blessed.
Test: tests::unit_axes (m2v_gpu / m2v_cpu_icd): a 16-thread threadgroup
kernel whose simdgroup sum sits in a loop steered by gid.y; 4x2x2 never begins
the variant; 8x1x2 begins it once, runs on the plain variant meanwhile, then
settles on it, Metal's words every time.
A unit-axes variant's objects are made under its state's lock of begun variants
Two dispatches of one state could both find a translated variant gone from
the begun set while the first made its objects, and the second begin its
translation again. The first now makes them under the lock, as variant()
compiles under the lock of the state's variants.
Public: RuntimeFact::UnitAxes { axes, relief }, VariantKey.unit_axes,
LoweringInputs.unit_axes, BindingPlan::unit_axes_variant; WorkCounts
unit_axes_variants_begun, unit_axes_dispatches, unit_axes_meanwhile. No new
Degradation kind.
Verified: job 31119 at 58f7ef3c21: workspace clippy under --cfg m2v_gpu,
metal2vulkan with no feature and each feature alone, rustdoc -D warnings.
Job 31118: metal2vulkan + runtime suites 5187/5188; the one failure is the
golden hash table (24 cells of rfs_async_copy_{1,2,4}, the expected
SEMANTICS change), re-blessed on development. Job 31098 at c7f44ff865: the
engine test tests::engine_simd_unit_axes and the runtime test
tests::unit_axes on lavapipe. Iris compile-only replay of a guest's records
(31117): one depthwise state takes the variant (driver estimate 2.47M ->
0.57M cycles, spills 179:340 -> 0); the GPU-time A/B is pending.
|
||
|
|
e7b9c5bfdc |
RUNTIME 2329: A GPU route's commands are drawn one draw per command in the replay variant, indexed
The GPU route of a rate-mapped pass's host step drew each command's corners in its merged variant: a non-indexed draw of every index, which loses the indexed draw's vertex reuse and looks its command up per vertex. On the Iris Xe the wide frame's pieces took 74.2 ms against 48.0 ms when the host read the records (job 30850). Now the step reads back each command's VkDrawIndirectCommand and its index entry (the device address of its first index and its index size, bind::DRAW_INDEX_ENTRY_BYTES, now public), resolves the index address to its Metal address through the resident set's ranges and the live table's, and draws each command as the host draws a record it read: indexed where it is, with its instances, base vertex and base instance, in the state's replay variant (BufferForms::Replay), each draw pushing the command's own slot tables at its PushHole::RootTableAddress holes (CommandTables). The commit's settle begins the replay variants for the routed executions. The corner cutting in the piece loop goes: an indexed routed draw is cut into index ranges as any. Tests: the pixel and depth test asserts indexed draws are recorded on a routed frame; the count test runs three frames, the host step making no pipeline on any and nothing made at all on the second and third. Public: bind::DRAW_INDEX_ENTRY_BYTES (api_signatures, api_surface). Verified: job 30942 at the branch tip: clippy for metal2vulkan and the runtime, the runtime under --cfg m2v_cpu_icd, the runtime and validation under --cfg m2v_gpu; the two route tests on lavapipe. Job 30922: lavapipe suites 78/78, API tests 15/15, rustdoc -D warnings; a negative control (the change reverted but its tests) fails the pixel test with 0 indexed draws recorded. The Iris and 3090 GPU-time A/Bs are pending. |
||
|
|
a7e519150b |
RUNTIME 2326: Scheduler: a host step held at its gate gives way but to writers of its reads
What: a batch held for its host step, once the step took its gate, kept its place in the order across queues, so every later commit of any queue whose footprint conflicted with it waited host-side until the GPU work before the step completed and the step recorded. A step whose uses commit could not bound (shadowed textures, tile memory, a visibility query, an inherited function table) conflicts with every batch that makes a tracked use, so it held every queue, the compositor's unshared queues included. On an RTX 3090 a rate-mapped pass executing a GPU-written indirect command buffer held every queue's commits for the 89 ms pass before it in its command buffer. Now such a batch gives way, as it already did before its gate (the x86 Macs take a later commit of another queue first; the M3 keeps commit order), but for a later commit that writes what the step reads on the host (its executions' records and ranges), which the gate does not cover, or that shares a fence with it. The batches after it on its line give way with it. A step whose host reads are not known (staged gathers and scatters, indirect dispatches, loop checks, predicated executions, indirect sparse updates) keeps its place from its gate on, as before. How: Held keeps the step's host reads as a footprint when the gate is taken (CommandBufferShared::step_host_reads, step_reads without the bounded-uses requirement; Footprint::of_uses); place_of answers GivesWay for it; the order's comparison for a batch that gives way checks fences and, for such a step, a later write of its reads. Order itself is unchanged. Docs: the scheduler's and order.rs's rules, gate_of, WorkCounts, and the host-replayed-indirect-commands notice (degradation.rs, docs/API.md). Verified: tests::held_step_order on lavapipe, three legs (results in the report): an unshared queue's fill while the pass waits at its gate, the pass bounded and not, goes with no look held behind it; a reset of the records the step reads still waits behind the pass's batch. Before this change the unbounded leg's fill went 111.40 ms after its commit, 0.2 ms before the pass (m3-max-30848 at cd77de72d8, 3 looks held). Also in this landing: cd77de72d8 Test: an unshared queue's fill waits for no other queue's host step. RUNTIME 2326: an unchanged artifact's later commits on other queues no longer wait behind a host step held at its gate. Proof (m3-max-30854, lavapipe): held_step_order's unknown-uses leg 0.17 ms after commit, 0 looks held (base 111.40 ms, 3 held); a reset of the step's records still waits. Negative control m3-max-30866 (the old gate condition): that leg fails, 125.03 ms, 4 looks held. |
||
|
|
58de9ba9a1 |
The runtime's own device tests take four VkQueues by default, not the plan's 18
What: in the runtime crate's test build, DeviceOptions::default() carries queue limits of a round robin of two VkQueues and none for presenting (TEST_QUEUE_LIMITS), beside the staging and fill queues: four on NVIDIA's families, where the queue plan takes 18. Outside the crate's own tests the default is unchanged (None, the plan), and on RADV's and lavapipe's one graphics queue the limits leave the plan as it is. DeviceOptions' Default is now written out (every field named) so that its queue_limits can be the test default there; the API signature table is re-blessed for the derive moving to an impl, which changes nothing for a consumer. A test whose work needs more than the default gives on a device with queues to spare (the program's third command queue, unshared or not; a presenting queue; reserved or extra queues; a read of the queue sharing) panics where it asks for it, on every device, and makes its device with `queue_limits: None`: the runtime lane's LANE_QUEUE_LIMITS rule, whose failure is the device's metal2vulkan-queue-limits-reached and so is said only on a device with queues to spare. Here the check reads no plan, so a lavapipe run finds every such test. least_queue_plan and many_devices measure the plan and take it. Why: NVIDIA's driver makes and destroys one device at a time across processes, and each VkQueue adds to both. Measured on the RTX 3090 (620.70.06, a probe build that timed each phase of a device's opening and teardown, m3-max-30672): alone, vkCreateDevice took 540-575 ms and vkDestroyDevice 163 ms of a device test's 1.17 s (priming 129-142 ms, loader and instance 93 ms, the runtime's own phases under 25 ms); at 12 threads 55 device tests took 66.9 s, 1.2 s each, no less than one at a time, their vkCreateDevice a median of 8.1 s and vkDestroyDevice 2.8 s. On the RTX 5080 Laptop GPU a device of 2 queues took 145 ms against 445 ms with 17 (DeviceOptions::queue_limits' measurement). Verified: tests::queue_limits::the_tests_default_devices_take_four_of_nvidia_s_eighteen_queues (no device: NVIDIA's families give 4 VkQueues under the default, 18 at the plan; fails without the change, whose default is the plan) and tests::queue_limits_device::a_default_test_device_fails_where_its_work_needs_the_plan (on the device the cfg selects: the third command queue, an unshared one past it, a presenting queue, a read of the queue sharing and a reserved queue each panic under the default, and a plan device makes each). Also in this landing (the lane's later commits): - 1edf6b494a The runtime tests' default queue limits fail a test by its live command queues, not its made ones - 9a2bfa7bc5 Tests that ask for reserved or extra queues take the queue plan - b9e7cd775b Tests that keep more than two command queues live take the queue plan Proof (m3-max-30836 at b9e7cd775b): clippy plain and cpuicd 0; the no-device tests 33/33 (the_tests_default_devices_take_four_of_nvidia_s_eighteen_queues: 4 of 18 placed); lavapipe runtime suite 2732/2732. Negative control m3-max-30752 (default_queue_limits returns None): fails at the 4-of-18 assert. No RUNTIME bump: the product default is unchanged. |
||
|
|
b585744208 |
Boxed draws: the constant's numbers count the three draws the patches frame still fanned out
GEOMETRY_TRIANGLE_WORK's doc (
|
||
|
|
f40cc8595b |
RUNTIME 2325: A rate-mapped pass's host step decodes GPU-written records on the GPU (its GPU route)
A render pass over a rasterization-rate map that executes an indirect command buffer the GPU may write goes to the host step. There the host read every record, decoded it and drew each command through the probe and the fan-out routes. On the consumer's RTX 3090 that step took 44.7 ms of a 65.8 ms frame, reading 781 records a frame. The only rule its executions broke was the rate map's. At a host step that fans the pass's triangles out, an execution whose records the GPU may write, and which takes its merged GPU form once the rate map's rule is passed over (the cause.rs decision), now takes its GPU route (render/executions/gpu_route.rs): - The step records the form's prework: the head, the preprocess and the two merge passes. It copies each command's first corner and the merged draw's two VkDrawIndirectCommands to the host, submits that with a fence and waits, as it does for its probe. - The host reads those words and no record. Each command that draws becomes one direct draw of its corners in the state's merged variant, with the merged header pushed (RenderLowering::merged_header). - The probe and the routes take those draws as they take commands the host read: probed, then fanned out, boxed, in parts or region by region. A long corner draw is cut into piece-sized ranges, as an indexed command is. - The host reads the records as before where the total reaches MERGED_CHUNK corners, where the prefix does not rise to the total, or where the prework did not complete. RenderExecution::record_gpu's prework moves into RenderExecution::prework, which both paths share. The replay loop takes a GPU route's corners beside the records the host read (Replayed, StepCommand). The new counters are WorkCounts::rate_map_gpu_routes and rate_map_gpu_route_wait_nanos. Tests: - New, tests::rate_mapped_gpu_route. Eight commands of a buffer that inherits the encoder's pipeline state: grids, one in two instances, one without indices, and the large, medium and wide triangles the probe flags. Each command is nearer than the one before, under LessEqual depth and half-alpha blending. It asserts no record read, one route, one probe and three flagged draws, and that the colour and Depth32Float bytes equal the encoder's own draws. - Changed, tests::host_step_rules. Its empty command, through the route, counts as nothing_to_probe. Also in this landing (the lane's later commits): - d2728b735e: the step's commands are one vector of reads or of corners (no per-command enum of 3.3 KB); clippy. - 51afad9359: HostReplayedIndirectCommands' cost names the GPU route's second round trip (the notice's text changes). RUNTIME 2325: an unchanged artifact's rate-mapped host step now decodes GPU-written records on the GPU, and the notice's text changes. Negative controls (m3-max-30703): the plan.rs lifts reverted fail a_merged_draw_s_variant_fans_out (NotImplemented(RasterizationRateMap)); the route turned off fails rate_mapped_gpu_route's counts ([8, 0, 1, 3] against [0, 1, 1, 3]). |
||
|
|
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. |
||
|
|
acd25fd445 |
RUNTIME 2323: NVIDIA's RTX 3090 image uses miss a buffer's write in the same VkCommandBuffer: such a use goes in a new one
runtime_lane::heap_textures::a_buffer_write_shows_in_an_overlapping_texture,
a_heap_texture_metal_compresses_keeps_the_driver_s_compression_by_default and
an_adopted_device_stating_host_image_copy_aliases_its_heap_textures failed on the RTX 3090
(NVIDIA 620.70.06) at pins 93b and 94 (m3-max-30259, 30260, 30491, 30492): a Shared heap's
64x64 RGBA8Unorm texture, a linear image in the heap's memory, read all 4096 texels as they were
after a copy into a buffer over the same bytes. The encoder trail (each encoder its own
submission) passed at the same archive (30469), and so did the trail half of 30552 at
|
||
|
|
7c223b02e4 |
RUNTIME 2320: A host step's notice names every GPU-form rule its pass breaks; rate-mapped steps that probe nothing are counted by why
What: where `commit` keeps a pass whose indirect commands the GPU may write from the GPU form, and the `host-replayed-indirect-commands` notice of that first rule is to be announced (`Device::announces_host_step`, a peek that counts nothing), the decision runs again passing over each rule once named (`render/executions/cause.rs`'s `Passed`, `DeferredPass::rules_past`), and the notice names every rule past the first that the pass breaks too, each judged as though the rules before it were kept: the rate map's as though the pass had none. A rule the rest takes its answer from (the commands' one primitive type, the pipeline state and its kind, the inherited state's tessellation, vertex function and tile memory, the buffer's size, a refusal) is never passed over. The commit path is unchanged where the notice was announced already: the first rule decides, as before. Three WorkCounts fields count the rate-mapped passes a host step records without a probe: `rate_map_steps_unfanned` (no fan-out: policy, features, memoryless attachment, shadowed texture), `rate_map_steps_nothing_to_probe` (no command read) and `rate_map_steps_probing_none` (commands read, no draw probed); with `rate_map_probes` they count every such pass once. Why: the consumer's walk of a 3D renderer sees one notice, naming the rate map, so whether a GPU form for rate-mapped passes would cover its pass (rules past the rate map) is unknown; and about half a host step a frame there probes nothing, for no counted reason. The notice's text changes (a RUNTIME bump at landing). API: three public WorkCounts fields (api_signatures.tsv blessed); nothing removed. Verified: tests::host_step_rules on lavapipe (an indexed triangle and an empty command of a GPU-written buffer, executed in a rate-mapped pass: the rate map's notice names that rule alone; with a visibility result mode set, the notice names the visibility rule, then the rate map past it, which fails without this change; the counts: probed once each, the empty command's pass probing none). Also: host_step_rules: the buffer inherits the encoder's pipeline state; Degradation::HostReplayedIndirectCommands says its notice names the rules past the first. Verified (lane icbgpu, msi m3-max-30616 at eec7881980, lavapipe): clippy -D warnings plain and --cfg m2v_cpu_icd 0; 74/74 over host_step*, icb_*, indirect_command_buffer*, notice_command_buffers, rate_map*, rate_mapped*, degradation*, trail_gpu_forms and draw_shape_notices, the new host_step_rules among them; api-signatures --check clean. Landed (main) at once: the hand negative control, gpucfg clippy and rustdoc run after. RUNTIME 2320: the notice's text and what a run records change. WorkCounts gains rate_map_steps_unfanned, rate_map_steps_nothing_to_probe, rate_map_steps_probing_none. No Degradation kind. |
||
|
|
257bdd7d14 |
SEMANTICS 2117 / RUNTIME 2319: GPU-written ICB records naming released or reused state IDs run what a Mac runs
What: two changes to how an indirect command's record names a pipeline state the program released. 1. A record's state word gains a bit, KERNEL_PIPELINE (layout::KERNEL_PIPELINE = 2, CommandRecord::kernel_pipeline, RecordView::kernel_pipeline). A kernel's pipeline setter writes it wherever the token names a state. A kernel's copy carries it with the pipeline word, and its "reports" test now reads RETAINED alone. A kernel's compute reset keeps the bit beside RETAINED. Metal's reset leaves the command executing with the pipeline it had (measured on the M3 Max and the M4: reported cleared, run by the next dispatch). For a kernel's write, that pipeline is the state the write resolved, so the retained pipeline keeps saying the kernel wrote it. The CPU's compute reset does the same. The CPU's pipeline setter clears the bit, and a record the CPU wrote never carries it. The replay's state-word check and decode accept the bit; either bit beside no pipeline is still malformed. Where the bit is set, the runtime's host step, getter and identifier ignore the state the CPU set and resolve the ID by its holder as the GPU last could write it. Case 4 (the CPU set x, x released, y took the ID, then a kernel writes the state) now runs y, as the M3 Max and the 5300M do; before, it ran x, announced. Case 5 (the kernel writes only the buffers) runs x unannounced, as every Mac does. The host step no longer guesses, so the "Unsure" announcement and may_name_another are gone. 2. The device keeps the program of each freed pipeline state ID's last holder (FreedPrograms): one per ID, dropped when any state takes the ID. Every live indirect command buffer of the device holds the store and the device holds it weakly, since a program holds its device. A buffer the GPU may write takes the store's programs at its first such write. Case 1 (x released before the write, its ID taken by no one) now runs x, as the M3 Max and the UHD 630 do; the Radeon Pro 5300M fails the command buffer instead. Where Macs disagree, the cheaper answer is taken: failing the CB would need a failure path decided mid-flight in a host step. Bound: one program per freed ID that no state retook, so at most the peak count of live supportIndirectCommandBuffers states plus placed IDs, kept only while an ICB of the device lives. Still announced (ReleasedCommandState, the command runs nothing): a state released while no ICB of the device lived, and one past the ID's last four holders. SEMANTICS_VERSION 2117: kernels that set pipelines now write the state-word bit, so their SPIR-V and golden hashes change (re-blessed on development). api_signatures blessed for the new field and method. No new Degradation kind. RUNTIME_VERSION is left to the landing. Tests: indirect_commands::tests::records (a_kernel_s_pipeline_is_told_from_the_cpu_s, plus the random field round trip with the bit). The engine_indirect_commands expectations of kernel writes carry the bit, and the kernel reset keeps it. Runtime: released_programs (the freed store's one program and its release on take) and notice_command_buffers (a host-step Unrun now reached through a kernel's write of a state released while no ICB lived). Validation runtime_lane: indirect_host_steps (case 1 runs the template; the forced notice past four holders and while no ICB lived; case 4 runs the flat template; case 5 runs the template unannounced) and indirect_executions (the GPU-writable copy case no longer announces). Run on lavapipe in the lane's msi job; the results go in the lane report. Also: Pin the notice of a state released while no buffer of commands lived; Replay tests: the kernel's pipeline bit runs, an unknown bit faults. Verified (lane relstate, msi m3-max-30537): clippy --cfg m2v_cpu_icd exit 0; runtime tests 24/24; validation tests 113/113 on lavapipe, the new released-state cases 1, 4 and 5 among them. Landed (main) at once: the plain clippy and translator rerun (m3-max-30546) and the hand negative control (m3-max-30555, steelbrain/relstate-nc) run after landing; the engine golden hashes of kernels that set pipelines are re-blessed on development. RUNTIME 2319: what a GPU-written record naming a released or reused state runs changes. |