703eca0dba4e095675af488e4f68ab01aa4cd34f
354
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
d694f52506 |
Copy in at a commit only the copied host buffers its command buffer's commands use
reims-vgpu's 5080 game probe past its views' budget (512 copies of stitched views) spent 65% of its CPU in its dirty logs' queries, which every commit's copy in made for every logged copy (about 110 commits a second, about 6 ms each, every copy's own log walked: m3-max-5561's profile). A command buffer's GPU reaches only the resources its commands use, as Metal's does, so the copies the others lie in need not be current for it. DirtyCommit now keeps the keys its commands used, read or written (at most 4096, past which every copy), beside the writes it kept; the commit hands them to CopiedBuffers::copy_in (copied::Written, which named the merge back's writes, is CopiesReached, the key set both take). A copy its commands do not reach is neither compared nor asked of its logs, and keeps the stamp it last synced to, so the first commit that uses it takes every write since. Every copy is copied in where the command buffer's uses went unnoted or a command may reach memory no use names (a function that reaches buffers through addresses, work on the GPU alone, a host step's records: State::reaches_unnamed). Shadows' copies in from a copy are commands of their encoder, their uses noted with the copy's key, so a texture over a copied buffer reaches its copy. Counted: WorkCounts::copied_copy_ins_unused. The copied-host-pages notice and API.md's catalogue say which copies a commit compares. tests::copied::a_commit_copies_in_only_the_copies_its_commands_use: a copy left alone keeps its bytes, the first commit that uses it takes every write since, and every copy where one may reach anything. copied_stitched_bench times a commit that uses 8 of 512 copies beside one that reaches every copy. (cherry picked from commit bc9f3f5ec63504fce3d8f89eb49110099b2b45ab) |
||
|
|
2e5a2b0d20 |
Say why short_row_kinds.m's multisampled copies died: its forked children, not Metal
short_row_kinds.m ran each case in a child that forked and did not exec, and every copy between a buffer and a multisampled texture there ended in SIGABRT inside Metal's blit. API.md read that as Metal's answer and so as a reason the multisampled short-pitch copy is unmeasured, which contradicted sample_interleave.rs's measured placement of such copies on the same GPU. multisample_buffer_copies.m (M3 Max, macOS 27.0.1, job m3-max-5571) separates the candidates. Forked without an exec, each case aborted: Metal's blit makes its program through its compiler (findOrCreateDriverProgramVariant -> MTLCompiler compileBuiltinRequestInternal -> _os_crash_msg). Spawned, every case returned with its bytes as written: RGBA8Unorm x4 and R8Unorm x2, at RenderTarget|ShaderRead, with PixelFormatView, ShaderRead alone and with PixelFormatView, Private and Shared, with and without options:, with and without a clearing pass, and without allowGPUOptimizedContents. The nine layouts multisample_buffer_layouts holds the runtime to lay exactly where it expects, at both render-target usages. So the runtime's multisampled copies stand on a measurement that holds, and the multisampled short-pitch copy stays refused only because it is not measured. The probe records that answer; short_row_kinds.m, API.md, sample_interleave.rs and the layouts test say it. No behaviour changes. (cherry picked from commit 3660f4ec2f16c6ae8e0443b9989756116c1ffc0e) |
||
|
|
9feee35118 |
State the copied-host-pages cost in API.md's catalogue as the notice now announces it
tests::degradation_catalogue::a_runtime_kind_s_entry_states_the_cost_it_announces failed at 368f5d1b7d (m3-max-5476): the entry kept the old words. (cherry picked from commit 4b892e7ee29a748bb1b142b7601527abd7d8d505) |
||
|
|
be0a50f1a1 |
Test and document the blits at a pitch below the row for depth, stencil, buffer-backed and two-plane textures
Unit tests: Depth16Unorm and Stencil8 at a pitch below the row place each row at y x bytesPerRow both ways, Depth16Unorm on the aligned path too, a pitch off the unit or of 0 refused; a texture over a buffer's row copy at such a pitch reads overlapping buffer rows and writes them out in turn, each row but the last its first bytesPerRow bytes, a last row past the buffer refused. Device test (src/tests/short_row_kinds.rs): Depth16Unorm, Stencil8, both aspects of Depth32Float_Stencil8, an RGBA8Unorm texture over a buffer and RGB10A8_2P_XR10, 32 x 4, at half the row and half plus a texel: in, each row read whole from y x bytesPerRow; out into a buffer of 0xcc, the rows in turn, the later row's bytes standing, nothing past the span written. Docs: CopyProblem::BytesPerRow no longer names depth/stencil or buffer-backed textures at a pitch below the row (only off the unit or 0); two_planes.rs and API.md's accepted difference state the probe's answers, the multisampled copy out staying refused because every probe copy between a buffer and a multisampled texture, at the packed row too, ended its process in Metal's blit (SIGABRT). The probe's header records what it answered. REFUSALS.md regenerated (a new BufferRange site in plan_rows_copy). (cherry picked from commit e54ac4e63f4e9be0f1451ea2e7cccf8f74b66f34) |
||
|
|
d946043cc5 |
Lay a heap's one-plane YCbCr rows off 16 bytes as Metal's blits do, sharing bytes
Item 2 laid a heap's one-plane YCbCr texture whose row is not a multiple of 16 bytes in packed rows and announced heap-one-plane-layout. Metal's blits lay such a row, where it is 16 bytes or more, the row rounded down to 16 bytes apart, so consecutive rows share its last row % 16 bytes, and its copies out read each row whole from there (an Apple M3 Max under macOS 27.0.1, probes/one_plane_ycbcr_heap_rows.m, m3-max-5064: 10 x 3, 12 x 3, 13 x 7, 20 x 3, 33 x 3 and 100 x 30 at 4:2:2, 10 x 3, 13 x 7 and 33 x 3 at 4:4:4, and a 13 x 7 x 3 array, whose slices lie as its answer counts them; each last byte written matches this layout's span). That layout is one we can read, so the runtime now takes it. heap_plane_layout gives a one-plane plane one_plane_pitch: row - row % 16 for a row of 16 bytes or more in more than one row, a packed row else; an array's slices stay where the answer counts them. heap_planes returns the copies into the shadow's image and back out of it apart (PlaneCopies); a plane whose rows share bytes takes plane_copy_regions, the copies an IOSurface plane whose GPU rows share bytes takes: into the image each row whole from its own offset in two regions a slice, the shared bytes read for both rows; back each byte once, a shared one from the earlier row. Metal's blits leave the shared bytes from no one row (the even rows' at 10 x 3, 12 x 3, 20 x 3 and 13 x 7, the later row's at 33 x 3, the earlier row's at 100 x 30); the earlier row's is one of them, said in docs/API.md's accepted differences. Still announced heap-one-plane-layout: rows under 16 bytes, which Metal lays 16 apart past the answer and whose copies out read none of the rows past the first back, and mipmapped and 3D textures. The notice's doc, cost and catalogue entry say so. Tests: tests::heap's a_heap_one_plane_texture_s_rows_lie_as_metal_s_blits _lay_them (no device) holds the pitches, slice pitches and spans to the probe's for eight shapes, every texel read into the image from its own offset, and every byte written back once, a shared one from the earlier row; the device test heap_one_plane_rows lays 13 x 7, 33 x 3 and a 13 x 7 x 3 array at 4:2:2 and 4:4:4 in the heap's bytes as Metal does with no notice, and announces a 6 x 3; the lane test makes a 13 x 7 with no notice and announces a 6 x 3 and a mipmapped one. (cherry picked from commit ff300cc511502049e318d113015a5e2c14cb4645) |
||
|
|
fcde58393c |
Announce the interlocked split with its own cause, and expect it in the fetch lanes
The split before a draw that reaches interlocked storage an earlier draw
of its instance wrote (Split::InterlockedWrites, where
DriverFact::InterlockedDrawsRaceUnderLoad holds) is announced as
render-pass-split. Its instances share one shape, so the notice gave the
generic reason ("its draws keep different attachments out of their
subpass"), which is wrong for it. SplitCauses gains interlocked_writes,
counted where the split is taken (an execution's runs through its
Found), and the notice names the cause. The RenderPassSplit doc and the
docs/API.md catalogue entry name the fact.
Three framebuffer_fetch lanes failed on the M3 Max (m3-max-5404). The
split is announced with the backing it gives a memoryless attachment,
and it adds instances. fetches_degrade_once_per_kind and
a_plain_draw_before_a_fetch_takes_the_devices_faster_form now expect
the announcement where the device splits so (splits_interlocked_writes).
a_memoryless_attachment_fetched_after_a_plain_inline_draw_starts_from_zero
counts the splits: 3 a pass there, none elsewhere.
Verified: cargo fmt. The M3 lane run follows.
(cherry picked from commit 844d58ba93764fd2b34d668114ac05b565c76a0d)
|
||
|
|
f9bc470d7c |
Move a shadow made before its pages' in-place verdict in place once it passes
A texture over host pages made before its class's in-place verdicts were known is a shadow (CheckPending): an unknown, not a lack. Under the owner's 11-07 ruling a shadow is only for accesses that cannot be done in place, so such a shadow must not stay one for life because it was made early. Each such shadow now waits for its class's verdicts (StorageForms::moves). The check's thread, at each verdict, decides from facts stored with the wait (class, usage, texel bytes) and takes no handle of a program's texture. Where the verdicts take an image in place, the texture waits for the storage-form switch. At the commit of the device's only uncommitted command buffer, the switch makes the image in place exactly as the texture's making makes it: the declared plan, with feedback loop and storage usage where the device makes them so, and noted for a rebind and its first move. Where every encoder ran, the texture presents it from then on (TextureShared::moved; every storage read goes through Texture::storage). It is counted in host_textures_in_place and in the new WorkCounts::host_textures_moved_in_place, and its slots are written again. No texel is copied: between encoders the shadow holds nothing the buffer lacks, and the image in place is the buffer's bytes, whose uses hazard tracking orders after earlier copies back and merges. A view made before the move keeps the shadow. A shadow with a usage or render shadow, over detached or copied bytes, or whose image the device refuses stays a shadow. The shadow's image is kept with the texture until it goes. Test: runtime_lane::in_place_textures::a_texture_made_before_its_verdict_moves_in_place_once_it_passes (under the validation layer). Docs: storage_form.rs and in_place.rs module docs, FAST-PATHS in-place row, HOWTO, API.md. (cherry picked from commit 605d0444de1ad1a9b93e02649db7e1b2fda18e93) |
||
|
|
be1f1c141b |
Take the storage form for a private target whose self-read splits for want of STORAGE
A draw that reads its pass's color attachment at its own pixels after a render-target barrier takes the snapshot only where no later fetch could render the attachment through a stand-in (`keeps_own_attachment`: the image has STORAGE). A private texture whose device lays an image out otherwise with STORAGE (with_free_usage leaves it off: the Iris Xe's optimal BGRA8Unorm, as the orchestrator relayed from the 4845 A/B, 12-15 ms a frame of 30 splits for the private selfread target) split at every such read, every frame, for good. The fallback now notes the texture for its storage form (texture/storage_form.rs), the switch a fetching pass's scratch already takes: at a later commit its image is made again with STORAGE and its texels copied in once, announced as fetched-target-storage, and its later passes' readers take the snapshot. A texture noted already returns before its plan is asked again, as a reader that splits notes it at each such draw. Test: tests/self_read_storage.rs (device test), with a test-only switch that makes STORAGE cost every image (DeviceShared::storage_costs_forced, read in Device::if_free): a private BGRA8Unorm target's first pass splits and takes the form at its commit, its later passes' readers take the snapshot, each pass's texels Metal's; where the device does not take the path, every reader splits and nothing swaps. Docs: the fetched-target-storage declaration and its API.md entry, the FAST-PATHS attachment-read row. (cherry picked from commit e0444b4029c9372197faf8c5bab3d967cb9bb543) |
||
|
|
8f652b31f1 |
Write a blit's rows out of a texture below their row in turn, the later row's bytes standing
A copy out of a texture at a bytesPerRow below the region's row was refused Invalid(Copy(BytesPerRow)), as Metal writes such overlapping rows in no one order. Metal runs the copy, though, so under rule 2 it may not fail: on the Apple M3 Max under macOS 27.0.1 (probes/short_row_blits.m, jobs m3-max-5158 and 5170) every such copy returned, rows lay y x bytesPerRow apart with nothing past their span written, and of 300 shapes of 12 formats at half the row about a fifth left the later rows' bytes standing. The later row's bytes are one of Metal's own answers. placed_rows no longer refuses the copy out at a pitch below a row; the rows are placed as a copy out at any other pitch off Metal's rules is, and plan_placed_copy's later_rows_win writes them in turn: the texture goes to a packed staging buffer in one region, and the staging rows go to the buffer in one vkCmdCopyBuffer whose destination regions are each row's bytes no later row writes, disjoint as VUID-vkCmdCopyBuffer- pRegions-12482 asks, one region a row. No buffer-image region states a row length below the width (VUID-VkBufferImageCopy-bufferRowLength-09101). Still refused: a multisampled texture's copy out at such a pitch (where Metal places its rows there is not measured), a texture over a buffer, and depth and stencil formats but Depth32Float, as before. docs/API.md's accepted differences say so; CopyProblem::BytesPerRow's doc and basis lose the case and REFUSALS.md is regenerated. Tests: blit_plan's layouts test takes the copies out at a pitch below the row (rows at y x bytesPerRow); a_copy_out_at_a_pitch_below_the_row_leaves _the_later_rows (blit_plan, no device) checks the unstaged bytes for a one-plane YCbCr texture at its described row, RGBA8 at half, RGBA32Float at three quarters and R8 at a pitch of 0, nothing past the span written and at most one region a row; described_row_copies' new device test copies 501, 504 and RGBA8Unorm out at a pitch below the row into a buffer of 0xcc and reads the later rows' bytes standing. (cherry picked from commit 73554a28ae7c83ccdcb01d5ebb95787b74928c21) |
||
|
|
c6e1d5a9fd |
Make a BC1 or BC4 texture over a surface's plane at an offset or pitch off 16
The runtime refused a BC texture over a plane of a surface with planes whose offset or bytesPerRow is off 16 bytes, as NotImplemented(SurfacePlaneShape). The M3 Max answers nil for every BC texture over a surface, so the x86 Macs are the reference (job m3-max-4779 on macbook-pro-2019: an AMD Radeon Pro 5300M and an Intel UHD 630 under macOS 26.7.1, surface_texture_envelope.m's bgraat8.bc1 at offset 8 and bgrarow264.bc1 at 264 bytes a row). Both GPUs' blits and samples take block row j at the plane's offset + j x bytesPerRow, with no rounding to 16. linear_plan::blocks_off_sixteen makes a BC texture of 8-byte blocks (BC1, BC4) at an offset and bytesPerRow that 8 divides, at least 16 bytes a row. Every BC plane now lies at the CPU's layout on the GPU too (plan_iosurface_plane's blocks flag): at multiples of 16 the two were already equal. The CPU calls take the plane's own offset, as the 5300M's getBytes does, while the UHD 630's getBytes and replaceRegion take a plane at offset 8 from byte 0. That difference is recorded in docs/API.md's accepted differences. BC4 was not measured off 16; it takes BC1's 8-byte block rows. BC textures of 16-byte blocks (BC2, BC3, BC5, BC6H, BC7) off 16, and 8-byte ones off 8 or under 16 bytes a row, stay refused. SurfacePlaneShape's doc names them, and so does its reach mark in REFUSALS.md. Tests: tests::linear_plan makes bgraat8.bc1, bgrarow264.bc1, BC4 at (8, 264) and BC1 at offset 40, with the GPU layout equal to the CPU's. It refuses BC3, BC5 and BC7 off 16, BC1 at offset 4 and at 260 bytes a row, and BC4 at 8 bytes a row. tests::surface_shapes (a device test) gains bgraat8.bc1, bgrarow264.bc1 and bgraat8.bc4 on every path. docs: linear_plan.rs's Block-compressed surfaces, the plane call, SurfacePlaneShape, BufferRefusal::PlaneShape, the FAST-PATHS known gaps and the API.md accepted differences. Regenerating REFUSALS.md changes only the reach mark. CONFORMANCE-COVERAGE.md and the API signatures are unchanged. (cherry picked from commit ff454bd8b269fff6abf590da85cd050862d539a9) |
||
|
|
0c621da77a |
Make a texture over a surface's plane whose rows are wider than its pitch
Metal makes a 2D texture over a plane of a surface with planes whose rows are wider than the plane's bytesPerRow, and a 1D texture wider than one row; the runtime refused both as NotImplemented(SurfacePlaneShape). On the M3 Max every path reads row y whole from the plane's offset plus y times bytesPerRow (surface_texture_envelope.m's bgra1x2.65x64, bgra1x2.128x32, 420v.p0.65x64, 420v.p1.33x32 and bgra1x2.1d.128), so the texels lie in one place and the 2D texture's rows overlap, on the GPU and the CPU alike. linear_plan::wide_rows makes such a texture of a colour format over a plane whose offset and bytesPerRow are multiples of 16, its GPU layout its CPU one. A 1D texture is one row from the offset. A 2D texture's overlapping rows are held as the rows of a pitch off 16 are: a shadow whose copies reproduce the sharing, refused where a render pass stores into it, blits into it refused (NotImplemented(OverlappingSurfaceRows)), announced as CollidingSurfaceRowWrites. What is new is that the shared head can be wider than the pitch (a byte shared by three rows or more), so plane_copy_regions copies it in in pieces no wider than the pitch, and copies row 0's head back as one row. plane_rows_share_bytes asks the GPU layout alone, as a wide plane's CPU rows share bytes too. Other formats, and planes off 16, stay refused: nothing measured them. The write orders come from overlapping_plane_row_writes.m, extended in the previous commit and run on the M3 Max (macOS 27.0.1, job m3-max-5088, three processes a case), and recorded in its header. The GPU gives the shared bytes the answers it gives the rows of the same GPU pitch and row at a pitch off 16: no one order for blits, and for a kernel the earlier row's within the first threadgroup's rows. Where three rows share a byte, the kernel at 8 x 4 keeps the earliest row's. replaceRegion writes the rows in order, so the latest row's bytes stand, in every shape and process. So the runtime's copy back, which keeps the earliest row's bytes, is one of Metal's kernel answers. Its CPU writes go row by row, as Metal's do. The notice's cost now says "the earliest row's" in place of "the earlier row's", and docs/API.md's catalogue says the same. Tests: - tests::linear_plan: the probe's wide shapes are made, with their layouts. Wide rows off 16, of a depth format or of a 1D texture off 16 are refused. A render target over wide rows is OverlappingRows. - A new sweep: 2232 wide planes, 1302 of them sharing more than a pitch, over five texel sizes, pitches of 16 to 64 and 2 to 4 rows. It holds plane_copy_regions to what Vulkan allows and to the earliest-row rule (hold_the_copies, which now allows the head's pieces and a bufferRowLength of 0). - tests::buffer_texture: its sweep now holds that only a wide plane's CPU rows share bytes, its CPU layout its GPU one. - tests::surface_shapes (a device test): the probe's five wide shapes read as Metal reads them on every path, with a blit into the 2D ones refused. docs: linear_plan.rs's Beyond the plane's rows and Rows that overlap; SurfacePlaneShape, the plane call and BufferRefusal::PlaneShape; the CollidingSurfaceRowWrites declaration and its API.md entry; and the FAST-PATHS known gaps. REFUSALS.md, CONFORMANCE-COVERAGE.md and the API signatures are unchanged when regenerated. Checks: job ids are in the tip's report. (cherry picked from commit 344cd110f8f612907f26dd9a30b0871e299ddb27) |
||
|
|
6b6a7f522b |
Make mipmapped, 3D, multisample and sliced textures over a surface's plane
What. Buffer::new_texture_with_iosurface_plane over a plane of a surface
with planes makes three shapes it answered
NotImplemented(SurfacePlaneShape) for:
- a 2D texture of more than one level, a 3D texture and a 2D multisample
one, of a colour format (linear_plan::apart_from_plane: is_linear and
tail_held): a texture of the device's own memory
(Device::surface_texture_apart), zero when made in every storage mode,
a Private one's too (texture.rs's new Fresh::Zero start, which skips
Metal's fresh pattern and the uncounted held start), announced by the
new Degradation::SurfaceTexelsApart ("surface-texels-apart",
precision). A Memoryless one stays MemorylessSurfacePlane.
- a 2D array of more than one slice, of a colour format, over a plane
whose offset and bytesPerRow are multiples of 16
(linear_plan::slices_apart): its first slice over the plane as a 2D
texture's rows, its others in a tail of the texture's own. The planner
lays the slices one image apart and gives Placed::kept, the second
slice's first byte (or the buffer's length where that comes first);
Texels::kept cuts the tail there instead of at the buffer's length
(with_tail, past, staging), so the shadow's copies, blits and CPU
calls take slice 0 from the plane and the rest from the tail.
Announced by SurfaceTexelsTail, whose doc and cost now name both
cases.
Why. Metal makes these, and on the M3 Max under macOS 27.0.1
(probes/surface_texture_envelope.m, job m3-max-4776) it lays them out in
no one place: bgra1x2.mips2/mips7, 420v.p0.mips2, bgra1x2.3d.d2,
420v.p0.3d.d2 and bgra1x2.2dms4.private read level 0 or slice 0 by blit
and kernel from other bytes than its blits, replaceRegion and getBytes
put there; bgra1x2.2darray.a2 and .a2.64x64 keep slice 0 over the plane
on every path while slice 1 is read at the plane's offset by blits and
getBytes, one image on by kernels, and written at the plane's offset.
By the rule of
|
||
|
|
8eb3b6df31 |
Lay a heap's one-plane YCbCr texture in Metal's rows, not the carrier's tiles
Apple's nine one-plane YCbCr formats (501, 504, 521, 524, 560, 562, 563, 590, 607), held for copies alone in R16Uint or R32Uint, took the carrier's tiled heap layout in a placement heap: their texels lay in R32Uint/R16Uint tiles, and the texture took the carrier's tiled answer, where the size query answers Metal's packed rows (reims-vgpu's jobs m3-max-4955 to 4985). Metal lays them as rows (probes/one_plane_ycbcr_heap_rows.m on the M3 Max, jobs m3-max-5055 and 5064, every format alike): a 2D texture's rows one packed row apart where the row is a multiple of 16 bytes, a 1D texture's one row, an array's slices at multiples of 128. The runtime now answers them through planes_answer (one_plane_heap_answer, HeapLayout::Measured) and holds them as the 4:2:2 textures are held, always a shadow of the heap's bytes in rows (HeapTextureShape::rows); heap_plane_layout lays a one-plane array's slices at 128 and heap_planes copies such slices a region each. Shapes Metal lays no one way are announced, new Degradation HeapOnePlaneLayout (heap-one-plane-layout): rows off 16 bytes, which Metal's blits lay the row rounded down to 16 apart, lie packed; a mipmapped or 3D texture, whose first level Metal addresses past its answer, lies apart from the heap's bytes (AliasRoute::Unaliased) at Metal's answer. Tests: heap_one_plane_rows (device): six shapes in a 4:2:2 and a 4:4:4 format, every byte of the heap after the copies in and every texel of the copies out where Metal's are, allocatedSize Metal's answer; and the two announced shapes reading what they wrote. The probe header gains what it measured. API.md catalogue entry, api_signatures regenerated. Not yet verified: the device tests, clippy and a control follow. (cherry picked from commit 1e59e4c80f3e28c97ea80c8496e51dd6a94c4c83) |
||
|
|
3312a0ad84 |
Make a texture over host pages before its verdict without waiting for the in-place check
A texture over host pages made while its class's in-place verdict was pending started the check
and waited for that verdict as it was made, up to in_place::VERDICT_WAIT (5 s). The check's
rounds take seconds on some devices and builds: on um870's Radeon 780M (RADV, Mesa 26.2.6), in a
debug build, the first of the consumer's odd-width surfaces (3662x16, rows of 14656 bytes,
ShaderRead | RenderTarget) took 1.75 s and 1.86 s to make (job m3-max-5168), past the ~2 s the
consumer's guest waits for the COMPLETE of its next message. reims-vgpu's
on_vulkan_a_presented_surface_at_an_odd_width_reads_row_for_row failed there ("a COMPLETE") from
the wait's landing on; every command buffer of the same shape completed in under 2 ms.
A texture made before its verdict is a shadow again (ShadowCause::CheckPending, counted in
host_texture_shadows_check_pending), and its making starts the check and waits for none of it.
A program that makes such textures as it starts, and wants them in place on a driver's first
run, starts the check earlier with Device::settle_in_place_checks and a zero timeout; a device
whose record holds the verdicts knows them as it is made, as before. VERDICT_WAIT,
InPlaceChecks::wait_for and WorkCounts::in_place_verdicts_waited go (api_signatures.tsv).
Test: tests::first_host_texture, the consumer's shape: six surfaces over no-copy buffers at widths
3662, 1831 and 1001 (rows padded to 64 bytes), ShaderRead | RenderTarget then ShaderRead, each
copied out by a blit and read at its own pixels by a draw. The first is a shadow made before its
verdict; before this change it waited and was counted 0 there (m3-max-5168), so the assertion
fails without the fix. fresh_pages's in-place test settles the check before its texture, as a
texture made before its verdict is a shadow now. The waiter's unit test goes with wait_for.
Docs: in_place.rs, docs/API.md, docs/HOWTO.md, the FAST-PATHS in-place row.
(cherry picked from commit eca12ad708a8f1ad53521c967d4340a9b2635a22)
|
||
|
|
eb6c13f52b |
Give a render target in place over host pages the storage usage its snapshot reads fetch through
On the Iris Xe (m3-max-4845, the self_reads lane, a 3662x2039 BGRA8 surface over host pages, 30 pairs of a 600x400 draw, a render-target barrier and a draw reading the target at its own pixel), a surface in place (557d9f0905) split every reading draw: 30 splits a frame, 30 copies of the whole surface into the reader's copy (224M texels copied in), 22.4 and 27.2 ms of GPU a frame, where its shadow took the snapshot (cut A, 60b9a69d39): 30 snapshotted draws, no split, 4.7 and 4.3 ms. The in-place image took the feedback loop usage (aliases 1) but not the storage usage, which a snapshot's fetch of the attachment in the pixel interlock reads through (RenderLowering::keeps_own_attachment), so snapshot_wanted fell back to the split: the image was the texture's declared plan's, where a shadow takes undeclared usages (with_undeclared_usage). A texture over host pages that renders, in place, now takes the storage usage too (framebuffer_fetch::storage_candidate over the feedback loop plan, with the view in another format a fetch stores through where the device needs one: ANV's RGBA twin of a BGRA format) where the device's check passed for a shader's writes over the pages' class and the texel is one the check's kernel stores (4, 8 or 16 bytes): with that usage a shader writes the texels in place, which the check's writes cover. Tried first, then the feedback loop plan, then the declared plan: the first the device makes the image in place with. Elsewhere its readers split as before. A rebind asks the writes verdict of an image with storage usage already. Tests: tests::in_place_storage (new, device): a render target in place over host pages has the storage usage only where the check passed for writes there, with the feedback loop usage and a fetch through storage. runtime_lane::snapshot_reads::a_surfaces_readers_take_the_snapshot_at_any_area expects a snapshot for an image in place only where it took the storage usage (Pointer writes: Passed), as for a shadow. Docs: in_place_image.rs (its usage), API.md (textures over host pages in place), FAST-PATHS.md (the attachment-read row: images over host pages, and the shadow only where a texture is one). Verified: cargo fmt; the build, clippy, lavapipe and the Iris A/B and snapshot lane follow in the tip's evidence. (cherry picked from commit e4d61153702293e23bd874cf0830ff22d6be307a) |
||
|
|
6276d55b25 |
Textures a shader writes over host pages in place, where the device's check passes for their writes
A texture over host pages whose usage writes it through a shader (`ShaderWrite` or `ShaderAtomic`) was a shadow on every device: its texels copied in before each use and merged back after each write. The owner's ruling of 11-07 (confirmed for discrete GPUs) has CPU-visible memory worked on in place wherever the device can, slower or not, with a shadow only where in place is impossible, announced and counted. This takes such a texture in place on the same terms as one that renders, from the parked branch park/shaderwrite-in-place, onto the per-class, per-access check, with no device-type rule: a discrete GPU takes it in place too. - `in_place.rs`: a third access, `Access::Writes`, which a texture of `ShaderWrite` or `ShaderAtomic` usage takes; a texture is tried in place where its class's check passed for each access it takes (`Access::takes`: renders, writes, or reads where it does neither), asked in that order until one did not pass. A texture a shader writes of texels of 1 or 2 bytes, which the check's kernel stores none of, is a shadow (`ShadowCause::StoreWidth`); `ShadowCause:: ShaderWrite` is gone. Nine verdicts a record (CHECK_VERSION 3). - `in_place_check.rs`: the storage rounds, per class: a texture of `ShaderWrite` usage over the pattern, every texel stored by the crate-owned copy-in kernel through an unsigned-integer view (`Texture::store_in_place`, from a buffer outside the Metal address space), its first move first, while the writer writes the bytes between rows and after the image; every texel must read the kernel's bytes, every other byte the writer's or the pattern. `STORE_SHAPES`: 4, 8 and 16-byte texels, packed, padded at 512 bytes (widths no multiple of 4, odd heights) and at a tight 16-byte pitch, and 1920x1080. - `WorkCounts`: `host_textures_in_place_written` (of `host_textures_in_place`, those a shader writes) and `host_texture_shadows_store_width` are new; `host_texture_shadows_shader_write` is now the subtotal of the shadows a shader writes, as `host_texture_shadows_render_target` is of those that render. The rebind of a texture in fresh pages asks every access its image's usage takes. Tests: the decision test covers every usage, texel width and combination of the three accesses' verdicts, and the order in which they are asked; the cause words and the record of nine verdicts. Lanes: in_place_textures gains `written_textures_over_host_pages_take_the_path_their_checks_answered` (64x64 `RGBA16Float` at 1024 and 512 bytes, 61x64 at 496, signaling-NaN halves beside the texels: in place exactly where `Pointer writes` passed, a kernel's writes reaching the pages, every other byte kept), and `textures_that_render_or_write_take_the_path_their_checks_answered` replaces the test that counted every written texture a shadow; no_copy_textures and pitched_surfaces take a written texture in place where its texels are 4, 8 or 16 bytes. Docs: in_place.rs, in_place_check.rs, the policy's docs, API.md (the in-place paragraph, the shadow paragraph, the `shadowed-texture` notice), HOWTO.md, the runtime README and FAST-PATHS.md's in-place row and host-pages bullet. (cherry picked from commit c3ffb08376251b87e16b7b417b39f1458e271085) |
||
|
|
24ceac6e88 |
Make device copies on a discrete GPU of Managed textures over host pages alone
On a discrete GPU, a texture over host pages that only samples or reads, over memory that carries a log of its writes, was a device copy (a shadow in VRAM whose copies in take the rows the log reports) whatever its storage mode: a speed choice, so the GPU read the surface from its own memory instead of across the bus. The owner's ruling of 11-07 (confirmed for discrete): Shared and IOSurface memory over guest pages is used in place over the import, never shadowed to VRAM for speed; Managed keeps Metal's two copies on a discrete Mac. So `Texels::device_copy` now also asks for `Managed` storage and a buffer's bytes (not an IOSurface plane's, whose memory is one copy whatever the descriptor's storage mode): a Shared texture and an IOSurface's are in place over the import where the device's check passed, as on every other device. Tests: the runtime's `a_logged_device_copy_sampled_in_an_inline_pass_is_copied_in_before_the_pass` and the device_copies lane make their buffers Managed (`over_logged_as`, `over_as`); the new lane test `a_shared_surface_over_logged_pages_is_no_device_copy` asserts a Shared surface over logged pages is no device copy on any device, in place exactly where the check passed for pointer pages, and that its reads hold the pages' texels before and after a logged CPU write. Docs: API.md, the runtime README, FAST-PATHS.md's in-place row, the WorkCounts field and the lanes' module docs. (cherry picked from commit fd9fc11dd372a0985fdbc921adb2bc971ff78a3d) |
||
|
|
158f7220ff |
Pages the process maps read-only are a copy whose GPU writes are dropped, on every device
On Linux, a no-copy buffer, heap or rebind over pages the process maps read-only went to the caller's dma-buf source wherever it gave one, and so did pages an import alignment above the host page left with no pointer import (by_pointer false), which skip the gate. A dma-buf of the pages takes the GPU's writes, which Metal drops (an M3 Max under macOS 27.0.1: the CPU reads read-only pages as they were). The runtime announced that as read-only-pages-written. Without a source the pages were refused, where Metal makes the buffer. The owner's rule (10-23) is to drop such writes on every device, never refuse them. Such pages are now a copy whose GPU writes are dropped (copied.rs), with or without a source, which is never called for them. The gate is still asked first where the pointer would be imported, and its refusal is still counted as a refusal. Counted: WorkCounts::copied_unwritable_pages (new, public), announced as copied-host-pages with its own cause. Degradation::ReadOnlyPagesWritten is removed (public: api_signatures, docs/API.md's catalogue, the lane's notice registry), and so are HostWindow::unwritable and degrade_read_only_pages. Tests: the dma_buf_imports lane test is now read_only_pages_are_a_copy_whose_gpu_writes_are_ dropped. It fails at the base, where the sourced buffer's fill reaches the file's pages and the unsourced one is refused. The host_memory lane test a_read_only_page_is_a_copy_on_linux_and_ read_elsewhere replaces the refusal test. The runtime's copied_device tests cover a new buffer and a rebind over read-only pages whose gate admits them: a copy, the source unasked. The keep-alive order test uses writable memfd pages, which RADV imports as dma-bufs all the same. (cherry picked from commit 68805d8a5742590e157b089f336c17e8e1dc4ef4) |
||
|
|
88ddbf4f90 |
Keep a colour plane's texels past its surface in a tail of the texture's own
What. A colour texture of a plane of an IOSurface with planes (Buffer::new_texture_with_iosurface_plane) whose GPU or CPU rows run past the buffer standing for the surface is made. Its texels inside the surface are the buffer's bytes, as every texture over a buffer's are; its texels past it lie in a tail of the texture's own (Texels::past, the form |
||
|
|
23ffb2f64f |
Name the in-place check's record by the driver and the check alone; wait for the verdict
The record of the device's in-place check was named by RUNTIME_VERSION too, which moves at almost every pin: every reims boot after a pin move ran the check again, and the textures made before it answered (WindowServer's framebuffers, made at its start) were shadows for that boot's life. - in_place.rs: the record's name and body hold the check's tag, kind and version and the driver's identity (vendor, device, driver version, driver ID, name, info, device UUID), not the runtime version; the body loses its runtime field. CHECK_VERSION is the version of what decides the answer: the check, and the images over host pages it checks as the product makes them. Asked by main for the owner's 11-07 ruling. - A texture made while its class's verdict for its access is pending starts the check and waits for that verdict as it is made, up to in_place::VERDICT_WAIT (5 s), instead of taking a shadow for its life (InPlaceChecks::wait_for, woken by each verdict set and by the settle; counted WorkCounts::in_place_verdicts_waited). Past the wait it is a shadow, counted check_pending. - self_reads prints the check's time (SELF-READ-CHECK ... took). Tests: tests::in_place pins the record name to the identity and check alone (a hash computed in the test), drops the runtime field from the frame tests, and checks a waiter wakes on its own verdict and on the settle. Docs: in_place.rs, in_place_check.rs, docs/API.md, docs/HOWTO.md, docs/FAST-PATHS.md's row; api_signatures.tsv gains WorkCounts.in_place_verdicts_waited. Verified: build, clippy and the touched tests in the follow-up jobs named in the tip's report. (cherry picked from commit 841a92b0020f1d43e943c9bc04245cffb7fcf503) |
||
|
|
8ab8a8c0fe |
Render targets over host pages in place, where the device's check passes for them
A texture over host pages whose usage renders into it (an IOSurface's render target, the guest desktop's framebuffer) was always a shadow: in_place() refused RenderTarget usage by policy, so every render pass instance over one copied the whole texture in, kept it and merged it back (on the Iris Xe of RPL-P, ~3 ms an instance at 3662x2039 in reims's measurements, 90-98% of the desktop's GPU time a composite). ANV makes the linear image such a texture needs at every pitch probed (BGRA8 at widths 3662, 1920, 2560, 3840, 1366 and 1440, packed and padded to 16, 64, 128, 256 and 512 bytes, with color attachment and feedback loop usage, for host allocations; job m3-max-4631), so nothing on the device kept it out. The owner's rulings (10-27: render targets in place where the driver leaves the bytes alone; 11-07: CPU-visible memory worked on in place even where a linear image is slower) take such a texture in place where the device's own check shows the operations Vulkan lets touch the bytes beside the texels leave them alone. So: - in_place.rs: the check's verdicts are per class and access (Access::Reads, Access::Renders): a texture that renders asks its class's render verdict; only a shader write (ShaderWrite, ShaderAtomic, Unknown) is refused by usage. ShadowCause::RenderTarget is gone; the pending, failed and unchecked causes name the access. The record holds six verdicts (CHECK_VERSION 2). - in_place_check.rs: rounds of their own for an image that renders: the texture made with RenderTarget usage, the writer writing the bytes between rows and after the image alone, through the first move, the moves into ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT and back where the image has that usage (Texture::settle_feedback_moves, render_target::feedback_moves, recorded as moved_barriers records them), and a render pass of the check's own queue that clears at load and stores. Every texel must read zero after, every other byte the CPU's write or the pattern. - in_place_image.rs: a texture that renders takes the feedback loop usage where the device makes the image with it (counted feedback_loop_alias_images), so a self-read after a render-target barrier reads through a snapshot rather than a split; else the declared plan's image. - texture.rs: on a discrete GPU, the device copy (dirty-log shadow) stays for textures that only sample or read; one that renders works on the pages in place. - WorkCounts::host_texture_shadows_render_target now counts, of the shadows counted by cause, those that render: the render targets still shadowed, whatever the cause. Docs: in_place.rs and in_place_check.rs module docs, HostPageTexturePolicy, the runtime README, docs/API.md, docs/FAST-PATHS.md's in-place row and host-pages bullet. Lanes: in_place_textures (render targets in place where "Pointer renders: Passed", recalled verdicts 6), no_copy_textures (render targets may alias; passes_blend_load_and_store_as_private_textures runs under both policies, so in-place render targets are checked byte for byte against a private texture with the padding untouched), pitched_surfaces (render targets may alias in the _in_place runs), attachment_read_costs::self_reads (settles the check first, prints textures in place). Verified: build, clippy and the touched tests in the follow-up jobs named in the tip's report. (cherry picked from commit 557d9f090525801183aaff5958c4738c0cfabe46) |
||
|
|
fe494f10cd |
Run a one-row threadgroup of a lockstep-only kernel on its own pipeline
OpenCL C's scale kernel (if (i < n) b[i] *= k) uses no simdgroup operation, yet on the RTX 5080 a dispatch in threadgroups of 16 paid a second compile on emulated simdgroups and its degrade notice. The lockstep pass orders b[i]'s read and write: two threads of a simdgroup share their grid position's x where the threadgroup is narrower than 32 and taller than one row. The pair stands where only some threads run, so its barrier is a subgroup barrier (a tangle barrier under maximal reconvergence), which pins the kernel to the Direct tier's whole 32-lane subgroups, and a 16-thread region was a partial simdgroup for the emulated variant. In a threadgroup of one row no two threads of a simdgroup share an x, so no pair meets and no barrier is needed. - The lockstep analysis runs its pairs a second time where each simdgroup lies within one row (a position's x then differs by 1 to 31 between two threads, as an index does), only where a subgroup barrier keeps a 32-lane tier; Lockstep::rows records that none conflicts. - Lowering takes the inserted simdgroup barriers' class after selection, so it knows whether they are the kernel's only simdgroup semantics; then, on a flattened tier, the kernel records RuntimeFact::RowLockstep. - The binder runs a one-row region of such a kernel on the planned pipeline whatever its width, that region without REQUIRE_FULL_SUBGROUPS where it is not whole subgroups. A partial region of two rows still takes the emulated variant. Tests: the binder's rules (one row of 1, 16, 48 threads planned and unflagged, 32 and 64 flagged, a 100-thread grid's edge, two-row partial regions on the variant, no fact no exception); and on the RTX 5080 profile the scale shape keeps Direct, records RowLockstep and plans 1, 16 and 48 threads on its one pipeline, while b[gid >> 1] and a kernel reading its lane do not. (cherry picked from commit a6c76c206d4438e3948b05464cef7d65fd63d5ab) |
||
|
|
f87e50df30 |
Cap a kernel's threadgroup at its required work-group size (air.work_group_size)
OpenCL C's reqd_work_group_size(x, y, z) reaches the AIR as a trailing
kernel attribute, !{"air.work_group_size", i32 x, i32 y, i32 z}, which
the decoder refused as an unknown stage attribute. It is now
Stage::Kernel's work_group_size (each dimension at least 1, stated once,
kernels only), carried in KernelFacts, and caps the pipeline's
maxTotalThreadsPerThreadgroup, Metal's answer and the device's, at
x * y * z: the M3 Max answers 64 for (64, 1, 1) and 1024 without, and
runs the kernel in threadgroups of 64 and of 32 (job m3-max-4483). No
refusal is added: a descriptor maximum beside it is unmeasured.
Tests: the ABI decode (size, zero, twice, a vertex function); the
engine's maxima of a kernel with and without it on the M3 profile; and
the runtime device test of wg in groups of 64 and 32.
(cherry picked from commit b9fc38d7abef4bab73ad0821efa30560f136d997)
|
||
|
|
c0965318a6 |
Decode an argument passed by value (air.constant) as a constant buffer of its own size
Apple's OpenCL compiler writes each scalar, vector or struct kernel
parameter as an air.constant node: a location, an optional
air.struct_type_info, the type size and alignment, the type and argument
names, and no access or address space. The entry loads the value from a
constant-space pointer, so the role is a read-only constant buffer
holding exactly its bytes, as a constant T& reference is (buffer_size is
the type size). Only a kernel takes one. Reflection then answers as the
M3 Max does in OpenCL mode: float k Float 4/4, struct {float; int} Struct
8/4, 3 past its index.
Tests: the ABI decode of the node (role, layout, refused keys, missing
size, device pointer, vertex stage); the engine reflection of a float and
a struct by value; and on the runtime device tests scale (by bytes and by
buffers at offsets), st and items with d passed by value, against the M3
Max's answers (job m3-max-4483).
(cherry picked from commit ee4ebc233112c297bbb9680535d0fffab4fb153e)
|
||
|
|
93d2fc8b95 |
Link a kernel of OpenCL mode as Metal links it: hidden buffers and work-item reads
A compute pipeline Metal makes with openCLModeEnabled (Apple SPI) from a kernel of Apple's
OpenCL compiler (`__entry_<name>` of a library of sourceLanguage 1) binds three hidden buffers
ahead of the kernel's own and reads OpenCL C's work-item functions from the dispatch. Metal
refuses a plain pipeline of such a kernel ("Internal compiler error"). Measured on the M3 Max
(macOS 27.0.1, jobs m3-max-4483 and m3-max-4504): its reflection lists the kernel's arguments,
each buffer 3 past its index and __local memory at its own, then __global_offset_and_num_dims
(index 0, read-only uint), __printf_buffer (1, read-write char) and
__image_order_data_type_table (2, read-only uint), all used; get_global_id adds buffer 0's offset
to the grid position, get_global_offset and get_work_dim read buffer 0, and the other work-item
functions are the global built-ins of their names.
- ComputePipelineDescriptor::open_cl_mode_enabled, carried into LoweringInputs::open_cl_mode
(part of the key) and SpecRequest::open_cl_mode; the stage-entry cache keys on it.
- air.get_global_offset.i32 and air.get_work_dim.i32 decode as AirIntrinsic::WorkItem.
- canon::opencl, after SCCP and before the global built-ins: appends the three buffers, makes
get_global_id(c) the lane plus the offset word, the offset and dimension count loads from
buffer 0, a dimension past 2 OpenCL's 0 or 1, and a dimension the kernel reads from its data a
select over the three lanes; canon::opencl::entry moves the buffer-indexed arguments 3 on and
adds the buffers' bindings, which the reflection's unspecialized path uses too.
- Without the mode the kernel compiles as Metal AIR and lowering refuses a WorkItem read
(Unsupported, Lowering(Dispatch)).
- RuntimeFact::OpenClMode records the mode; a Compiled kernel of the other mode is
InvalidDescriptor(OpenClMode). The runtime compiles its variants under the descriptor's mode,
and its warm record carries the field (RECORD_FORMAT 5).
- SEMANTICS_VERSION 1991, ARTIFACT_FORMAT_VERSION 493 (a fact tag added).
Tests: canon::tests::opencl (indices, hidden buffers, the reads' rewrite), the translator's
engine_opencl_mode (the M3's reflection, slot writes, key, the mode check), and the runtime's
opencl_mode device tests (add, lsum, cmul and every work-item function against the M3's values).
(cherry picked from commit e2fdc7b4309c2c239cf1227d0a4c6c54552c1be0)
|
||
|
|
803648acd8 |
Make a texture buffer over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture of a texture buffer whose texels run past
the buffer's length (inside Metal's allocation rule) is made instead
of returning NotImplemented(TexelsPastBufferLength), as a 2D texture
or array already is. Its texels inside the length are the buffer's
bytes; those past it lie in a tail of its own, a zeroed Shared buffer
the runtime owns, laid out from the functions' first byte (the offset
rounded down to 16, as Metal's kernels read a texture buffer).
- GPU: the texture buffer takes the staged form (StagedTextureBuffer,
announced): its bindings view the tail as their staging buffer. The
copy in takes the bytes inside the length from the buffer (none
where the texels lie wholly past it), the copy back gives only those
bytes back, and a Shared buffer's merge copies the current part from
and to the buffer and the tail apart (staged_bytes, which now names
a texture buffer's staging buffer as well as an image's, and
record_out, which copies the staging buffer's every byte).
- CPU and blits: as for 2D, each row split at the length
(Texels::past, whose rebase is now the tail's base, tail_base).
Only an IOSurface plane past its surface stays
NotImplemented(TexelsPastBufferLength); the gap's doc, its reach in
scripts/refusal-surface/reach.tsv, the StagedTextureBuffer catalogue
entry and docs/API.md's accepted difference say so.
Why. Plain Metal makes these: reims-vgpu's tbprobe on both x86 oracle
Macs (jobs m3-max-4019, 4046, 4152) and the M3 Max probe
(probes/texture_buffer_past_length.m, job m3-max-4617), whose paths
read and write the bytes past the length as one memory, as a 2D
texture's. The tail gives the 20000-byte buffer's answer for every
shape, as the 2D tail does.
Tests.
- tests/buffer_tail_device.rs: a texture buffer of 64 R32Uint texels
from 3968 of a 4096-byte buffer (32 past) and from 4096 (all past):
as made, after a kernel's write across the length (ob1_texel_buffer)
and after replace_region past it, a kernel, get_bytes and a blit
read alike; the buffer's words inside the length are written, every
other word and 16 buffers around it keep theirs.
- linear_plan unit rows: texture buffers past the length made.
- runtime_lane::buffer_textures: the texture buffer at 3968 is made.
- Conformance: buffer-tails-texture-buffer, 1024 R32Uint texels from
16384 of a 20000-byte buffer (904 inside): ob1_texel_buffer reads
and writes, getBytes, replaceRegion, blits from and into it, the
buffer's bytes; recorded on the M3 Max (3 runs, one outcome, every
site the model's answer).
Verified:
- M3 Max, macOS 27.0.1: the probe (m3-max-4617) and the recording
(m3-max-4640): buffer-tails-texture-buffer is made, announcing only
the staged-texture-buffer notice, and the 2D tail cases still are.
- gem10 (m3-max-4635): clippy of the runtime (all targets, all
features) and of runtime and validation under --cfg m2v_cpu_icd;
the runtime's unit tests (70 of 70); the runtime lane on lavapipe
(172 of 172, the new texture-buffer test among them); the
buffer_textures, texel_swizzles and degrade_notices validation lanes
(27 of 27).
- gem10 (m3-max-4662): rustdoc of runtime and conformance; the
conformance unit tests over the tails, refusal, catalogue and
accepted-difference rows (20 of 20); a lavapipe replay of the six
buffer-texture cases, all six announced as the ledger expects.
Clippy there named the shape test's two constant assertions, now
const blocks; clippy of runtime and conformance and those unit
tests again on this tree: m3-max-4688.
- Negative control (m3-max-4662): the runtime's sources at
|
||
|
|
76f46963b6 |
Driver facts: RADV on the RX 7900 XTX decodes BC1 to BC3 as Metal does
The XTX's BC1 to BC3 texels, unorm and sRGB, read as Metal's decode in the runtime lane `compressed_decode::bc1_to_bc5_texels_read_the_device_s_decode`: 0 of 4096 channels off for each of the six formats (RADV, Mesa 26.2.6, job m3-max-4261 on homelab-gem10's XTX, MESA_VK_DEVICE_SELECT 1002:744c!), the 780M's reading exactly. Its BC4 and BC5 read as the 780M's do too (BC4 snorm 10 channels up to 1.6/255, BC5 snorm 44 up to 1.726/255), so `ChannelBlockDecodeIsMetals` stays off for both. So `ColorBlockDecodeIsMetals` gains a RADV row on the XTX (0x744c, the new AMD_RX_7900_XTX), and a BC1 to BC3 texture there no longer announces `compressed-texel-decode`. The notice's doc, docs/API.md's catalogue, docs/FAST-PATHS.md's row and the fact's measurement doc name the XTX. The 12 RADV ledger rows of bc1/bc2/bc3-rgba-srgb now state that the block decode is measured to be Metal's on both GPUs, so the sRGB decode is what differs. Test: `a_radv_gpu_no_row_names_takes_radv_s_driver_wide_fact_alone` presented the 780M under the XTX's deviceID as a GPU no row names; it now expects the XTX's two facts (the driver-wide zero fetch and BC1 to BC3's decode) there and the driver-wide fact alone under 0x1114, at another release too. Pinned files change (driver_facts.rs, degradation.rs): the runtime pin and RUNTIME_VERSION are the orchestrator's. (cherry picked from commit 18101735f400ebe243e775a67b7d8da19ea2ad5a) |
||
|
|
9ee7323e76 |
Make a 2D texture over a buffer whose texels run past its length, those texels in a tail
What. Buffer::new_texture and new_linear_texture of a 2D texture or a
2D array whose texels run past the buffer's length (inside Metal's
allocation rule, past which Metal answers nil and so does the plan)
are made instead of returning NotImplemented(TexelsPastBufferLength).
The texels inside the length are the buffer's bytes, exactly as
before; those past it lie in a tail of the texture's own: a zeroed
Shared buffer the runtime owns (Texels::tail), laid out from the
texels' first byte, and no other allocation's memory.
- GPU: such a texture is kept as a shadow image (ShadowedTexture is
announced). The tail is the shadow's staging buffer; its copy in
takes the bytes inside the length from the buffer, its copy back
(staging rows clipped by inside_rows) writes only those bytes back
to the buffer, and a Shared buffer's merge copies the current part
from and to the buffer and the tail apart (shadow_merge.rs).
- CPU: getBytes and replaceRegion split each row at the length
(past_runs, write_past).
- Blits: copies that name the texture's bytes split their rows at
each side's length (RowsCopy::split) and copy the part past it
from or to the tail; a copy with an ordinary texture goes through a
scratch buffer of the encoder; synchronizeResource covers the bytes
inside the length; the extended-range rewrite announces its note
rather than binding the buffer's words past the length.
Texture buffers and IOSurface planes past the length stay
NotImplemented(TexelsPastBufferLength), whose doc now says so.
Why. Plain Metal makes these textures: reims-vgpu's oracle on the
AMD 5300M and the UHD 630 (4096-byte buffer, 64x16 and 64x17 at rows
of 256, offsets 0, 256 and 2048) and the M3 Max probe
(probes/texels_past_buffer_length.m, job m3-max-4337) for the same
shapes. Under Policy::Dies the refusal ended the consumer's host. The
M3 Max's paths agree that the bytes past the length are one memory:
the next allocation's over a 4096-byte buffer, the allocation's own
zeros over a 20000-byte one, read and written alike by every path.
The tail is the second answer for every shape; docs/API.md's accepted
differences records that the runtime never reads or writes another
allocation there.
Tests.
- tests/buffer_tail_device.rs (m2v_gpu / m2v_cpu_icd): 64x17 over
4096 bytes, 64x16 at 2048, 64x80 over 20000 bytes (row 78 across
the length), 64x1 wholly past, a Private buffer's, and a 2D array
whose second slice is past the length; each path (kernel, blit,
CPU) reads what each other path wrote, the buffer keeps its bytes,
and 16 buffers around it keep theirs.
- Unit tests: linear_plan expectations (2D and array past the length
made, texture buffers refused), RowsCopy::split, inside_rows.
- Conformance: buffer-tails-kernels (scout_read_u / scout_write_u,
getBytes, replaceRegion, the buffer's bytes) and buffer-tails-blits
(blits from a buffer across the length and from a texture past it,
a copy out into a texture, blit and getBytes reads), RGBA8Uint
16x256 at offset 4096 over 20000 bytes, recorded on the M3 Max
(3 runs, one outcome, every value the model's).
- The runtime_lane assertion that a 2D array past the length is
refused now asserts it is made.
REFUSALS.md and CONFORMANCE-COVERAGE.md regenerated.
Verified:
- M3 Max, macOS 27.0.1: probe m3-max-4337 (the shapes above); record
m3-max-4492 (both cases, 3 runs, one outcome each, every site the
model's answer); replay on MoltenVK m3-max-4508: buffer-tails-* and
the four buffer-texture(s)-* cases announced (every value exact).
- gem10, lavapipe (LLVM 23.1.4, 256 bits), m3-max-4509: unit 71/71
(linear_plan, buffer_texture, blit_plan, tail); device tests under
m2v_cpu_icd 139/139 (the four buffer_tail_device tests and every
buffer_texture, shadow and blit test); runtime_lane::buffer_textures
7/7; conformance replay of the same six cases: all announced.
- Negative control, same job: the runtime's sources at
|
||
|
|
32c15dd1b8 |
Follow a texel call's status word through member insertions and extractions
Apple's GL code generator writes a texture read it swizzles back into the read's own
{ <4 x float>, i8 } with insertvalue and takes the texel out again. The status analysis knew a
carrier only as the call or a whole copy (phi, select, freeze), so any insertvalue exposed the
word and every GL texture-buffer shader on the 5080 guest was refused as
Unsupported(Lowering(Texture), NotImplemented).
A carrier is now a value plus the member path at which it holds a call's word: [1] in the call's
own result, empty in the word itself. Copies keep the path. An insertvalue into a carrier carries
it unless it overwrites the word's member, and an insertvalue of a carrier carries it below the
member it writes. An extractvalue shortens the path, observes nothing when it takes another
member, and takes the word at its own member. A word re-inserted whole demands no bits there:
they are demanded where it is taken again. Every other use of a carrier (a store, a call, a
return) still exposes the word and is refused. This holds for every call the analysis already
followed: read, sample, sample_grad and gather, compare forms included, on every texture type.
Tests (engine_texture_tail): four new carrier forms. The texel reinserted, a {T, i8} rebuilt
from its members, a read nested in a larger aggregate, and a select of a read and its rewritten
copy. Each, and a word overwritten, compiles on every profile with the texel only taken, with
Metal's texels on the interpreter. Each carries resident() to a lowered residency read, plain
and sparse. Each refuses the whole word taken after it, as does a read stored whole.
(cherry picked from commit bb664f60be54c6e443cc13a619760542663ba5bc)
|
||
|
|
a0eda5a037 |
State which integer operations are folded for an OpenCL kernel's immediates
The API guide said an integer operation on a narrow width is folded over constants; SCCP folds ctpop, bitreverse and bswap alone (94d75b4fad), and a narrow min or max is refused. (cherry picked from commit 12cc0037e02e018d5196e3c6145ceb88bdcdc593) |