c83dcdd3843cc3993fcdb1e26b6bdd818e415dd8
73
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c83dcdd384 |
Give the predication step ops that drop, hold and resume a range, and check a unit's end
The steps this packet landed as, in order: - Answer command predication as Metal does on an M3 Max under macOS 27.0.1 - Probe Metal's command predication from the validation crate's Metal platform - Wait for the predication probe's command buffers through the bounded wait - Name the record a predication block left open came from in its command buffer's failure - Refuse a run's first indirect dispatch of another dispatch type at Metal level 26.7 - Read an encodeEndDoWhile's word only where it closes a live DoWhile - Run command predication on devices without buffer device addresses - Nest predicated loops to any depth, their copies bounded by what they lay down - Read a predication word past its buffer as Metal reads it - Halt a predication unit where a loop runs past its copies - Name the lane's fixed loop case type, which clippy found too complex Content: the tree of `development` at ef8b74ec1b, unchanged. |
||
|
|
0d9e71903b |
Read VK_EXT_provoking_vertex: provokingVertexLast and provokingVertexModePerPipeline
The steps this packet landed as, in order: - Write the index rewrite pass's primitives in either provoking vertex order - Draw Apple's last provoking vertex: a last-vertex pipeline, else lists led by it - Test Apple's provoking vertex modes against Metal's on the device - Describe the provoking third way as pipeline-dependent; fix the table test - Check the last provoking vertex through a geometry stage; key its slice notice on stages - Test that executions keep the first vertex; scale the weights check by the values - Register rt6_provoking in the engine inventory and golden printouts - Add host_ab's provoking workload: flat-shaded draws at provoking vertex modes 0 and 1 - Add the index gather pass: one dispatch for a run of direct draws' lists - Gather direct indexed draws' lists in runs: one dispatch per run, not three per draw - Add the rotated-weights variant: Metal's barycentric weights from a rotated triangle - Count private lists' gathers under a last-vertex pipeline; take the open runs whole - Draw listed triangles' barycentric weights through the rotated-weights variant - Draw every provoking vertex mode past 1 the third way, its top bit set or not - Announce nothing for a provoking-mode draw that makes no primitive Content: the tree of `development` at 91b1df7b21, unchanged. |
||
|
|
9adc8a867a |
Draw Metal's private primitive types 5 to 8 as the lists Metal draws
The steps this packet landed as, in order: - Test the private primitive types' draws against Metal's lists on the device - Check the private draws through the weights' geometry stage too - Use is_multiple_of and as_chunks in the private lists - Fail a draw of primitive type 9 as Metal's GPU does - Give the private-types fixture its golden printout and inventory rows - Discard what a hang's queue schedules during it, and time the hang as measured - Regenerate REFUSALS for the type-9 runtime changes - Read Metal's quad primitive ID under private quads and quad strips - Read a type-9 hang's Scheduled at Metal's time, not at its held last batch - Schedule a hang's queue's command buffers from the hang's Scheduled on - Stop a hang's thread waiting on a failed command buffer; keep storage-form commits on their last batch - Hold a hang's joined command buffers behind a closure, so Rustdoc ends Content: the tree of `development` at 5441a97bda, unchanged. |
||
|
|
787d92fdc2 |
Answer a heap texture's allocatedSize from the place that holds it
The steps this packet landed as, in order: - Answer a kept heap texture requirement before asking the device's limits - Answer whether a command buffer or submission uses given objects, cloning nothing - List devices' registry IDs without making devices, and open one by its ID - Give a made pipeline state's reflection from its compile, after its creation - Enable optional device extensions where each device can, and say which it enabled - Let a caller vouch for its host pages' write permission, skipping the kernel's answer - Import read-only host pages from the caller's dma-buf source, and say whether a device takes shared pointers - Hold a texture of Apple's private usage 0x8 alone to what Metal does with it - Measure RADV 26.2.4 on the RX 7900 XTX: its pointer imports follow their address - Free a no-copy buffer's dma-buf imports before its keep-alive goes - Measure a file's pages mapped under a live RADV pointer import, a known gap - Let what waits for a dma-buf import's free go as its fields drop Content: the tree of `development` at 0a38130573, unchanged. |
||
|
|
7b8ebc5b3e |
Use AtomicU64::try_update, the name fetch_update now has
The steps this packet landed as, in order: - Refuse buffer-texture copy layouts whose rows pass u64::MAX instead of wrapping - Wait without a deadline for a timeout past the host's clock, and test copies at the buffer's edge - Place a multisampled buffer copy's rows where plain Metal does, staging off-texel rows - Say that Metal copies the multisampled layouts the runtime still refuses - Count the rows a compressed-texture blit rewrites, and test a copy out off the texel Content: the tree of `development` at e5ff75b136, unchanged. |
||
|
|
1d15b13eb7 |
Complete a queued commit its own work refused
The steps this packet landed as, in order: - Pin the runtime sources with a refused queued commit's completion Content: the tree of `development` at a62e8a365f, unchanged. |
||
|
|
6da0b55c4b |
Leave a commit's own work behind a render encoder's end in flight, on request
The steps this packet landed as, in order: - Regenerate the refusal surface and pin the runtime sources with commits behind the lowering thread Content: the tree of `development` at 770f8bce10, unchanged. |
||
|
|
e3ade73ace |
Run a fragment's quads whole through MoltenVK 1.4.2 without shaderQuadControl
The steps this packet landed as, in order: - Withhold MoltenVK 1.4.2's blend warning of attachments it cannot blend - Measure the M3 Max at MoltenVK 1.4.2, named apart from the M4 - Say what queue_storms measured at MoltenVK 1.4.2 plainly - Make a heap's set layout MoltenVK's support query refuses only where it runs it, announced Content: the tree of `development` at 285be2f493, unchanged. |
||
|
|
1505f4f5b3 |
Lower a render encoder's end on the device's lowering thread, on request
The steps this packet landed as, in order: - Regenerate the refusal surface and pin the runtime sources with the end on the lowering thread Content: the tree of `development` at bf576119ea, unchanged. |
||
|
|
59f83d5bd4 |
Lower a render encoder's logged calls on the device's lowering thread, on request
The steps this packet landed as, in order: - Regenerate the refusal surface and pin the runtime sources with the lowering thread Content: the tree of `development` at e282080dd5, unchanged. |
||
|
|
19ccb91916 |
Log a render encoder's calls and lower them after they return, on request
The steps this packet landed as, in order: - Regenerate the refusal surface and pin the runtime sources with the logged render encoder Content: the tree of `development` at f3cfaa3feb, unchanged. |
||
|
|
b94953dfa9 |
Resolve GPU-alone work's resident set at the first submission, not by recording it again
Content: the tree of `development` at 3f5472f696, unchanged. |
||
|
|
d218c939a4 |
Encode again at a rebind an encoder whose only host-page use is its end copy back, and its GPU-alone work
Content: the tree of `development` at 3c7d40aea2, unchanged. |
||
|
|
b30642f159 |
Merge a GPU replay's draws of one list type or points into one draw in the translator
The steps this packet landed as, in order: - Draw a GPU-written render execution of one list type or points as one merged draw - Reset an indirect command buffer's records on the GPU with one fill - Regenerate the refusal surface after the merged draws, rebased onto development - Regenerate the refusal surface over the host-step cause Content: the tree of `development` at 99ae896ad5, unchanged. |
||
|
|
15400171f0 |
Name the rule that sent a render execution to the host step in its notice
Content: the tree of `development` at 6c685a586b, unchanged. |
||
|
|
31421e12b9 |
Bind set 0's buffers at dynamic offsets and find a command's set 0 among its command buffer's
Content: the tree of `development` at fa2a26bda6, unchanged. |
||
|
|
4a286a459a |
Send GPU-written compute executions to the host step where it runs them faster
The steps this packet landed as, in order: - Set the runtime version and pin the runtime sources at the merged tree - Set the semantics version and pin the runtime sources after the render GPU form - Bless the golden hashes at the merged tree - Bless the authored compile census at the merged tree - Regenerate the refusal surface at the merged tree - Pin the runtime sources after the compute indirect command cost rule - Regenerate the refusal surface after the compute indirect command cost rule Content: the tree of `development` at f4a0642491, unchanged. |
||
|
|
f05f8a5a94 |
Count a replayed draw's misses of the buffers its slot tables do not hold
The steps this packet landed as, in order: - Run GPU-written render commands on the GPU alone, and let a check state what it looks for - Say that a check of every kind runs on the GPU alone where the records rule out both kinds - Pass what the check looks for in the compute lane's checked execution - Add host_ab's icb_draws workload: a kernel writes the draws of Apple's GPU-encoded ICB sample Content: the tree of `development` at 665d587ae2, unchanged. |
||
|
|
83ecf464ec |
Make a long new host-visible buffer in fresh pages imported by pointer, with nothing written
Content: the tree of `development` at 12606c508c, unchanged. |
||
|
|
3d9304798d |
Add host_ab's icb workload: a kernel writes compute commands that a second encoder executes
The steps this packet landed as, in order: - Run GPU-written compute executions on the GPU alone by indirect dispatches where the device has no generated commands - Run a concurrent encoder's GPU-alone execution with no barrier between its commands Content: the tree of `development` at 343b1abcb4, unchanged. |
||
|
|
f864c34b29 |
Replay GPU-encoded draws on the device: replay-bound vertex and fragment functions and a draw preprocess
Content: the tree of `development` at bd0d482965, unchanged. |
||
|
|
651dcbd8f4 |
Read which commands a function may write into indirect command buffers
The steps this packet landed as, in order: - State what an indirect command buffer's records may hold, from every route that writes them Content: the tree of `development` at 9a885fa69c, unchanged. |
||
|
|
62370dc95a |
Fetch a BGRA8 or RGBA8 shadow's texels through its own view in cut merges
Content: the tree of `development` at ed95238f3d, unchanged. |
||
|
|
7f28814948 |
Destroy a block's buffer of addresses with no vkQueueSubmit under way, and make no buffer in the memory log
Content: the tree of `development` at ff17d7c868, unchanged. |
||
|
|
7ef86a35d8 |
Hold a kernel's static half threadgroup arrays as typed Workgroup objects
The steps this packet landed as, in order: - Pin the runtime sources after the typed threadgroup step's doc edit - Take the device's sin and cos as Metal's fast ones in a fast-math module on MoltenVK - Write the typed threadgroup region test's module as a plain string - Convert a plain class's half texel by the device's conversion on MoltenVK - host_ab: compare each gpu kernel's output between the sides - Share an imageblock slice write out to the whole threadgroup where one invocation writes it - Copy a half slice's cell bits straight to a half-bits slot Content: the tree of `development` at b0e2bd6190, unchanged. |
||
|
|
d01ed34d37 |
Add DeviceOptions::assume_unmeasured_identity: run a measured device as an unmeasured GPU
The steps this packet landed as, in order: - Pin the runtime sources at the switch on the development base - Blend fast-math colors into BGR10_XR_sRGB and RGB10A8_2P_XR10_sRGB as the linear forms do - Name a placement heap texture the heap does not make at an offset inside it Content: the tree of `development` at 3386fdcac8, unchanged. |
||
|
|
fab21259b7 |
Make a compute state's first dispatch pipeline at its creation, and one form per key on MoltenVK
Content: the tree of `development` at 52fe66739d, unchanged. |
||
|
|
33e89bd482 |
Fit mesh, compute and tile pipelines to ANV's compiler word bound
On ANV a pipeline whose largest stage module passes 400,000 words under the exact forms is retranslated with those forms dropped until it fits; render pipelines already were, and now mesh, compute and tile pipelines are too, announced as exact-forms-over-compiler-limit with the kind of pipeline state named. New Device::fit_mesh_variant, fit_compute_pipeline and fit_tile_pipeline for pipelines linked from stages compiled ahead. The known gap is gone from docs/FAST-PATHS.md. Verified: the fit tests for every kind, 188 translator and runtime tests and the device notice tests on ANV, and 7 of 7 on RADV. Folds in: - Fit mesh, compute and tile pipelines to ANV's compiler word bound |
||
|
|
0a34e8c743 |
Read a per-sample fragment function's pixel reads where Vulkan evaluates them, noted, as Metal accepts them
A fragment function that runs per sample (programmable blending reads its attachment) and also reads [[position]] z or w, [[point_coord]], [[barycentric_coord]] or a centroid varying was refused at link; Metal accepts it and reads each as the pixel's in every sample's run (M3 Max at 4x, measured). These reads now read where Vulkan evaluates them for the sample, with PrecisionNote::MultisamplePosition and its bound (the value's change over half the pixel's diagonal, or across the covered area for a centroid varying). Chromium's Skia Graphite on Dawn (Claude Desktop) made such pipelines. The new test shader is its own fixture, engine/multisample_fetch; engine/multisample is unchanged. Verified: the guest's pipelines compile on six profiles and Claude Desktop draws in the macOS guest on the RTX 5080 with no fatal line; the multisample, point_coord and link tests fail without the change and pass with it. Folds in: - Read a per-sample fragment function's pixel reads where Vulkan evaluates them, noted, as Metal accepts them - Move the programmable-blending fixture entry out of engine/multisample into a fixture of its own |
||
|
|
6898b52edf |
Hold freed memory for the program's own with_vk_queue submissions, and tear the device down on its own thread
On drivers that park freed memory (MoltenVK among them), memory freed while the program's own with_vk_queue submissions may still use it now waits for them, by a mark each use signals. The watch of those marks and the release of freed memory hold only the device parts they use, never the device, and teardown closes the parking first and waits for the handler threads: the program's last drop tears the device down on its own thread before it returns, as Metal's last release does (vkDestroyDevice needs external synchronization and every child object destroyed first). freed_memory.rs is listed among the modules that may keep the device's functions, with that reason. Verified: the freed-memory and teardown tests on ANV, lavapipe and the M3 through MoltenVK (14 of 14 each), the two teardown tests fail without the fix, and the presenting test that crashed in the batch passed 20 of 20 on the M3. Folds in: - Hold MoltenVK's freed memory for the program's own with_vk_queue submissions, by a mark each use signals - Hold nothing of the device in the watch of the program's marks and the releases of freed memory - List freed_memory.rs among the modules that keep the device's functions |
||
|
|
7bc5866f45 |
Draw a multisampled 32-bit float depth copy, announced, where the driver's fragment depth is unmeasured
On a driver whose fragment depth is unmeasured, a multisampled Depth32Float copy is drawn and announced rather than refused. Folds in: - Draw a multisampled 32-bit float depth copy, announced, on a driver whose fragment depth is unmeasured Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
5783db2459 |
Keep a fetched merge's texels in an image copy of its shadow, the kept images held per queue
A fetched merge keeps its texels in an image copy of its shadow where the copy in takes no keep, and kept images are held per queue and taken by any later keep of the same shape once its encoder ended, so merges stop making a new image each time. Folds in: - Keep a fetched merge's texels in an image copy of its shadow where the copy in takes no keep - Keep merges' kept images per queue, taken by any later keep of the shape once its encoder ended Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
e841dd6b4a |
Read the Radeon 780M of Hawk Point as the measured Phoenix 780M, with its own device profile
The Radeon 780M of Hawk Point (PCI device 0x1900) takes the driver facts measured on the Phoenix 780M (0x15bf), the same GPU, and gets its own committed device profile. Folds in: - Read the Radeon 780M of Hawk Point (0x1900) as the measured Phoenix 780M (0x15bf) Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
d77bd86377 |
Compute half + - * and fma in 16 bits under the 16-bit float controls
On a device whose half roundings take the 16-bit float controls (RoundingModeRTE, DenormPreserve and SignedZeroInfNanPreserve for 16 bits with shaderFloat16: ANV and RADV among the committed profiles), a half + - * is now the device's 16-bit OpFAdd, OpFSub or Fma(a, b, -0.0), kept apart, between exact conversions (ops::f16_binary, the form the measured MoltenVK fact already takes). Where shaderFmaFloat16 is enabled too, a half fused multiply-add is OpFmaKHR on 16 bits (new fma::Route::F16Khr), under either policy. Elsewhere the f32 operation and its rounding pair, the round-to-odd routine and native device maths' Fma stay as they were. Exact: Vulkan's precision table lists OpFAdd, OpFSub and OpFMul for half precision, and OpFmaKHR, as correctly rounded, to nearest even under RoundingModeRTE, with denormals kept under DenormPreserve and zero signs under SignedZeroInfNanPreserve, the modes the entry declares where it computes in 16 bits (narrow::computes_in_16_bits). That is Metal's half arithmetic and Metal's half fma, which the round-to-odd routine emulated. A NaN's bits are the device's, as the controlled rounding's already are; Metal's NaN is selected around the instruction where the profile asks for it. The half fma under native device maths no longer records NativeFma there. Why: the device's compiler spent most of a large half fragment function's making on the f32 -> f16 -> f32 rounding pairs, most of which follow a + - * or a fused multiply-add. On ANV a consumer's largest fragment library made in about 4 s, and about 2.2 s without its rounding pairs. New: VkFeature::ShaderFmaFloat16 (the Khronos table, enables, the ash and runtime feature chains, derivation, the codec), OpFmaKHR's feature by its operands' width, the builder's OpFmaKHR on 16-bit floats, and the owned fixture engine/hfb_filter_bank (a 32-case switch of runtime-sampler tap loops and half arithmetic chains) with its engine inventory rows. The validation engine's enable list enables shaderFmaFloat16 from VkPhysicalDeviceShaderFmaFeaturesKHR beside shaderFmaFloat32, and the opened-chains pin records it for the profiles that list it. Docs: docs/FAST-PATHS.md's half rounding row, and the NativeFma notice in artifact.rs and docs/API.md. Verified, as the commits state: - On the UHD 770 (ANV, Mesa 26.2.4) the fixture's fragment library made in 1.74-1.89 s against 4.64-5.26 s before (3 alternating rounds, no driver caches), SIMD8 instructions 25,902 -> 18,736, translation 0.17 s release; driver_deviations::half_arithmetic_answers_as_metal passes there. - On the UHD 770 in the release m2v_gpu build, the groups that failed before the engine enabled the feature pass: candidate engine runs, platform enables and device, engine_render, engine_compute, engine_textures, acceptance_pipelines, the runtime lanes kernel_textures, sparse_textures, renders, argument_buffers and runtime_probe, and the half and fma driver deviations. - Debug translator tests: engine_arith, lower::arith, the fma, derivation, device, ash_interop, cache and fast_paths tests, and the engine inventory's llvm_as parts; engine_native_half (counting the 16-bit operations and their exact conversions) and engine_spirv_cross_forms (no NativeFma where the half fma route is F16Khr), with fused and engine_arith, 213 passed. - clippy of metal2vulkan. |
||
|
|
1ef457d88b |
Refuse an unordered framebuffer fetch and drop interlocked draws' barrier where the driver orders them
Three changes to framebuffer fetch and the pixel interlock.
1. An unordered framebuffer fetch is refused; FramebufferFetchPolicy is deleted. Metal orders a
fragment function's read of its color attachment after every earlier fragment of the pixel,
within a draw and across draws. Where a device offers neither ordered form
(rasterization-order attachment access, or the pixel interlock's storage form where the
pipeline's state lets it be exact), the opt-in FramebufferFetchPolicy::AcceptUnordered
compiled the read as an unordered input attachment with a precision note. An unordered read
can return the attachment before an earlier overlapping fragment's write: a different value
in memory, not a rounding, which the owner's rule allows neither as a default nor as a
switch. No exact form exists on such a device, so the fetch is refused there, as the default
already did. The runtime never ran the unordered form, so no runtime behaviour changes.
- Removed: DevicePolicy::framebuffer_fetch, the enum FramebufferFetchPolicy and its
re-export (and its api_surface row), ProfileFields::framebuffer_fetch,
PrecisionNote::UnorderedFramebufferFetch, and the runtime's note kind of that name, whose
code metal2vulkan-degrade-unordered-framebuffer-fetch is retired; the runtime's
framebuffer_fetch::ordered check; validation's --accept-unordered-fetch on corpus-vulkan,
corpus-moltenvk and corpus-pipeline, and the device worker's framebuffer_fetch field.
- lower::fragment::color refuses a read no ordered form serves (Unsupported{FramebufferFetch},
naming both forms); lower::fragment::fetch refuses a blocked storage form with its blocker.
- The profile's fields change, so every profile fingerprint does.
2. No barrier between interlocked draws' colors on a driver measured to order them. Between two
draws of a render pass instance where the later one reaches a color in the fetch's
interlocked storage form (or an extended-range color's half shadow) that the earlier one
wrote, the runtime recorded a fragment-to-fragment storage barrier on every device. Vulkan
orders such draws by the interlock alone (ordered interlock modes follow rasterization
order, which follows primitive order through a subpass, and the interlocked storage image is
decorated Coherent). A new answer fact, DriverFact::InterlockOrdersDraws, measured on ANV on
the Iris Xe of Raptor Lake-P, drops that barrier there for these colors alone. The fragment
imageblock's storage and the depth stand-in keep their barrier everywhere, as does every
unmeasured driver. RADV on the Radeon 780M still needs the barrier: without it one blend
table case leaves 19 of 495 band results wrong over 5 runs. New lanes:
runtime_lane::interlocked_draw_order (every device, with its owned fixture ido_draw_order) and
the ignored release bench runtime_lane::tile_path_costs (a window server's composite on
Metal's tile path, fixture tgp_composite), with their engine inventory rows. A FAST-PATHS
bullet records the barrier and the fact.
3. A left-out interlock color's framebuffer slot holds a placeholder image. A color attachment
the draws read and write as a storage image in the interlock is left out of their subpass,
but its framebuffer slot held a view of the very image the draws write, which the validation
layer reads as VUID-vkCmdDraw-None-06537 for a draw recorded inline. The slot now holds a view
of a placeholder that nothing reads or writes (DONT_CARE load and store, GENERAL layouts): the
device keeps one for each format and sample count, plus one for each further color of that
shape in the same framebuffer, grown to cover a larger framebuffer and freed once no
framebuffer holds it; none is made per frame. A color whose draws use sample planes, and the
planes' anchor, keep their own image's view. New WorkCounts fields
storage_placeholders_made and storage_placeholder_attachments.
Verified, as the commits state:
- The translator's fetch tests (pipeline::compile ordering, engine_fragment, engine_moved_writers,
device profile fingerprints and serde, fast_paths) keep the refusals; the raster-order-group
read on a device with neither ordered form expects the fetch's own refusal naming both forms.
Validation checks every public fetch case is refused on lunarg-desktop-baseline-2023 and
vk12-floor, and that the command-line flag is gone.
- Iris Xe (ANV) with the fact in place: interlocked_draw_order 3 runs with every texel right,
extended_range_blend_table 17 passed (0 of 495 bands wrong), framebuffer_fetch 49 passed. A
1080p pass of 27 interlocked draws took about 1.08 million GPU cycles with the fact against
1.46 million with the barrier forced (about 9 to 20 us a draw).
- The placeholder lane test (two RGBA32Uint colors over four passes and sizes): placeholders and
slots (2, 2), (2, 4), (4, 6), (4, 8) through the interlock on the RX 7900 XTX (RADV) and the
UHD 770 (ANV), none through input attachments, no validation message. On lavapipe 122 lane
tests and 47 runtime render unit tests passed; on the RX 7900 XTX 94 lane tests passed.
- The engine inventory and llvm_as parts pass for the new fixtures; clippy in every
configuration and Rustdoc -D warnings.
|
||
|
|
6f3730abf7 |
Keep a queue's memoryless color backings across its passes and command buffers, one per shape
A pass that renders a memoryless color attachment into an image of its own (a framebuffer fetch through the pixel interlock reads it, or the pass splits) made a fresh backing image for each pass, held by its command buffer and freed when that completed. On a device without lazily allocated memory (ANV), a 1920x1080 RGBA16Float attachment fetched by about ten passes a frame made and freed a 16.8 MB image each pass, and the runtime's memory log on an Iris Xe showed a 64 MiB image block made and freed up to three times a second, each a fresh allocation the kernel zeroes. Now each command queue keeps those backings (attachment_stand_in::pooled_backing), keyed by the attachment's pixel format, render format, samples, layers and extent. A pass takes a kept one that backs no other attachment of the pass, else makes one and keeps it. The pool keeps at most 32 backings and at most 256 MiB beyond the one just made, the one taken least recently going first, and goes with the queue; each command buffer still holds the backings it rendered into until it completes. The count bound covers a compositor's frames on the consumer's macOS guest, which render 11 to 14 extents of one memoryless RGBA16Float attachment a frame (about 40 MB together): a bound of 8 evicted each backing before its next take. A memoryless depth or stencil backing is still the pass's own. Exact: Metal refuses a Load and a Store of a memoryless attachment, and a pass gives every texel a draw can read a value before its draws (its Clear, or the zero its DontCare load clears to), so no pass reads what another left in a backing. The passes of one queue that take a backing are ordered by their uses of it. New WorkCounts field pooled_backings_made. The memoryless-backed notice's cost text and its docs/API.md catalogue entry say a color's backing is kept by its command queue. Verified, as the commits state: clippy -D warnings for the runtime and validation crates, plain, --cfg m2v_gpu and --cfg m2v_cpu_icd. The lane cases framebuffer_fetch::a_queue_keeps_one_memoryless_backing_for_its_passes (three command buffers of two passes over fresh memoryless attachments, the second loaded DontCare and read as zero: one backing where the device announces memoryless-backed, none elsewhere) and a_queue_keeps_a_memoryless_backing_for_each_shape_it_renders (12 sizes twice in turn, every texel checked: 12 backings, where a bound of 8 makes 24) were added for the device batches. |
||
|
|
e35bf78bd5 |
Shadow every padded texture over a buffer and every texture over host pages, keeping CPU writes
A texture over a buffer could be an image bound to the buffer's bytes: a padded texture that only read (PaddedReadsPolicy::Alias, the default), and any 2D texture over a no-copy buffer's host pages (a linear image, a DRM_FORMAT_MOD_LINEAR image at Metal's row pitch, or on MoltenVK a Metal texture over the import's MTLBuffer). An image bound to imported memory starts UNDEFINED, and a layout transition "may perform read and write accesses on all memory bound to the image subresource range", so such an image kept Metal's bytes across its first move only through a host keep (read the bytes, submit the move alone, wait, write back what changed), which undid a CPU write made inside that window. Metal keeps every CPU write to bytes a command buffer does not write: on the M3 Max, a kernel reading half a padded no-copy texture while the CPU rewrote the bytes between its rows and its other rows kept every CPU byte in 10 of 10 rounds. Changing bytes in memory is not a precision note, so under the owner's rules it may be neither a default nor a switch; exact is the default, and cost chooses only among exact forms. Now a padded texture over a buffer, and every 2D texture (or array) over a no-copy buffer's host pages, imported by pointer or as dma-bufs, is a shadow on every device, whatever its usage: an optimal image of the runtime's memory, copied in from the bytes before a use and merged back after a write. Texture::vk_image answers None for such a texture. Removed: - DevicePolicy::padded_reads and the enum PaddedReadsPolicy (Alias, Shadow); its FAST-PATHS row, its tests::fast_paths choice and its api_surface row. - The images over host pages: the linear image for host allocations, the DRM_FORMAT_MOD_LINEAR image over host allocations with its refusal memo, the modifier image over a buffer texture's own dma-buf, the Metal texture over the import's MTLBuffer on MoltenVK (VK_EXT_metal_objects is no longer enabled for it), and the one image shared by textures of one plan over one import. - The first move's host keep, and its notice unrestored-first-move-bytes (Degradation UnrestoredFirstMoveBytes), retired. - WorkCounts fields first_move_keeps, first_move_kept_bytes, first_move_restored_bytes, pitched_host_images, pitched_host_image_refusals, pitched_host_image_refusals_recalled, shared_alias_images and shared_alias_moves_waited. Kept: the buffer's dma-buf import as the last resort where the pointer is refused, on any device; the images of heap textures over host pages, including over dma-bufs (a heap resource's contents are undefined until written, in Metal too); a linear image over a buffer of the runtime's own memory (PREINITIALIZED), whose first move FAST-PATHS records as a one-line known gap. ShadowedTexture (shadowed-texture) now also covers read-only padded textures. Also: a staged shadow's copy back merges rows that lie one after another into one region (a packed 1080p surface takes one region, not 1080), and two new counters size what a shadow kept across a command buffer's passes could save: WorkCounts::shadow_attachment_passes and shadow_attachment_textures. Docs: docs/FAST-PATHS.md (the shadow bullet with its costs, the known gaps), docs/API.md (section 1's texture paragraph, the shadowed-texture and dont-care-stand-in entries, the retired code), docs/HOWTO.md section 6, the runtime README, linear_attachment.rs's module doc. Cost, as measured: on the Iris Xe a frame sampling four BGRA8Unorm tiles over no-copy pages took 3.2-5.3 ms as shadows against 3.0-6.1 ms as images (textures made once) and 3.4-7.1 against 4.6-8.6 ms (made each frame). On the UHD 770 (ANV, release, alternated), one Load/Store pass into the guest's 1080p surface took 1.89-1.97 ms as a shadow against 2.56-3.09 ms as the linear alias, whose draws ran slowly in host memory; 12 passes 20.9-21.1 ms against 27.4-27.8 ms, at about 40 us more CPU a pass. Verified, as the commits state: - runtime_lane::first_use_writes (new: another thread writes bytes of a texture over host pages that its first use does not read, from 2 ms before to 2 ms after the commit; every write stays) passes on the RTX 3090, the Radeon 780M and the UHD 770. - runtime_lane::pitched_surfaces asserts a shadow for every surface (counted, vk_image None), including the CPU write beside a padded texture during its first use and the new counters; no_copy_textures asserts a shadow and no modifier queries; the keep, pitch-refusal and shared-image tests go with what they tested. - The lanes restated for the shadows pass whole: dma_buf_imports 13, resource_ids 38, rotated_textures 7 and linear_attachments 20 on the RX 7900 XTX and the 780M (RADV), the UHD 770 (ANV, with row_copies 2) and the RTX 3090. - linear_attachments renders over a Shared buffer of the runtime's memory, so the linear attachment paths stay covered, each test asserting the way its passes took; 21 pass on the RTX 3090, the 780M, the RX 7900 XTX and the UHD 770. - Runtime and validation nextest without a device, 2306 passed; the translator's fast_paths, api_surface, published_crates, refusal and driver_facts tests, 34 passed; clippy in every configuration and Rustdoc -D warnings. |
||
|
|
1df750bbd4 |
Resolve multisampled color by the device's average by default, Metal's rule on ResolvePolicy::Exact
A pass that resolves a color attachment whose format has Metal's resolve rule at its sample count
drew the runtime's exact resolve after the pass on every device whose AVERAGE is not measured to
be Metal's (everything but MoltenVK): one more render pass instance per resolved attachment,
between full barriers, reading the stored samples as an input attachment. That form is exact
and costly in GPU time. By the owner's rule (fast by default, exact on request, both kept), the
device's resolve becomes the default, announced, and the exact resolve a switch.
- DevicePolicy gains resolve: ResolvePolicy { Device (default), Exact }, a runtime choice alone
(no emitted code changes, no profile carries it). exact_answers() selects Exact.
- Under Device the attachment resolves in its pass by Vulkan's AVERAGE, announced as
device-rounded-resolve (precision), whose reason names ResolvePolicy::Exact: no extra pass, and
a render target needs no input attachment usage for the resolve. Under Exact everything is as
before.
- Unchanged under both: a driver with DriverFact::ColorResolveAverageIsMetals (MoltenVK on
Apple's GPUs) resolves in the pass with no notice, and an attachment a fetching pass's sample
planes hold as it ends resolves from them by Metal's rule.
- device-rounded-resolve's docs and cost state the measured bound: one code for a unorm, snorm or
packed 16-bit unorm channel, two for an sRGB channel; a float channel's last bits are counted,
not bounded.
- Docs: a new docs/FAST-PATHS.md row for the switch; docs/API.md's policy bullet and the
device-rounded-resolve and shader-resolve catalogue entries; color_resolve.rs, policy.rs and
driver_facts.rs state both values. The api_surface table lists ResolvePolicy.
Why: the exact form's extra pass costs GPU time on every device but MoltenVK (a resolved pass's
command buffer 73-77 us against 51 us on the Iris Xe, 63-75 us against 45-48 us on the 780M), and
no driver measured matches Metal's rule, so none gains ColorResolveAverageIsMetals.
Measured, as the commit states (release builds, 1920x1080 frames of 97 command buffers, every
fourth pass resolving an RGBA8Unorm x4 attachment, the exact form against the device's,
alternated): GPU busy a frame on the Iris Xe (ANV) 2.52 and 2.41 ms -> 1.92 ms (the guest's
shape 3.04, 2.77 -> 2.44, 2.43 ms); on the Radeon 780M (RADV) 2.33 to 2.78 -> 2.00 to 2.13 ms; on
the RX 7900 XTX 1.38 -> 1.36 ms.
The device's average against Metal's rule: on RADV (780M and RX 7900 XTX), ANV (Iris Xe),
lavapipe and NVIDIA (RTX 5080 Laptop), unorm and snorm channels land one code below Metal's at a
tie (16-bit channels exact on NVIDIA), sRGB within one code both ways (up to two at 4 samples on
NVIDIA), packed formats within one, float channels differ in value.
Verified, as the commit states:
- The new lane runtime_lane::resolve_rounding::the_device_resolve_rounds_as_announced (default
policy) passes on lavapipe, the RTX 5080, the 780M, the RX 7900 XTX and the Iris Xe: every
closed format at 2 and 4 samples resolved by the device, device-rounded-resolve exactly where
the fact is absent, and every difference against Metal's rule within the notice's bound.
- The exact form keeps its lanes: the validated options take exact_answers(), so
resolve_rounding's other tests, degrade_notices, nan_resolves and framebuffer_fetch run under
ResolvePolicy::Exact as before.
- tests::fast_paths (the switch, and that the choice keys no profile), the driver_facts tests,
api_surface, the runtime's degradation and driver_defects tests; fmt, clippy in the three
configurations, rustdoc.
|
||
|
|
0b8edc87d3 |
Keep a queue's head and its draws from waiting on pipeline makings, and split each making's time
Metal makes a pipeline state at its creation, so no Metal submission waits for a making. Ours waited in four places, and this packet removes each wait without changing which pipelines, keys, memo entries or notices are made: - A queue's head ranks first. The process's budget of pipeline makings gains a rank, Urgency::Head, between a host step's making and a committed command buffer's. Once a batch is first in its command queue's line, the scheduler raises the makings its host step records to it (CommandBufferShared::hasten_head), so a head's making goes before aged makings, earlier committed ones and a program's. The budget still decides only the order of driver calls: no turn past the budget, no preemption. - A caller waiting for another's library lends its turn. Library::made, where another caller is making the same pipeline library, gives its thread's budget turn back for the wait (budget::without_turn) and takes one again at its rank after, so idle waiters no longer hold every turn while one of them compiles. - Draws take the key's residual form while their own pipeline is made. A state's creation now makes its predicted key's residual form (every SpecKey::RangeAtBindOffset at 0), which reads the same bytes as the key at every bind offset inside the buffer. A draw whose own key's pipeline is not made, while its residual form's is, draws with the residual form at once (pipeline/render/residual.rs); its own key's making goes to the pool at Urgency::Ahead and later draws take it once made. An unbound constant slot now reads at its residual (pushed 0), so a draw that leaves such slots unbound takes the creation's key itself and makes nothing; the only cost is that such a read is no longer a constant ANV can push. - A tile dispatch's pipelines are made on the pool. A render encoder's tile dispatch (dispatchThreadsPerTile and its region forms) hands each region's making to the device's pool, as a compute dispatch does, hastened to a committed command buffer's rank; its pass records later where a making is still in flight (render/pending_tile.rs). A failed making is made again by the recording, and where that fails the command buffer fails with CommandBufferError::PipelineCreation and failed_pipeline names the dispatch, as for a compute dispatch; the call no longer returns the driver's error. A pass whose first command is a tile dispatch executes an empty secondary where it met an internal error, and a dispatch after a pass's inline instances records in the pass's segment before its later instances. With METAL2VULKAN_LOG_PIPELINES set (a default-off diagnostic), each render pipeline's creation log line now splits its time: the digests, each part's library (made by this making, with its record loaded or missed, or another caller's), and the link. Nothing is timed while the log is off. The pool's test hold counts its holders, so one test's drop no longer releases another test's held makings. New WorkCounts fields: residual_form_draws, residual_form_makings, pipeline_pool_busy and tile_pipelines_pooled. Docs: docs/API.md (section 10 and the accepted differences), FailedPipeline's docs, the METAL2VULKAN_LOG_PIPELINES entry in env_vars.rs. Exact either way, so no FAST-PATHS row. Why: on the consumer's cold boots on ANV's Iris Xe, the guest's command buffers were held 1.7 to 7.9 s between commit and submission while a queue's head waited for its pass's lazily made pipeline behind makings no submission needed first. In one cold boot 413 of 565 draw makings differed from a made pipeline only in RangeAtBindOffset (17.2 of 20.0 s of draw making), and one tile dispatch's making blocked the guest's encoding thread for 3.46 s. Verified, as the commits state: - Budget tests: the ranks with a head's making, and a head's making ahead of aged and earlier committed ones (it was aged, committed, head); a waiter lends its turn (without the change the turn stays held). Device test tests::pipeline_wait_order: a queue's first held batch's making goes first in the pool; a hold of the pool lives until its own drop (fails with the old bool). With the shared hold, tests::dispatch_pending failed 3 of 3 runs on lavapipe and passed 3 of 3 with the counted one. - tests::uniform_bind_offsets (4, including draws taking the residual form with the pool held, exact pixels, two makings once released) and tests::inline_continues pass on lavapipe, the RTX 3090 and the UHD 770 (ANV); the validation lanes draw_work and made_at_creation (8) pass on lavapipe. With the residual form off, the new test's command buffer times out. A draw leaving constant slots unbound takes the creation's pipeline with no making (device test), and the slot-plan test expects the residual on every committed profile. - tests::tile_pending: a tile dispatch hands one making to the pool and its command buffer completes after it with the fixture's exact stores; a released state stops its making and a dispatch that took it remakes its own. Both fail when the pipelines are made at the call. - pipeline::creation_log's test of a making's split (no device). - Lane and budget tests that counted while the pool still worked (framebuffer_fetch on the 780M, draw_work on the M3, the head-ranking test on the 780M) now wait for the pool to settle. - fmt and clippy, plain, --cfg m2v_gpu and --cfg m2v_cpu_icd. |
||
|
|
a97f7c2757 |
Keep Metal's contract for host imports and shadows: no posted deallocator, no copy back over CPU bytes
Two fast paths that broke Metal's contract are gone: the posted deallocator of a released host import and the shadow copy back over bytes the CPU may write. A released import is freed in the call, as Metal frees it, and a shadow merges back only the bytes the GPU changed. The notice codes of the two retired kinds are retired too, and the runtime holds the list of every notice code ever issued so a retired code is never reused. The keep-alive lanes wait for the keep-alive that goes with an import's free. Folds in: - Free a released host import on a handler thread by default (later removed) - Copy a shadow back over bytes the CPU may write by default (later removed) - Remove the shadow copy back over CPU-written bytes and the posted deallocator, which broke Metal's contract - Wait for a keep-alive that goes with its import's posted free in the keep-alive lanes - Retire the codes of the two removed notice kinds, and hold every code ever issued Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
f29872bd92 |
Sample extended-range textures as Metal does across mip levels, array layers and 3D
Extended-range textures sample as Metal does at every mip level and array layer and in 3D under no mip filter or a nearest one. The emulated sample is one routine per shape, its constant texel offset passed as an argument; a linear sample takes its exact sum from each tap's codes, undecoded, and its value on the grid by a multiplication by 1/255 with an exact correction. Draws whose variant takes a two-plane extended-range texture slot are counted. Folds in: - Sample extended-range textures' mip levels and array layers as Metal does - Sample extended-range 3D textures as Metal does under no mip filter or a nearest one - Emulate an extended-range sample as one routine per shape where the driver keeps calls, its constant texel offset the call's argument - Hand a linear extended-range sample's exact sum each tap's grid steps from its codes, undecoded - Take a linear extended-range sample's value on its grid by a multiplication by 1/255 and an exact correction - Count draws whose variant takes a two-plane extended-range texture slot Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
f514cb9a7d |
Cut shadowed textures' copies to what their commands touch, merge back every buffer another writer may write, and count copies by cause
A texture over a buffer's bytes or another image whose own image is a shadow now copies in, keeps, merges and copies back only the texels its commands reach, with fewer barriers, descriptor pools and scratch fills, and merges its writes back wherever another writer may write the bytes during the run. What changes: - Which shadows merge. A shadow merges back (kept before the first command that writes through it, only the words its commands changed reaching the bytes) over every buffer's bytes but a tracked Private or Memoryless buffer the runtime made: Shared buffers and host pages as before, and now Managed buffers (on unified memory the CPU writes the GPU's memory, and without it a later upload may run on another queue) and untracked buffers another queue may write. A tracked Private buffer's shadow, a command replacing every texel, an image's shadow, and turned and two-plane textures still copy back. A merge goes in place wherever the texture's first and last words lie in the buffer and the bytes lie in pages; only a first byte inside a word, a staging buffer or a last word past the buffer still merges through a copy, a new FAST-PATHS known gap since that round trip can undo another writer's write between its copies. - Correct merges. A command that replaces every texel followed by one that writes part of it is copied back before the keep, so the merge carries the later writes. A merge of a part leaves a twin stale there alone. A detached buffer's shadow binds no stand-in (the null handle while detached), so no merge binds a range past a 256-byte stand-in. - Cut copies. A read inside a rectangle keeps the rest of the changed rectangle for the next read; an image's one-level, one-slice shadow cuts its copies in as a buffer texture's do; a keep and merge are cut to the rectangle the encoder's commands write in, in bands within the device's limits; a loaded shadowed colour's copies are cut to its draws' scissors also in passes that clear another attachment or take a reach clear (Vulkan's scissor test leaves coverage outside at 0). - Cheaper copies. On ANV (DriverFact::ShadowCopyBackDispatchFaster, now every ANV device measured) a merge's keep and changed copy are the copy back's dispatch, and a cut merge reads the changed texels straight from the shadow's integer view (bind::shadow_merge_image_module), with no copy after the commands. On the UHD 770 (new DriverFact::ShadowCopyInDispatchFaster) a merged shadow's copy in and its keep are one dispatch (bind::shadow_copy_in_module), its 4-byte view R8G8B8A8_UINT because ANV drops a storage image's compression for an R32 view. The shadow kernels take a bind::ShadowTexelView. A cut merge's scratch is kept for the next merges and not zeroed. The shadow kernels and a linear attachment's merge push their descriptors where the device pushes set 0, so a shadowed pass makes no descriptor pool. A run of shadow copies in an unordered encoder shares one barrier before and one after, keeping a barrier only between copies that touch the same memory and one writes. - Counters (WorkCounts): every copy in by why it is made and by what holds the texture's truth, first copies apart (shadow_texels_first_copied_in_*, shadow_texels_recopied_*, shadow_texels_copied_in_images, shadow_texels_bounded_copied_in), shadow_texels_kept, shadow_merge_copies_dispatched, shadow_merges_fetched, shadow_copies_in_dispatched, shadow_merge_scratches_reused and _zeroed, owned_descriptor_pools, how passes take shadowed colours (shadow_attachment_loads_*, _clears, _clears_in_part), shadows_sharing_truth, and the tiles a loaded colour's scissors cover against their bounds. - Docs: shadow.rs and shadow_merge.rs module rules, API.md's shadow entries, FAST-PATHS' costs of matching Metal and known gaps; the snapshot rule's figure is now an upper bound. Why: Metal writes only the texels a command writes, and another writer may write bytes no command touches during a run. On an M3 Max under macOS 27.0.1, a fill of an untracked Private buffer from a second queue ran inside a first queue's kernel or render pass 5 times of 6 and both texels kept their writes, as did a CPU write to a Managed buffer; a tracked Private buffer's fill always ran after. And in the consumer's Finder drag on the Iris Xe, whole 1080p shadow copies were most of the composite command buffers' GPU time. Verified: - Iris Xe, four shadowed textures a frame over anonymous pages, commit to completion: merged passes that draw 11.7-11.8 ms -> 5.0-5.4 ms and scissored ones 11.3-11.4 -> 3.6-3.9 ms across the dispatched copies, cut keeps and fetched merges; a 1080p Load pass's GPU time 4572 -> 3484 us with the fetched merge. - UHD 770: a 1080p Load/Store pass 2390 -> 1683 us GPU with the fetched merge; a 1080p Load pass 1.64-1.67 -> 1.43 ms with the fused copy in; the kept scratch took a 1080p Load pass 4205-4755 -> 2626-3595 us commit to completion (RX 7900 XTX 4112-4392 -> 1628-1697 us). Shared barriers saved about 0.65 us of GPU time per barrier removed on the Iris Xe (680 -> 120 barriers a frame). - runtime_lane::pitched_surfaces 28 of 28 on the UHD 770, Iris Xe, Radeon 780M, RX 7900 XTX and lavapipe, with merges under changing scissors, split instances and two textures over one buffer matching a private texture's bytes; under synchronization validation with no message. The shadow lanes 123 to 132 of 123 to 132 on the M3 Max, lavapipe, Iris Xe and RADV; extended_range_blends, linear_attachments and padded_loads on the RTX 5080 with no validation message. - Unit tests: tests::shadow (24), clear_reach, owned_pushes, shadow kernels through all four views on the CPU interpreter, driver_facts. clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd), rustdoc. |
||
|
|
ca8340b4ee |
Group ready batches into one kernel submission on Mesa's drivers, and order a queue's batches by their ends
On ANV over i915 every kernel submission lists every VkDeviceMemory of the device, at a cost per
object; the consumer's guest drag on the Iris Xe had 302 entries per execbuffer (260 of them host
imports) at 112 to 128 execbuffers a frame. The runtime now makes fewer kernel submissions and
fewer command buffers per frame, under two new runtime policies.
What changes:
- DevicePolicy::completion, CompletionPolicy { Grouped (default), Exact }; exact_answers()
selects Exact. Under Grouped, on a driver whose queue merges consecutive submits (Mesa's common
queue: ANV, RADV, lavapipe, NVK and the rest), the scheduler holds ready batches of one VkQueue
and submits up to four in one vkQueueSubmit, only the last signalling, so Mesa merges them into
one kernel submission:
- a batch whose only signals are events' joins, the group's end signalling each event to the
highest index held; a batch waiting for a signal the group holds sends the group first;
- only a group's first member may wait for anything not yet seen complete, since Mesa gathers
every member's waits before the first member's commands; a later waiter goes alone after the
group in the same call. Metal never holds one command buffer back for another's wait;
- batches that cannot join (first work, binary semaphores, fences, sparse updates, wrapped
images, storage-form switches) submit the held group first;
- a pass that finds nothing ready keeps the group held while two or more earlier submissions of
its queue are not seen complete, gated on the second-to-last, so commits arriving meanwhile
join. It goes once full, when a head waits for the GPU, or when a thread waits for one of its
command buffers;
- a held batch that ends its command buffer turns Scheduled, takes its kernel end time and runs
its submission handlers as it is held, so waitUntilScheduled returns at once, as Metal
schedules a command buffer committed behind running work within 0.2 ms;
- submission checks run ahead for up to three batches behind a line's head, so checked command
buffers are found ready together; a failed group restores its waits, signals its last value
and fails each member once; the group's submission allocates nothing.
New degradation kind grouped-completion (Precision), announced once per device: a group's
members but the last are seen complete late, by at most three later batches' GPU time plus one
completion turn, and intermediate event values are seen late, never wrong.
- An event-signalling batch's end goes into its work's last command buffer, as every other batch's,
unless its signal must wait for another queue's earlier signal.
- DevicePolicy::batch_order, BatchOrderPolicy { Ends (default), Exact }; exact_answers() selects
Exact. On ANV, RADV and NVIDIA's driver, measured to run a queue's submissions one after another,
each batch ends with a barrier to every later command of its queue, the tracker takes an earlier
batch of that queue as ordered (no barrier per dependency), and a batch's start timestamp with
nothing planned before it is written at the bottom of the pipe. Other drivers and Exact keep the
barriers per dependency.
- WorkCounts: grouped_submissions, batches_grouped, group_ends_full / _wait / _apart /
_first_work / _drained / _checks / _held, event_waits_met, batches_with_none_pending and kin by
pending depth, groups_kept_pending and groups_sent_for_waits; frame_costs prints them, with
kernel submissions and ioctl time where the i915 execbuffer script is loaded, and gains guest-
shaped legs over 260 and 520 host imports.
- Docs: FAST-PATHS rows for both policies (the grouping row with the guest's frame rates), API.md
entries, add_submission_handler's doc, the runtime README and the scheduler modules' docs.
Why: each fewer kernel submission saves the scheduler thread an ioctl of about 80 to 130 us there,
and each barrier per dependency buys nothing on drivers that run a queue's submissions in order.
The bound of four was kept: eight measured about three fewer submissions a frame for twice the
completion lateness and no frame-time change.
Verified:
- Iris Xe, guest shape over 520 host imports, Grouped against Exact: 26.2-26.7 execbuffers a frame
against 67.0, ioctl 2.77-2.81 against 6.89-6.96 ms, scheduler 52-53 against 122-123 us per
command buffer, through completion 5.98 against 8.70 ms a frame.
- UHD 770, the held group at a 1 ms commit pace: 25.0 kernel submissions a frame against 58.1,
scheduler 67-82 against 113-124 us per command buffer, the same frame time and GPU idle;
completion seen 1.82-1.86 ms after GPU end against 0.43-0.46 ms.
- In the guest on the Iris Xe, Grouped made 24.4-27.5 kernel submissions a frame against Exact's
42.4-43.8 and saved 0.4-1.7 ms of scheduler CPU a frame; the frame rate was alike within
boot-to-boot noise (15.7-17.3 against 16.4-17.6 fps).
- runtime_lane::grouped_submissions (held signals on one and two queues, waiters leading, groups
held behind running work with and without submission handlers and checks, both policies, the
validation layer silent): 19 of 19 on ANV and lavapipe; the held-handler case fails without its
change. commit_work, gpu_times, grouped_submissions, queue_order, events and first-use lanes 77 of
77 on the Radeon 780M, RX 7900 XTX and RTX 5080; under synchronization validation 34 of 34 on
the UHD 770. The runtime's device tests 1066 of 1066 on ANV; the unit suites 4534 of 4534.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc.
|
||
|
|
ed3ca3aa1f |
Push set 0 where the device has the push command, read uniform buffers at constant offsets, and share pipeline layouts
A draw's and a dispatch's set 0 is pushed where the device can, its uniform buffers are read at
constant offsets where the binding allows, and alike pipeline layouts are one object, so switches
between alike states keep set 0.
What changes:
- Pushed set 0. Where the device has vkCmdPushDescriptorSet (Vulkan 1.4 or VK_KHR_push_descriptor),
a variant whose set 0 fits maxPushDescriptors, takes no set or binding flags and binds at one
bind point makes set 0 a push descriptor set layout. Its draws, dispatches and tile dispatches
push set 0's writes instead of allocating, writing and binding a set. Draws push incrementally:
only the writes that differ from what set 0 holds, as Vulkan allows until the set is disturbed;
baked samplers are pushed with every full push, as Vulkan requires. Every other variant and
every device without the command keeps the allocate-write-bind path. vkCmdPushDescriptorSetKHR
joins the exit guard's table and the device's priming. WorkCounts draws_pushing_set_zero,
set_zero_writes_pushed and dispatches_pushing_set_zero.
- Two driver defects, both typed RuntimeDriverDefect variants:
- PushedBufferSizesUnset on MoltenVK (every release): its pushed sets leave the buffers'
sizes unfilled, so a runtime array length reads 0. MoltenVK binds set 0 from pools.
- PushedDescriptorsStaleAfterPipelineBinds on ANV: a descriptor kept across a pipeline bind
reads zeros. There the first push after each pipeline bind carries at least one write.
- Uniform reads. Each uniform-view slot declares a specialization, SpecKey::RangeAtBindOffset:
where its descriptor range starts at the bind offset (inline bytes, an unbound slot, or a bind
offset the views' base alignment A divides), a read takes the Metal offset alone, a constant
for a constant member, so ANV pushes the constants into registers. Elsewhere it adds the
residual as before. Both forms are exact.
- Bind-offset classes. A bind offset is classed only by what a plan reads: A where the slot reads
through a uniform view and A divides it, else its alignment up to 4 for the vertex fetch. A slot
bound at an offset A does not divide leaves the specialized slots for good, so a slot at moving
offsets keeps one shape and one pipeline. The debug check of a table brought in place compares
those slots.
- Shared pipeline layouts. The device keys set and pipeline layouts by everything their creation
takes (sets, bindings, baked sampler handles, push-constant ranges), so variants defined alike
share one VkPipelineLayout; set 0 and the push constants then survive a pipeline bind between
them. WorkCounts pipeline_layouts_made and pipeline_layouts_shared, and set_zero_equal_shape_switches,
set_zero_writes_on_equal_shape_switches and set_zero_writes_if_shapes_shared for the switches
between layouts of one set-0 shape that are still apart. A new bench, frame_costs_alternating.
- New owned fixture engine/ubo_bind_offsets; docs/API.md states the alignment and the mask.
Why: on an RTX 5080 laptop GPU in runtime D3, vkCmdBindDescriptorSets waits about 973 ms for the
GPU to wake after 20 s idle, and vkCmdPushDescriptorSet 0.02 ms. ANV loads a uniform buffer ahead
of the shader only for constant offsets: the guest's display present spent 18 of its 29 sends on
uniform loads. And the guest pushed 597 set-0 writes a frame on switches between alike layouts,
where 244 would do.
Verified:
- RTX 5080 laptop after 20 s idle: a draw's call 957-974 ms binding set 0, 0.20-0.25 ms pushing it.
draw_work and dispatch_work 14 passed on it and on lavapipe, both taking the push path, and the
bind path with the extension withheld.
- On the M3 Max, the push path failed 30 of 61 tests (runtime array lengths reading 0) and crashed
Metal's compiler service on render variants; with set 0 bound on MoltenVK they pass as before.
- Iris Xe, 1080p passes of a full-screen draw: a float4x3 matrix and two packed_float3 per pixel
691.6 -> 407.7 us (-41%), twelve float4 451.0 -> 429.7 us; INTEL_DEBUG showed 21 sends -> 3.
RADV was unchanged. With the offset classes, a guest-shaped bench's encoding thread went from
5.65-5.70 back to 5.16-5.45 ms a frame and 194 pipeline lookups a frame to 0.
- The ANV defect: unorm_depth_bias failed 3 of 3 without the guard, passed 3 of 3 with it, on the
Iris Xe and the UHD 770.
- Shared layouts, frame_costs_alternating: set-0 writes 1920 -> 1320 a frame and draw states 2600
-> 2000 on RADV and ANV; a draw -2.3% instructions on both. On lavapipe (debug) the runtime unit
tests 1057 passed and every runtime lane test passed but for failures that reproduce without the
change; on RADV 115 lane tests passed, no VUID message.
- Unit tests: engine_access, bind::plan::slots, bind_shape_of, render::bound, argument_table,
driver_defects; uniform_bind_offsets device tests on lavapipe and ANV. clippy -D warnings (plain,
m2v_gpu, m2v_cpu_icd) and rustdoc.
|
||
|
|
d485925af2 |
Keep the commit path off the GPU's wake and the scheduler's lock: cached uploads, timestamps at completion, primaries begun ahead
A command buffer's encoding, commit and property reads now make no call that waits for a powered-down GPU or for the scheduler's submission, as Metal's return at once. What changes: - Upload arenas (argument, handle and root tables, constant blobs, neutral buffers, status words) take host-cached, host-coherent system memory (MemoryClass::Shared) instead of write-combined memory, which preferred device-local memory on a discrete GPU. Unified-memory devices are unchanged; a device with no host-cached coherent memory keeps its device-local type. No flush is needed: Vulkan defines coherent memory as needing none, and a submission orders the host's earlier writes. New WorkCounts::upload_chunks_in_device_memory. - The calibration pair that places GPU times on the host clock (vkGetCalibratedTimestampsKHR) is read by the completion turn, not at commit. The placement and its pair cache are unchanged; UncalibratedGpuTimes now says the calibration failed as the command buffer completed. - A completed command buffer's settled spare pool begins one primary ahead on the completing thread, with the spares' lock released and only where no thread waits on the command buffer's gate, so the next command buffer's first encoder records into it instead of beginning one. The pool passes between threads under the spares' lock, which is all vkBeginCommandBuffer's external synchronization asks. WorkCounts primaries_begun_ahead and encoder_primaries_begun_ahead. - A timed command buffer's timestamp slot is reset on the host (vkResetQueryPool, a Vulkan 1.2 required feature the runtime enables) as it takes the slot, so no command buffer the GPU runs resets a query; an adopted device keeps the command resets. WorkCounts timestamp_slots_reset_on_host. - kernelStartTime and kernelEndTime are two atomics beside the command buffer's state, and status and error an atomic and a once-set error published at each transition, so a read waits for no replay or submission and a commit takes no new lock. An Error status always finds its error. - WorkCounts counts the command buffers begun by what they were begun for (encoders, segments, continuations, secondaries, batch work and barriers, kept barriers, internal), printed by frame_costs. - docs/HOWTO.md notes NVIDIA's runtime D3 wake (about 1 s after about 15 s idle) and how a host that wants none keeps the GPU powered; never required. Why: on an RTX 5080 laptop GPU in runtime D3, the first write into device-local host-visible memory after 20 s idle waited 977 ms for the wake, and so did the commit's timestamp read (a commit took 973-977 ms; Metal's returns at once). On ANV a begin clears the command state, 8 to 20 us each, 0.80 ms of the Iris guest's 17 ms frame. And the scheduler holds the state lock through a batch's replay and submission, so a status or kernel-time read waited 60-65 ms behind 131,072 fills. Verified: - RX 7900 XTX, release A/B: encoding-thread CPU 5.27 -> 4.79 ms a frame with cached uploads, the vertex-heavy GPU time unchanged (28.18 -> 28.19 ms); draws_setting_bytes_write_no_device_local_memory fails without the change on the XTX, RTX 3090 and RTX 5080. - RTX 5080 laptop: a frame's commit after 20 s idle 973-977 ms -> 0.02-0.03 ms; the wake is now in the wait, as Metal's commit-and-wait shows it. gpu_times and degrade_notices 27 passed on it and on lavapipe. Host-reset slots saved about 1-2 us of GPU time a command buffer there; neutral on the Iris Xe. - Iris Xe: encoding-thread CPU 4.96 -> 4.62 ms a frame and a pass open 5.71 -> 2.77 us with primaries begun ahead; 95.85 of 97 encoders a frame took one. - runtime_lane::property_reads on the RX 7900 XTX and Radeon 780M fails without the change (reads of 60.3-65.1 ms) and passes with it (longest read 0.022-0.097 ms); on the M3 Max under MoltenVK it passed with 0 slow reads and the commit allocation bound held at 4.00. A new test checks status reads Completed in the completed handler, after the wait and in a deallocator. - Unit tests: spares, gate, exit_guard, gpu_time, completion, command_buffer (up to 218 passed per run); clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc. |
||
|
|
437e37cb59 |
Keep the driver's compression for textures Metal compresses, the uncompressed heap image behind HeapCompressionPolicy
On a compressing driver (ANV's CCS on the Iris Xe), textures the runtime made uncompressed for
reasons that no longer hold now keep the driver's compression.
What changes:
- A device's own texture without allowGPUOptimizedContents makes its image from the descriptor's
usage alone (TextureDescriptor::own_image_usage), not with PixelFormatView usage, so the driver
keeps it compressed. Its layout is never visible (no size answer, no aliasing; views, blits and
fresh contents follow the descriptor), so this is exact. Heap, sparse and shared textures keep the
PixelFormatView image. On MoltenVK, whose blits of a compressed RG11B10Float or RGB9E5Float
texture rewrite texels (RuntimeDriverDefect::CompressedImageCopiesRewriteTexels), such a texture
keeps the uncompressed image, deciding from the image the device's Metal would compress.
- A heap's colour texture that Metal itself compresses (by heap_tiled::metal_compresses_layout)
takes the driver's optimal, compressed image by default, announced once as the new degradation
kind heap-texture-compressed (Precision). New DevicePolicy::heap_compression,
HeapCompressionPolicy { Compressed (default), Uncompressed }; exact_answers() selects
Uncompressed, the host-transfer or linear image that keeps aliased writes visible byte for byte.
It is the runtime's choice alone and keys no profile. Textures Metal keeps uncompressed keep
that form under both values.
- optimized-depth-stencil-texture is announced only for heap textures and heap size answers, the
only places the difference shows; a device's own or shared depth texture no longer announces it.
- Docs: a FAST-PATHS row with both forms' costs, the API.md catalogue entries, and the docs of
allow_gpu_optimized_contents, the degradation and DriverFact::DepthStencilImagesStayGpuOptimized.
Why: the uncompressed form costs a 2048x2048 RGBA8Unorm render target's clear 676 us against 27 us
compressed on the Iris Xe. And Metal does not show aliased writes over a texture it compresses
either: on an M3 Max under macOS 27.0.1, a buffer fill over a compressed texture's bytes made every
covered texel of drawn content read opaque magenta, never the written value; only clear-only
content and uncompressed (ShaderWrite) textures showed the write. So the uncompressed heap image
matched Metal only for clear-only content.
Verified:
- runtime_lane::heap_textures::heap_compression_costs (new, ignored) on the Iris Xe, release, ABAB:
compressed clear 26.9 us and copy 647.7-649.1 us; uncompressed clear 676.2-676.5 us and copy
673.9-693.2 us.
- On ANV: the new heap test (compressed textures kept 4096 to 9696 texels unchanged under an
aliasing write, uncompressed ones 0; notice counts exact), the heap_textures, heap_layouts,
heap_metal_sizes, compressed_blits, fresh_contents and mipmaps_exact lanes, 53 passed, 0 failed.
- runtime_lane::compressed_blits on the M3 Max caught the MoltenVK blit defect (an RG11B10Float
byte read back as 224 where Metal keeps 250), which the uncompressed image fixes.
- The translator's fast_paths and driver_facts tests (17) and api_surface (11) on gem10; the
runtime's image_plan and texture_descriptor tests; clippy -D warnings (m2v_gpu).
|
||
|
|
2b97fc1cf0 |
Render packed 16-bit, 8-bit sRGB and RGB9E5 attachments the device cannot render through integer views of their words
The RTX 5080 samples A1BGR5Unorm, ABGR4Unorm (and every other 16-bit packed order), R8Unorm_sRGB,
RG8Unorm_sRGB and RGB9E5Float but renders none of them, and lavapipe renders neither 8-bit sRGB
format. A render target, clear or draw of such a texture was refused as the device lacking the
format, which ends the guest of any app that renders to one. They now render through an R8_UINT,
R16_UINT or R32_UINT view of the same bits, the fragment function writing Metal's word.
What changes:
- metal::format::WordAttachment (public, with WordField): a format's fields in its word (packed
16-bit layouts named from the least significant bit, Srgb8, Rgb9e5). WordAttachment::of holds
where the device samples the format (or its UNORM twin), does not render it, and renders the
word's integer format: derived from format features alone, on every driver.
- Translator: LoweringInputs::word_colors names such attachments. The fragment output to one is
declared as a uint and each return stores Metal's word: a packed channel h(x) to nearest even,
NaN 0, clamped to [0, 1], times the maximum code, rounded to even; an sRGB channel through
Metal's twelve-bit table; RGB9E5 by the truncating kernel-write rule (shared with the storage
write, lower::texture::rgb9e5_word). The cache codec carries the new fields.
- Partial write masks and blends:
- in the pixel interlock (where the device orders fetch through it alone), a packed 16-bit or
8-bit sRGB word's partial mask merges the kept fields from the word read first;
- a packed 16-bit word's blend other than One/Zero decodes each code as Metal's blend reads
it, h(c / m), blends in half as the 8-bit unorm blend does and encodes Metal's word. Metal's
tile holds a pass's earlier result finer than the codes, so this is a near-equivalent within
one code, recorded as PrecisionNote::DeviceColorConversion and announced; the exact form (the
extended-range half shadow taken by word attachments) is a FAST-PATHS "not built yet" row;
- where fetch reads rasterization-order input attachments (lavapipe), an 8-bit sRGB word's
partial mask merges over its input attachment (new RuntimeFact::WordInputMerge), per sample in
a multisampled pipeline.
- Runtime: the texture's image keeps its own format, sampled and blitted natively, made mutable
with extended usage and the word view listed; the pass's attachment is the view; a pass clear
writes the word of Metal's clear.
- New degradation kind shared-exponent-kept (Precision): Metal's tile store normalizes a loaded
RGB9E5 word whose largest mantissa is below 256 in each tile a draw reaches, which a Vulkan pass
keeps; announced at each such draw, with a FAST-PATHS row.
- DeviceColorConversion's rustdoc states that Metal blends a packed 16-bit attachment against its
tile's finer values within a pass.
- Still refused, recorded as FAST-PATHS known gaps: colour inputs and resolves of word
attachments, blended or fetched sRGB words, an output of fewer than four lanes for a blended
packed word, RGB9E5 half outputs, blends, masks, inputs and resolves.
- New owned fixture engine/wm_samples and runtime_lane::word_samples for the multisampled merge.
Why: these formats are Metal render targets the guest uses, and the device holds and samples them;
only rendering them directly is missing.
Metal's rules, measured with plain Metal on the M3 Max under macOS 27.0.1: 65,536 float4 and half4
outputs and 4,096 clear colours per packed format, 0 texels off the rule; a One/Zero blend stores
the same bytes; the blend sweep (2,891 states, 8,192 random pixels, four packed formats, half and
float, fast and safe maths) gave Metal's code in every channel without fast maths and within one
code under it; within a pass Metal's tile holds a packed attachment finer than its codes (blends
in one pass follow the unrounded value, across two passes the stored codes); RGB9E5 draws and
clears 65,536 of each, 0 off.
Verified:
- Translator and runtime unit filters on gem10: 162 of 162 and 258 of 258 (word attachments),
394 (partial masks in the interlock), 370 and 422 (blends, including 864 words the M3 stored
checked on the interpreter), 538 (sRGB and RGB9E5 words), 38 and 108 (input-attachment merge).
- On lavapipe: runtime_lane::color_writes 5 passed, RG8UnormSRGB under the red mask 0 of 107,814
channels off where it was refused before; word_samples, 64 texels of 4 samples merged, the edge
texels keeping both greens; public_fixtures_engine with the new rows.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc.
|
||
|
|
697c55d514 |
Announce a loaded snorm or RGB9E5 attachment's kept codes, and store them as Metal's tile store does under TileStorePolicy::Exact
Metal's pass, once it draws, writes each 32x32 tile a draw reaches back through its texels'
values: a signed normalized channel's minimum code (-128, -32768) reads as -1.0 and is stored as
the code above it, and an RGB9E5Float word whose largest mantissa is below 256 under an exponent
above 0 is stored normalized. A Vulkan pass's load and store keep those bytes.
What changes:
- New degradation kind snorm-minimum-kept (Precision), announced at every draw and indirect
execution in a pass that loads a single-sampled R8, RG8, RGBA8, R16, RG16 or RGBA16 Snorm colour
attachment and keeps it, naming each such attachment. It joins shared-exponent-kept for RGB9E5.
- New DevicePolicy::tile_store, TileStorePolicy { Device (default), Exact }; exact_answers()
selects Exact. It is the runtime's choice alone and keys no profile. Under Exact the load pass
that already rewrites extended-range, padded and bfloat attachments also takes a single-sampled
snorm or RGB9E5Float attachment in the tiles the pass's draws reach, with two new
bind::unused_bits_module rules (SnormMinimum, SharedExponent; the module is keyed by
PixelFormat), and nothing is announced. An attachment the load pass cannot take keeps the
device's load and store, announced.
- New answer fact DriverFact::TileStoreIsMetals for MoltenVK 1.4.1 on Apple's GPUs: its render
pass is a Metal render pass, so its tile store is Metal's for both kinds. There neither value
adds a load pass or a notice.
- Docs: one FAST-PATHS row for the switch, its cost the load pass's measured GPU time; a known gap
for lavapipe, which states no blend for any snorm format, so a blending snorm pipeline is
refused there; API.md's policy bullet and catalogue entries; the unreached-tiles-rewritten text.
Why: a code no Metal write leaves, but uploaded or copied bytes may hold, reads back differently
after a drawing pass. The exact form costs a copy of the render area through a dispatch before
every such pass, so the device's store stays the default, announced, and Metal's store is a
switch away.
Verified:
- Metal's behaviour probed on an M3 Max under macOS 27.0.1 (70x40 targets of five snorm formats):
a pass that draws nothing moves no code; a tiny triangle moves every minimum code of its first
32x32 tile and none elsewhere; a blended full-target draw moves all of them; a blit there and
back moves none. The guest's sweep showed the same on R8Snorm and RG8Snorm.
- Unit tests: unused_bits (both rules against CPU models over every code, the M3's example
RGB9E5 word, the masked-tile rewrite), fast_paths (the row, no profile key), driver_facts,
api_surface, owned_divisions: 38 passed on gem10.
- runtime_lane::snorm_tile_store under Device and Exact for both kinds, asserting load-pass
counts, bytes and notices: on lavapipe with padded_loads, extended_range_blends and the notice
site check, 15 passed (Exact took the load pass, Device announced); on the M3 Max under
MoltenVK 1.4.1, 4 passed through the fact (no load pass, no notice) and 11 more beside them.
- The load pass's cost (FAST-PATHS): on the Radeon 780M, a 1080p pass per frame of BGRA10_XR
1958.8 us against RGBA16Float's 135.3 us; the snorm and RGB9E5 cases take the same pass, not
timed alone.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc.
|
||
|
|
86b5d6faf3 |
Cut the encoding thread's allocations, locks and copies per draw and per render pass
A draw, a pass open and a pass end on the encoding thread now do far less work that no answer needs. Every change records the same commands in the same order, retains and lets go of the same objects at the same points, and announces the same notices with the same text. What changes: - Kept objects. The device keeps every VkRenderPass it makes, by everything it is made of (at most 256, destroyed with the device), so passes alike make none (WorkCounts::render_passes_made). A pipeline state keeps the last four pipelines its draws found, not only the last one. A device's depth-range facts are read once at its making. A pass layout's kept-attachment notices (extended-range-bits-kept, snorm-minimum-kept, shared-exponent-kept) are decided once per layout, dropped wherever the layout changes, and checked against a fresh decision at every draw in debug builds. - Storage reused. Each draw's commands (push bytes and writes, descriptor ranges, extents, uses) are written over the last draw's storage; push field bytes sit in place up to 32 bytes; a draw's host-memory uses go into a vector its encoder keeps; the pass layout and pass-start tables move as boxes, not 700-byte values. - Lists in place. A pass's shape lists, default viewport and scissor, first drawn rectangle, colour sets (as bit masks), clear values and attachment extents are held in place, bounded by the eight colour attachments; a pass end makes no list it would leave empty; a draw's attachment reads are checked one attachment at a time; a command buffer's dynamic states are bits. - Fewer locks. A render encoder retains its own argument tables through its exclusive borrow, with no lock; set 0 is allocated under the bind's lock; the settled variant and plan move out instead of cloning; a draw's pipeline state, variant objects, VkPipeline and samplers are retained once per encoder, the first eight of each kind in place. A draw's use keys are kept and named only where the last command's use there took another key. The latest used memo entry stays where it lies when it is used again. - Fewer commands. A stencil state whose front and back values match is set by one command with VK_STENCIL_FACE_FRONT_AND_BACK, which the Vulkan specification defines as updating both faces. - The recorded-state checks are #[inline], so their cost no longer depends on which codegen unit holds them. - runtime_lane::frame_costs' allocation bounds drop to the new counts (pass open 14 -> 4.5, pass end 40 -> 19, a draw's bounds with them) and fail without these cuts. The pass-open bound allows one more allocation on Apple's platforms, where Rust's standard library boxes a mutex at its first lock. Why: the consumer's guest is bound by its encoding thread. Its task thread spent 6.61 ms a frame in draws and 1.77 ms in pass ends, and allocation, B-tree lookups, memmoves and locked instructions were large shares of both. Verified: - Allocations (counting allocator): on the RX 7900 XTX (RADV), a guest-shaped pass's draw 39.70 -> 32.70 for the reused commands and a pass open 11 -> 5 for the lists in place; on the UHD 770 (ANV), a pass end 22.43 -> 16.91 and a pass open 5.00 -> 4.00, the same on lavapipe (debug). - User-space instructions, release A/B medians: render passes kept, a frame -1.9% on the Iris Xe (about 113 vkCreateRenderPass2 calls a frame before, none after); the boxed moves and depth-range facts about -2% a draw each on the RX 7900 XTX and -1.2..-1.5% on the UHD 770; the kept notices -0.9% a draw on the UHD 770; locked instructions per process 22.45M -> 21.73M on the UHD 770. - Unit tests: field_bytes_hold_what_they_were_made_of, equal_faces_take_one_stencil_command, depth_ranges, using_the_latest_entry_again_keeps_the_order, and the graphics binder's tests checking every instantiation written over earlier commands equals a fresh one. Lane tests in draw_work (a pass drawing as the one before makes no render pass; a state switching keys finds its pipelines again). - On lavapipe (debug): the runtime unit suite 1066 passed; the stand-in, extended, split, inline, tile, reformat, snapshot, held-depth, feedback, instance, render-pass and frame-cost lanes 228 of 234 (the 6 failures passed when rerun alone with the validation binaries built). The notices' lanes 38 passed on lavapipe (debug, the assertion at every draw) and on the UHD 770. The pass-open bound passed on the M3 Max under MoltenVK. - clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc. |
||
|
|
bc50be430d |
Log device memory behind METAL2VULKAN_LOG_MEMORY, keep two empty pooled blocks, pool neutral images on ANV and RADV
Three changes to how the runtime holds device memory, and a diagnostic to see it. What changes: - METAL2VULKAN_LOG_MEMORY, a default-off diagnostic (set to anything but empty or 0). A device logs one line per VkDeviceMemory it allocates, imports or frees, through its message sink at Info severity (id metal2vulkan-memory), else on stderr: what it is (a pooled or dedicated block, a host-memory import with its host address, a dma-buf import), its handle, memory type, bytes and device address range. Memory with the device-address flag but no buffer of addresses is asked through a buffer made over it and destroyed at once; on NVIDIA that address is the GPU virtual address a fault report names. A block parked until the batches in flight complete is named as it starts to wait. Each pooled placement of at least 4 MiB also prints a line as it is placed and as it is returned. Off, nothing changes: the switch is read once, no buffer is made and no line formatted. Documented in env_vars.rs and docs/API.md. - A pool keeps up to two empty pooled blocks (at most 128 MiB a pool), where it kept one. Every kept empty block but one goes once it stayed empty for one second, checked as a placement returns, and every kept empty block of a memory type goes before a block of that type fails to be made, and the make is tried again. New WorkCounts pooled_memory_blocks_made and pooled_memory_blocks_freed. - Neutral images and interlocked passes' storage placeholders take a pooled block of images on ANV and RADV, and a block of their own elsewhere (memory::binds_wait, from the driver id). Why: - An RTX 5080 run of the consumer lost its device on a copy engine's write to an unmapped page, and the fault report names only a GPU virtual address; the log places it against the memory the runtime held. - With one kept empty block, the block made so the encodings find room was mostly the kept one, so a frame's buffers returned each frame cost a vkAllocateMemory and a vkFreeMemory a frame (a guest boot on ANV showed the alternation in its buffer pool through the log). - ANV on i915 and RADV on amdgpu list every VkDeviceMemory in every kernel submission at a cost per object; in the consumer's frames on the UHD 770 those images were 15 of the 17 dedicated blocks. A bind into a block with queued work waits for that work on NVIDIA's driver, and lavapipe waits for its queue lock at the view's making, so those keep their own blocks. Verified: - tests/memory_log.rs (device test): a block's address asked through a buffer made over it equals its buffer of addresses' address; a CPU test holds a placement line's words. - runtime_lane::pool_churn (new): seven 9 MiB private buffers a frame, filled, waited for and dropped; over 32 frames no pooled block made or freed. Blocks made and freed a frame went 1.00 / 1.00 -> 0.00 / 0.00 on RADV (RX 7900 XTX) and ANV (UHD 770); the test took 1.20 and 0.96 s before and 0.52 and 0.47 s after on ANV. tests::memory (17) passed. - A probe outside the runtime measured a bind into a block with pending work at 0.2-1.8 us and the view at 1.8-5.1 us on ANV (UHD 770), 0.0-0.6 us and 0.6-2.0 us on RADV (Radeon 780M and RX 7900 XTX), the submission still pending after both, as with a fresh block. The kernel_textures neutral lane now checks that a pipeline state's neutral images add no dedicated block on ANV and RADV; it, the first-use neutral lane and the placeholder framebuffer lane passed on the UHD 770; the runtime's heap and memory unit tests 83 passed. - clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc. |