006d43ecb0d4c34f256df81fac9d9c2adbd5801d
384
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7b29073f8c |
A dma-buf export's texture goes in place through its own dma-buf where no image binds in the memory
On RADV the runtime's memory exported as a dma-buf takes no image of a texture's: the format query takes the dma-buf handle type for no linear image, and its DRM_FORMAT_MOD_LINEAR image requires a dedicated allocation (VUID-vkBindImageMemory-image-01445), so the 780M's VA-API frames' planes were announced shadows (m3-max-10261, 10304). Binding an image naming another handle type there is no way out: the layer checks each type of the memory's export set against the bound image (VUID-VkExportMemoryAllocateInfo-handleTypes-09860, m3-max-10339). As the last step before the shadow, on any device that does it, the texture's image is the runtime's route for images over dma-bufs (Device::dma_buf_image): a DRM_FORMAT_MOD_LINEAR image whose explicit plane lies at the texels' offset in the memory with Metal's pitches, bound to a dedicated import of that memory's own dma-buf: - dma_buf.rs: explicit_plane_image (shared with dma_buf_image_unbound), exported_dma_buf_image_unbound (the format query with DMA_BUF importable, the driver's layout, the image's memory within the memory and of its type) and bind_exported_dma_buf_image: vkGetMemoryFdKHR(DMA_BUF) of the memory (Device::dma_buf_of, as export_memory_dma_buf makes one), vkGetMemoryFdPropertiesKHR, the dedicated import at the image's size (01433; the import's type is among the image's, 02989; bound at offset 0, 02628), of the memory's own type. Vulkan imports a payload into the instance that exported it (VkImportMemoryFdInfoKHR, fd-00668). import_dma_buf hands the driver a duplicate and closes ours either way. The import is a DmaBufPages of no source (of_exported), freed after the image, live in WorkCounts::dma_buf_image_memories_live; each image is counted in the new WorkCounts::exported_dma_buf_images. - texture.rs: exported_dma_buf_alias, after alias_unbound's refusal of the image in the memory (a shared block's, or a buffer's dedicated allocation): only for the runtime's dma-buf exports, only on a refusal (a pending or failed verdict stands), under the device's check of that memory; the image must hold exactly Metal's texels to the buffer's end (linear_plan::aliases). alias_image binds it (exported_dma_buf_texture_image: the buffer's memory held, the first move acquiring from VK_QUEUE_FAMILY_FOREIGN_EXT into GENERAL as an image over dma-buf pages does), alias_image_made answers it unbound. Devices whose image binds in the memory (ANV, lavapipe) keep that path unchanged. - in_place_check.rs: the ExportedDmaBuf class takes a dma-buf's dedicated allocation too, and its textures take this route wherever the image in the memory is refused, so its verdicts (reads: a CPU write through the buffer's mapping read through the import's image; writes and renders the other way) measure it. CHECK_VERSION 13 -> 14: 13's records kept ExportedDmaBuf Unchecked as a cause that lasts. Test: exported_textures' a_dma_buf_export_s_planes_go_in_place_through_its_own_dma_buf_where_no_image_binds_in_it asks the device itself (the format query and the image's dedicated requirement) whether a plane's image binds in the memory; where none does and the device makes DRM_FORMAT_MOD_LINEAR images, each plane must be in place through the import (counted) or a CheckFailed shadow, never Unchecked; the buffer's export is a dma-buf (fdinfo exp_name); one import live per such image, none once the textures go; no VUID. The NV12 test reads such an image's memory plane (09433). The RX 550 enables no VK_EXT_image_drm_format_modifier: its planes stay announced shadows. Docs: API.md's shadow rule, HOWTO section 7, the runtime README, the module docs. Verification follows: the 780M, the RX 550, lavapipe and the Iris Xe under the layer, then the 5080 through an entry. (cherry picked from commit c2e90e2321937067d38cebc5b342f651a638b064) |
||
|
|
5ebe1d32aa |
Revert the dual dma-buf export and the opaque-descriptor naming
Reverts 1acb4f1fbf, 07d9fcac79, 6a6523d2bf, 4a13dfe5bc and 239d8ff9bb as one fix-forward commit; the tree is b4331408bd's again. An image naming an opaque file descriptor in a block exported as DMA_BUF | OPAQUE_FD went in place on the RX 550 (m3-max-10339 at 239d8ff9bb), but the validation layer reported VUID-VkExportMemoryAllocateInfo-handleTypes-09860 at each bind: it asks vkGetPhysicalDeviceImageFormatProperties2 for the bound image with each handle type of the memory's export set, and RADV supports no dma-buf linear image. Its DRM_FORMAT_MOD_LINEAR dma-buf image requires a dedicated allocation. So no image in a shared block exported as a dma-buf is clean under the layer there, whatever else the block exports, and the block goes back to exporting the dma-buf alone, with no opaque naming and no counter of it. The next commit takes the DmaBuf route instead: the block's own dma-buf, imported as memory dedicated to the texture's image. (cherry picked from commit af8bda811b4ba9a7816965d2f3bf1fd710d1e40e) |
||
|
|
0b1dd0fc36 |
An image over a dma-buf block names a type the block is exported as, with no image-side compatibility test
On the 780M (m3-max-10304 at 07d9fcac79) the image naming an opaque file descriptor over a block exported as DMA_BUF | OPAQUE_FD was refused only by the image-side compatibility test this branch added: RADV's format query lists compatibleHandleTypes 0x1 (the opaque type alone) for its opaque linear images. That test was stricter than Vulkan: - VUID-VkExportMemoryAllocateInfo-handleTypes-09860: the export set's bits must be compatible "as reported by ... VkExternalImageFormatProperties, or VkExternalBufferProperties"; the buffer query answers them so (FdExport::new). - VUID-VkImageCreateInfo-pNext-00990: an image's handleTypes lie in its own compatibleHandleTypes; the image names one type. - VUID-vkBindImageMemory-memory-02728: the memory's export set includes one of the image's types. So the test goes (LinearRefusal::Incompatible and ModifierMemory::shared_with with it). What stays, per handle type the image names: the format query reports it EXPORTABLE, not DEDICATED_ONLY; the image made requires no dedicated allocation (VkMemoryDedicatedRequirements); its memoryTypeBits take the block's type and its alignment is met at the texels' offset (alias_unbound_in's aliases check); and the in-place check measures that exact image, under the layer, before a texture takes it. The VUIDs are cited where the export set (FdExport::new) and the image's handle type (alias_unbound) are decided. Docs follow: API.md's shadow rule, HOWTO section 7, the in_place.rs module doc. Verification: the 780M, the RX 550, lavapipe and the Iris Xe next, then the 5080 through an entry. (cherry picked from commit 239d8ff9bbd4477d784f4ccc815ebf8af53dcad0) |
||
|
|
6d5c7b8e92 |
A dma-buf block's images name an opaque file descriptor where the device takes no dma-buf image in a shared block
On the 780M (RADV PHOENIX) the runtime's memory exported as dma-bufs kept every texture a shadow: the device's image format query refuses the dma-buf handle type to a plain linear image and takes it for a DRM_FORMAT_MOD_LINEAR image only in a dedicated allocation, so the in-place check of that memory made no image and its verdicts stayed Unchecked (m3-max-10261). RADV takes an opaque file descriptor for the same images in a shared block (the opaque-descriptor planes are in place there, alignment 256). The remedy, decided from documented queries alone: - exported_memory.rs: FdExport::new asks vkGetPhysicalDeviceExternalBufferProperties for the dma-buf and the opaque handle types with the runtime's buffer usage. Where the dma-buf's compatible types hold the opaque one, and the opaque one is exportable, not DEDICATED_ONLY, and compatible with both, a shared block of dma-bufs is allocated exportable as DMA_BUF | OPAQUE_FD (Memory::export_dma_bufs_as). Elsewhere, and for a buffer's dedicated allocation, it stays the dma-buf alone. The buffer still names the dma-buf type (VUID-vkBindBufferMemory-memory-02726 needs one in common) and export_memory_dma_buf is unchanged: vkGetMemoryFdKHR of the dma-buf type, a dma-buf of the same memory. - memory.rs: Exported carries the export set beside the handle type; bound_memory answers the set. - texture.rs: alias_unbound tries the image naming the dma-buf type, then, where the block exports both, the one naming the opaque type, each through the same linear-then-DRM_FORMAT_MOD_LINEAR route (alias_unbound_in). An image takes a handle type only where vkGetPhysicalDeviceImageFormatProperties2 with that type reports it exportable, not DEDICATED_ONLY, and lists every type the block is exported as among its compatible types (external_image_limits, modifier_image_limits; LinearRefusal::Incompatible). Where neither takes it, the shadow and its notice name both refusals. - in_place.rs: the class follows the memory (ExportedDmaBuf for any block of dma-bufs); the check's own textures go through the same route, so its verdicts are of the image a texture names. CHECK_VERSION 13 -> 14: 13's records kept ExportedDmaBuf Unchecked as a cause that lasts. - WorkCounts::exported_dma_buf_images_named_opaque_fd counts the images that name the opaque type over a dma-buf block (api_signatures.tsv). Test: exported_textures' a_dma_buf_block_s_planes_name_an_opaque_fd_where_its_images_take_no_dma_buf_in_a_shared_block asks the buffer and image queries itself, apart from the runtime: it asserts the block's export set matches the buffer queries, the buffer's export is a dma-buf (fdinfo exp_name), and, where the block exports both and the dma-buf type takes no image of the plane's format in a shared block, each plane is in place naming the opaque type (counted) or a shadow of a byte the check found changed, never Unchecked; no VUID under the layer. Without the change it fails on RADV: the block exports the dma-buf alone where the buffer queries answer both. Docs: API.md's shadow rule, HOWTO section 7, the runtime README and the module docs. Verification: to run on the 780M, the RX 550 and lavapipe, then the 5080 through an entry. (cherry picked from commit 1acb4f1fbf1fd4df8fcee2948417dcc089909fe4) |
||
|
|
04f1587445 |
Snapshot refusals: say which clause leaves an own-pixel slot out, and count unreadable splits by it
WorkCounts::reading_draws_split_unreadable_own_pixel counted draws whose
own-pixel slot no snapshot serves without saying why: its one logged reason
lumps a branch, a sample, a derivative, a store and a function that writes
memory. On the guest compositor's 780M walk it is 23,031 draws (23,463
before f922125bb1's demote guard), so the guard served another shape, and
which clause refuses decides the next step. Counts and interface facts
only; which slots qualify is unchanged.
Translator: spirv::requirements::snapshot keeps one reach mask per clause
and states each slot left out with every clause that holds for it
(StageInterface::snapshot_refusals, StageModule::snapshot_refusals, the new
public pipeline::SnapshotRefusal): Branch, Derivative, Sample,
GroupOperation, Store, Atomic, ImageWrite, UndefinedOperand, WritesMemory,
Interlock, Coherent, Other (a slot past 127, values that do not settle, a
ray query, a mesh output count, an unmatched call, the entry's returned
value). The walk now runs also in a function that writes memory or a module
with an interlock or coherent resource, so such a slot is stated with the
per-value clauses too; its slots stay left out as before. A snapshot variant
judges none. ARTIFACT_FORMAT_VERSION 494 (two encoded fields, one enum),
SEMANTICS_VERSION 1996 (a new interface fact).
Runtime: a draw split for UnreadableOwnPixel is counted once under each
clause that leaves out any of its unreadable attached slots
(WorkCounts::reading_draws_split_unreadable_own_pixel_{branch, derivative,
sample, group_operation, store, atomic, image_write, undefined_operand,
writes_memory, interlock, coherent, other}), and the log names the clauses,
once a device per set.
Tests:
- spirv::requirements::snapshot::tests::only_values_no_helper_can_pass_on_qualify:
every sink states its one clause, with new sinks for a quad swap, a
storage-buffer store, an atomic, an image write and a coherent image.
- spirv::requirements::snapshot::tests::a_slot_left_out_by_the_function_or_its_index_says_so:
WritesMemory alone and beside a derivative; slot 200 Other beside slot 0
qualifying.
- pipeline::compile::tests::the_interface_states_why_a_slot_takes_no_snapshot:
owned fixture sd_read_discarding on the 780M's profile states none, and
Branch alone with shaderDemoteToHelperInvocation withheld; tob_read none;
the render pipeline's fragment stage the same.
- runtime_lane::snapshot_reads::a_reader_that_ends_itself_by_its_texel_takes_the_split_for_its_branch
(device): the discarding reader with demote withheld: 3 * FILL, two
splits, two unreadable own-pixel splits, both under branch alone.
api_signatures blessed (26 records); api_surface row for SnapshotRefusal;
docs/API.md's snapshot reads name snapshot_refusals.
(cherry picked from commit 4412816cc23ede42b266ad4d2c62465711853d83)
|
||
|
|
12f7267750 |
Depth comparisons record RestrictedDepthRange on every device without VK_EXT_depth_range_unrestricted, MoltenVK included
Without the extension Vulkan gives a depth image no value outside [0, 1]: a copy may take none (VUID-vkCmdCopyBufferToImage-pRegions-07931), and a render write is clamped to the viewport's depth range. MoltenVK's driver was measured to keep such values (DriverFact::DepthImageKeepsValuesOutsideUnitRange), and its depth comparisons required that property in place of the note; the owner's rule is never to rely on undocumented Vulkan behaviour, so the fact follows the extension and nothing else. With the extension a comparison records nothing already, so the fact, the VkProperty::DepthImageKeepsValuesOutsideUnitRange it derived and the texture plan's kept_depth_range are removed: depth_comparison records RestrictedDepthRange wherever the extension is not enabled (ANV, RADV, MoltenVK), a precision note, logged and never fatal. SEMANTICS_VERSION 1995: MoltenVK's comparing stages record the note and no longer require the property. The codec drops the variant by name (no format bump: a removed variant's tag stays unused). docs/API.md's restricted-depth-range entry, FAST-PATHS rows 79 and 80, the note's and the measurement table's docs, engine_depth_range's test (the note on MoltenVK too, no module requiring the extension), driver_facts' MoltenVK row and api_signatures (three variants) follow. The compare-clamp lane predicts restricted-depth-range by the extension alone again. Verification follows in the lane jobs; the golden tables and the authored compile census are re-blessed on development. (cherry picked from commit 90d231de945294c8428c05f79946f09bbb426819) |
||
|
|
afb53192f7 |
Depth uploads clamp on every device without VK_EXT_depth_range_unrestricted, MoltenVK included
Vulkan takes no copied depth outside [0, 1] without the extension (VUID-vkCmdCopyBufferToImage-pRegions-07931), and a driver measured to keep one (DriverFact::DepthImageKeepsValuesOutsideUnitRange, MoltenVK's) does not make the copy valid: the owner's rule is never to rely on undocumented Vulkan behaviour. MoltenVK 1.4.2 does not expose the extension, so ImageFacts::depth_clamps is now the extension's absence alone: MoltenVK's uploads (replace_region, blits from buffers, copies from colour textures, a heap's tiled copy in) clamp as ANV's do and announce restricted-depth-upload. The fact stays for the translator's depth comparisons (lower/texture/slot.rs depth_comparison, through VkProperty::DepthImageKeepsValuesOutsideUnitRange) and for the validation executor's own raw copies (candidate/platform/compute.rs). The lanes follow the rule (degrade_notices::clamps_depth_uploads, the heap lanes, texture_blits::depth_images_keep_what_their_drivers_claim, which checks the clamp where the device lacks the extension, and buffer_depth_samples). The combined-format blit lane counts apart the GPU-assisted check's reports at offsets off a depth's 4 bytes: layer 1.4.363 reads a D32_SFLOAT_S8_UINT depth aspect's buffer at 5 bytes a texel, where the spec lays it out as D32_SFLOAT's. Verification: Iris, lavapipe and the M3 lanes follow in their jobs. (cherry picked from commit 6dfbc9c0dd0b4b3690ce2824d16fb561afc51047) |
||
|
|
460a608d1b |
Depth uploads clamp into [0, 1] on devices that take no other: replace_region, blits from buffers, copies from colour textures
On a device without VK_EXT_depth_range_unrestricted whose driver is not measured to keep a depth outside [0, 1] (ImageFacts::depth_clamps, ANV on the Iris Xe), a copy into a D32_SFLOAT or D32_SFLOAT_S8_UINT depth plane took Metal's bytes as they are, which breaks VUID-vkCmdCopyBufferToImage-pRegions-07931 for any value outside [0, 1]. The heap's tiled copy-in already clamped (TiledLevelMove:: clamps_depth); every other upload now goes through the same clamp, on the bits: a NaN of either sign 1.0, -0.0 kept, other negatives 0, above 1.0 (+inf too) 1.0, the rest as they are, no denormal flushed. - Translator: bind::clamped_depth (the CPU rule) and bind::depth_clamp_module (DepthClampModule), an in-place clamp over a buffer's words in the extended-canonical kernel's shape (first, width, row and image pitches). The tiled kernel's clamp now shares the module's SPIR-V helper. - Runtime, depth_clamp.rs: clamps_depth (one test of format, aspect and device facts, which heap_tiled now uses too), the CPU clamp of packed bytes, and BlitCommandEncoder::clamp_depths / clamped_depth_copies: one dispatch a region (split into images or rows past the device's storage range or workgroup counts), each its own command so the tracker orders it between the copies. - replace_region clamps the packed bytes on the CPU before any route (a host copy, the staging queue, a submission), so no depth image holds a value outside [0, 1] that a later copy of its texels moves on. - A blit from a buffer into such a depth copies the regions' bytes into a scratch buffer, clamps them and copies from there; a plan that stages its rows clamps its staging buffer in place; a copy from a colour texture through the encoder's scratch clamps the scratch before the copy into the depth. - WorkCounts::depth_uploads_clamped counts each clamp. - restricted-depth-upload stays announced where it was; its doc, the replace_region message, docs/API.md, the blit and replace_region docs and the FAST-PATHS device-gap row say the upload clamps. - MoltenVK (DepthImageKeepsValuesOutsideUnitRange) and devices with the extension are untouched. Lanes, runtime_lane::depth_upload_clamps, under the validation layer's GPU-assisted buffer-copy check: replace_region, a blit from a buffer (as it is, through its plan's staging at an offset of 2, and into Depth32Float_Stencil8's depth) and a copy from an R32Float texture, each checking no VUID-07931, the clamp counted, and each texel read back clamped (or as written where the device keeps it). The heap lane now shares the lanes' device and message checks. Unit tests: the clamp rule, the kernel under the interpreter, the region splitting, the CPU clamp. api_signatures blessed (+16), api_surface table updated; REFUSALS.md unchanged on regeneration. Verified: not yet (Iris, lavapipe and Linux clippy are queued). (cherry picked from commit a63c3646dd5e3fad8b24e387c4adb0f94d635ac9) |
||
|
|
098eec639b |
API.md: when a texture over exported memory is a shadow
The shadowed-texture list in section 10 gains the exported-memory causes the handle-type fix introduced: the check of that exported memory not passed (pending ones move in place), the image format query refusing the handle type but in a dedicated allocation, and a buffer's dedicated allocation. (cherry picked from commit cd993135eca08d877b7b55a3c0570df86df7510f) |
||
|
|
ee3f269fa3 |
Heap depth textures: the copy in clamps a 32-bit float depth into [0, 1] where the device takes no other
A heap's 32-bit float depth texture whose shadow copies the heap's bytes into its image went through vkCmdCopyBufferToImage with whatever float the bytes held. On a device without VK_EXT_depth_range_unrestricted that is invalid usage for a value outside [0, 1] (VUID-vkCmdCopyBufferToImage-pRegions-07931); ANV stored it clamped, and the runtime only announced it (restricted-depth-upload). The tiled texel kernel (metal2vulkan::bind) now clamps a level's elements on the way into the tight buffer where the level says so: - TiledLevelMove::clamps_depth, set with TiledLevelMove::clamping_depth; - the shape's level record grows to 14 words; - the clamp compares the word's bits, so no denormal is flushed: a negative value becomes 0.0, one above 1.0 (and +inf) becomes 1.0, a NaN of either sign becomes 1.0 (as nan_clear.rs clears a NaN depth), and -0.0 and every value inside [0, 1] keep their bits; - the move back is unchanged. HeapTiledCopies::new takes the image's format and marks the 4-byte depth planes' levels of a D32_SFLOAT or D32_SFLOAT_S8_UINT image where ImageFacts::depth_clamps holds: exactly where restricted-depth-upload is announced. MoltenVK, whose driver is measured to keep such values (DriverFact::DepthImageKeepsValuesOutsideUnitRange), keeps its copies as they were. The clamp is the device's own answer, so the notice stays and its text now says the copy in clamps. Tests: - bind::tiled_texels::tests::clamped_depths_move_into_the_image_inside_0_1, run through the CPU interpreter; - lane heap_textures::a_heap_depth_texture_s_copy_in_takes_no_depth_outside_0_1, which turns on the layer's GPU-assisted buffer-copy check (gpuav_buffer_copies), asserts no VUID-07931 message, and checks a blit reads the clamped values where the device clamps, else the bytes as they are. Docs: - the restricted-depth-upload declaration, docs/API.md's catalogue and its docs/FAST-PATHS.md device-gap row say the copy in clamps; - docs/FAST-PATHS.md's known gaps gain one entry: a heap texture Metal keeps uncompressed lies in its driver's layout where its image fits Metal's answer (heap-texture-untiled-layout); - api_signatures.tsv is blessed for the two new public items. Verification in the tip report. (cherry picked from commit de683c02ce08d337e8281dd752c2519f863bbe39) |
||
|
|
8b664a27a2 |
Shadow log names every shadow a texture makes; never-stood copies in split by what kept the end from standing
The walk's unskipped copies in are all of a 3648x2038 surface that never
stood, and the shadow log, which named only a texture over a buffer's bytes,
never named it. Two instruments to find out which shadow it is and why no
command buffer's end leaves it standing:
- METAL2VULKAN_LOG_SHADOWS now names each shadow a device makes of a
texture: a usage shadow (a binding beyond its usage, an attached read, a
YCbCr texture's writes), with what the texture's own image is (an aliasing
image over the bytes with or without the feedback loop usage, a shadow, or
an image of its own); a rotated texture's image of its stored frame and its
twin; a two-plane extended-range texture's image; a depth or stencil
texture's tiled twin over a surface plane; and a YCbCr texture's converted
image and render shadow. A line's truth is the buffer's bytes or the
texture's own image.
- WorkCounts::shadow_texels_never_stood_{unmet, not_current, dropped,
partial, end} split shadow_texels_unskipped_never_stood by what last kept a
command buffer's end from leaving the image standing
(shadow_standing::Missed): no end met it, an encoder ended with its image
not holding the truth, what the command buffer carried let it go, the end
held it in part or stale, or the end records no standing. Each shadow that
may stand keeps the last one; off the counts it changes nothing.
Verified: cargo fmt only so far; the checks run as a potluck job.
shadow_standing_device now asserts the five sum to never_stood and that a
first read's never-stood texels are all unmet.
(cherry picked from commit 1dd2a2ee2b9c39a2ba7aaeea3e3ad7906fd035f9)
|
||
|
|
dae9923446 |
Heap refit docs: which textures an image in place serves, and what the shadows of Metal's tiles cost
HeapTextureHostTransfer and HeapTextureLinear (and docs/API.md's catalogue) say the refit takes an image of host-transfer usage only for a texture Metal compresses or whose layout is not modelled, and of one Metal keeps uncompressed only a linear image whose every element lies where Metal's tiles place it. docs/FAST-PATHS.md's costs record the shadow of Metal's tiles kept for every other such texture, with the 1x1 shadow's GPU time measured on the Iris Xe at RUNTIME_VERSION 1909 (35.9 us against 8.1 us a frame); the compositor's 3x3 to 10x10 shapes are not measured apart. (cherry picked from commit dc30f3c6c8768ab3780bad861bba9db1ad9f4b84) |
||
|
|
ec94c62dce |
heap depth textures: a merge's keep holds the heap's bytes, not the image's
A 2-slice Depth32Float 64x64 x2 multisample texture in a Shared placement heap on ANV (Iris Xe, RPL-P, Mesa 26.2.6) lost the samples a blit wrote into one slice: 16384 of 16384 were off Metal's tiles after the merge back, while a read straight from the image matched. The heap's bytes held 0xee before the blit. The copy in hands the image 0xeeeeeeee, a float outside [0, 1], which Vulkan leaves undefined in a depth image without VK_EXT_depth_range_unrestricted, and ANV stores 0.0. The merge's keep was moved out of the image (only drivers announced drawn-depth-copy kept the heap's bytes), so it held 0.0, and the merge kept the heap's 0xee in every byte of a written sample that equals 0.0's: a probe found 9155 0xee bytes left in the slice, the 9134 zero bytes of the samples plus 21 sample bytes that are 0xee, and no sample whole. Now a heap's tiled texture with a depth aspect, of any sample count, keeps the heap's bytes: the staging buffer its copy in filled where the keep follows it (WorkCounts::shadow_keeps_from_staging), else the heap's bytes themselves, and plans no moves out of the image for the keep. Every byte a command wrote is merged whatever the copy in changed; a value the copy in changed in a texel no command wrote is written back as stored, as a copy back writes it. That clamp is the device's: a heap's 32-bit float depth texture whose shadow copies the heap's bytes into its image now announces restricted-depth-upload as it is made, on a device without VK_EXT_depth_range_unrestricted whose driver is not measured to keep such a value (ANV; not MoltenVK, NVIDIA or lavapipe with the extension). Its declaration, docs/API.md's catalogue and a device-gap row in docs/FAST-PATHS.md say so. The measured drawn-depth-copy flag a multisample texture held for its keep is gone with its one reader; the announcement at making stays. heap_multisample_textures_keep_their_samples_in_metal_s_tiles now also checks, for each counted 32-bit float depth texture, restricted-depth-upload as it is made where the device clamps, and that a blit into one slice or aspect keeps from staging. Verification in the tip report. (cherry picked from commit 688e1dcc00ff67979833fdcbaf2f5484057e18a6) |
||
|
|
7fbbac9536 |
Heap textures: an image that fits Metal's answer lies in place before a shadow
A single-sample colour heap texture whose image of the route the device first took (ANV's compressed optimal image under the default HeapCompressionPolicy, say) takes more bytes or a coarser alignment of the heap than Metal's answer was a shadow of the heap's bytes in Metal's tiles, copied in before each command buffer's first use and back after each writing encoder. The owner's rule keeps a shadow as a correctness fallback only: where the device makes an image that fits the answer in the heap's memory, the texture now lies there in place, its optimal image of host-transfer usage first, else its linear image (Device::fitting_heap_image), announced heap-texture-host-transfer or heap-texture-linear with the making's facts and what the first image took. Unverified: built and measured on ms01's Iris Xe in the commits that follow. (cherry picked from commit c1a996cd53f74d0afa130dd867ab42499c2b758f) |
||
|
|
6ef13920d0 |
Shadow causes for a walk: why a private truth's first copy in moved, and a log of each shadow made
The 780M's glass composites copy large Private IOSurface planes in each command buffer: walk 9286 counted 41.07 M texels first copied in per composite, 37.70 M of them over images an earlier command buffer left standing, yet only 3 copies in a composite were decided against a standing (2 skipped) of 84 shadow copies. No count said where the rest were decided, nor why each shadow over those planes takes no image over the bytes. - WorkCounts::shadow_texels_unskipped_*: every encoder's first copy in of a Private (or Memoryless) buffer's bytes, an IOSurface plane's among them, that moved its texels, by where it was decided (shadow_standing::Unskipped): unstanding (its shadow never stands: untracked, a heap's, the caller's memory, its VkBuffer handed out, writes dropped), between_instances (a held render pass's copies between its instances, inline_splits, which no submission decides), after_encoder_writes, recorded_whole (predicated laying, no new VkCommandBuffer), command_buffer (at submission: its command buffer reaches unnamed memory or an earlier encoder wrote the truth or image), let_go (at submission: the standing let go). With shadow_texels_skipped_by_standing they sum to shadow_texels_first_copied_in_private_buffers + _private_surfaces. And, but for unstanding, by what the standing held then (shadow_standing:: LetGo, Standings::let_go): stood, never_stood, unnamed_since, truth_written, image_written; for those decided as the encoder records them, by the batches submitted so far. - METAL2VULKAN_LOG_SHADOWS (default-off diagnostic, shadow_log.rs): one line per shadow a device makes of a texture over a buffer's bytes: the call (new_texture_with_iosurface_plane for a plane's), format, size, levels, usage, the buffer's storage mode, length and object ID, the texels' offset and row pitch, and the reason its shadowed-texture notice gives (announced once a device). Two textures over the same bytes name the same object ID and offset. - Standings::stands is folded into let_go; submit.rs's gate answers where it was decided. - Tests: shadow_standing_device checks both sums in every leg, and the first read's copy in is let_go/never_stood, the read after another queue's fill let_go/truth_written, a read after its own command buffer's fill command_buffer, a read once the VkBuffer was handed out unstanding. - Docs: shadow_standing.rs, WorkCounts, docs/API.md (the log), env_vars REGISTRY; the artifact test's note on the variables the runtime reads. api_signatures blessed. No behaviour changes: counts and a default-off log only. RUNTIME_VERSION not bumped (main's). Verified: cargo fmt; builds and tests run as potluck jobs after this commit. (cherry picked from commit a82491daf4a24ad57845c6e0f62bd53946dc22f8) |
||
|
|
8e1383b1b6 |
In-place check: an unchecked verdict whose cause lasts is kept; one that may pass is checked again
The previous commit kept every unchecked verdict out of the record, so a driver that truly lacks what a class needs (an extension, a feature, an import, a format or an image of the shape, such as lavapipe's DmaBuf and Pooled rows-in-lines, which RuntimeDriverDefect:: ExplicitPlaneRowsPastHeight refuses) would be checked again by every device. Such a cause is fixed for the driver's identity, as stable as a passed or failed verdict, so it is kept; only an unchecked verdict from a cause that can change between runs is kept unmeasured and checked again. - in_place_check::Unmade: the reason the check made no pages, pass or image, and whether its cause lasts. ClassPages::make, ExportedPages::make and Round::NotMade carry it. Lasting: no host import (VK_EXT_external_memory_host), no dma-buf images, export only as a dedicated allocation, no host-visible coherent type, no DRM_FORMAT_MOD_LINEAR images, and a placement answer the image's making decides before it binds (Refused Rows, Image, Pitch, Placement, DmaBuf; another route of the shape), and an error that is the device's gap or Metal's refusal (Error::Unsupported, Error::Invalid). May pass: pages, memory or mappings not made, an export failing, a no-copy buffer copied or imported otherwise on a device that imports host memory, an answer in place that only the bind refused (the dma-buf's import), detached or sourceless pages, the writer thread not started, a first move, pass or kernel's stores failing, the kernel's buffers refused, any other error (out of memory, a lost device, a Vulkan failure, the runtime's own gap). - check_class answers, by row ends, whether an unchecked verdict met a cause that may pass; run writes those verdicts pending in the record and the rest as given. encode writes the verdicts as given; decode reads every verdict byte (unchecked among them). - Notes say which cause it was, "(a cause that lasts, kept)" or "(a cause that may pass, checked again)": the first of each kind per class and access. - CHECK_VERSION stays 12 (the bump the previous commit made, not landed): a record of 11 may hold unchecked verdicts whose cause may pass, which no device takes now. - Tests: an_unchecked_verdict_is_checked_again_where_its_cause_may_pass_and_kept_where_it_lasts (device test, replacing the previous one: the pointer class's failed import is noted as a cause that may pass and checked again by the next device; every measured verdict is recalled, each unchecked one recalled unchecked or checked again; on a driver with ExplicitPlaneRowsPastHeight the DmaBuf reads of rows inside lines are recalled unchecked). The record round trip holds passed, failed, unchecked and pending verdicts. The in-place textures lane's record test takes measured <= recalled <= VERDICTS. narrow_writes_device and freed_memory read only the report's verdict lines, not the notes after them (20 narrow lines counted where 16 were due on lavapipe, job 9303). - Docs: in_place.rs, in_place_check.rs, WorkCounts::in_place_checks_recalled, settle_in_place_checks, docs/API.md, docs/FAST-PATHS.md (the in-place row). Verified: cargo fmt; builds and tests run as potluck jobs after this commit. (cherry picked from commit b420f97f56237fc0bf153691e9ac7e5a8e923386) |
||
|
|
aa188702ad |
In-place check: an unchecked verdict is no measurement, kept unmeasured and checked again
On the Iris Xe (ANV) reims' arm-s boots made 890 shadows over guest RAM imported as dma-bufs,
every one "the device's check made no image over host pages imported as dma-bufs" (Unchecked),
small ShaderRead textures at offset 0 on whole pages among them, where a fresh check of the
same driver passes the class's reads (
|
||
|
|
6f702cb76a |
docs/API.md: an exit mid-making, the difference left
What: the accepted differences' "Process exit" names what the exit hook's registrar leaves: a making on the program's own thread, which the exit does not wait for, and destructors the driver's compiler registered in the last 2 ms before the exit (or past the registrar's 16384 registrations), which can run beside the compile, where Metal compiles in another process. Why: the registrar (RUNTIME_VERSION 1899) closed the rest of exit_guard's hole for makings on the runtime's threads; what is still open is a consumer-visible difference, and one such exit (a consumer's making thread left running) ended its process with SIGSEGV inside NVIDIA's SPIR-V compiler on the RTX 5080. How verified: docs only; the figures are exit_guard's MAKING_INTERVAL and MAKING_REGISTRATIONS. (cherry picked from commit 5f1846a295017a2244fde27cdd2ed3db97bdb9cb) |
||
|
|
0d66b9de2b |
with_vk_queue: the closure gets the VkDevice its VkQueue belongs to
`CommandQueue::with_vk_queue` now calls `f(&ash::Device, vk::Queue, u32)`. The device is the serving generation's, read under the queue's lock with the VkQueue. After a recovery the queue lends the new VkDevice's VkQueue. Until now a caller could get the device only from `Device::raw` handles it had cached, and after a recovery those name the lost VkDevice. The consumer's copier did exactly that: it submitted command buffers from a pool made on the lost device to the new device's queue, and the process died inside RADV (a segfault at null+0x50 in libvulkan_radeon.so, right after our "VkDevice was lost and made again" log). No call let it see the change atomically. Every call site in the runtime, its examples and the validation lanes takes the new argument. The runtime README's interop and "A lost device" sections, `Device::raw`'s docs and docs/API.md's device-recovered entry say what the closure gets. api_signatures.tsv is re-blessed (one signature changed). Test: device_recovery::a_lent_queue_names_the_vk_device_it_belongs_to_across_a_recovery. It reads the lent queue's device before and after recover_for_test. The two differ, and the second equals what Device::raw answers after the recovery. The test also asserts the old route is wrong: the raw handle cached before the recovery differs from the lent queue's device after it. That cached handle was the only source of the device under the old signature. (cherry picked from commit b4bf228df9db98a451c997f350c6014b027f7e31) |
||
|
|
ded385b661 |
YCbCr textures: announce the device's conversion at the first conversion; the lanes read in-place samples as Metal's
On the Radeon 780M, which converts the 4:2:0 formats itself and reads their planes in place, the ycbcr lanes failed 9 of 48 at this branch (um870 m3-max-8383) and 17 of 48 at development's tip (gem10 m3-max-8421), the same 9 among them. Two causes: - A texture whose conversion is the device's announced ycbcr-filter-not-exact as it was made, though a texture whose planes every function reads in place never converts and so never reads the device's conversion (a_ycbcr_texture_sampled_and_gathered_by_one_function_reads_its_planes_in_place, a_ycbcr_sample_through_an_unmeasured_filter_is_announced). Converts::new now announces it at the texture's first conversion. WorkCounts::ycbcr_device_conversions still counts the texture as it is made, so a lane can tell before a read that the texture's image holds the device's conversion. The lanes' notice predicates now take a conversion that ran, WorkCounts::ycbcr_device_samples (device_samples), in place of the textures made. - The lanes held the samples of a texture whose planes are read in place to its image's texels, the device's conversion on such a device, where a function reading the planes converts the codes itself: Metal's conversion and filter under the lane's exact_answers (YCbCrInPlacePolicy::Exact), as ycbcr.rs states. Texels::sampled takes Metal's steps of the codes (modelled) for a texture read in place and the image's texels elsewhere, in a_linear_sample_of_a_ycbcr_texture_is_metals, a_linear_sample_is_metals_through_each_sampler_and_result and its fragment twin, a_ycbcr_slot_takes_the_devices_filter_in_the_pipeline_its_creation_made and ycbcr_textures_read_the_texels_metal_converts; a_draw_samples_the_planes_as_written_before_it holds a draw read in place to Metal's conversion of the uniform codes. four_two_two_and_four_four_four_codes_read_what_metal_reads also held a code twin over a surface whose chroma plane it does not fit in to Metal's codes where the device reconstructs them itself: it now takes the device's codes there, as the test's other surfaces do. Docs: the ycbcr.rs and ycbcr_device.rs module docs, Degradation::YCbCrFilterNotExact and its docs/API.md catalogue entry say the notice comes at the first conversion. Verified: cargo fmt; the 780M runs on um870 and gem10 follow. (cherry picked from commit c498f9383a3f4a2ef3f267a135ea5494aa8fb5e4) |
||
|
|
5640e17560 |
Document the model's linear sample of planes read in place
FAST-PATHS.md gets the ledger row for ycbcr_in_place_reads (Model default, Exact switch, the 780M's exact-form cost measured at development's tip), the device-gaps row and the in-place section name the choice; API.md's policy list and the half/float filter and ycbcr-filter-not-exact catalogue entries name the model; PrecisionNote::HalfSampleFilter/FloatSampleFilter and Degradation::YCbCrFilterNotExact docs say the model records and announces them. (cherry picked from commit 5f83699d296386c3b0b357f2baa63cfefc086096) |
||
|
|
6ba9ac779f |
BufferDescriptor::aligned_byte: lay a buffer's byte on a multiple of 256 bytes of its memory
A consumer that lands decoded frames in a buffer of the runtime's own memory makes plane textures at CoreVideo's offsets: the first plane 32 bytes into the surface, the second 32 bytes past a multiple of 256 after the first's rows. A linear image aliasing the buffer binds at the buffer's memory offset plus the texture's, which must meet the device's linear-image alignment (256 on RADV, 128 on NVIDIA, 64 on lavapipe), and the runtime starts each buffer on a multiple of 256, so those planes are shadows there (the 780M probe, um870 m3-max-8351: Shared and Private buffers, in place at 0 and 256, shadows at 32, 64 and 128). BufferDescriptor::aligned_byte (with_aligned_byte), a runtime extension for the runtime's own memory, names the byte to lay on a multiple of 256 (LINEAR_IMAGE_ALIGNMENT). placed_new_buffer then makes the VkBuffer that byte's shortfall longer, binds it where its placement starts, and starts the buffer's bytes that many bytes into both (BufferParts offset and base, the mechanism host imports use), so the byte lands on the multiple and textures there alias the memory. Such a buffer is never parked nor taken from the parked, and lies in no fresh pages. Its length and gpuAddress (the runtime's address space's) are unchanged; a Shared one's contents start the byte's remainder short of a multiple of 256, which the field's docs name against Metal's page-aligned contents. Refused with NoCopy contents (Problem::AlignedByteNoCopy). tests::aligned_byte: over Shared and Private buffers laying byte 0x20, the 8-bit and 10-bit frames' planes (R8/RG8 at rows 3840, R16/RG16 at rows 7680; the second plane at 0x20 + 0x7E9000 or 0xFD2000), sampled, written and rendered into, alias wherever the same texture at offset 0 of a plain buffer does, and are shadows at 0x20 of a plain buffer wherever the device's linear alignment is past 32; a blit of each sampled plane reads the bytes at its offset; length, gpuAddress and contents as above; the refusal over NoCopy. Docs: the field, HOWTO, API.md's shadowed-texture entry, the runtime README; api_signatures blessed and REFUSALS.md regenerated. New public items: BufferDescriptor::aligned_byte, BufferDescriptor::with_aligned_byte, Problem::AlignedByteNoCopy. Verified: cargo fmt; the 780M, lavapipe and Iris runs follow. (cherry picked from commit bef28766eee658ef30dfcc5d0492a1493171b34d) |
||
|
|
016c09572a |
Pooled moves: docs and API signatures
TexturePlacement::Pending: over the device's own memory, a texture made while the pooled check is pending now moves to its image at Metal's pitch the same way (it no longer stays a shadow for good). Texture::vk_image, docs/FAST-PATHS.md (row 41), docs/API.md (the shadow reasons over the device's own memory) and docs/HOWTO.md (the padding-unobserved paragraph) say so, naming WorkCounts::pooled_textures_moved_in_place and pooled_texture_shadows_freed_after_move. API signatures: the two new WorkCounts fields (scripts/api-signatures/signatures.py --bless, two lines added). (cherry picked from commit 4c1beda492dcc4af16923df09724b7fbf0e7387a) |
||
|
|
535f50063f |
Pooled bound over tracked Private buffers alone: CPU-visible caches lie in place at any size
The owner's 2026-11-07 ruling: over CPU-visible memory the GPU works in place wherever the device's check passed, however much slower; a shadow there is a correctness fallback, never a speed choice. The 48 KiB pooled bound (LinearCost) chooses between two speeds where both forms give the same answer, which holds only over bytes only the runtime's commands write. So it now applies to tracked textures over Private buffers alone (Texels::only_commands_write), for every access; over a Shared or Managed buffer, and for an untracked texture, a texture that samples, renders or is written takes the DRM_FORMAT_MOD_LINEAR image at its pitch at any size wherever its check passed. This widens the previous commit's sample-only exception. reims's histogram (boot 8203) shows no rendered cache past 48 KiB, so the render and write side changes nothing measured today. The bound's doc comment, LinearCost's (internal and public) and docs/API.md and docs/HOWTO.md now say so. Test: a_texture_past_the_pooled_bound_is_a_shadow_of_its_linear_cost_over_private_memory_alone replaces the rendered bound test and the previous commit's sampled one: 164x82 at 704-byte rows, past the bound, rendering and sample-only, over a tracked Private buffer Shadow(LinearCost) and no pitched image where the device makes such images, over a Shared buffer never LinearCost and the pitched image where the pooled check of its access passed. (cherry picked from commit cd89debcd731885e8045dc998252a08edc3dc60f) |
||
|
|
f8caa83975 |
Pooled bound: a texture that only samples bytes the CPU writes lies in place at any size
The 48 KiB bound weighs a DRM_FORMAT_MOD_LINEAR image at Metal's pitch against a shadow that renders into its own optimal image, or samples it copied in once. A texture that only samples a Shared or Managed buffer's bytes (or an untracked texture that only samples) has no such shadow: its shadow is copied in whole at every command buffer that samples it, as the CPU may have written the bytes. The guest's large device caches are WebKit's tiles, about 5 MiB each, CPU-painted and only sampled; past the bound each was a shadow re-copied in every command buffer. Measured on the Iris Xe (ANV, Mesa 26.2.6; job m3-max-8243, runtime_lane::pooled_draw_costs::pooled_sample_costs), a frame that samples four such textures whole after the CPU wrote a texel of each, GPU microseconds as shadows at the padded pitch against linear images at the tight one: over Shared buffers 1308x512 (2.7 MB) 327.8/215.9, 1324x940 (5.0 MB) 802.2/380.1, 3648x2038 (30 MB) 5789.3/2601.6; over Private buffers, whose shadows stand copied in once, 237.7/216.2, 404.4/409.4, 2028.1/2433.2. So the bound keeps covering textures that render or are written, and those that only sample bytes only the runtime's commands write (Texels::only_commands_write, the predicate a shadow's standing uses). Test: a_sampled_texture_past_the_pooled_bound_lies_in_place_over_bytes_the_cpu_writes (164x82 at 704-byte rows, past the bound, sampled: over a Shared buffer a pitched image where the pooled reads check passed and never Shadow(LinearCost); over a Private buffer Shadow(LinearCost) where the device makes such images). (cherry picked from commit d99c9c507b00e7b1537257a7a2fddd18d9563e2f) |
||
|
|
48caeeb155 |
DegradeNotice::command_buffer: the command buffer whose work announced a notice
A consumer that makes some notices fatal (reims-vgpu's ReleasedCommandState, PrivateResourceOption, HostDeallocatorDelayed) could not tell which command buffer a notice was about: a ReleasedCommandState announced at a host step on the scheduler's steps thread ended its whole VM. Now every notice carries the ID of the command buffer whose work the runtime was doing on the announcing thread, so the consumer can fail that one command buffer. What changed: - CommandBuffer::object_id: an ObjectId, minted at the command buffer's making from the process-wide count buffers, textures and heaps use. - DegradeNotice::command_buffer: Option<ObjectId>, read at the notice's making from a thread-local scope (degradation::NoticesFor), as `call` reads the call being lowered. The scope is set where the runtime holds the command buffer and does its work: the compute and blit encoders' logged funnels and their other recording calls and ends, the render lowering's at-call funnel, its unit calls, its batches' lowering (on the lowering thread or a drain) and its end, the resource state encoder's calls, encoder openings, the commit (at the call or queued behind a render end), a batch's submission and the storage-form settle that rides on it, host steps, a rebind's encoding again, and GPU-time reads. Nested scopes name the innermost. - None, explicitly, for a recovery of the device (device-recovered), for grouped-completion (several command buffers' batches), and inside the program's code the runtime calls (exit_guard::program, indirect command checks, executed-commands handlers). - A bind's memoized notices, announced again at each later bind under announce_each, are named as that bind's: its command buffer and the call being lowered (the call was the first bind's before; same mechanism). - ObjectId docs, docs/API.md section 9, docs/RUNTIME-PORTING.md; API signatures re-blessed (two records: the field and the method). Tests (runtime crate, device tests): - notice_command_buffers: an ICB execution recorded at a host step announces released-command-state on the steps thread naming the executing command buffer; its commit's host-replayed-indirect-commands, on the program's thread, names it too; private-resource-option of an ICB made between the encoder's calls names none. - deferred_calls: the call-naming test also checks the command buffer under both lowering policies; a new test waits for the lowering thread to announce unsized-points after end_encoding and checks the thread, call and command buffer, and that a device notice between the encoder's calls names none. - vertex_conversion_notices: a memoized bind notice (device-nan-encoding) announced at a second command buffer's draw names that command buffer and its own call index, with bound_notices_made proving the memo was reused. (cherry picked from commit b4c2ba83ea726229f129a405ce6f432b0bdb0127) |
||
|
|
df2d326289 |
A device's teardown leaves the device to the process's end at its next step once the exit began
runtime_lane::exits::exits_right_after_learning_of_completion_are_clean failed on the RTX 5080 in lane 10 of development's round at |
||
|
|
f5da0934bf |
exit_guard: past half its bound, the hook names where the sections it waits for began
An exit that waited for the runtime's work said nothing about what it waited for until its bound
ran out, and then only that the driver still ran it (the at-once notice). An exits-lane exit
that took 2.08 s on the RTX 5080 (runtime_lane::exits, handler_learns_exit, development
|
||
|
|
7e5821d9d1 |
In place: renders over padding a buffer declares unobserved take a verdict that lets that padding change (Access::UnobservedRenders)
What: a new check access, UnobservedRenders, that the renders rounds answer beside Renders, as the
storage-write rounds answer BufferWrites beside Writes. Where a shape's rows' padding is free
(Shape::padding), a renders round that changed no byte but of that padding (after a row's last
texel, before its pitch, the last row's included) fails Renders for its row ends and keeps
UnobservedRenders. A byte past the last row's pitch, or a texel, fails both. A new Padding variant,
Unobserved (Free padding over a buffer that declares padding_unobserved, Texels::padding), makes
in_place() ask UnobservedRenders in the stead of Renders (Access::rendered); the wider render-target
plan of an image in place asks the same. The check's SHAPES gain 172x67 BGRA8 at a 704-byte pitch,
whose last row's pitch ends 64 bytes past a multiple of 128 and 256, so a device that writes back
more than a line around a row's last texels changes a byte past the image and fails both.
VERDICTS 48 -> 56 (7 accesses), the record 56 bytes; CHECK_VERSION stays 11 (unlanded).
Why: on the Iris Xe (job 7965 at c4eeeba7e8), the pooled class's Renders verdict failed for rows
ending mid-line (the clear and store, and draws, write back the 64-byte line holding a row's last
texels whole), so none of the 93 device caches went in place (93 shadows, frame 4145 us declared
and undeclared alike), and the item's case (a padding-unobserved texture at a 64-aligned pitch, rows
ending mid-line, rendered) stayed a shadow (CheckFailed{Renders, InLines}). The declaration already
lets a render pass's load and store write those bytes; no byte past the last row's pitch may change,
and Padding::of guarantees the last row's pitch ends on a line.
Also: a padding-unobserved buffer in fresh pages takes the same rule; BufferDescriptor's doc says so.
Tests: unit cases for the compare (the line write-back of each row's padding is Padded; a 128-byte
write-back past the last row's pitch, a byte past it or a texel is Changed), Padding::declared, the
tally (Renders answers two), the decision test over Unobserved padding, the shadow-cause words; the
device test asks the UnobservedRenders verdict and asserts the texels' padding is Unobserved. Device
evidence follows on the Iris.
(cherry picked from commit 990d744ec71269663e292c7f2f3e4148d166bacb)
|
||
|
|
6717cac4ea |
Pooled class: a bound in bytes past which a texture over pooled memory stays a shadow (TextureShadowReason::LinearCost)
Measured on the Iris Xe (probe 7933): a small cache's shadow costs a fixed 3.5-4.3 us a
command buffer that writes it, which a linear image at Metal's pitch saves, while caches of
1.4 MB and more render and sample 8-18% slower as linear images than as shadows with their
copies. Over Private memory both forms give the same answer (no CPU reads the bytes, the check
judges the first move), so this chooses between two speeds and takes no FAST-PATHS row or
switch. in_place::POOLED_PITCHED_BYTES bounds a texture's rows to their pitch, the same on every
device; past it the cause is ShadowCause::LinearCost, which the placement query answers as the
new public TextureShadowReason::LinearCost { bytes } through the shared route. docs/API.md (the
padding-unobserved reason) and HOWTO say why.
The bound's value here (256 KiB) is provisional: the size sweep on the Iris and the 780M places
it at the measured crossover in a following commit.
Verified: cargo fmt; api signatures re-blessed (one variant added); REFUSALS.md regenerates
unchanged; builds follow.
(cherry picked from commit 366e098c15c7227006ba7633ecda574da224690e)
|
||
|
|
703eca0dba |
Pooled class: tests and docs
The padding-unobserved device test settles the check and holds the answer to the making's (NotHostPages exactly where the texture aliases, else the shadow's cause); a new device test renders textures of the guests' cache shapes (64-aligned pitches, rows ending inside a 64-byte line) over declared buffers and checks that a pitched image appears only where the pooled class passed for reads and renders, that the CPU's texels read back through the texture, that a clear reaches the buffer's rows, and that the bytes after the last row keep the CPU's. The validation lane reads 48 verdicts. Docs: in_place.rs and in_place_check.rs module docs, FAST-PATHS row 41, API.md (placement answers, the shadow reasons), HOWTO's padding-unobserved paragraph, the runtime README, BufferDescriptor::padding_unobserved, TexturePlacement's NotHostPages and Pending (a pooled texture made before its verdicts stays a shadow). Verified: cargo fmt only; builds and the device runs follow. (cherry picked from commit ae31d0fd3841b136c692897cbdf425633e9344c3) |
||
|
|
3feb4b3a55 |
Keep a tiled texture's own image through a detach, its first level the bytes' last texels
A tiled texture of more than one level (Buffer::new_tiled_texture) over a no-copy buffer presented the shared zero stand-in at every level while the bytes were detached, and refused CPU access at every level (DetachedTexelAccess). On a Mac its later levels are the texture's own memory, which a detach leaves, and its first level the pages it took, whose last bytes its CPU access reaches. The texture's image is its own, so it now keeps presenting it: noted with keeps (NotedTexture::keeps), it takes no stand-in at the detach (TexturesOver::images leaves it out, and so do the stale-reach notes) nor at its making over detached bytes. Before anything is detached, the detach loads its first level with the bytes' texels as they are then (keep_first_levels, Texture::keep_first_level: a get_bytes of the pages, then a write into the image), so an unnamed read and get_bytes read the last texels, those the CPU wrote after the last copy in included; a replace_region of that level stays refused. The later levels are read and written in the image as before. Once the bytes lie in pages again the first level copies them in at its next use. The load reads the level's texels once on the host (11.7 KB for WindowServer's 54x54) and stages one copy for the next submission, at a detach only. Docs: the item's rustdoc says the difference (its first level reads its last bytes while detached, where a texture over the pages alone reads zeros), with its other levels' rule and the copies of item 1 and 2; detach.rs, stand_in.rs, DetachedTexelAccess's doc and docs/API.md. REFUSALS regenerated (unchanged), api signatures checked (no change). Verified by the device tests: see the tip's evidence. (cherry picked from commit 87435362577424f2e7757ff69bcb292b401dc9ed) |
||
|
|
aadc115900 |
In-place check: a store failure fails every class's pass; compares read in wide loads
With the dma-buf class's pages imported on the Iris Xe (the commit before), two things showed, both from one cause: ANV maps its exported memory uncached for the CPU, whatever the memory type (job 7706: types 1 and 2 alike), so each byte the check reads there is a bus read of about 80 ns. 1. A flaky pass. The check's writer reads each byte before it rewrites it, sweep after sweep, while the GPU stores; a sweep of a 101x51@512 window there takes about 2.7 ms, against a store step of 0.1 to 0.8 ms, so it revisits a row's last line about 40 us apart instead of under a microsecond, and rarely lands a write between the GPU's read of the line and its write-back. The storage-write rounds of rows that end inside lines saw the padding change in 3 of 18 dma-buf rounds against 10 and 14 of 18 of the pointer and fresh-pages classes (job 7706), and the dma-buf class passed storage writes inside lines in one fresh check of three (job 7688), where its pass would have put a kernel's writes in place over kept padding on a guest's pages. In that run every round agreed (none saw a change). carried_store_failures: a class's failure of an access whose rounds store (renders: the pass's clear and store, and the draw; storage writes and buffer writes: the kernel's stores), where that class's reads of those row ends passed (so the failure is the stores', not the first move's), fails the other classes' passes of that access and row ends. The line write-back belongs to the store path every class's images share; how often a class's rounds see it does not. A reads failure (whether the GPU sees the CPU's bytes depends on the class's mapping and import), an unchecked verdict and a class whose pages could not be made carry nowhere. Each carried failure is noted. To change no verdict a texture already took, the check now gives its verdicts together once every class is done, not per class. 2. A 19 s check. Bytes::matches compared the window byte by byte: 2.7 s for each round of the 3840x2160 surface over the dma-buf pages (the fill took 4 ms). It now compares each period whole first (slice equality, in wide loads) and looks for the byte only where one differs; a cleared row's texels likewise, a chunk of zeros at a time. CHECK_VERSION stays 9 (the commit before, not yet released). Docs: the module's verdicts paragraph and run's, API.md's in-place check paragraph. Test: a_store_failure_fails_the_other_classes_passes_and_nothing_else_carries (tests/in_place.rs), the Iris's verdicts of the flaky run: the dma-buf class's pass of storage writes inside lines alone fails, as the pointer class's failure; a failure of the dma-buf class's own carries to the others; reads failures, an unchecked verdict and a store failure of a class whose reads failed carry nowhere. Verified: pending (the unit test with and without the rule, the Iris check time and verdicts in release, the device test repeated, the 780M and lavapipe verdicts against development's). (cherry picked from commit f2f0e284c2b62980bbc3f1e1881e01b2c8ce9227) |
||
|
|
b1e2f06e9e |
Docs: a written texture over host pages is a shadow by width only outside 1, 2, 4, 8 and 16 bytes
Two passages still said a shader's writes of 1- or 2-byte texels keep a texture over host pages a shadow: the shadowed-texture entry of docs/API.md's degrade-notice catalogue and the host-pages bullet of docs/FAST-PATHS.md's costs. The device's check now stores those widths too; a texture is a shadow by its width only for a width outside the ones it stores. Verified: docs only; grep finds no other passage that names 1- or 2-byte written texels as a shadow's cause. (cherry picked from commit 90bd51d7a55257a40e115c55da2a53c7bb0b4f80) |
||
|
|
6575c031f5 |
In place: 1- and 2-byte texels a shader writes, checked apart by the device's check
In every guest session reims measured (Iris Xe and Radeon 780M, macOS 26.7.2 guests), host_texture_shadows_store_width was 114, from 23 distinct R8Unorm, A8Unorm and R16 textures a shader writes (32x32 at 256-byte rows among them). They were shadows because the in-place check's write kernel stored only 4-, 8- and 16-byte texels (STORED_TEXEL_BYTES, ShadowCause::StoreWidth), so no check covered a driver's writes of narrower ones. What changes: - in_place.rs (from selfread's parked 0c587bcad5): Access gains NarrowWrites and NarrowBufferWrites, with 36 verdicts instead of 24. Access::written picks the writes check of a texel width and padding. STORED_TEXEL_BYTES holds 1, 2, 4, 8 and 16; NARROW_TEXEL_BYTES holds 1 and 2. in_place asks the written check in place of Writes. The report names "narrow writes" and "narrow buffer writes". CHECK_VERSION goes to 9 (development's dma-buf import fix took 8). - in_place_check.rs: NARROW_STORE_SHAPES, rounds of their own for the narrow accesses, through the copy-in kernel's R8_UINT and R16_UINT views (a801dac7d7). The shapes are packed R8 256x16 and R16 128x16 at 256; R8 61x37 and R16 45x29 at 256, whose rows end inside a word and whose heights are odd; the 16- and 64-byte tight pitches; and an R8 1024x1024. The source buffer holds a word per texel, the texel's bytes low and zeros above, since CopyIn takes 4*words() bytes a texel. A narrow round's change fails only the narrow verdicts, never a 4/8/16-byte texture's. A device whose kernel or image is not made (no shaderStorageImageExtendedFormats) leaves them unchecked. - in_place::storable: one helper for a render target's storage usage, used by route.rs and storage_form.rs. It asks Access::written(texel, Padding::Kept) instead of Writes, so a narrow render target never takes the 4-byte verdict. writes_reach (the storage usage an image that does not render takes beyond its usage) and fresh_pages_take ask the written check of the texels' width; InPlaceWatch carries the width. - InPlaceAccess::Writes covers the narrow accesses. Docs (in_place, the check, API.md, HOWTO, FAST-PATHS row, runtime README, WorkCounts, HostPageTexturePolicy, TextureShadowReason) say 1, 2, 4, 8 and 16 bytes, with narrow writes checked apart. The lane's VERDICTS goes to 36. Tests: - The decision test runs every width, 3 bytes for StoreWidth among them, against narrow answers that differ from their wide twins'. It also checks storable. - Shape tests cover the narrow set: tight pitches, row ends at 16/64/128/256, free padding. - New: each_check_of_storage_writes_stores_its_texels_width. A narrow tally case. - New device test narrow_writes_device: the guest's 32x32 R8Unorm and A8Unorm (and RG8Unorm and R16Unorm) at 256-byte rows over a no-copy buffer. Each takes its narrow verdict's path, its placement query agrees, a kernel's writes reach the bytes, and the padding and the bytes past the last row are kept. - in_place_storage adds an R8Unorm render target. Verified: not yet built; the build, clippy, unit and device runs follow as jobs. (cherry picked from commit dbb985df199b1c46bb783aafbd50efd40bcab187) |
||
|
|
26d00a396c |
Weigh a reader of its pass's color by what it covered in its last measured pass
The area rule weighs a reader through no scissor at the share least favourable to each form, since a draw's recording cannot know what it covers. A 1280x720 or 1080p reader covering the whole target therefore took the snapshot, 1.97-2.34x the split's GPU time on the Radeon 780M, while the consumer's readers over 3% of a 3662x2039 target need the snapshot (Iris 12.8 -> 1.7 ms a frame). Both shapes weigh the same at recording, so no static rule serves both. Now, on a device with occlusionQueryPrecise that resets queries on the host, each reader the rule would weigh records its drawing commands inside a precise occlusion query of its pass's own pool (render/coverage.rs). As the command buffer completes, the count is kept on the reader's first color's texture, keyed by the pipeline state and the reader's place among that state's readers of the texture in the pass. Later passes weigh that reader at its count: the snapshot where SNAPSHOT_PIXEL_COST per covered pixel per color costs no more than the split's copy. A device without precise queries or host reset, a reader inside an app's visibility query (already refused the snapshot), a pending pipeline's draw and a replay record no query and keep the area rule. Instances recorded inline after a split keep the query's begin and end with their draws. Both forms are exact; a stale count costs the form it chose until a pass after the change completes. Counted: WorkCounts::coverage_queries and reading_draws_by_coverage. The crossover lane runs each cell once untimed so its timed frame is weighed by the learned count. Tests: tests::learned_coverage (forms and bytes across a sparse -> whole -> sparse change; an app's Counting visibility query keeps its count with a reader inside), coverage unit tests. (cherry picked from commit 1108cd1bdebfb15f9da91b39ed80d91d8624bc28) |
||
|
|
b136c2531a |
Buffers: a declaration that the bytes between a texture's rows are unobserved
A consumer's cache buffer of the runtime's own memory (the 780M guest's 3662x2038 desktop
surface, more guest-page pieces than udmabuf takes) holds textures whose rows lie 14848 bytes
apart, 14648 bytes of texels each. linear_plan::holding shadows every such texture, since an image
at that pitch holds the bytes between rows and Vulkan lets its layout moves and a render pass's
load and store write them; the consumer's download copies each row's texels alone, so it never
reads those bytes, and the shadow's copies cost it about 1 G texels/s in a Finder drag.
BufferDescriptor::padding_unobserved (with_padding_unobserved) is the maker's declaration that
nothing reads the bytes between a texture's rows over the buffer (each row's bytes after its
texels to its pitch, the last row's included) nor between its slices. A runtime extension with
no Metal counterpart, only for the runtime's own memory: refused, Invalid
(PaddingUnobservedNoCopy), with NoCopy contents. The buffer keeps it (Buffer::padding_unobserved).
- The route (texture/route.rs) decides it for a buffer of the device's own memory:
Route::Device { holds } carries linear_plan::holding's answer, which with the declaration
holds rows and slices that lie apart (rows that share bytes stay refused). The making and the
placement query share it: the query answers NotHostPages where an image may hold the texels,
and the new TextureShadowReason::BytesBetweenRows where it may not (it answered NotHostPages
for both before).
- aliases takes the declaration: the image's subresources may then hold the padding
(linear_plan::within_padding: each subresource ends at its slice's last row's pitch or before,
slices at Metal's stride), never a byte past the last row's pitch, nor memory past the
buffer's. A byte of the image's memory past every subresource is reached by no operation on
it, the reading texels_alone already rests on, so no new check class is needed.
- WorkCounts::unobserved_padding_aliases counts the aliasing images that hold such bytes.
- A buffer the runtime lays in fresh pages (a long one where pointer imports cost submissions
nothing) keeps the in-place check's route: the declaration lets nothing more there (documented).
Docs: the field and builder, NotHostPages and BytesBetweenRows, HOWTO's paragraph on textures
over the runtime's own memory, API.md's shadow reasons and placement answers, the runtime
README; REFUSALS.md and api_signatures.tsv regenerated.
Tests: linear_plan's unit tests of the declared holding and aliasing (padding to the last row's
pitch held, past it or past the buffer refused, slices at Metal's stride alone, shared rows
refused); the route's placement test of both Route::Device answers; a device test
(tests/padding_unobserved.rs): a 101x48 BGRA8Unorm texture at 416, 448 and 512 bytes a row over
an undeclared buffer answers Shadow(BytesBetweenRows) and is a shadow, over a declared one answers
NotHostPages and is an aliasing image wherever the device lays one at the pitch (counted), at
least one pitch aliasing, its texels read back by a blit; and the declaration refused over the
caller's memory. The in-place lane's unobserved_padding_costs times a frame reading the
consumer's surface shape over a declared and an undeclared buffer.
Verified: pending (lavapipe and MoltenVK device tests, the 780M lane run next).
(cherry picked from commit 430523ce0e4dbd8433eb2b514f837d44ce1c5a9a)
|
||
|
|
11a1901a23 |
In place: the shadow notice names in-place images; the lane counts image-to-image copies
Follows the commit before, whose "WIP" line this commit's verification replaces: an in-place image of a texture that does not render takes the usages its descriptor lacks where the device's check passed for what they reach (the storage usage where the writes check passed, the one that lets free padding change; the attachment usage where the renders check passed; the sampled usage always), the first set the device makes the image with, most usages first, each at the texels' pitch in their memory or not made. A texture that renders keeps the route's `storable` (`texture/route.rs`), the strict writes check, as before; renders stay strict. - The `undeclared-usage-shadow` notice's declaration and docs/API.md's entry name the in-place case: a shadow or stand-in where the device's check failed for what the usage lets reach the pages, none where it passed. - `fresh_pages_take`'s docs point at the route's `storable`. - The lane counts a shadow's copies from an image too (`shadow_texels_copied_in_images`), which is how the usage shadow of an image in place copies, and prints the count on either path. - The module docs split the declared usage, the lacking usages and a render target's usages into their own entries. Verified: pending (clippy, rustdoc, the runtime's unit tests, lavapipe and Iris lanes run next). (cherry picked from commit 11d16a1b92cfdca3c409ff2f0501a67f0c1b607c) |
||
|
|
7205978cfa |
Make a tiled texture of more than one level over a buffer's bytes
The x86 macOS guests' WindowServer asks for a texture over a buffer with several mipmap levels through Metal's private newTiledTextureWithDescriptor:offset: bytesPerRow: (BGRA8Unorm 54x54 of 6 levels, 64x60 of 7, ShaderRead, over a new 16384-byte Shared buffer at 256 bytes a row). The runtime had no such entry, so the guest's bundle answered nil and the x86 featureProfile could not be turned on. Buffer::new_tiled_texture makes what new_texture makes, and a 2D texture of more levels (BufferTextureCall::Tiled lets linear_plan take them; a texture buffer of more levels stays MipmapLevelCount, and its offset keeps the validated 16-byte rule as the linear SPI's does). No Vulkan image lays level 0 over the buffer's rows and the other levels elsewhere, so the shared route sends it to a shadow over any buffer (Route::Levels, answered TextureShadowReason::Mipmapped): one image of every level, made zero in a Shared or Managed texture, whose existing shadow copies move level 0's texels alone (their range was already level 0), so the bytes reach level 0 before the GPU reads it and level 0's writes reach the bytes by the end of the encoder. Announced as shadowed-texture, naming the levels; counted in shadowed_textures and shadows_zeroed. The paths that assumed every texture over a buffer has one level: - blits: such a texture is an image to a blit, as a heap shadow is (Texture::blit_texels; BlitCommandEncoder::see notes it), so every level is a blit source and destination, generate_mipmaps included; - get_bytes and replace_region reach level 0 in the bytes and the other levels in the image; - a reinterpreting view shadow and a usage shadow, whose truth would be the bytes alone, are refused for it. Buffer::tiled_texture_placement answers the placement for the new call. Docs: the item's rustdoc (Metal's selector and what differs), docs/API.md, the degrade catalogue, RUNTIME-PORTING, the runtime README; api_signatures blessed (three additions, no breakage), REFUSALS regenerated (MipmapLevelCount's text). Verified: api-signatures, refusal-surface and metal-coverage checks locally; the builds, lint and device runs are the potluck jobs that follow. (cherry picked from commit b040d815059b99a20426234239aa756b282b25b9) |
||
|
|
ab8651ae38 |
Run a device call again on the serving generation where its own was lost under it
tests::device_recovery::each_recovery_announces_its_own_wait failed on the M3
in 10 of 30 runs at
|
||
|
|
d60e8b5b60 |
Answer a texture's placement through the image in place's making up to its bind
On the Radeon 780M (RADV) a guest surface whose pitch is no multiple of 256 bytes (3664 px BGRA8 at 14656 bytes a row) is refused Refusal::Pitch where the image in place is made: the driver lays its linear image's rows out at another pitch, and refuses the DRM_FORMAT_MOD_LINEAR image at that one. The query stopped at the route and answered InPlace, so the consumer sent such a surface in place and got a shadow copied in for every command buffer, the case the query exists to prevent. Now the image in place's making is two steps, shared: Device::unplaced makes and checks the image of a plan before any memory is bound (over pages imported by their pointer, in_place_unbound's linear or DRM_FORMAT_MOD_LINEAR image and its requirements against the bytes' place and memory type; over dma-buf pages, dma_buf_image_unbound's image checked against the pages, before the caller's source is asked), and Device::place binds it. in_place_image runs the rows check, then the wider plans and the declared plan through both steps as before. The query's placement_over_buffer, where the route is the image in place, calls Device::in_place_image_made: the same rows check and the same unbound step for the declared plan first and then the wider plans, releasing each image unbound, answering Shadow(Refused(kind)) with the declared plan's refusal where none is made. Its cost: one or two VkImages where the declared plan is made in place, a pair more per wider plan where it is refused; nothing bound or submitted. What only the bind shows stays unknown: over dma-buf pages the caller's source and the driver's import of its dma-buf. The new device test a_pitch_the_device_lays_no_image_at_answers_its_shadow asks and makes BGRA8Unorm textures at pitches past their rows (61 texels at 256..1024 bytes, 3664 texels at 14656, 14672 and 14848, a render target), each answer equal to what the making counted, and at least one Shadow(Refused(Pitch)). (cherry picked from commit fb619a2a4f6fa9bfa524cd7ae88c6e76a10d12ed) |
||
|
|
3f8b07c044 |
In-place check: a kernel's writes of a texture over a buffer may change its rows' padding
What: a second verdict for a kernel's writes, Access::BufferWrites, taken by a texture over a
buffer's rows (no IOSurface plane's) whose buffer holds its last row to its pitch and whose rows,
each to its pitch, start and end on a line of the device's memory (in_place::Padding::Free). The
same Writes rounds give it: the writer and the compare tell a change of a byte of the shape's
rows' padding (after a row's last texel, before its pitch, the last row's included) apart from
any other change. A round that changed only such bytes (Round::Padded) fails Writes for its row
ends, as before, and counts as kept for BufferWrites, and the rounds go on through every shape;
any other change (a texel, a byte past the last row's pitch) fails both and ends the class's
rounds. in_place() asks BufferWrites in the stead of Writes for such a texture; renders, an
IOSurface plane's rows and a render target's storage usage (storable) keep the strict verdict.
The rebind's choice of fresh pages carries whether the padding is the buffer's own. 24 verdicts,
CHECK_VERSION 7; the report adds `{class} buffer writes` lines.
Why: real Macs disagree on those bytes, so Metal leaves them to the GPU. The probe
(row_padding_writes.m) found an Intel UHD Graphics 630 under macOS 26.7.1 writing older values
back over the CPU's writes to the padding of textures over a buffer under a kernel's writes
(10,197 and 28,162 bytes in 100 rounds of 3662x64 and 61x64 BGRA8, 304 and 307 in the last row;
m3-max-7240, m3-max-7269), keeping them over IOSurfaces and under clears, stores and draws; an M3
Max under 27.0.1 (arm64 and x86_64, m3-max-7241) and a Radeon Pro 5300M (static check, 7269) kept
every byte. The owner's ruling: follow the x86 Macs' envelope and remove the shadow copy where
possible. On the Iris Xe, whose writes write back the 64-byte line holding a row's last texels,
written textures over a buffer whose rows end inside a line now take the image in place.
Docs: in_place.rs and in_place_check.rs module docs, docs/API.md (the in-place paragraph, the
shadowed-texture notice, section 10 Kernels with the three probe results), FAST-PATHS row 41, the
runtime README. Lanes: in_place_textures' VERDICTS 24 and its written-texture checks ask the
buffer writes verdict where the padding is free (in_place_rows::padding_free/writes), the
padding bytes of a texture in place with free padding no longer held to the pattern.
Tests: tests::in_place's decision test over both paddings; Padding::of cases (the guest's
3662x2039 surface at a 14656-byte pitch is free, 416x51 at 64-byte lines kept, slices apart);
Bytes::compare telling a change of each row's padding (the last row's last byte included) apart
from one past the last row's pitch or of a texel, and from padding that is not free; Tally's
verdicts for the Iris's walk and the others.
Verified: pending.
(cherry picked from commit 200f2a9e2b26eeaff45c1cc5ec71decf42d8437e)
|
||
|
|
1aeff532b6 |
Answer where a texture over a buffer's bytes lies before it is made
A consumer that routes each surface either to textures over its pages in place or to a cache of its own had to parse the doc-hidden in_place_check_report() strings and re-derive row ends to learn the runtime's verdict. Now it asks: - Buffer::texture_placement(descriptor, offset, bytes_per_row) and Buffer::texture_placement_with_iosurface_plane(descriptor, plane) answer a TexturePlacement: InPlace, Pending (a shadow made before its verdict, which moves in place where it passes), Shadow(TextureShadowReason) (policy, store width, check failed or unchecked with its InPlaceAccess and InPlaceRowEnds, Refused(InPlaceRefusal), texels past the length, a device copy), NotHostPages, or OtherShape. - The answer is the making's own decision: the route a texture over a buffer takes (past its length, no host pages, a device copy, bytes detached or copied, and the in-place decision against the verdicts) moves out of storage_over_buffer into Device::route_over_buffer (texture/route.rs), which the making and the query both call. make_texture_over takes a goal, make or ask, so the query runs every check the making runs before it makes anything and refuses the same arguments with the same errors; the IOSurface client direction refusal is one function both use. - Device::settle_in_place_checks is public, documented: it starts the check, says when the verdicts are known (a zero timeout waits for nothing), and how a recovery's new VkDevice reads them again or checks anew. Tests: tests/texture_placement.rs maps every route and shadow cause to its answer; tests/texture_placement_device.rs (m2v_gpu, m2v_cpu_icd) asks and makes over host pages: pending then known after the settle, the pending texture moving to the answer at the next quiet commit, a store width, a render target, an IOSurface plane, a long buffer, texels past the length, no host pages, a texture buffer, detached bytes, the Shadow policy and a forced failed check, comparing each answer with the counts the making moved, and the errors of refused arguments. docs/API.md and the runtime README describe the query; api_signatures re-blessed; docs/REFUSALS.md regenerated. (cherry picked from commit bef6ce09f56d8a7c1ad5ee7ef934a06a39b58c7a) |
||
|
|
973245f2c6 |
Make a rebound draw's slot rebinds and push overlaps allocate nothing in steady state
runtime_lane::frame_costs::a_frame_s_draws_and_pass_ends_allocate_within_their_bounds read 21.16 allocations a draw on the M3 in a debug build, past its bound of 20 (round |
||
|
|
532fc35b7a |
In-place verdicts by row ends: texels that share a line of the device's memory with bytes beside them, and texels that share none
On the Iris Xe (ANV) a pass that clears and stores a linear image, and a draw into it, write back whole the 64-byte line that holds a row's last texels. That puts an older value back over a CPU write beside the texels, so the check fails render targets over host pages there, and every such texture is a shadow. The write-back cannot reach a CPU write when no line holds both a texel and a byte beside the texels: the probe read 0/100 for rows that end on a line, and 0/25 for a 3840x2160 surface of tight rows. A 3840x2160 BGRA8Unorm surface's 15360-byte rows are 240 lines each. The check's verdicts are now kept per class, access and row ends (in_place::RowEnds): - The line is the device's nonCoherentAtomSize. vkspec defines it as "the size and alignment in bytes that bounds concurrent access to host-mapped device memory". - RowEnds::of reads the texels' address, offset and pitches. Texels are OnLines where their first byte and their end lie on a line, and so do each row's (or slice's) start and end where bytes lie between rows (or slices). Elsewhere they are InLines. - The check runs the shapes whose texels share no line first (Shape::rows; seven of SHAPES at 64-byte lines). A byte changed beside one of them fails both row ends. A byte changed beside a shape that shares a line fails InLines alone, since the OnLines rounds have already run (the verdicts function). A device that fails InLines now also runs its OnLines shapes. - SHAPES gains two shapes whose rows end inside a 16-byte line, at the 16-byte pitch a driver that lays rows tight uses: BGRA8Unorm 101x51 at 416 bytes and RGBA16Float 33x17 at 272, the same shapes STORE_SHAPES already holds. MoltenVK makes no linear image with bytes between rows except at that pitch, and its line is 16 bytes. Without these two, none of its shapes whose texels share a line was made, so its reads and renders were Unchecked for those texels: on the M3, a probe of this change without them gave Pointer and Fresh reads and renders Unchecked 5/5 for InLines (m3-max-6750). - SHAPES and STORE_SHAPES gain the same widths at the 64-byte pitch of a driver that lays rows at the next multiple of 64: BGRA8Unorm 101x51 at 448 and RGBA16Float 33x17 at 320, and RGBA8Uint 101x51 at 448 and RG32Uint 33x17 at 320. On lavapipe (llvmpipe's linear images take 64-byte rows, its line 64 bytes) no shape whose texels share a line was made without them: tests::in_place_check::the_in_place_check_checks_fresh_pages_where_held_imports_cost_submissions read the Fresh verdicts Unchecked for all three accesses of those texels (m3-max-6991). The shape test now holds that drivers whose rows lie at the next multiple of 16, 64, 128 or 256 bytes each have such a shape, for each access. - The record holds 18 verdicts. CHECK_VERSION goes to 6, so a record of the old check is not read. - The report keeps its nine lines, now the InLines verdicts (the old verdict exactly, since an OnLines failure fails both), and adds nine ", rows on lines" lines after them. - The texture's own row ends decide, everywhere a texture asks for its verdict: its making (Texels::rows), a shadow's move in place (MoveWait, move_wanted) and a copied rebind into fresh pages (fresh_pages_take_images, from the watch's place in its pages). ShadowCause::CheckPending, CheckFailed and Unchecked name the row ends, and the notice says them. - Device::in_place_check_line (doc-hidden) answers the line. The lanes that hold a texture to its verdict compute its row ends themselves (runtime_lane::in_place_rows, apart from the runtime's reckoning) and read that row ends' line. Docs: FAST-PATHS row 41 and the API guide describe the row ends. The ShadowedTexture notice docs name them. The known gap for rows that end on a line is closed and deleted. Tests: RowEnds::of covers an offset, an address, a pitch and slices off a line, tight rows that do or do not end on a line, a 1-byte line, the 3840 and 3662-wide surfaces, and the check's shapes per class. The verdicts function: a change beside OnLines texels fails both row ends, a change beside InLines texels fails InLines alone, and a forced failure and an unchecked class are covered. The decision test runs every class with both row ends. The record test covers 18 verdicts. Verified, the whole check on fresh caches (the probe test, this change plus the test alone; the Iris Xe and RADV runs at 5beb0be2a5, before the 64-byte shapes, on development |
||
|
|
5aa31f836c |
Rebind a draw's slots by rebinds the plan works out once for them
A rebound draw that moved buffer offsets spent about 470 instructions a draw (lavapipe, draws.10k shape) in rebind_slots, and 13% of the M3's time, writing one 4-byte push word: each draw walked the template's stages, fields, buffers and vertex buffers again to find what the changed slots decide, though that depends on the plan and the slots alone. BindingPlan::slot_rebinds now works that out once for a list of slots (a public, opaque SlotRebinds: each changed buffer slot's place among the descriptor ranges and its push fields, the loose fields, the vertex buffer places; None where rebind_draw_slots_into answers Ok(false) whatever the state), and rebind_draw_slots_with rebinds by it, looking at the state and the commands alone and writing each word as a fixed-size store. rebind_draw_slots_into is the two in turn, so there is one implementation; builds with debug assertions check that the rebinds given are the plan's own for their slots. The runtime keeps the rebinds with the settled draw (SettledHere), made at the first draw rebound that changes a list of slots and kept while the next draws change the same slots; a new settle drops them. The rebind test now also rebinds each case by rebinds made once per plan and slot list and holds them to the whole rebind's answer and commands. docs/API.md describes the two calls; the surface table, the signature table and docs/REFUSALS.md (a renamed site) follow. (cherry picked from commit 0397cbb254eb9402d5955d2ed2edab1ea0b2b6dd) |
||
|
|
0529a98e4c |
Announce each recovery's own wait, slow failing and failed making
After a device's first recovery, a later recovery's step notices were never shown: a call's wait for the recovery past 10 seconds, its command buffers taking past 10 seconds to fail, and its new VkDevice's failure all went through degrade_once(DeviceRecovered), whose record carries across generations, and the first recovery's own notice set that record. So a slow second recovery announced nothing, and a second recovery whose VkDevice could not be made left the device answering as lost with no notice (rule 2: a degradation is announced). Each recovery's notices are now its own (Device::degrade_recovery_step, whatever the kind's record says), still bounded: the wait is announced once per recovery by the first call to wait past the bound (a flag in the line's Lost state, so N waiting calls give one notice, not N), the slow failing once per recovery by the call that claimed it, the failed making once (the line fails). degrade_recovered no longer sets the kind's record, which nothing reads for this kind now. Tests (tests::device_recovery, device builds): with the bound set to zero through a per-device test hook, each_recovery_announces_its_own_wait runs a first recovery, then recoveries with three threads calling the device, and requires a later recovery to announce one wait (never two); a_later_recovery_announces_its_failure fails the second recovery's making through a hook and requires its notice to reach the sink. (cherry picked from commit fefe1396ef30708568c6811e98659fbe08771671) |
||
|
|
aeb74087b3 |
Zero-initialized images: pooled blocks of images, a zeroed start only over bytes no resource used
The draft gave each Shared or Managed texture that copies on the host a vkAllocateMemory of its own (Fit::Zeroed), so allocations grew with the textures. The Vulkan specification ties VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT to the image's memory being zero, "either from being explicitly set to zero by an application or from being allocated with VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT", with no rule on binding offsets or dedicated allocations, and any image may move out of UNDEFINED in place of its layout (VUID-VkHostImageLayoutTransitionInfo-oldLayout-09229). So: - memory.rs: on a device that enabled zeroInitializeDeviceMemory, every block of images is allocated with VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT (Memory::zero_image_blocks), pooled as before. Each pooled block keeps the end of the furthest range ever placed in it (PoolBlock::placed_to); a place past it in a zeroed block reads zero (Pool::place_fresh, Placement::fresh). Fit::Zeroed, make_zeroed and allocate_image_zeroed are gone. - texture.rs: such a texture's image is made in ZERO_INITIALIZED and placed as any image; over fresh bytes it moves out of that layout on the host (counted images_started_zeroed), else it takes today's path: moved out of UNDEFINED and its zeros written on the host. - The XTX probe (job 6317, release, tests::zeroed_start, 3 rounds after runtime suspend plus one awake): development's making waited for the queued fills (180, 521, 342 ms after suspend, 1.09 s awake); the zeroed start took 0.26 to 0.32 ms. After suspend the texture's first CPU write waited instead (442 to 572 ms, until the fills ended), 71 us awake: recorded in FAST-PATHS' known gaps. - tests: memory.rs a_place_reads_zero_only_past_every_range_placed_in_a_zeroed_block (CPU); zeroed_start.rs many_shared_textures_made_in_turn_take_pooled_blocks (1000 made, kept, let go, 1000 again: times, blocks, no dedicated block, zero texels). - Docs: host_copy.rs, README, API.md, WorkCounts::images_started_zeroed. Not yet built. (cherry picked from commit b0cf11a49e44b8530b84e664d231c928421ddf93) |
||
|
|
a508b327de |
Zero-initialized images: an enables test, API.md's runtime-own extensions, the signature table
Enables::enable_zero_initialize_device_memory gets the test each runtime-own enable has (tests/enables.rs: the structure, of the registry's type 1000620000, is chained only once enabled, its member TRUE, the extension's name after host image copy's). docs/API.md's paragraph of what the runtime enables for itself outside the vocabulary names VK_EXT_zero_initialize_device_memory and when. api_signatures.tsv gains WorkCounts::images_started_zeroed (scripts/api-signatures, --bless). Not yet built; the next gem10 build runs it. (cherry picked from commit 2ec9061a61c7262e7a05b4e42f0e1122518439cf) |
||
|
|
ec9706e6e3 |
Survive the loss of the VkDevice: the device is a line of generations
Metal's MTLDevice survives a GPU recovery; the runtime's device refused every call with DeviceLost from the first loss on, and the consumer ends its VM at the first refusal. Now a device the runtime made is a line of generations (device/line.rs), each a DeviceShared over its own VkDevice, and the first call that needs the device after a loss makes a new VkDevice of the same physical device, options, queue families and extensions. - Two kinds of handle. The program's device (and its clones) is a root handle: it holds the line, pins no generation, and every public Device call goes to the generation that serves (each public method forwards to its *_now body). Objects hold generation handles, so their Vulkan calls, drops included, reach their own VkDevice alone. A generation handle's check is one relaxed load of the line's generation (Device::generation_serves). - A draw pays nothing for it. A command buffer takes its generation once, as it is made (CommandBuffer::generation); its encoders' per-draw reaches (work counts, fresh-unwritten and alias records, sampler-slot changes, attachment read notices) read it there, not through a device handle's kind. A bind's device check is one compare of the cells the two handles hold, inlined, its refusal (Device::foreign) out of line. - The state machine (Live, Lost, Failed): the claiming call recovers, every other call waits (a notice past 10 s, waiting on); threads command buffers' completion depends on never wait. Recovery: the lost generation's command buffers in flight fail through its completion path, its queues drain under their locks, create_on makes the next VkDevice, the queues are retired. - Command-buffer answers, as a real loss is one more hang: the oldest incomplete batch's command buffer fails GpuHang (exact on one VkQueue; on two or more the queue whose oldest incomplete batch was submitted first, said so in the notice), counted against its queue so the second revokes it (AccessRevoked); the others GpuRecoveryVictim; one committed on the hang's queue before the recovery runs nothing and completes with no error; one made before and committed after fails GpuRecoveryVictim. One loss names one hang: a batch that went to the driver just before the loss and reached the lost device's completion after the loss took the pending batches fails with it, as a victim (its own wait need not fail: the test hook's VkDevice runs it), and no later failure of the lost device names a second hang. - Command queues survive: a queue is a root handle and a cell of its place on one generation (VkQueue, slots, pools, hangs), which a recovery retires and the next command buffer re-makes; label and GPU-error count go on. - Objects made before a recovery are refused where they meet the new VkDevice or need their lost one: RuntimeGap::MadeBeforeRecovery, at the 38 lost-device checks (Device::lost_refusal) and at every foreign-object check of one line (Device::foreign). DeviceLost stays for a device the consumer made. - Carried across generations: the address space, resource IDs and the passing holds a making waits out before it takes one, unique identifiers, counters and the announced notice kinds. - A device handle is an enum of the two kinds (24 bytes, was 16): the shadow merge's copy-back dispatch, which holds handles, is boxed (clippy's large_enum_variant). - Device::recover_for_test (public, documented) runs the whole path with no GPU fault; RuntimeGap::AdoptedDeviceRecovery on an adopted device. - Degradation::DeviceRecovered (device-recovered), announced at each recovery with the culprit and its time. WorkCounts::vk_devices_live, vk_devices_made, device_recoveries: two VkDevices while objects of the lost one live, one after. Docs: docs/API.md catalogue entry, the runtime README's device-loss section, FAST-PATHS known gap (a make whose own submission first meets the loss is refused DeviceLost), docs/REFUSALS.md regenerated (refusal_surface.py names a forwarded body's sites by its public method), api_signatures blessed. Tests: runtime_lane::device_recovery (hang and victims, command buffers on their way to the driver at a recovery, MadeBeforeRecovery and the VkDevice bound, revocation at the second hang, a command buffer made before fails as victim, all under the validation layer; a recovery that finds nothing of the queue scheduled names no hang, its command buffers victims), tests::device_recovery (the hold of the hang's queue between a loss and the recovery), detach_lost and the MoltenVK lost-device lanes updated to the recovery's answers. Verified: - lavapipe: runtime suite and touched validation tests 1850/1850, surface 19/19 (m3-max-5695, gem10, before the rebase onto |