bb21c14865fd994b46bb26c74619cc5e01ac4bbc
544
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
135df83657 |
RUNTIME 2357: Textures over buffers: an image over a buffer's texels may take its whole placement; an unobserved buffer lies on the linear image alignment
Intel's driver for the UHD 630 on Windows (101.2145) rounds a small linear image's VkMemoryRequirements size up to its 4096-byte alignment: BGRA8 73x8 at a pitch of 320 has a 2560-byte subresource and a 4096-byte image, 16x16 1024 -> 4096, RGBA16F 88x8 6144 -> 8192. The in-place check (linear_plan::aliases) bounded the image's size by the buffer's VkBuffer bytes from the texture's first, so a texture over a padding-unobserved Private buffer of exactly its rows was a shadow, and a buffer placed on 256 bytes failed the image's 4096 start too. The room an image over a buffer's texels may take is now the buffer's own placement from its byte 0 (Buffer::memory_room: bytes no other resource is placed in), in texture.rs's two aliasing checks and the two-plane YCbCr check. A buffer whose maker declares its padding unobserved is placed on the device's linear images' memory alignment (Device::linear_image_alignment: one probe image's alignment, a 64x8 R8G8B8A8_UNORM linear image, kept for the device), its start and size whole units of it; the recycler's BufferMaking keys on that alignment, and a device recovery's carry places such a buffer so again. Where the alignment is 256 or less (RADV, lavapipe, MoltenVK), every placement met it already and nothing changes. Cost: at most alignment - 1 bytes more for each such buffer on the UHD 630, plus the start's padding. Still a shadow: an image the driver sizes past its alignment's rounding, R8 4096x1 over 4096 bytes taking 16384 on the UHD 630 (FAST-PATHS known gaps), and on that driver textures over buffers that do not declare their padding unobserved where the image is larger than the placement or starts off 4096. Tests: padding_unobserved's a_texture_whose_rows_fill_an_unobserved_buffer_is_in_place makes a 73x8 BGRA8Unorm texture at the device's own linear pitch over a Private padding-unobserved buffer of its rows alone and asserts the placement lies on the alignment, the texture is the image over the buffer, and no shadow is counted. Docs: BufferDescriptor::padding_unobserved, the runtime README entry, FAST-PATHS known gaps. Checks: on the UHD 630 (Windows, m3-max-32630, at the same diff before its rebase), padding_unobserved's new test passed: 73x8 at a pitch of 320 over 2560 bytes, 4096 of room on 4096, an image over the buffer, 0 shadowed. At cb7660c625: clippy plain, m2v_gpu and rustdoc 0 (m3-max-32602); lavapipe touched set 153/153 and m2v_cpu_icd clippy 0 (m3-max-32603). |
||
|
|
f4c9902c63 |
FAST-PATHS: the cold Shared making's range on this tree is 95-97 ms
The previous commit gave 92-97 ms; m3-max-32595's two runs of this tree made the cold round in 97.0 and 94.6 ms. |
||
|
|
9ee682344f |
FAST-PATHS: the 16 KiB allocation's measured cost
A 16385-byte buffer's VkBuffer requires 32768 bytes where 16400 did, on RADV PHOENIX and lavapipe (m3-max-32595, m3-max-32558). On the Radeon 780M, release, exclusive, the base (d2ee5bca5b) and this tree run twice each in one job (m3-max-32595): 1000 buffers of 16 KiB + 1 to 4 MiB required 763.3 MB against 754.8 MB and took one more 64 MiB block in their second round; making them took the same time within the runs' spread, Shared ones cleared on the host and Private ones' first fills alike. |
||
|
|
a1175662e7 |
RUNTIME 2355: Textures over buffers: a buffer of 16 KiB or more holds Metal's allocation, a heap's buffer its heap
A texture over a buffer whose texels run past the length was always a copy: a shadow image or a staged texture buffer whose bytes past the length lay in a tail of its own. Metal's texels there are the allocation's: a buffer of 16 KiB or more holds its length rounded up to 16 KiB (allocatedSize), zero when made, and a heap's buffer reaches its heap's end, whose bytes are the heap's. Now a buffer the device makes in the Metal address space with a length of 16 KiB or more takes that allocation (buffer.rs's metal_allocation): its VkBuffer and placement are its length rounded up to 16 KiB, which its first fill clears with the rest (Buffer::clear_first: the host's clear of a Shared or Managed buffer, the device's fill of a Private one), with no command of its own. A texture keeps in place the bytes the buffer's memory holds for it (Buffer::texel_reach: the allocation, a heap's buffer's heap to its end, a no-copy buffer's length), so such a texture is made as one inside the length is: an image over the buffer's memory where the device makes one, a texture buffer viewed in place. The shader-visible ranges, robustness, copy reach (a blit past the length is still refused) and exported sizes stay at the length. Heap, no-copy, wrapped and exportable buffers, and every buffer under 16 KiB, take their length; past what the memory holds a texture keeps its tail, as before. The runtime has no buffer allocatedSize; a heap's size and a heap texture's allocated_size are unchanged. The tails conformance cases now lie in place: their comments say so, and the texture buffer case drops its staged-texture-buffer allowance, which no device can fire there any more (its view starts at 16384). Tests: buffer_tail_device's last-texel case lies as over a buffer that holds it inside its length, with no tail; a new case over a 20000-byte buffer (64x128 packed, ending at 32768) reads zero in the padding as made, lies as inside the length, lands a kernel's writes past the length in the buffer's memory, takes no copy where it is an image over the buffer, and refuses a blit past the length; the heap case lies in the heap, its kernel writes landing in the heap's other buffer; a new case over a heap's second buffer keeps its texels past the heap's end in a tail; the no-copy and 4096-byte cases keep their tails. Docs: buffer_texture.rs's Tails, linear_plan.rs's Length, docs/API.md's accepted difference and StagedTextureBuffer entry, and a FAST-PATHS cost-of-matching-Metal entry for the padding. Checks: the jobs that compiled and ran this commit are named in the lane's report. Evidence (lane jobs): m3-max-32551 (msi): clippy runtime+conformance -D warnings 0; 2632/2632 runtime+conformance; fast_paths + api_surface 34/34. m3-max-32578 (lavapipe) at the tip: touched 56/56 (buffer_tail_device incl. the allocation, heap and heap-end cases, texture_placement_device, linear_plan, buffer_texture, degradation_catalogue); runtime+validation partition 1/4 1572/1572. VkMemoryRequirements on lavapipe for a 16385-byte buffer: 32768 (alignment 64). The padding is cleared by the buffer's existing first fill (no new command). allocatedSize: no buffer API; heap sizes unchanged. The PHOENIX run, the release creation bench and lavapipe partitions 2-4 follow in the lane. Conformance: buffer-tails cases now in place; the M3 venue's cost records for buffer-tails-* re-bless on development. Lane commits: d2ee5bca5b (bench), a8f3796f59, ee54952340 (heap cases in a placement heap). |
||
|
|
b7053280de |
RUNTIME 2346: 4:2:2 textures over IOSurface planes: an image of their texels, decoded from the pairs in place
A GBGR422 or BGRG422 texture made over a buffer's bytes (Buffer::new_texture_with_iosurface_plane,
a CoreVideo 2vuy or yuvs plane, over a Shared buffer or a no-copy buffer's host pages) had no
decoded twin: twins are attached only to textures whose image is their own for good, so every
dispatch or draw that read or sampled it was refused, with a "needs R8G8B8A8_UNORM SampledImage"
line naming a format every device samples.
Such a texture is now an R8G8B8A8_UNORM image of its texels, the converted shadow a two-plane
YCbCr texture over planes already is (ShadowSource::Converted, its conversion now an enum of the
planes' and the pairs'): its copy in, before the first command of a command buffer that reads it
and after a command wrote the bytes, is one dispatch of the new bind::chroma_convert_module that
reads the pairs where they lie, at any byte of their VkBuffer, through one storage-buffer binding,
and writes Metal's texels (ChromaDecode, exact) through the image's R32_UINT view. Copies, blits
and CPU calls keep moving the plane's bytes. Where the device converts the pairs' format with
Metal's reconstruction (MoltenVK), the copy in is that conversion instead: the plane's rows copied
into the pairs' image, sampled through the conversion (chroma_sample_module) into a scratch,
copied into the image; announced decoded-texel-precision at the copy in's planning. The set binds
the buffer's VkBuffer, so the planning makes it again after a rebind gave the buffer another one,
and each command buffer holds the set it took. The placement query answers OtherShape. A plane
the window cannot take (past maxStorageBufferRange, a last word past the buffer, rows that share
bytes, texels past the buffer; with the device's conversion, a first byte or rows off 4 bytes)
keeps the carrier, its reads refused; FAST-PATHS records it as a known gap.
Per frame, per texture (w x h texels): before, no read ran at all; the texture was an R8G8_UNORM
carrier of the plane, 2 bytes a texel. Now no byte is copied: one dispatch reads the w*h*2 bytes
of pairs in place and writes w*h*4 bytes of texels (1920x1080: 4147200 read, 8294400 written).
Memory: one R8G8B8A8_UNORM image, w*h*4 bytes (1920x1080: 8294400), in the carrier's place; with
the device's conversion also the pairs' image (w*h*2) and the scratch (w*h*4), and per copy in a
w*h*2 copy in and a w*h*4 copy out. Announced carried-decoded-twin (an existing kind) with that
cost. No new Degradation kind, no new WorkCounts field.
A carrier's binding without a twin is now refused NotImplemented(Format) naming the texture's
format (pvrtc::holds_for_copies), not a need of the twin's view format.
Public surface: metal2vulkan::bind::{chroma_convert_module, ChromaConvertModule} added
(api_signatures.tsv blessed, api_surface table); docs/REFUSALS.md regenerated (one more
binding_view site of Format).
Tests: the in-place kernel against ChromaDecode's decode under the interpreter (both orders, first
bytes off a word, odd sizes, rows apart); a carrier's binding refusal (binding_view unit test);
a device test of both formats over a Shared buffer and over host pages reading Metal's measured
bar values (an Apple M3 Max, macOS 27.0.1) and Metal's decode of a random frame written on the
CPU before the next command buffer, OtherShape from the placement query, and the device's
conversion counted and announced where it converts. Verification jobs follow in the lane report.
Evidence (lane jobs): msi m3-max-32240 at 94f603bf35, --cfg m2v_cpu_icd on llvmpipe: 130/130 touched tests, clippy -D warnings 0;
the device test fails without the fix (placement not OtherShape, the read's dispatch refused). PHOENIX gem10 m3-max-32260
(archive m3-max-32241): all 4 cases (GBGR422/BGRG422 over a Shared buffer and over host pages) "Metal's texels, exact"
for the M3's measured bars and a random CPU-written frame; ycbcr_device, ycbcr_refresh, twin_reads 7/7. MoltenVK (device form)
run on the M3 follows.
Lane commits: 735234d5f4, d59f44baa6, 94f603bf35.
|
||
|
|
a9dce911e7 |
Known gaps: drop the first commit's translation; held_step_order's numbers from a release build
|
||
|
|
9aadbdf281 |
held_step_order: time Scheduled from the commit's return; hold the commit call to a frame
command_buffers_behind_a_waiting_step_read_scheduled failed 3 of 3 on the Radeon 780M (PHOENIX) inside the whole device suite (m3-max-31782): the long command buffer's commit returned 405.95, 23.66 and 10.50 ms after its call, and the test bounded the call plus the scheduler's pass to `Scheduled` by 10 ms together. Scheduled itself came 19.6, 1.6 and 2.3 ms after the commit returned: the ordering the test is for held. What holds the call (probes m3-max-31832 and m3-max-31876, gem10's 780M idle, step marks in the commit path): no pipeline wait (commit_pipeline_wait_nanos 0) and no lowering; Recording, Deferred::prepare of the host-step pass. Its first commit translates the variants the step draws with on the program's thread (DeferredPass::settle: the step's buffer forms and the fan-out's, the route's replay variant; record_on_gpu's decision and, once a device, the notice's rules past its cause): 24.1 / 23.7 ms cold, 49.8 in an earlier run. A later commit finds them made: 1.0 ms (2.4 in the earlier run), about 30 lookups of 5 to 35 us, no single repeated item. The suite on the host's cores stretched the same work about tenfold. The translation cannot move earlier (whether the pass is a host step and its route are decided at the commit) nor off the program's thread (the device keeps only what the program's calls make, in its order). So the test's one bound mixed two properties. Now: - `Scheduled` is timed from the long commit's return, still within 10 ms (the long work ends 100 ms or more after it); - the commit call is asserted apart, by its own clock (WorkCounts::commit_nanos), within a frame's 16 ms in one of the runs at least (the later runs are warm), the test's own work_counts() snapshot outside the timed span. docs/FAST-PATHS.md's known gap is rewritten to what is measured (the first commit of a host-step pass translates its step's variants, why it stays there), and CHANGELOG's known-failing line with it. Verified: see the lane's report (PHOENIX 5/5, negative control with a sleep in the commit path). |
||
|
|
d9236a8a11 |
Known gaps: a commit held past 16 ms on a Radeon 780M; a teardown wait past 16 ms on an RTX 2080
Two latency tests fail on some GPUs at the 0.2.0 release candidate, recorded where a user reads open gaps (docs/FAST-PATHS.md, Known gaps) and in the 0.2.0 CHANGELOG entry, at the owner's call to document them as failing and release: - tests::held_step_order::command_buffers_behind_a_waiting_step_read_scheduled: on the Radeon 780M (Phoenix, m3-max-31782, exclusive) the long command buffer's commit returned 405.95 / 23.66 / 10.50 ms after its call over the test's three runs (bound 10 ms); pin 97's XTX printout shows the same shape (315.68 -> 12.59 -> 17.11 ms). The ordering the test is for held in every run. - tests::teardown_threads::a_running_queue_switch_check_leaves_the_device_to_the_program_s_thread: on an RTX 2080 (620.70.06) it failed 3 of 3 alone (m3-max-31777): the teardown waited 33.1 / 23.3 / 19.8 ms for the check, 19.6 / 22.0 / 18.4 ms of it the check's objects' release; it passes on the RTX 3090, RX 7900 XTX and Radeon 780M. That host's driver calls on the 2080 ran several times slower than usual during the measurement (cause open). Docs only. |
||
|
|
b585744208 |
Boxed draws: the constant's numbers count the three draws the patches frame still fanned out
GEOMETRY_TRIANGLE_WORK's doc (
|
||
|
|
5983bb3e72 |
RUNTIME 2324: Boxed draws: a fanned-out triangle's geometry stage is worth 24 vertex-regions, not 180
The boxing rule (RUNTIME 2318) took GEOMETRY_TRIANGLE_WORK = 180 from the pieces lane's bands frame, whose 22-by-10-pixel triangles cost 132 ns each fanned out on an Iris Xe: mostly their fragments, which every route shades, not the geometry stage boxing saves. Its 61 boxes on the patches frame (2-pixel quads, about 18 regions a box) lost on every device measured, the pass's warm piece: Iris Xe (Mesa 26.2.6) 4.64 ms fanned, 9.21 / 9.06 ms boxed (m3-max-30553) Radeon 780M (Mesa) 6.47 / 6.46 ms, 13.57 / 13.57 ms (m3-max-30687) RTX 3090 (620.70.06) 2.80 / 2.77 ms, 3.01 / 3.00 ms (m3-max-30686) On that frame, whose fragments cost little, a fanned-out triangle cost 15.4, 21.5 and 9.3 ns, a boxed vertex-region 0.59, 0.87 and 0.19 ns: 26, 25 and 49 units. The constant is the least, 24.7, rounded down, so a draw it boxes costs no more than its fan-out on each of the three; a lower constant only boxes fewer draws than 180 did. The doc and docs/FAST-PATHS.md's row carry the numbers. tests::rate_mapped_boxed_draws: the 120-by-40 strip across ten regions (50 units a triangle, the patches frame's boxes about 55) is now fanned out, and a patch across four regions' corner is boxed in its place, so the test still boxes a draw across region borders: counts [1, 0, 3, 4, 4]. At 180 the strip is boxed and the counts fail. tests::rate_mapped_boxed_rule checks the rule on the patches frame's average draw: 18 regions fanned out, 4 boxed. The lane's patches frame no longer asserts that it boxes a draw. RUNTIME 2324: an unchanged artifact's rate-mapped draw that boxed at 180 fans out at 24. |
||
|
|
8a374ba0e5 |
RUNTIME 2318: Rate-mapped draws whose triangles lie in few regions are boxed, not fanned out
At a host step under RateMapRegionPolicy::FanOut, a probed draw the probe flags nothing of goes through the fan-out variant, and so does a flagged draw's fanned part. Its geometry stage emits a copy of each triangle per region it touches. On the pieces lane that stage costs a fanned-out triangle what 371 to 739 vertex invocations for one region cost. On an Iris Xe that is 130.7 ns a triangle, against 0.352 ns an index-region through the region-copy variant. On a 3D renderer's frame there (tm91-iris), about 68 of the 125 ms of rate-mapped pieces a frame tracks the probed and fanned geometry, which is 383 fanned draws a frame. Such a draw is now boxed when that holds no more work: drawn through its region-copy variant into the boxes of the regions its triangles reach by the probe's bounds (fan_out::run_boxes of Probed::reach, a part's from its own blocks), as a run is. - The rule: rate_mapped_pass::boxes_cheaper, regions x (vertices + REGION_DRAW_WORK) <= GEOMETRY_TRIANGLE_WORK x triangles (a direct draw; a strip's triangles counted at vertices / 4). - GEOMETRY_TRIANGLE_WORK = 180: about half the least that a fanned-out triangle cost against a vertex for one region on the four devices measured (Iris Xe 371-500x, Radeon 780M 739x, RX 7900 XTX 570x, RTX 3090 654x; the constant's doc has the numbers). The rule is device-independent, keyed to no app, map or shader. - No new pass, variant or readback. fan_out_asked asks for the region-copy variant (settled at commit already) and the recording takes the boxes (RenderLowering::boxed_reach). Pixels: the routes already share a pass and put a vertex at one window position. A pixel lies in one region, whose copies keep the draw's order of instances and primitives in either route. The bounds are widened as the probe's are, so a box holds every pixel a copy would cover: the same pixels and depth wherever today's routes agree. A boxed draw rides whole in its piece, as a fanned-out one does; its work is no more than its fan-out's. Counts: WorkCounts::rate_map_boxed_draws and rate_map_boxed_vertex_regions (CopyRoute::Boxed). A boxed part is not a run, so rate_map_region_runs and rate_map_parted_region_triangles leave it out. Test: tests::rate_mapped_boxed_draws, 6 commands blended at half alpha: - boxed: a 10-pixel patch, a 120x40 strip across region borders, a patch of two instances, and a patch without indices; - fanned out: a whole-target grid and one wide quad. It checks probes 1, flagged 0, fanned 2, boxed 4, region-copy draws 4, and boxed vertex work under the whole table's. The pixels equal the encoder's bit for bit. Under Exact nothing is boxed. Also (2f82e025be): The pieces lane draws each command's own patch: rate_mapped_pieces_host_step_patches; (01d8344d2a): A command's settle at commit boxes no draw; the boxed test's counts keep their function's name. Verified (lane ratemap3, msi m3-max-30513 at 01d8344d2a, llvmpipe): rate_map|fan_out 26/26, the new rate_mapped_boxed_draws among them (probes 1, flagged 0, fanned 2, boxed 4, region-copy draws 4, boxed vertex work 10752 against the whole table's 997056; pixels equal the unboxed execution; nothing boxed under Exact); rate_mapped_fan_out, region_boxes, pieces and depth_equal unchanged. Landed (main) at once: clippy x3 (m3-max-30514), the Iris A/B and the hand negative control run after landing. RUNTIME 2318: what a run records and draws changes. No Degradation kind. API: two WorkCounts fields added (rate_map_boxed_draws, rate_map_boxed_vertex_regions); api_signatures.tsv blessed. A consumer building WorkCounts by struct literal must name them. |
||
|
|
497e1f4ec0 |
SEMANTICS 2116: NVIDIA's float denormals under the 16-bit float controls are the device's, noted
What: a new DriverWorkaround, FloatDenormalsKeptUnderHalfControls, with rows for NVIDIA's driver on the RTX 3090 and the RTX 5080 Laptop GPU (the GPUs its MetalFloatDenormals rows name). In an entry that declares the 16-bit float controls (narrow::controlled_modes) on such a profile, the float operations the deviation covers record PrecisionNote::DeviceDenormals and the module requires no VkProperty::MetalFloatDenormals. An entry that declares no float-controls mode keeps the deviation, and so does every other driver. Why: runtime_lane::driver_deviations::fused_pairs_answer_metals_nans_and_denormals failed on the RTX 5080 Laptop GPU (615.71.09) and the RTX 3090 (620.70.06) at pin 93b. The same 33 of 4,096 words in each fixture kept a denormal where Metal answers zero (thread 0x11: 1e-20 * 1e-20 gives 0x116c2; thread 0x29: the smallest denormal times 2^30 gives 0x04000000). That held for the lone product a * w as much as for the fused pairs, so the fused pairs are not the cause. The fixtures compute half in 16 bits, so their entries declare RoundingModeRTE, DenormPreserve and SignedZeroInfNanPreserve for 16 bits. The deviation's probes (nan_denormals, nan_denormals_fast) declare no mode and flush on the same GPUs. Vulkan leaves 32-bit denormals to the implementation when no 32-bit mode is declared (the NVIDIA profiles report independence ALL), and NVIDIA states no shaderDenormFlushToZeroFloat32. So the device's answer stands (owner rule 1), scoped and noted; nothing is flushed in the shader. RADV on the Radeon 780M (Phoenix and Hawk Point, Mesa 26.2.6) declares the same modes there and passed the test at pin 93b, so it keeps the deviation. MoltenVK states no shaderDenormPreserveFloat16, so its entries declare no 16-bit mode. The device test now decides "Metal's" per kernel (requires_property), as the float_denormals tests do, and asserts DeviceDenormals where the kernel does not require the property. The new unit test float_denormals_under_the_half_controls_are_the_devices_where_its_driver_keeps_them checks the 5080 Laptop GPU, the 3090, the desktop RTX 5080 and the 780M against fmx_fma_precise, fmx_fma_fast and nan_denormals. It fails without the rows. Docs: the workaround's doc, the DEFECTS and MetalFloatDenormals table docs, the deviation and property docs, PrecisionNote::DeviceDenormals, docs/API.md's device-denormals entry, docs/FAST-PATHS.md's denormal row, the signature table. SEMANTICS_VERSION 2116: NVIDIA modules' notes and requirements change. No new Degradation kind. Landed (main) at once, before its check: the lane's check (clippy plain and cpu_icd, the touched unit tests, the two denormal device tests on lavapipe) and the NVIDIA device proof run after landing. |
||
|
|
1858a2fb34 |
RUNTIME 2316: Rate-mapped passes count their region-copy and fanned-out vertex work by box size
What: new WorkCounts fields - rate_map_whole_copy_vertex_regions, rate_map_own_copy_vertex_regions, rate_map_run_vertex_regions: vertices x regions drawn through the region-copy variant into the whole table, by the encoder's own draws, and by a host step's runs; - rate_map_fanned_vertices, rate_map_fanned_box_vertex_regions: vertices fanned out through the geometry stage, and those times the regions of their probe-bounded boxes; - rate_map_fanned_vertices_boxed_16, _64, _256: fanned-out vertices whose boxes hold at most that many regions. render::fan_out::Probed::of also ORs every block's bounds (its reach). FAST-PATHS' FanOut row, docs/API.md and rate_mapped_pass.rs list them. Why: on Iris a whole-table region copy costs about 16x a geometry-stage fan-out a triangle, and the consumer's 127 ms a frame of rate-mapped GPU time cannot be split between the encoder's own whole-table draws, runs and fanned draws from today's counts. A plain sum cannot say how much fanned work lies in small boxes, which a cheaper route for few-region draws would take. How verified (lane ratemap3, msi m3-max-30401 at 7a17a61829): render::fan_out unit tests 6/6; rate_map device tests on lavapipe 19/19, with exact counts in a_host_step_fans_out_the_commands_the_probe_does_not_flag (encoder frame: own == whole == (5 x 3072 + 9) x table regions; host step: no whole-table work, fanned vertices exact; under Exact all zero); clippy -D warnings plain, cpu_icd and gpu; api_signatures --check clean. RUNTIME 2316: what a run records changes. No Degradation kind, no behaviour change. |
||
|
|
057b794f5b |
SEMANTICS 2115 / RUNTIME 2315: rate-mapped region copies record a box of regions per multi-draw
What: a draw through its region-copy variant recorded its regions 16 at a time (the device's
viewports). Each recording set 16 scissors, pushed its first region and stored DrawIndex as
ViewportIndex. On a guest frame the host step made about 4.7k such recordings a frame (Iris and
RTX 3090), while the GPU sat idle waiting for the step.
The variant's four clip distances already keep each copy to its region's pixels, as a fanned-out
copy's are kept; the per-region scissor only culled. Now:
- The vertex function draws region first + (DrawIndex / c)*nx + DrawIndex mod c from a pushed
box (PushField::RegionBox, renamed from RegionFirst, now [first, columns]).
- It stores 0 as ViewportIndex, the recording's one viewport, so it writes every output the base
variant wrote.
- The recording sets one viewport and its box's union scissor.
- A direct draw records a box as many regions at a time as one vkCmdDrawMultiEXT takes
(maxMultiDrawCount - 1), its rows in order. A run records one recording per box its bounds
reach; any other draw records the whole table in one or a few.
- Indirect draws keep one region a recording, under that region's scissor.
- The variant still needs shaderOutputViewportIndex and shaderDrawParameters; it no longer
needs multiViewport.
Exactness: a border between two regions of a recording holds no pixel centre and no sample at
Vulkan's standard sample locations (at least 1/16 px inside a pixel, up to 8 samples), while each
copy's clip distance there is zero up to rounding. A box is recorded one column (row) at a time:
- in a pass whose custom sample positions put a sample on a pixel's left (top) edge;
- on a device without standardSampleLocations;
- in a 16-sample pass.
See render/fan_out.rs, folds.
A box's recording and the recordings of each of its regions alone run one pipeline that writes
the same outputs. They differ only in their dynamic viewport and scissor values and the integer
region each draw selects (Vulkan's Invariance appendix, Rules 2 and 4). The agreement between the
encoder's region-copy vertex function and the host step's fan-out geometry stage stays the
existing FAST-PATHS known gap, checked by running: no new near-equivalent, no new accepted
difference.
SEMANTICS_VERSION 2115 (the variant's module and push layout); ARTIFACT_FORMAT_VERSION 523 (the
PushField tag); RUNTIME_VERSION 2315 (what a region-copy draw records). Docs: rate_mapped_pass.rs,
render/fan_out.rs, bind/fan_out.rs, the translator's region-copy plan and store, docs/API.md, and
the FAST-PATHS fan-out row and known gap. docs/REFUSALS.md regenerated unchanged; api_signatures
blessed. No new Degradation kind, no WorkCounts field.
Tests:
- render/fan_out/tests.rs: run boxes, box recordings, box scissors, the fold rule.
- tests::rate_mapped_region_boxes (device test): the same two passes drawn directly (boxes) and
indirectly (one region a recording, its own scissor), additively blended into RGBA16Float with
a ground plane, border-crossing slivers and off-screen and w-straddling triangles, then an
Equal pass, compared bit for bit, with the recordings counted.
Verified (lane ratemap2):
- msi m3-max-30288 at 9240cc0ea6: clippy -D warnings, all targets and features, plain, cpu_icd
and m2v_gpu, exit 0; rustdoc -D warnings exit 0; translator touched tests 226/226; runtime
33/33; lavapipe 13/13.
- rate_mapped_depth_equal: 0 failing pixels in every pairing under Exact and FanOut. Without
the ViewportIndex store, FanOut's mixed-route pairings had 2853 of 89483 (m3-max-30235).
- rate_mapped_region_boxes: direct 3 draws in 3 recordings against indirect 3 in 624, 0 texels
differ, Equal-pass mismatches [0, 0].
- Negative control (each clip distance widened by one pixel): rate_mapped_region_boxes fails,
25464 texels differ, Equal-pass mismatches [11019, 0].
- The Iris GPU-time A/B (ms01, m3-max-30315, exclusive) is running; the consumer's renderer run
at the next pin is the workload proof (rate_map_piece_gpu_nanos a frame on Iris).
Landing note: docs/API.md merged by hand with RUNTIME 2314's probe-parts sentence (both rewrote one
paragraph), and rate_mapped_pass.rs's Fan-out now says the probe runs in parts (RUNTIME 2314).
|
||
|
|
dfda37628d |
RUNTIME 2311: ICB records lie in pooled memory where a held pointer import taxes every submission
What: DevicePolicy gains indirect_records (IndirectRecordsPolicy, a runtime
choice no profile carries). Under the default, Untaxed, an indirect command
buffer's records and overflow slots take fresh pages of the runtime's own
(a pointer import held for the buffer's life) only where the device's import
tax check has not found that a held pointer import costs every submission, or
has not answered; where it has (RADV, ANV on i915), they lie in pooled
host-visible memory as the runtime's other buffers do. Under Carried, which
exact_answers() selects, they lie in fresh pages wherever the device imports
host pointers, as before, so a recovery keeps them. A recovery of a taxed
device under the default loses pooled records and rewrites them as a new
buffer's (carry.rs's existing pooled path); the device-recovered notice
already counts such buffers ("N indirect command buffers, M of them whose
records were lost"), as on a device without pointer imports and for
device-local records on discrete GPUs. No new Degradation kind.
Why: on a Radeon 780M (RADV, Mesa 26.2.6, Linux 7.3.3) beside a guest game
whose ICB records were the process's only pointer imports (3 buffers, 19.6 MB),
the submission thread had 5 windows of 65-140 ms in 12 s in which every
amdgpu_cs_ioctl waited in mmu_interval_read_begin or returned EAGAIN (373 of
the run's 382 failed calls, retried at once by libdrm). RADV lists every
imported memory in every CS, amdgpu re-faults every userptr page each CS and
adds the CS fence to every listed BO, so a page migration of one of those
pages (kcompactd, khugepaged, and the runtime's own block making in direct
compaction) waits in amdgpu_hmm_invalidate_gfx for all the process's GPU work
in flight while every submission waits behind it. With no userptr BO listed,
compaction migrates pages without waiting on any fence.
Docs: the FAST-PATHS ledger row (default, switch, the recovery cost, the
measured chain), API.md's device-recovered text, HOWTO's residency section,
fresh_pages.rs, indirect_command_buffer.rs and carry.rs, the conformance
crate's Policy::Exact list. API: signatures blessed, api_surface row,
REFUSALS.md regenerated.
Tests: tests::icb_records_policy (Linux, cpu_icd/gpu): the import tax forced
Holds/Fails; under Untaxed+Holds the records lie in pooled memory, no fresh
pages made, a recovery moves them and its notice counts 1 lost; under
Untaxed+Fails and Carried+Holds in the runtime's own pages, kept, 0 lost. The
translator's fast_paths names the choice, checks it keys no profile and that
exact_answers() takes Carried. icb_carry_race's own-pages cases run on a
Carried device (device_recovery::carried_device), so they assert the carry of
own pages whatever the device's verdict.
RUNTIME_VERSION moves: where records lie and what a recovery keeps change on taxed devices.
New public items: metal2vulkan::device::IndirectRecordsPolicy { Untaxed, Carried } and
DevicePolicy::indirect_records.
Verified, msi m3-max-30127 at cba1ec585a (the fix plus a test-only fix: DevicePolicy is
non-exhaustive, so the tests set the field on a copy):
- clippy -D warnings --all-targets --all-features: metal2vulkan + runtime plain 0, runtime
--cfg m2v_cpu_icd 0;
- translator tests 49/49 (fast_paths with the new choice, its no-profile key and exact_answers
tests, api_surface, api_signatures);
- runtime under cpu_icd on llvmpipe 34/34: icb_records_policy, icb_carry_race, icb_records_home,
indirect_command_buffer*, device_recovery_every_kind, device_recovery_carry.
ICB-RECORDS lines:
- Untaxed with the tax forced Holds: records not in own pages, 0 fresh-page buffers, the
carry moved them, notice "1 of them whose records were lost";
- Untaxed with the tax forced Fails: own pages, 2 fresh-page buffers, kept;
- Carried with the tax forced Holds: own pages, 2, kept.
Workload proof owed: reims's traced loaded-desktop walk on the 780M (per-CS get_user_pages 0, no
-EAGAIN windows).
|
||
|
|
ce54ad8b25 |
RUNTIME 2310: an unshared commit on its way goes before another queue's batch whose room came after it
A scheduler pass that found another queue's batch's room let it go while an unshared queue's commit there, taken in, waited only for the runtime: its host step (handed to the steps' thread in the same pass), its submission checks, or a shared event's value whose signal was already submitted and had not landed. Order::next refused the unshared head and sent the other batch; the unshared command buffer then waited for that whole batch on the GPU. In reims's traced walk ld91 (um870 Radeon 780M, guest compositor beside gameload) another queue's batch went in while a compositor's command buffer so waited ahead of 33 of the 46 frames answered more than a refresh late: 20 at its host step (e.g. take 1794684425.009: gameload #19392 committed -3.0, submitted +2.6, inside WS #19398's commit +2.3 -> submit +2.8), 13 waiting for the landing of its other unshared queue's signal. The rule (unshared_hold.rs, "Commits on their way"): each unshared commit carries its place among those posted on its VkQueue (SlotShare::posted_unshared now answers it). Each look collects the unshared heads on their way (on_its_way: binary semaphores ready, every event value reached or reached by a submitted signal, held only for its host step with no pipeline making pending, or for its checks) that wait behind no earlier commit (is_behind), and a batch whose room came is held (behind_commits) while one posted before its noted count leads its line so. The step's end, the checks or the landing wake the scheduler's thread, whose next pass sends the unshared one first. Each look asks again: a head waiting for anything else (a value nothing submitted reaches, a binary semaphore, a making, a decode, a rebind) or behind an earlier commit (the held batch's own included) holds nothing, so neither waits for the other. Other threads' passes leave such batches to the scheduler's thread (first_for_the_thread widened to heads on their way), which they wake. Counted in the existing WorkCounts::heads_held_for_unshared_commits (doc widened). No switch, no public item, no Degradation kind. Docs: unshared_hold.rs, FAST-PATHS unshared-isolation row, API.md. Tests: unshared_hold unit test of behind_commits with places on their way; queue_share_device (lavapipe), each leg by the scheduler's pass and a committing thread's: an_unshared_head_at_its_host_step_goes_before_work_whose_room_came_after_its_commit, an_unshared_head_waiting_for_a_signal_to_land_goes_before_work_whose_room_came_after, an_unshared_head_behind_an_earlier_commit_of_the_held_queue_holds_nothing, an_unshared_head_waiting_for_a_value_nothing_submitted_reaches_holds_nothing. RUNTIME_VERSION moves: what a run submits, and in what order, changes. Verified (msi lavapipe): - m3-max-30046 at 71c8bf7337 (the rule plus a test-only fix), runtime crate, --all-features --all-targets -D warnings: - clippy plain and --cfg m2v_cpu_icd: 0; - 103/103 tests: unshared_hold, queue_share, queue_share_device, scheduler, scheduler_held_wakes, scheduler_wakes, inbox, waiter_submits, commit_and_submit, hold_sites, dispatch_pending, queue_limits_device, stall. - New tests, each run once through the scheduler's pass and once through a committing thread's: - at its host step: the other buffer began 0.168 / 0.199 ms after the unshared one; - waiting for a signal to land: 0.183 / 0.206 ms after; - behind an earlier commit: holds nothing; - waiting for an unreached value: holds nothing. The RV2303 tests still pass. - Negative controls: - m3-max-30021, rule off: both "goes before" tests fail (the other buffer began 1.519 ms before the unshared one); - m3-max-30036, the two no-hold exclusions removed: both no-hold tests time out at 20 s. - Test-only fix in this change: RV2303's committing-thread test held its scheduler thread with an application batch that now correctly waits behind the stepping unshared dispatch. Its holder is now a command buffer on another unshared queue, which nothing holds back. |
||
|
|
41bac06524 |
RUNTIME 2308: no explicit DRM_FORMAT_MOD_LINEAR plane at a row pitch NVIDIA's shaders misread
On NVIDIA's proprietary driver, a DRM_FORMAT_MOD_LINEAR image with an explicit plane at a row
pitch that is no multiple of 32 bytes is made, and vkGetImageSubresourceLayout reports that pitch
back, but its shaders read the rows at another pitch. Measured case: 64 x 64 BGRA8Unorm at rows
272 bytes apart is read by a kernel at 256 and copied out by a blit at 272. Rows 288, 320, 384 and
1024 apart read right.
Measured on:
- the RTX 5080 Laptop GPU (615.71.09): the sweep over every multiple of 16 bytes to 1024;
- the RTX 3090 (620.70.06).
Both over host pages and over the device's own memory.
Vulkan makes the implementation validate an explicit plane layout and refuse one it cannot use
(VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT), so no documented rule explains the
misread: it is a driver defect. It caused the 5080's wrong texels on development. A texture in
place over host pages, at rows padded 16 bytes past their texels, read other rows through the
pitched route; a read twin at rows 272 apart was one such texture.
The change:
- RuntimeDriverDefect::ExplicitPlanePitchMisread, on every NVIDIA GPU and release until a probe
finds a clean one.
- Device::explicit_plane_pitch refuses such a plane at a row pitch that is no multiple of 32 where
the device has the defect. It does so in both makers of an explicit plane: pitched_image (host
allocations and the device's own memory) and explicit_plane_image (dma-bufs). The texture then
takes its shadow (Refusal::Pitch; the shadowed-texture notice names the pitch), or texel rows
for a slot that only reads.
- The bound is the measurement, not the driver's own linear alignment. The driver's own linear
images lay rows at multiples of 128, and keying on that would shadow 288 and 320, which read
right.
- A cfg(test) switch, DeviceShared::explicit_plane_pitch_misread_forced, stands in for the defect
on a driver that reads such planes right (lavapipe).
- docs: a FAST-PATHS known gap (NVIDIA's pitch, with both measurements); api_signatures.tsv +1.
REFUSALS.md is unchanged.
No new Degradation kind or WorkCounts field. RUNTIME_VERSION moves because in-place routes change
on NVIDIA, and the linear-alignment records are keyed on it.
Tests:
- textures_at_padded_rows_read_their_bytes: 64 x 64 BGRA8Unorm at 256, 272, 288, 320, 384 and
1024, over host pages and the device's own memory, each read by a kernel and by a blit. No
pitched image at 272 where the defect applies.
- The same test under the forced defect: on lavapipe, 272 moves off the pitched image and reads
right, while 288 stays pitched.
- driver_defects lists the new defect.
- The padded-rows sweep tests, and the shadow log test's twin at padded rows.
Verified:
- msi m3-max-29913 at 7a64d31930:
- clippy -D warnings, all targets and features: plain, --cfg m2v_gpu and --cfg m2v_cpu_icd all
exit 0;
- lavapipe read_twin_device, driver_defects, in_place_check and shadow_causes_device: 43/43;
- api_signatures, api_surface and fast_paths: 47/47.
- Negative control (rule disabled): the forced test fails with pitched 1 at 272.
- RTX 5080 at 39d564abc4 (archive md5 dd1f3982, b5080 entry roip2-fixarch-5080-112137):
read_twin_device 20/20. That includes the shadow log test that failed before: its twin at 272
now takes the twin's shadow.
- The RTX 3090 run of the same archive (m3-max-29951) is queued; its result follows in the lane.
|
||
|
|
8dd9d3af55 |
Refusals name what they saw: an unknown ABI key's string or shape, a stage-size refusal's weight and bound
- Every Abi(UnknownKey) that named no key now carries what the reader found: the unknown string (an argument's role or attribute, a visible function's key, a node's tag, a compile option, a signature kind, a module flag), cut at 64 bytes, or, where there is no string, the operand's shape in LLVM spelling. The detail is a crate-private field of InputError (`saw`), printed by Display and Debug; it lives there and not in Location because a Location field grew the translator's Error past clippy's result_large_err. No public item or refusal kind changes; REFUSALS.md regenerated unchanged. - The ANV stage-size refusal (Feature::StageSize, DriverDefect) names the module's entry weight and the bound it passed in its symbol, which Display prints: "entry weight N, past the bound B". The bounds and the refusal are unchanged; the FAST-PATHS known-gap row says so. Why: a consumer's log of a GL-on-Metal kernel refused as UnknownKey at an argument with key None and of two kernels refused for stage size could say neither which key nor how far past the bound; one rerun at the pin carrying this names both. Translation output unchanged: no SEMANTICS or RUNTIME bump. Verified (msi, m3-max-29879 at 2ddbda8ecf): clippy air + translator 0; metal2vulkan-air 567 passed incl. abi::tests::an_unknown_key_names_what_it_read (a synthetic node per site, whole location, seen detail and Display); metal2vulkan a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused (symbol and Display name weight and bound past each defect's bound), error::tests and engine_handles compute tests 10 passed, llvm-as present (no SKIPPED). |
||
|
|
948b5e37fb |
RUNTIME 2306: a texture over a bit-24 buffer that no image lies over reads a shadow of its read twin, not of the copy
A no-copy buffer of Metal's private option bit 24 is a copy of its pages off macOS, beside a read twin over the pages in place. A slot that only reads a texture over such a buffer binds the texture's read twin, but only where the twin's texture lies in place over the twin's bytes. Where it did not (RADV lays no DRM_FORMAT_MOD_LINEAR plane whose rows or first byte are off a multiple of 256: a window server's 48x48 textures at rows of 192 bytes, its 128x128 ones at rows of 512 from 32 bytes in), the twin's texture was made as a shadow and dropped. The slot then bound the program's texture, itself a shadow of the copy for the same reason, so its command buffer used the copy and its commit compared the whole copy with the pages. Workload reason (reims's appwalk17 desktop walks, numbers only): twin textures not in place 780M 362, RTX 3090 304, Iris Xe 1; copies compared 52,537 (2,897 MB), 43,384 (2,138 MB) and 331 (35 MB); the Iris compared in one walk step only, the one that made its one twin not in place. Copies compared plus twin slot reads come to about the same total on all three (56,775, 52,277, 54,233): every such read that missed a twin read the copy. Now the twin's texture is kept as a shadow of the twin's bytes where the program's texture is a shadow too, and the slots that only read the texture bind it under the same proof as before. The program's texture lists it beside its own shadow (shadow::texture_copies, held weakly), so draws, rebound draws, dispatches and resident textures copy it in from the pages in place at its first use in each command buffer, where they copied the texture's own shadow in from the copy (a shadow of a copy of Shared memory never stands). Where the pages carry a log of their writes only the changed rows move. The command buffer names the twin's and the shadow image's keys, never the copy's, so its commit compares nothing. No store reaches the pages: the twin's one GPU access is the copy in's read, the shadow is the runtime's own image no call returns, the slots only read it, and a copy back would write the twin's key, which every encoder refuses. Discrete devices take it too: their copy lies in system memory (MemoryClass::Shared), as the pages do, so the shadow's copy in crossed the bus before and crosses it now; what goes is the CPU's comparison. Cost: an image of the texture's size per such texture while it lives. - WorkCounts::read_twin_texture_shadows (new field). No new Degradation kind. - The shadow log's twin line says whether the twin's shadow serves the read slots. - cfg(test) DeviceShared::linear_pitch_rule_forced: RADV's LINEAR plane rule at Device::unplaced. - Tests (read_twin_device): the two shapes sampled by a draw and the 128x128 one read by a kernel through the twin's shadow (compares 0, a CPU write read next, a fill read back through the copy, pages kept); over logged pages the second command buffer copies nothing in and a told write moves its rows alone. The screen-sized texture lavapipe lays no image of now reads its twin's shadow too. - Docs: read_twin.rs, shadow_log.rs, API.md and the FAST-PATHS row on bit-24 memory; api_signatures.tsv (+1). Verified (msi lavapipe, m3-max-29778 at 69f0a567b1): clippy plain and --cfg m2v_cpu_icd 0; read_twin_device, copied_device, copied:: units, texel_rows_device, dirty_pages_device and waited_reads 73/73; api_signatures and fast_paths 35/35. With RADV's LINEAR rule forced (offset and pitch multiples of 256): 48x48 at pitch 192 and 128x128 at pitch 512 offset 32 sampled by a draw and read by a kernel: twin slot reads +1, compares 0, texels the pages', a CPU write read in the next command buffer; a fill in the same command buffer reads back through the copy with one compare, pages kept; over a dirty log an unchanged twin copies 0 bytes. Negative control (serves cut back to in-place only): the 3 new tests fail, the commit compares the copy. |
||
|
|
933b4e774d |
SEMANTICS 2112 / RUNTIME 2304: a texture no image can lie over is read and written in place through a texel buffer of its rows
A texture over a buffer is Metal's linear layout: texel (x, y) at offset + y * bytesPerRow + x * bpp. Where the device refuses the image route over the buffer's pages (a texture over pages that need more than one dma-buf, a LINEAR plane at a refused pitch or offset) but the buffer is in place, a slot whose function only reads (read, not sample or gather), writes or asks the size of that texture now binds a storage (or uniform) texel buffer view over the buffer's bytes, addressed as rows (the row pitch in texels and the size from a push field), instead of a shadow image copied in and out. The texel buffer view's format converts as the image's would: the device's own conversion, no note. - Translator: a structural fact of the slot (its uses are read/write/size only, proven in lowering), a push field and a variant key, after the YCbCr in-place variant's machinery. - Runtime: the planner takes the rows variant where the image route is refused for a stated reason; the tracker sees the slot's writes as writes of the buffer's bytes (rows only, the bytes between rows untouched); a buffer with a read twin takes no rows (its twin texture stays the shadow of its truth). Sample and gather uses, levels past the first, arrays, 3D and compressed formats stay shadows. - WorkCounts: texel_rows_textures, texel_rows_bound. No new Degradation kind, no precision note. - Docs: API.md variant section, FAST-PATHS known gap narrowed, the shadow log's rows line. Workload reason (consumer's 780M diagnostic, numbers only): of the device-gap shadows in three compute workloads, half the textures are only written by their kernels (1.67 G texels per pass), the other half only sampled; the written half takes this route. Verified (msi, lavapipe): texel_rows and read_twin tests 28/28 at f848389cfc (m3-max-29579): over a copy that lavapipe refuses as an image (pitch 272), no shadow copy, rows bound, texels inverted in the pages, gap bytes kept, a sample in the same and the next command buffer read the rows' writes; RGBA8Unorm 1024 codes read / 1024 floats stored and RGBA16Float 65536 / 65536 bit for bit against the image route. Clippy plain, --cfg m2v_cpu_icd and --cfg m2v_gpu 0; rustdoc 0 (m3-max-29541 at 532be1f473, route code unchanged since). Negative control (the row word swapped for the width word): 6 of 13 tests fail. Release first dispatch of a new state on lavapipe: base 4.12 ms cold / 0.98 warm, rows 2.80 / 1.56 (the rows side also commits over a copied buffer). |
||
|
|
2818c1fcd0 |
RUNTIME 2303: a committing or waiting thread's pass leaves other queues' batches behind an unshared head it cannot send
A thread about to block (Scheduler::submit_before_waiting) or one that just committed with
commit_and_submit (Scheduler::submit_at_commit) takes the inbox in and submits only the batches
that need nothing of the scheduler's thread (submit_plain_ready, plain_ready). take_in counts
the unshared commit taken, so RUNTIME 2300's gate in plain() lets other queues' batches through;
Order::next puts the unshared queue's head first but skips any head `ready` refuses and goes on
to the next. So where that head is ready for the scheduler's own look but not plain for this
pass (a submission or scheduled handler for a waiting thread, a host step already recorded, a
switch of storage forms riding on it), another queue's batch on its VkQueue whose room had come
was submitted ahead of it, where the scheduler's pass sends the unshared one first
("Heads put first").
The rule: such a pass notes the VkQueue of an unshared head it leaves that the scheduler's look
would find ready (first_for_the_thread: nothing of submit_ready's holds, every event value
reached), and leaves the other queues' batches held back there to the scheduler's thread too
(left_behind_unshared), which its caller already wakes for what it left: that thread's next pass
sends the unshared one first and them next. Bound: one wake and one pass of that thread. An
unshared head not ready for that thread either holds nothing, as its own pass lets the batch go
then. submit_ready's five holds move into holds_back(), shared by both, with the same order and
the same counts; CommandBufferShared::held_back_on() factors what held_for_unshared and
unshared_commits both tested. No switch, no counter, no public item, no Degradation kind.
Not covered, a known limit now written in unshared_hold.rs ("Deferred commits"): a commit left
to the lowering thread under RenderLoweringPolicy::Worker; counting it posted at the call would
hold other queues' batches through the lowering backlog, leaving the GPU idle.
Tests (queue_share_device, lavapipe): a waiting thread's pass with the scheduler's thread held in
a submission handler (waiter_submits::Held, now shared) takes in an application's fill and an
unshared fill with a scheduled handler; a committing thread's pass (commit_and_submit, default
Grouped completion: the fill goes alone where the device groups) takes in an application's fill
while the unshared queue's dispatch waits with its host step recorded (the pool's making held,
the steps' thread held at new trace points Step and Stepped while the scheduler's thread is held
in a submission handler). Each asserts that the pass ran and that the unshared one began first.
Docs: unshared_hold.rs ("Passes of other threads", "Deferred commits"), FAST-PATHS unshared
isolation row, submit_plain_ready.
Verified (msi lavapipe, m3-max-29578 at 258953844d): clippy plain and --cfg m2v_cpu_icd 0;
91/91 of unshared_hold, queue_share, queue_share_device, scheduler, scheduler_held_wakes,
scheduler_wakes, inbox, waiter_submits, commit_and_submit, hold_sites, dispatch_pending.
Both new tests: passes 1, batches the pass submitted 0, the other queue's buffer began
0.100/0.108 ms after the unshared one. Negative control m3-max-29586 (rule off): both fail,
the pass submitted 1 and the other buffer began 0.35/0.34 ms before the unshared one.
|
||
|
|
d8666d430f |
RUNTIME 2302: render encoders record into the VkCommandBuffer of the encoders before them
A render encoder took a VkCommandBuffer of its own at every open, so a compute, render and blit step began 2.71 and submitted 4 VkCommandBuffers per step (dispatch_chain renders, lavapipe). A render encoder with a log of its calls now takes part in the encoder fold: - One whose pass records at its end (draws in a secondary) joins the group before it; one whose first instance records inline joins none and may lead a group. - No barrier records inside a pass: a joined render encoder records one barrier from everything of the group's earlier encoders (FoldOrder::everything) at its open, counted in command_barriers. - Color groups, rasterization-rate maps and a depth attachment out of GENERAL take no group; segments, fence updates and Overwrites end the group after the encoder. Logless devices keep one VkCommandBuffer per render encoder. - A folded member's layout moves go before its group's first part (GroupPlaces). - A check splits a group with a render member at its pass's submission (as RUNTIME 2297 does for blits). - A group's order is built as its second encoder joins, not as its first ends. A/B (lavapipe, dispatch_chain, per step, base vs tip): renders 2.71 -> 1.35 VkCommandBuffers begun, 4 -> 2 submitted, GPU 119.5 -> 97.7 us; renders-apart 3.71 -> 1.00, 4 -> about 0, 143.6 -> 94.6 us; passes unchanged in buffers, the encoder's open about 250-480 ns more on the host (the group an inline pass begins), the whole pass within the host's noise. Tests: tests::render_fold (device), tests::held_depth, shadow_runs' rebind expectation (a rebind encodes a group whole). Docs: encoder_fold.rs, API.md, FAST-PATHS known gap and ANV row. Verified (msi, lavapipe): the full runtime suite 2683/2684 at c502efba29, the one failure the race test fixed in ca5042567b; clippy plain and --cfg m2v_cpu_icd, rustdoc, fast_paths 0. Negative control (the explicit order removed, renderfold-negctl): the hazard tests fail on their barrier counts; lavapipe shows no wrong texel because it completes each command as it runs, so the texel proof is a GPU that overlaps work. |
||
|
|
df4cee2e01 |
RUNTIME 2300: Unshared hold: a batch whose room comes during a pass waits for an unshared commit posted before it
A scheduler pass takes the inbox in once, at its start (scheduler/inbox.rs), then submits one batch after another, about 0.3 ms each on the Radeon 780M. An unshared queue's commit posted during the pass waits in the inbox until the pass and its handlers end, and "Heads put first" only orders heads already in the order. Meanwhile each further look of the same pass asks the other queues' held heads again, and one whose room came (the oldest batch's credit grew, or its queue's previous batch went) was submitted ahead of the compositor's commit. reims's traced ld-auto walks (um870 780M, guest compositor beside a load app) show the path: the compositor's command buffer committed at +1.97 ms from the take, the same pass then submitted the app's long command buffer's last batch (+2.16) and its short one (+2.49), and the compositor's went at +2.81; that frame finished behind the short one, a refresh late. Frames where a batch let go after one of the frame's unshared command buffers was committed went in ahead of it: 106 (pin 86), 127, 121, 129 (pins 88, 89) of about 611, carrying 7 of 9, 12 of 17, 23 of 27 and 15 of 19 of the frames answered more than a refresh late. The rule: SlotShare counts each VkQueue's unshared commits posted to the inbox (Scheduler::commit, before the post) and taken into the order (take_in). A held batch notes the posted count at the first look that finds its room (unshared_hold::behind_commits) and is held (HeldFor::UnsharedIsolation, new WorkCounts::heads_held_for_unshared_commits) until the taken count reaches its note. The passer never sleeps while the inbox holds a commit, so the next pass takes the commit in, sends the unshared head first where it is ready, and lets the held batch go in the same pass. Commits posted after the room came never hold it, so a compositor posting during every pass holds it one pass at most. Committing and waiting threads' passes leave such a batch to the scheduler's thread. No new switch; UnsharedIsolationPolicy::Off is untouched; the documented bounds (2 ms and 16 ms budgets, about one batch ahead) still hold. Not covered: the commit call's own work before its post (15 us at the median in the traces), and commits deferred to the render lowering thread (RenderLoweringPolicy::Worker; AtCall is the default). Tests: unshared_hold unit test of the note's bound; queue_share_device an_unshared_commit_posted_during_a_pass_goes_before_work_let_go_after_it (the scheduler paused after each vkQueueSubmit; the unshared command buffer committed during the pass that submits the app's first goes before the app's next; the unshared queue's next commit, posted after that room came, does not hold it). Docs: unshared_hold.rs, FAST-PATHS unshared-isolation row, API.md, WorkCounts; api_signatures.tsv (signatures.py --check passes). Verified (msi lavapipe): m3-max-29410 at the tip: clippy -D warnings (runtime, plain) 0; 74/74 under --cfg m2v_cpu_icd (unshared_hold, queue_share, queue_share_device, scheduler, scheduler_held_wakes, scheduler_wakes, inbox). Negative controls: the hold off (29412) fails with the slip reproduced (next 501.3 ms before drawn 752.6, 0 holds); a hold with no note (29413) fails starved (next 1007.1 behind later 756.4). The workload proof is a traced compositor-beside-load walk on the 780M after landing. |
||
|
|
618e452a38 |
RUNTIME 2298: a depth StoreAndMultisampleResolve into write-dropping memory completes without its resolve
store_out.rs faulted a pass whose depth attachment stored and resolved (StoreAndMultisampleResolve) into a resolve texture over memory whose GPU writes are dropped (Metal's private bit 24, or pages mapped read-only): PageFault, and a queue's second fault revokes it. Metal does not: on an M3 Max under macOS 27.0.1, a 4x Depth32Float attachment cleared to 0.25 and stored-and-resolved into a 16x16 Depth32Float at the start of a bit-24 heap completed 6 of 12 command buffers and ended 6 as innocent victims, never a page fault and never a revoked queue, its resolve texture's bytes kept; depth MultisampleResolve into the same heap faults every time. Now, as a pass's store actions settle at its end (render.rs end_pass, before the fault check), store_out::drops_depth_resolve takes a depth at StoreAndMultisampleResolve whose resolve target drops writes, beside a stencil that resolves nothing: its store becomes Store and its resolve goes. The pass completes, the depth's samples are stored, and the resolve texture is never written. Every other store-out fault stays: a depth attachment itself in such memory, depth MultisampleResolve, Store and CustomSampleDepthStore into it, colour and stencil StoreAndMultisampleResolve, and a depth whose stencil resolves too (that pairing is unmeasured). Docs: store_out.rs, docs/API.md, docs/FAST-PATHS.md. Tests (store_out_device): a depth stored and resolved into a private-bit heap completes without its resolve (descriptor's and encoder's action; pages and resolve bits unchanged; a later pass reads the depth's 0.25); depth MultisampleResolve into the same heap faults (control); colour StoreAndMultisampleResolve faults. Verified (msi lavapipe, m3-max-29338 at the tip): clippy -D warnings (runtime, all features and targets, --cfg m2v_cpu_icd) 0; store_out_device 9/9. Negative control m3-max-29343 (the settling removed): the new test fails with PageFault, the other 8 pass. |
||
|
|
8c5a1d592a |
RUNTIME 2297: fold groups split at Metal's submissions where a check or a rebind fails one
RUNTIME 2293's blit fold records a blit encoder and the compute encoders around it into one VkCommandBuffer, and those are separate Metal submissions, which a submission check or a rebind's EncodedUseRebound fails one at a time. Pin 90's lavapipe suite failed two tests on it (m3-max-29286 at 2293's parent passes; m3-max-29287 at 2293 fails these two): - submission_checks::a_submission_detached_behind_a_wait_fails_alone: the check failed the blit's submission, whose part holds no VkCommandBuffer, and its fill ran inside the compute encoder's; - rebind_reach::a_unit_s_encoder_that_laid_its_first_step_fails_encoded_use_rebound: the group could not be encoded again whole (the compute encoder laid its unit's first predication step and keeps no log), so the rebind refused the blit too, which Metal runs over the new pages. Now: - Each encoder notes whether a command of its own recorded into the group's shared tail (EncoderCore::in_tail; a group's first encoder always does). With a submission check set, the commit encodes again apart only those tail encoders, where they span more than one Metal submission and each can be re-encoded exactly (log kept, no segment). Otherwise a check failing one of those submissions fails all of them (State::widened), so the tail runs whole or not at all. Encoders whose commands all lie in their own VkCommandBuffers fail with their own submission alone. - A rebind of a group that cannot be encoded again whole splits it where each encoder that cannot lies in a submission the rebind fails anyway (State::split_rebound); the group's other encoders are encoded again apart and run. The FAST-PATHS known gap and API.md's committed-as-failed section say what still differs from Metal: a shared recording that cannot be split fails every submission whose commands it holds, and a rebind is refused where an encoder that cannot be re-encoded sits in a submission that still runs. No application of ours sets a submission check (reims-vgpu does not). New test: submission_checks::a_check_failing_one_submission_a_shared_recording_holds_fails_each_it_holds. Verified (msi lavapipe, --cfg m2v_cpu_icd): m3-max-29331 at the tip: clippy -D warnings (all features and targets, runtime + validation) 0 under m2v_cpu_icd and plain; 402/402 tests (rebind_reach, submission_checks, failed_commits, predication, rebinds, indirect, encoder_fold, command_buffer, fast_paths and pin 90's four). Negative controls on development's runtime sources (m3-max-29315, 29330): rebind_reach, wcdc and the new test fail. |
||
|
|
23f84517cb |
RUNTIME 2295: kept padding in an exportable block asks the device for its pitched image
A texture over a Private buffer's rows with bytes between them, at a pitch the device's linear image does not lay them at, was a shadow by fiat where the buffer lay in a block of the runtime's buffers allocated exportable as an opaque file descriptor; over a plain block the same texture is a DRM_FORMAT_MOD_LINEAR image at Metal's pitch, in place. texture.rs's alias_unbound now asks the device for that image made for the block's handle type. Where the device makes one, the texture binds in place and its first move is kept by copies (GpuKeep). Where it refuses, the texture is a shadow naming the device's refusal (InPlaceRefusal::Image), its reason text naming the exportable block, so a shadow log can count the case. On RADV it refuses: every image for external memory whose tiling is not linear asks a dedicated allocation, which a block is not. The FAST-PATHS known gap records the cause and the two in-place routes with their measured costs (a dma-buf import per texture; plain blocks' making stalls), for the owner to trade. fd_blocks_cover.rs's docs and FAST-PATHS's in-place and Private rows no longer claim such blocks hold every image a plain block does. Verified: Radeon 780M (RADV PHOENIX), kept_padding, exported_textures, ordered_renders and shadow_causes_device 15/15. Rows 768 bytes apart over an exportable block answer Shadow(Refused(Image)) counted (0,1,0); over a Private heap's buffer the texture is in place with its first move kept; every byte of both buffers reads back. The heap assertion (second commit) was printed on the 780M, asserted on lavapipe. msi: clippy -D warnings (--cfg m2v_cpu_icd and m2v_gpu) 0, lavapipe kept_padding 7/7, rustdoc 0. |
||
|
|
12cd9c6f79 |
RUNTIME 2293: blit encoders fold into the shared VkCommandBuffer as compute encoders do
A command buffer that mixes compute and blit encoders (the image workloads:
Photo Filter, HDR, RAW) began a VkCommandBuffer for every blit encoder, which
also ended the compute encoders' fold: dispatch_chain's blits shape (200
one-dispatch compute encoders each followed by a blit copy) went to the queue
as 799 VkCommandBuffers in one vkQueueSubmit (542 begun) on lavapipe, against 1
for compute encoders alone. On ANV each begin costs 16-20 us of host time.
A blit encoder now joins the group of encoders its command buffer's tail holds
by the rules compute encoders follow (encoder_fold.rs): same batch, the earlier
member one part with no segment, no fence update and nothing failing, no
command predication yet, the encoder trail off, protection options 0; a
compute encoder joins where the group's compute encoders are of its dispatch
type (Joining::{Compute, Blit}). Blit commands take the per-command FoldOrder
barrier through track(). What differs for blits:
- Blit encoders now always log their calls (replay.rs), as compute encoders
do, so a failure that splits a mixed group encodes its running members
again apart.
- A blit encoder ends a unit of command predication, so a group can hold two
units' compute encoders: an unbalanced record whose left-out work begins
past the group's first encoder (State::left_out_from, set by
leave_out_ended) now splits the group at the commit as a partial failure
does, the shared VkCommandBuffer never submitted. split_failure and the
rebind's encoded_together take one check, State::encodes_again_apart: no
predication, a non-compute encoder, or Predication::alone. A rebind in a
command buffer that used predication now encodes a group again where each
member is alone, where before it refused (EncodedUseRebound).
- An encoder whose part writes an ASTC carrier (its second twin's decode goes
after the part) or notes an Overwrite (judged by its part's summary, which
a group widens) ends its group. A folded blit's Overwrite goes to the
group's first part only where every earlier member is a blit encoder that
named nothing of the texture (Fold::overwrites_join), which is what
first_overwrites decided before folding.
- Spares tests that need one VkCommandBuffer per blit encoder update a fence
in each.
Tests (tests::encoder_fold): a compute/blit/compute chain is one
VkCommandBuffer with every copy and read right; an event signal, a dispatch
type change across a blit, predication, a whole-texture overwrite and an ASTC
carrier write each end a group; failures inside a mixed group run exactly
the encoders they leave; an unbalanced End past a group's first encoder
splits it; a rebind encodes a group again in a predicated command buffer.
Also: dispatch_chain gains the `blits` shape (a blit copy after each one-dispatch compute encoder)
and the `copies` shape (a command buffer of blit encoders only).
Verified (blitfold, msi lavapipe): m3-max-29164 at 5845456c61: clippy (runtime, cfg m2v_cpu_icd,
all targets/features, -D warnings) 0; 185/185 including the encoder_fold tests and
a_rebind_encodes_a_group_again_in_a_command_buffer_of_command_predication (the narrowed refusal:
words right, reencodes_refused 0; REFUSALS.md regenerated, unchanged). A/B m3-max-29165 (own target
dirs, md5 c2157758 base 45fdc3e601 / a2214763 tip, ABAB): VkCommandBuffers begun/submitted per Metal
CB, 200 dispatches: blits 542/799 -> 1/1, copies 271/399 -> 1/1, encoders 1/1 -> 1/1; lavapipe GPU
us a dispatch blits 54.98 -> 37.35, copies 9.25 -> 2.36, encoders unchanged; host thread CPU blits
~-1.1 us a dispatch, copies even (logging ~+300 ns a blit encoder paid back by no new
VkCommandBuffer and a shorter commit). No WorkCounts field or Degradation kind. Negative control,
lint in the other configurations and the suites run after landing.
|
||
|
|
fd53ee25b9 |
RUNTIME 2288: kept padding in a block of the runtime's exportable buffers is held in place, its first move kept by copies
A texture over rows whose bytes between them only the device's ordered commands write (Between::Kept) was a shadow when its buffer lay in a block of the runtime's buffers allocated exportable as an opaque file descriptor and never exported (Holds::FdBuffers, BoundMemory::Blocks). alias_unbound refused kept rows in any memory allocated exportable, because an image there names the handle type and starts UNDEFINED. Now such a texture takes the device's linear image made for the block's handle type, and its first move keeps the bytes it is bound to by copies around the transition (GpuKeep), as the DRM_FORMAT_MOD_LINEAR image over such rows in a plain block already did. - The keep now follows the image's initial layout (UNDEFINED), not the pitched route alone. - Kept rows in memory the runtime exported stay refused. - blocks_linear_image takes kept rows whatever the FdBlocks verdicts, as pooled_pitched_image does. Why: pin 88's regression. reims-vgpu's test made a texture over a plain Private buffer after one over a padding-unobserved buffer. At pin 86 the plain buffer took the parked buffer of the unobserved one, which lay in a plain block, so the texture kept its padding in place. Since RUNTIME 2279 the unobserved buffer parks in a Holds::FdDmaBufs block, which a plain buffer never takes. So the plain buffer got a fresh exportable block, and the texture became a shadow. A fresh plain Private buffer on the 780M was already a shadow there before 2279. This removes the dependence on that recycle. Docs: alias_unbound, blocks_linear_image, alias_image, linear_plan's Between::Kept and holding, first_move's GpuKeep, fd_blocks_cover's module docs, API.md's kept-padding paragraph, the Tests (kept_padding.rs, ecd3e3dfd5): the consumer's order (a texture over a plain Private buffer made after one over an unobserved one is kept) and the first use of each kind over Blocks. Verified (expbuf; debug archives built on msi from per-sha source and target dirs): - um870 780M RADV 1002:1900, A at ecd3e3dfd5 (tests only) m3-max-28998 (md5 9985c2be): 2 run, 2 FAILED (plain buffer in Blocks (0,1,0) vs expected (0,0,1); blit over Blocks a shadow). - Fix at 3446d50cd7 m3-max-28999 (md5 574d7b59): 14/14 pass over kept_padding, ordered_renders, exported_textures, shadow_causes_device; blit, clear and load over Blocks in place (kept 1, shadowed 0), the bytes between rows unchanged; ordered_renders runs its in-place branch (1 kept padding alias, 0 shadows); validation layer present, nothing reported. - lavapipe m3-max-28971 at the fix: 7/7. No Degradation kind added. |
||
|
|
27ed85dfc2 |
SEMANTICS 2109 / RUNTIME 2287: an 8-byte leaf at a proven 8-aligned offset moves as one uvec2
A buffer slot's 8-byte leaf (half4, float2, long, a chunked uchar8) whose AIR alignment is at least
8 and whose offset is proven a multiple of 8 (MemoryPlan::proven_align) is now one element of a
StorageBuffer { uvec2[] } view at the slot's binding, as a 16-byte leaf at a proven 16-aligned
offset already is one uvec4. Elsewhere it stays two words.
Why: under robustBufferAccess2 RADV's load/store vectorizer does not merge two word loads it cannot
prove 8-aligned, so a half4 read was two buffer_load_b32 where a native kernel reading f16vec4[]
has one buffer_load_b64 (780M Geekbench kernels run ~1.4x native's GPU time per job).
- Path::Vec2 beside Path::Vec4, Units::vec2, UnitViews::vec2; WordMem's vector read/write take the
lane count; views::declare_vec declares either width. Uniform views get no uvec2 view (std140
stride 16); device addresses and the threadgroup arena keep no vector unit.
- Exact under rule 1: the same bytes move. Descriptor bases are 16-aligned and a bound range is a
whole number of 16-byte units, so the word view's containment check is the unit's.
- The dynamic-views self-check module declares a uvec2 variable too (RUNTIME bump).
- docs/FAST-PATHS.md, multi-variable dynamic binding row: "narrow, uvec2 or uvec4 unit view".
No switch, Degradation kind, refusal or public type change.
Verified (codegen): ISA compile-only gfx1103 RADV 26.2.6 (amdgpu noop drm-shim) on our own half4
column convolution: the loop's read and store are buffer_load_b64 / buffer_store_b64 as the native
twin's; VMEM 5 -> 2 (native 2), instructions 88 -> 83 (native 56). msi m3-max-28997 at ae8ac29436:
clippy -D warnings all targets/features (translator, runtime) 0; touched tests 292/292
(engine_access incl. eight_byte_leaves_move_as_one_uvec2: views, OpStore counts, exact bytes on the
CPU interpreter at every residual, both encodings, every tested profile); metal2vulkan suite 3578
passed, 1 expected failure golden_hashes_match_the_table (re-blessed on development next).
|
||
|
|
c3a2623c6f |
RUNTIME 2280: a pass's store-out into bit-24 memory faults its command buffer off macOS
Measured on the M3 Max under macOS 27.0.1 (plain Metal, probes/readonly_encode_answers.m, jobs m3-max-28796/28797, 2 runs a shape, against writable controls, every pair agreeing), memory made with Metal's private option bit 24: - a pass storing an attachment there (Store / StoreAndMultisampleResolve), resolving into it (descriptor or a late store action) or storing a CustomSampleDepthStore depth there fails its command buffer with PageFault (~14-15 ms), its event signal fires, the pages stay unchanged; - a kernel texture write and a blit copy into a texture over it complete with the write dropped; - replaceRegion of a texture over it writes the pages (they stay CPU-writable); - command buffers after the fault (same queue, a new queue, 100 ms on) complete. Off macOS the runtime completed the store-outs. Now store_out.rs, at the pass's end once store actions settle: an attachment stored or a resolve target actually resolved into over memory whose GPU writes are dropped (Buffer::drops_writes of the texture's buffer or heap bytes) calls EncoderCore::fault(PageFault): the pass and every encoder after it run nothing, every event signal fires, the fault counts toward the queue's revocation as other faults do. DontCare, an unresolved resolve texture and writable memory complete. A cfg(test) switch store_out_unfaulted serves the negative control. Docs corrected in place from the measurement: read_only_view.rs, PRIVATE_BIT (values.rs), capabilities.rs, the host_page_writes cases' notes, the FAST-PATHS known-gap row, API.md, HOWTO.md. No refusal, public type, Degradation kind or WorkCounts field changes. Verified (rocontract, msi lavapipe m3-max-28813): clippy (runtime, cfg m2v_cpu_icd) 0; store_out_device 6/6 (colour Store with the buffer twinned and untwinned, resolve-into descriptor and late, depth CustomSampleDepthStore descriptor and late, Store in a bit-24 no-copy heap all fault; the completing shapes complete; the next command buffer completes and reads the pages); negative control (fault off): the Store completes. The suites run after landing. |
||
|
|
b38a5219e5 |
RUNTIME 2279: padding-unobserved buffers lie in blocks of their own, exportable as dma-bufs, no image bound there
On RADV a block of plain device memory is a buffer object of the process's reservation, and its making holds every submission of the process while the kernel fills its pages (FAST-PATHS: up to 228 ms under compaction). Buffers whose padding is unobserved (the DRM_FORMAT_MODIFIER_LINEAR textures over them import the buffer's memory as a dma-buf) now lie in a pool of their own (Holds::FdDmaBufs) of blocks exportable as dma-bufs, which are not of that reservation. No image binds there (a texture over such a buffer imports it: exported_dma_buf_alias); images and other buffers keep their blocks. The FdBlocks blocks of the in-place check are OPAQUE_FD-only, as before. A two-plane YCbCr texture over such a buffer reads its planes through the texel buffer (ycbcr_planes_images_kept_exportable_block). The pool keeps room only once it holds a block. Trade (FAST-PATHS Private row, hold row and a per-import known gap, with the numbers): each live dma-buf import is listed in every submission: ~0.49 us per import or block per submission. Verified (expbuf, um870 Hawk Point 780M, RADV, one run each, untraced): - contract m3-max-28666 (same diff pre-rebase): 29/29 under the validation layer, 0 reports of 09860/02726/02728; 0 textures lost placing for both kinds; textures over such buffers took the dedicated dma-buf import with 0 shadows, refusals or notices and read back right. - cost, held phases, base m3-max-28790 (own target dir, md5 dd89a7d7) vs arm 28667: 160 textures vkQueueSubmit 0.098 -> 0.186 ms, turnaround median 0.261 -> 0.363; 320: 0.097 -> 0.275 ms, median 0.266 -> 0.420, p99 0.405 -> 0.579; 0 turnarounds >= 8 ms either side. - stalls while the 160 buffers were made: base 19 and 10 turnarounds >= 8 ms (slowest 9.97 ms), arm 0 and 0 (slowest 1.04 ms); traced A/B 28407 vs 28435: 18 vs 0, 118.2 ms vs 0 waited on the reservation. The userptr notifier residual (up to 24.4 ms) is independent and stays. - lint at ee310a3087 (code identical to the tip): clippy x3 0, rustdoc 0, private rustdoc 0. Also: the reclaim bench's scroll arms (padding-unobserved buffers, with textures, held phases). |
||
|
|
89a50bb41b |
RUNTIME 2276: read twins serve draw and dispatch slots that only read a bit-24 buffer or a texture over one
Steps 1b and 2 of the in-place read-only (bit-24) no-copy buffers on Linux: a slot that only reads such a buffer, or a texture over one, reads the pages in place through read twins instead of the buffer's copy. - Texture slot: takes the texture's twin (a runtime texture over the buffer's twin, made with the program's texture where it lies in place) when every use the plan lists reads, as a sampled or storage image; every descriptor of the slot is that image; the slot is not snapshot, narrowed or attached; and the twin needs no usage shadow. - Buffer slot: takes the buffer's twin when the command reaches no memory through a root table, every use reads (storage or uniform), no descriptor of the slot is a vertex buffer, and the twin starts at the buffer's base. - After a command in the same command buffer may have written the buffer, both read the copy. - The write guard also covers note_reaching, note_draw and note_moved. - Fixed on the way: the texture slot proof refused every command binding a second texture (another slot's image descriptor answered "not this slot's image" instead of "not this slot"). - WorkCounts: read_twin_textures_made, read_twin_textures_not_in_place, read_twin_slot_reads. cfg(test)-only switches read_twin_unguarded / read_twin_unproven; the guard is unconditional otherwise. No new Degradation kind. - docs: FAST-PATHS row and API.md copied host pages, in place; api_signatures.tsv (+3). Verified (roip): lavapipe m3-max-28746 at c2e1c21d55: read_twin_device, copied_device, host_ram_copy_device 66/66 (kernel 64x64 texture and buffer-slot reads through twins, draw sampling, texture and buffer negative controls fail as they should, 3648x2038 screen not in place on lavapipe and read as before). RTX 5080 at b05d4de30e (same product code): 65/66, the one failure a wrong test check since removed; screen texture twin in place, draw and kernel reads of 3648x2038 compare equal. The 5080 run at the tip, clippy and the suites run after landing. |
||
|
|
3b2443c8fe |
RUNTIME 2275: the unshared hold's budget is 2 ms only while the unshared queue committed within 50 ms, else 16 ms
The unshared-isolation hold kept other queues' batches to about 2 ms of expected work ahead of an unshared (compositor) queue on the same VkQueue at all times. On the 780M that stretched Super Resolution's command buffers (reims gbo-780m A/B with isolation Off: SR 27.78 -> 24.78 s; 5772 holds). Now the 2 ms budget applies only while an unshared queue on that VkQueue committed within the last 50 ms; otherwise the budget is 16 ms (the intolerable-wait line), so a quiet compositor's first frame waits at most about 16 ms plus one batch. - SlotShare::unshared_committed: one relaxed atomic store per VkQueue at the commit call. - Flight::ahead takes the budget; Flight::room returns Room::Idle where only the 16 ms budget let a batch go; batches enter the flight either way, so the 2 ms bound is exact from the compositor's next commit. - WorkCounts::heads_let_go_unshared_idle (new). No new Degradation kind, no refusal change. - docs: FAST-PATHS unshared-isolation row (both budgets, reasons, trade, a replay over reims's hold-off trace: SR at 2 ms would hold 3,168 of 6,855 CBs, at 16 ms 0), API.md, the UnsharedIsolationPolicy::Bounded and new_command_queue_unshared docs. - queue_share_device: the held-work runs settle their queue's expected run before measuring. Verified (isohold): lavapipe m3-max-28760 at 337f244d25: unshared_hold, queue_share_device, scheduler_held_wakes 28/28; quiet compositor: second long CB let go 13.5 ms before the first ended, the compositor's CB ran between the second and third; active compositor: ran before the second long CB (Off: after the third). Negative control (window check removed) m3-max-28762: CONTROL_EXIT=100 (device test + 2 unit tests fail). The SR A/B on a 780M is owed. Clippy and the suites run after landing. |
||
|
|
2fe01c7ac0 |
FAST-PATHS: ANV's buffers and every device's textures past one dma-buf stay copies or shadows
What: two known-gap entries in docs/FAST-PATHS.md and the spec's reasons in the doc comments of `Device::sparse_granule` and `Device::imports_dma_buf_buffers` (dma_buf.rs). No behaviour change. Why: a consumer's guest buffers over scattered 4 KiB pages need more udmabufs than one (more runs than udmabuf's list_limit, 1024). The runtime already binds such a buffer as one SPARSE_BINDING VkBuffer over several dma-bufs where the driver reports the import (RADV: dma_buf_sparse_buffers in the consumer's 780M runs). ANV does not: it has sparseBinding and a sparse-binding queue family, but vkGetPhysicalDeviceExternalBufferProperties answers externalMemoryFeatures 0 for a SPARSE_BINDING buffer (dma-buf, host allocation and opaque fd, with device-address usage or without) and 0x6 for a plain buffer's dma-bufs, so by VUID-VkImportMemoryFdInfoKHR-handleType-09862 and VUID-VkSparseMemoryBind-memory-02731 no buffer over several imports is documented there: such a buffer stays a copy where its pointer is refused. A texture over such pages stays a shadow on every device: an image made with SPARSE_BINDING alone has no application-visible mapping between texel location and memory offset (spec, Sparse Buffers and Fully-Resident Images; Sparse Resource Features), and a linear image takes no sparse residency (VUID-VkImageCreateInfo-tiling-04121). Verified: probe job m3-max-28707 on the Iris Xe of RPL-P (Mesa 26.2.6-arch3.1, Linux 7.3.1): sparseBinding=1, sparseResidencyBuffer=1, queue family 0 flags 0x1f; external buffer features 0x0 with SPARSE_BINDING for all three handle types, 0x6/0x4/0x6 without. Spec text read from the Vulkan 1.4.366 specification. |
||
|
|
eccc2e2885 |
RUNTIME 2274: read twins: fix the four failures RUNTIME 2269 left on development
Pin 87's checks at
|
||
|
|
7af3c4228a |
RUNTIME 2272: a failure inside a group of folded compute encoders fails only the encoders it names
RUNTIME 2268 failed a whole group of compute encoders recorded into one VkCommandBuffer when a failure (commit_failed's From(n) or Set, a fault, a recording failure) named only some of them. Metal runs every encoder the failure leaves, so a From(n) inside a group dropped the work of the encoders before n: a consumer's protection probe (a compute encoder, then one made under protection options it fails From) read the first encoder's words as never written. Now every compute encoder logs its calls (replay.rs), a closed group keeps its members' logs until the commit, and the commit splits a group its failure fails in part (State::split_failure): the members that run are encoded again from their logs, each into VkCommandBuffers of its own, in the commit's call before the scheduler sees the batches (the rebind's encode-again path, held by the same mark); the shared VkCommandBuffer is never submitted and the failed members run nothing. Groups no failure splits give their logs back at the commit. The split also works in a command buffer that used command predication where its encoders are alone. The one remaining difference (docs/API.md section 10, FAST-PATHS known gaps): a group whose predication unit later laid a loop (encode_start_while / encode_start_do_while) or left a record unbalanced still fails whole. pending_rebind's test reaches its no-log case through an If opened by the encoder before (Unlogged::Predicated), since compute encoders now always log; Unlogged::NoCalls's doc and notice text name what logs nothing now. Cost (dchain, 5080 node CPU, dispatch_chain --host 20 --runs 9 --only encoders --dispatches 2300, no host-page buffer, ABAB, ns a dispatch): thread_cpu 3393/3396 -> 3539/3809; commit 113-126 -> 221-223 (logs held until commit; a follow-up gives them back under one lock and keeps them as spares); bind 49-50 -> 96-97 (the log itself, stays). RUNTIME_VERSION 2272: folded groups split at a partial failure. Verified (dchain): lavapipe full runtime suite at c118ca6fb6 (m3-max-28648) 2581 passed, 1 failed (host_ram_copy_device private-bit, the same at |
||
|
|
0043991660 |
RUNTIME 2269: a bit-24 no-copy buffer's blit copies read its pages in place through a read twin
Off macOS, a no-copy buffer made with Metal's read-only option bit 24 is a copied host buffer (CopiedFor::ReadOnly) whose copy takes every write; every commit that used it compared the whole copy against the pages (reims's 12.7.6 walk: 130,448 MiB compared, 34,462 compare threads, copy-in bytes 0). Now such a buffer also gets a read twin: the runtime's own buffer over the same pages, imported in place, outside the Metal address space (key bit 63), made only under the Contained policy and only where the pages import in place (never a copy). copyFromBuffer:toBuffer and copyFromBuffer:toTexture read through the twin until an earlier command of the same command buffer may have written the buffer (a write of its key, writes_unnamed, or unnoted uses); after that they read the copy, so the command buffer reads its own dropped write back and the next command buffer reads the pages. Every encoder refuses a command whose own uses write a twin key: it records nothing and fails its command buffer. The twin is placed over the bytes before its buffer, so a twin use does not drag in the copy. Counted: read_twins_made, read_twins_unimported, read_twins_uncontained, read_twin_blit_reads, read_twin_reads_after_writes, read_twin_writes_refused, copied_copy_ins_compared, copied_copy_in_bytes_compared. Docs edited in place: the FAST-PATHS row "Off macOS, GPU writes into read-only memory", API.md's copied-host-pages and private-resource-option rows, read_only_view.rs. RUNTIME_VERSION 2269: blit sources of bit-24 buffers read in place. Verified (roip, lavapipe m3-max-28537 at ad4ed6a591, 40/40 read_twin_device|copied_device): a 29,753,344-byte (3648x2038x4) buffer's copyFromBuffer:toTexture + buffer copy compare [0 copies, 0 bytes, 0 threads] (was [1, 29,753,344, 7]), texels and bytes match the pages; fill + copy-out in one CB reads the fill back, pages unchanged, next CB in place; blit fill, blit copy-in and a kernel store through a loaded pointer at gpuAddress leave the pages; a fill of the twin is refused (negative control: with the guard off it changes the pages); no twin when the import is refused, over read-only pages, or under UnsafeOff. Owed after landing: 5080, clippy x3, rustdoc. Next steps: sampled textures over the buffer, buffer slots, resident sets. Squashed from steelbrain/roip 4d4bef55bd..ad4ed6a591 (encoder.rs import conflict with RUNTIME 2268's encoder_fold resolved by keeping both). |
||
|
|
dd286c7304 |
RUNTIME 2268: record consecutive compute encoders of a command buffer into one VkCommandBuffer
A command buffer of N one-dispatch compute encoders went to the queue as 2N - 1 command buffers (each encoder's primary and a kept barrier command buffer before it). A compute encoder now records on in the tail of the compute encoder before it where nothing needs a boundary: same dispatch type and logging, same batch (no event wait or signal, no host step), the earlier encoder one plain part (no segment, no fence update, nothing failing or faulting), no command predication, encoder trail off, protection options 0. The barrier between the two is recorded per command by the tracker's own rule between two encoders of a batch (encoder_fold::FoldOrder), joined with the encoder's own serial barrier into one vkCmdPipelineBarrier. The folded encoder's uses and fence waits join the group's first part's summary, so the batch's plan orders the group as a whole; its own part keeps its fence updates alone. A rebind encodes a group again whole or not at all; a failure that fails one encoder of a group fails the group (docs/API.md section 10, "A command buffer committed as failed"). Counted: WorkCounts::encoders_folded. FAST-PATHS: the ANV command-buffer row notes folded encoders begin none. Also: the dispatch_chain example (gbkern, dchain): a chain of dependent dispatches by how a command buffer holds them (encoders, serial, raw barrier, raw split), with each shape's first command buffer's counts. RUNTIME_VERSION 2268: compute encoders fold into one VkCommandBuffer. Verified (dchain, at d7e4a9ce51, the same diff before its rebase): - lavapipe (m2v_cpu_icd): 40 tests incl. 8 new tests::encoder_fold (dependent chain, independent encoders take no barrier, dispatch-type change, fence update ends a group, commit_failed inside/at a boundary, rebind re-encodes a group whole). - RTX 5080 (m2v_gpu, b5080): 190 touched-family tests; FOLD-CHAIN folded 23, begun 1, barriers 17, 0 wrong words. - 5080 dispatch_chain, encoders shape, GPU us a dispatch: 1000: 8.41 -> 2.92, 2300: 7.43 -> 2.92 (raw barrier 2.92); vkQueueSubmit per command buffer at 2300: 1007 -> 44.6 us; command buffers submitted 2N -> 2. Owed after landing: the negative control (fold barrier removed reads wrong words), clippy x3, rustdoc, the full lavapipe runtime suite at the rebased tip (m3-max-28507), the 780M and XTX before/after. Squashed from steelbrain/dchain f51ba34c37..2f2000cfbc. |
||
|
|
1443135ad8 |
RUNTIME 2264: readers after a barrier of a texture without feedback-loop usage take leading snapshots, weighed by area and learned coverage
On NVIDIA's drivers a linear image takes no feedback-loop or input-attachment usage, so a draw that read such a color at its own pixels after a memory barrier split the pass and copied the texture's scissor box (the whole surface for a guest that sets no scissor) before the new instance: in a consumer's autoscroll on an RTX 2080 about 21 readers a present each copied a 3648x2038 surface, ~29 ms of a 45 ms take-to-show. Such a reader now splits the pass with no copy: its snapshot draws record in an instance of their own ahead of the reader's (LOAD/STORE_NONE, empty masks), a "leading snapshot". The device enables VK_KHR_load_store_op_none, else VK_EXT_load_store_op_none, below Vulkan 1.3 (the runtime's instance is 1.2, so STORE_OP_NONE was core on no device); the version comes from the device's properties. A leading snapshot reads the texture at every pixel its draw covers, so over host pages it is not cheaper than the split at every area: on an RTX 5080 Laptop GPU (split_parts, 8 readers a frame over a 2648x1658 surface over host pages) whole-surface readers took 22.98 ms a frame leading against 17.99 split, quarter-surface readers 6.06 against 8.55; the forms cross near half. weigh_snapshot takes whether the reader leads and skips over_bytes for it, so the area rule weighs its first pass and, where the device measures readers (occlusionQueryPrecise), learned coverage decides from the second: a reader keeps the leading form within the existing bound (SNAPSHOT_PIXEL_COST 20: 20% of a 4-byte color) and splits above it. A rebound kept reader weighs with the same flag. New WorkCounts: reading_draws_snapshotted_leading, reading_draws_leading_covered_within / _to_half / _over_half (where the guest's readers fall against the bound). docs/FAST-PATHS.md's row records the 5080 A/B. Also: the split_parts lane (ignored by default, run by name) measures what split readers cost and reads its fixtures from the crate directory the runner names. From steelbrain/nvscroll (81915c28de..3cdbfe9256, 11 commits). Verified on potluck at 3cdbfe9256: clippy gpu (28377), cpu_icd and plain (28379) 0; rustdoc -D warnings 0; api_signatures and api_surface 15/15; lavapipe 478/478 (copy form unchanged there). 5080 A/B nvscroll-ab-233300 (kind t). The tip's 5080 device test and lane (b5080 batch 28393) are pending; the 2080 and XTX runs wait for um790. |
||
|
|
4fc0ed0e3e |
FAST-PATHS: the unshared hold's cost in a game's frames on the RX 7900 XTX
The consumer's game on the XTX counted 5.5 ms a frame of batch_hold_nanos, all of it the unshared isolation hold, beside a 12 ms gap between its frame and its GPU time. queue_share's pairs mode runs that shape on the runtime alone: the hold keeps the next batch out of the VkQueue while the one ahead runs, and the GPU stays busy under both policies (idle 1.9% against 1.4%, a 0.18 ms against 0.12 ms gap before each frame at the median), so the hold is recorded as costing that, not the frame's gap. Verified: m3-max-28278 on homelab-um790-xtx-1's XTX, the four pairs runs exiting 0. |
||
|
|
b31c23f7c0 |
RUNTIME 2257: render targets placed apart in one Private placement heap keep no shadows
A game's render targets placed apart in one tracked Private placement heap (reims gameload G2
rtheap: MSAA colour, MSAA depth and a shadow map) were held as shadows on the Iris and the AMD
GPUs, with attached reads through copies, clears in part and sample moves every frame (+34.9 ms a
frame over native on the Iris guest at pin 77). Four causes, each with a test that fails before:
- C (d1eaec0f47, 792ea614de): a heap's images shared memory wherever their keys met, so a
texture placed apart was taken as attached to another's pass; images now share memory only where
their bytes meet, and the heap's own shadow images use their whole key's memory.
- B1 (6f54af68e2, e56bb982d7): a multisample heap texture takes the device's own size and
alignment answer and lies in its image (the 780M asks at most 64 KiB).
- D (f760b95001): a whole clear of a 2D multisample attachment copies nothing in.
- B2 (317d905449): a heap texture's device answer takes the device's alignment up to the heap's
own (the XTX's MSAA colour answers 256 KiB: 2375680 @ 256K, depth 1179656 @ 128K, shadow map
393224 @ 128K), the host GPU's real value as the owner's rule for device-describing answers
states.
New owned fixture hpr_reads (our MSL; regen-air-fixtures): fragment functions reading a device
buffer; its golden and the compile census are re-blessed at the next pin.
Verified (steelbrain/rtheap at 23fc75a899): release lane heap_placed_targets (320x192, 7
heap-placed targets, Device policy, mean of 10 frames), placed vs device-made: XTX 1.619 vs 0.576
ms before, shadows MsaaColor/MsaaDepth/Shadow, to 0.530 vs 0.594 ms, every shadow count 0
(m3-max-27670); 780M 2.150 vs 0.579 to 0.548 vs 0.599 ms (27671). Metal policy
(exact_answers): XTX 2.033 to 0.683 ms, 780M 2.650 to 1.079 ms, shadows kept as the switch says.
Texels and kernel reads equal the device-made frame on every leg. lavapipe green (27676); XTX
(27687) and 780M (27688) every heap_placed*, attached_levels, tracker, heap and shadow test
passes, the other failures only under the carried archive's compile-time paths and the
shadow_standing layer test fixed separately (
|
||
|
|
1cf0e1910d |
RUNTIME 2255: cubes and BC rows over an IOSurface plane are made where the x86 Macs make them
reims's oracle_surftex found the Radeon Pro 5300M and the UHD 630 making three IOSurface-plane
shapes that the runtime refused:
- a Cube and a CubeArray over a plane of a surface with planes (cases 119, 188-191). These were
refused as Metal's own Invalid; the M3 Max asserts "carriesComplexTexture || numFaces == 1", the
arm64 envelope.
- BC1 64x64 over a 420v luma plane, whose rows of blocks are wider than the plane's row (case 187).
This was refused as NotImplemented(SurfacePlaneShape); the M3 answers nil.
An x86 guest was answered "made" while the host held no object for it. The x86 envelope is the x86
Macs', and they agree, so the runtime now makes them as those Macs lay them out. Measured with
surface_texture_envelope on both x86 GPUs (m3-max-27621, -27622).
Cubes: face k lies at the plane's offset + k x rows x bytesPerRow, rows bytesPerRow apart. The
planner (linear_plan.rs, faces_at_pitch) lays a colour cube or cube array over a plane, at an offset
and bytesPerRow that are multiples of 16, as a 2D array of its faces at that pitch, for the GPU
and the CPU alike. Faces past the buffer go in the texture's tail, announced as SurfaceTexelsTail,
as a 2D array's texels past it do. The image is cube-compatible, as every cube's is. Every other
cube over such a plane (another format, off 16, several levels, rows wider than the plane's) is
NotImplemented(SurfacePlaneShape) instead of Invalid. Over a surface without planes it stays
BufferTextureProblem::TextureType. The CPUs differ: the 5300M's getBytes and replaceRegion take
every face at the first's bytes, and the 630's take them one image on from the surface's byte 0.
The runtime's CPU calls take the GPUs' layout.
BC rows of 8-byte blocks wider than the plane's row keep to it, as the x86 Macs' blits do: the
blocks in the plane's row lie in place; the blocks past it read zero and their writes are dropped.
There is no tail storage: the shadow zeroes them at its first move, and blits, replace_region and
get_bytes clip to the kept columns. InPlaceRefusal::Rows's doc now also covers rows that hold fewer
of a BC texture's blocks than its row. No Degradation kind and no public item were added. docs/API.md
records two accepted differences: the CPU calls follow the GPUs' layout, and a cube's faces past
the plane's rows lie at the plane's pitch. linear_plan.rs, the RuntimeGap and BufferTextureProblem
docs, FAST-PATHS known gaps and REFUSALS.md (regenerated) are updated.
Verified (planerows, 97de630b9f on
|
||
|
|
7e827c1b5e |
RUNTIME 2251: a two-plane YCbCr texture over IOSurface rows of codes that overlap is made, as Metal makes it
A two-plane YCbCr texture can sit over a plane of a surface with planes whose rows of codes are
wider than the planes' bytesPerRow (a texture wider than its plane, or a 10-bit format over 8-bit
rows). Metal makes it. The runtime refused it at creation: linear_plan's overlap_held answered
NotImplemented(OverlappingSurfaceRows), and the guest got nil. An arm64 guest's oracle run met
one: YCBCR8_420_2P 66x64 over plane 0 of a 64x64 '420v' (luma rows of 64 bytes).
Such a texture's texels are its conversion of the planes' bytes (ycbcr.rs), which reads every code
at the planes' rows, so rows that share bytes need no row rule. The refusal was written for a
plain plane's two-region shadow copies, which a converted texture never uses. overlap_held now
holds a two-plane YCbCr texture over a plane of a surface with planes, whatever its usage.
Still refused, now at use and with the precise gap NotImplemented(OverlappingSurfaceRows) (was
NotImplemented(Format)):
- a blit from a buffer into such a texture: Metal leaves no single row's bytes there (the
earlier row's at every shared byte of the 8-bit shape; 2047, then 1919, of 4032 for the 10-bit
one);
- a 4:4:4 texture's stored writes;
- a render pass whose rows of codes overlap (unmeasured).
Over a surface without planes it stays refused at creation (unmeasured). docs/FAST-PATHS.md's
known gaps, the RuntimeGap doc and REFUSALS.md (regenerated) say so. No Degradation kind, no public
item.
Metal's answer (probes/ycbcr_wide_code_rows.m, m3-max-27270, macOS 27.0.1, two processes a shape),
for the 66x64 8-bit shape and a 64x64 10-bit one:
- read() and the nearest sample of every texel equal the same texture over the same bytes laid
apart, bit for bit (0 of 4224 and 0 of 4096 texels differ);
- getBytes reads the luma rows at the pitch;
- replaceRegion writes them in order, the later row standing.
Verified (planerows, 5fdbf147d5 on
|
||
|
|
63b71d6e2f |
SEMANTICS 2102: the lockstep device pass takes a pointer loaded from thread, threadgroup or payload memory as naming no object
The device pass treated every device pointer loaded from memory as the object named by the canonical spelling of its source address (Root::Loaded). That is the right model for argument buffers, where two loads of one member name one buffer. A pointer loaded from thread, threadgroup or payload memory is different: it is a copy of a pointer that a store put there, and two slots can hold the same buffer's pointer. The pass took two accesses through two such slots never to overlap, and gave them no barrier. A convolution kernel stored through pointers reloaded from separate byval copies. An authored kernel that stores through one slot and reads its neighbour's word through another read a word that another chunk had already overwritten. Such a load now has unknown roots and meets every object, so the pair falls to the address facts like any other pair. Pointers loaded from device or constant memory still name the member's object, as the documented binding-overlap reading has it. docs/FAST-PATHS.md's known gaps record that reading. Verified (ftk2, 3f8dd8821e on |
||
|
|
c7810a5925 |
SEMANTICS 2101: the rate-map probe raises a block's bounds once a subgroup where the geometry stage runs subgroup operations
SEMANTICS 2100 ( |
||
|
|
8c89e236d0 |
SEMANTICS 2100 / RUNTIME 2248: a rate-mapped pass's parted run is drawn only into the regions its blocks reach
A flagged draw's runs (blocks of 64 triangles around the triangles the probe flags) were drawn region by region into every region of the map's plan. With the consumer's rate-map sample on the Iris Xe that was most of the frame: rate_map_piece_gpu_nanos 382 of 441 ms a frame at pin 74 (232 runs into 2074 regions, 83k run triangles). Now the probe ORs each 64-triangle block's bounds, widened as before, into 16 x and 16 y buckets (bind::fan_out::BOUND_BUCKETS, PROBE_BOUNDS_AT, BLOCK_SET, STRADDLE_SET, fn bucket; PROBE_SETS 6 -> 7), and a run is drawn, through the region-copy route as before, only into the regions its blocks reach, as consecutive ranges in table order. A triangle crossing w = 0 is bounded by its part where w > 0: per axis its positive-w vertices' coordinates, plus infinity on each side where an edge crosses w = 0 (the side is the sign of w_a*v_b - v_a*w_b; within 2^-16 or NaN, both sides). A run whose bounds reach every bucket draws into every region, as before. The route, its clip distances and the Equal-depth identity are unchanged. New counters: WorkCounts::rate_map_run_region_draws, rate_map_runs_every_region, rate_map_straddling_triangles. FAST-PATHS row 50 says so with its numbers. Verified (blotch, d141fe9096..b277d4df9e on |
||
|
|
b741f93b9e |
SEMANTICS 2098 / RUNTIME 2244: a rate-mapped pass's region-by-region draws copy each region in the vertex function, scissored, so Equal depth matches the fanned-out route
Under RateMapRegionPolicy::FanOut a draw was drawn two ways: fanned out (a geometry stage's copy of each triangle per region, window position a*x + b*w through one viewport), or region by region (each region through its own Vulkan viewport). The two rounded a vertex's window position differently, so a pass testing depth Equal against depth the other route stored failed along whole surfaces: the consumer's black blotches on lit surfaces in Apple's Modern Rendering sample on the RTX 3090. The depth-Equal repro left 44,666 of 89,483 pixels red on lavapipe whenever the prepass and the Equal pass took different routes; 0 under Exact or on one route. Now on a fanning device the region-by-region draws take a region-copy variant (RegionFanOut::RegionCopies), with no geometry stage. Its vertex function computes region RegionFirst + DrawIndex of the table, stores its position through the region's line and four clip distances by the one emitter the fan-out stage's copies use (pipeline::link::fan_out::region_copy: NoContraction arithmetic, Position and ClipDistance Invariant), and its draw index as ViewportIndex. Each recording sets as many viewports as one multi-draw takes, every one the fan-out's over the render area, with each region's scissor at its index (bind::fan_out::scissors), so off-region triangles are scissored, not clipped. The settle keys the pipeline with the same viewport count (fan_out::copy_viewports). The variant replaces the regions variant, so no pipeline is added per state. A device without multiViewport, shaderOutputViewportIndex and shaderDrawParameters keeps the per-region-viewport route (FAST-PATHS known gap). Exact is untouched. New: bind::fan_out::scissors, WorkCounts::rate_map_region_copy_draws and rate_map_region_copy_recordings, PushField::RegionFirst; cache codec variants (artifact format). Verified (blotch, steelbrain/blotch 1fd68a45c0..16d5c2404f): - lavapipe at 16d5c2404f: rate_mapped_depth_equal + rate_mapped_fan_out 4/4, 0 red in all 10 depth-Equal lines (mixed pairs included), 0 pipelines made at the host step; clippy CPUICD, GPU and plain 0; rustdoc 0. Translator suite at 8ad673ffba 3562/3563, the one failure golden_hashes (re-blessed on development). - 780M and XTX at 8ad673ffba (differs from the tip by the settle fix only): 0 red in all 10 lines. E->E GPU cold/warm: 780M 4.99/4.97 ms against Exact 1.68/1.65; XTX 1.14 ms/650 us against 569/265 us. Creation (shader cache off): 780M 1.32 ms/state (Exact 0.92), XTX 1.30 (Exact 0.68). - Owed: the same numbers at development's tip without this change (the GS fan-out), the clip-distance probe, and the 780M/XTX runs at 16d5c2404f. SEMANTICS_VERSION 2097 -> 2098, ARTIFACT_FORMAT_VERSION 518 -> 519, RUNTIME_VERSION 2243 -> 2244. |
||
|
|
4383b55aed |
SEMANTICS 2096: ANV: a stage heavier than the largest measured to compile in host-sized memory is refused, or keeps the widest pin
ANV's compiler takes memory that grows faster than the stage it compiles, inside the process that
creates the pipeline, well below the 2^20-object bound the serialized stage already keeps under.
Measured on the Iris Xe of RPL-P (Mesa 26.2.6), compute modules created cold through
vkCreateComputePipelines, the resident set sampled every second (job m3-max-26147): entry weights
73,814, 75,886 and 99,109 were created in 45 s, 47 s and 132 s at peaks of 1.76, 2.24 and
3.65 GiB; a module of entry weight 532,213 passed 16 GiB at 358 s without finishing. Job
m3-max-26086: a module of entry weight 796,525, its heap raw-texture arms dead, passed 20 GiB in
under two minutes. Both under the old bound (786,432) would have been handed to the driver: one
pipeline creation that can take a host's memory.
- DriverWorkaround::CompilerMemoryGrowsWithStageSize, keyed on ANV whatever its GPU and release
(device::derive), documented with those points.
- stage_bound: StageBounds holds both bounds (SERIALIZED_STAGE_WEIGHT 786,432;
COMPILED_STAGE_WEIGHT 99,109, the largest measured to compile, no margin below it as nothing
above it is measured to compile). emit keeps a module under every bound its profile's defects
set, with the same widest-pin retry; a refusal (StageSize, DriverDefect) names the serialized
stage's defect past 786,432 and the compiler's memory below it. The bound rises when a larger
compile is measured within host-sized memory.
- The test hooks (compile_bitcode_bounded, compile_stage_bounded) take StageBounds.
Docs: stage_bound's module docs and FAST-PATHS' known-gaps entry state both bounds with the
measured points only (weights, never names), and restate the serialized bound's figures in
entry_weight's units: the faulting stage 1,603,989 (0.683 objects per unit, was 1,565,083 and
0.70 by a count 2.4% lower), the other 21 stages' ratios as counted by that count, which ran 1.9
to 2.7% below entry_weight on the five modules both counted; the shader-object figure likewise
1,603,989. Feature::StageSize's docs and its reach line cover the memory bound; REFUSALS.md
regenerated. api_signatures.tsv blessed with the new variant (the bless also moves
scheduler_slice_rescues to the script's own order).
For a consumer on ANV: a module of entry weight past 99,109 and up to 786,432 that was handed to
the driver is now refused (Unsupported, Feature::StageSize,
Needs::DriverDefect(CompilerMemoryGrowsWithStageSize)) unless its pinned plan fits. Other drivers
are unchanged.
Tests:
- engine_simd_lockstep::a_kernel_past_the_stage_bound_keeps_the_widest_pin_or_is_refused covers
both defects: for each, under a bound the emulated module passes the kernel is planned again
pinned (exact at 32 lanes), under one its pinned module passes too it is refused naming that
defect, and past both the serialized stage's defect is named; RADV emits under every bound.
- engine_simd_lockstep::a_kernel_past_the_stage_bound_gets_one_answer_through_either_path on the
serialized bound through StageBounds.
- device::tests::profile::large_module_defects_are_keyed_on_anv includes the new workaround.
Verified, on msi, read from inside each job:
- m3-max-26184 (this change on
|
||
|
|
77788d5321 |
FAST-PATHS: the ANV shader-object compile of the stage-bound kernel, measured to 20 GiB
The known-gaps entry for the ANV stage bound said the kernel of entry weight 1,565,083, created as a VK_EXT_shader_object compute shader, held more than 8 GiB within ten minutes: that was the cap of the job that measured it, not the compile's end. Measured again with room (job m3-max-25881, the Iris Xe of RPL-P, ANV Mesa 26.2.6, vkCreateShadersEXT alone in a process under a 20 GiB cap, the child's VmHWM sampled every 60 s): 2.0 GiB at 60 s, 2.1 GiB from 120 s to 360 s, 5.3 GiB at 420 s, then past 20 GiB, where the job's cap stopped it at 435 s of wall time (434 s of CPU, one core). It did not finish, so the shader-object route is no way around the bound on this driver, and the refusal stays. Docs only. |
||
|
|
d38b5c4ef6 |
RUNTIME 2231: a managed synchronize copies out only the bytes the GPU wrote
On a device without unified memory, synchronizeResource: copied the whole Managed buffer (or a
texture's whole span over one) to its host copy every time. The runtime now keeps the GPU's
writes for each buffer that has been synchronized once (managed_sync.rs: GpuWrites, SyncCopy,
SyncOut), stamped in the scheduler's submission order across all queues. The copy-out is its own
segment (Deferred::SyncOut), decided when its batch is submitted, so it covers the writes of
earlier batches, of earlier encoders in its batch and of its own encoder, including a write
encoded after the synchronize but committed before it. Completion of the command buffer holding
the copy drops only the writes noted before the copy. It copies nothing when the GPU wrote
nothing since the last copy, and still copies the whole buffer where the writes cannot be known:
an untracked buffer; one whose VkBuffer was handed out or whose memory is exported; a buffer's
first synchronize; any batch since the last copy, not yet complete, that may write memory no use
names (State::writes_unnamed); and a synchronize recorded in place (a predicated loop's laying, or
no VkCommandBuffer could be made). Every barrier is still recorded. Pages no import maps copy back
only the regions copied. Textures over buffers take the same path (an image range counts as the
whole buffer). Touches command_buffer/submit.rs (record_syncs_out after record_scrubs) and
command_buffer/mod.rs (the footprint loop skips SyncOut segments), encoder.rs, tracker.rs,
deferred.rs, device/mod.rs. New WorkCounts: managed_synchronizes_unwritten,
managed_synchronizes_whole, managed_bytes_unwritten_skipped. FAST-PATHS managed bullet, API.md
managed section and the runtime README updated. No speed-for-accuracy choice.
Why: on the RTX 2080 the guest's Background Blur spent 0.90 s of GPU time copying out 3.5 GB
over 800 synchronizes (~176 MB a command buffer, the 2080's x4 link), whole resources each time.
Verified (mansync; step codes read inside the jobs):
- clippy --all-targets --all-features -D warnings, workspace: plain 25924, m2v_cpu_icd 25927,
m2v_gpu 25928, all 0; rustdoc -D warnings 25935 = 0 (at b72228629c).
- RTX 2080 (um790) at ac0887e7f5, 25942: 41/41 (managed_copy_device, detached_contents,
kept_padding, device_memory_overflow; hazard tests excluded). Counts (copied, skipped,
unwritten, whole), both Import and Pages: first synchronize (1048576, 0, 0, 1); after no write
(0, 1048576, 1, 0); after a fill in an earlier command buffer (16382, 1032194, 0, 0). Every
byte checked after each step, including a write committed before the synchronize's command
buffer but encoded after it, and a CPU write named by didModifyRange.
- Negative control (throwaway e1542d94c4, 26010): imports copy whole and pages drop kept writes;
both legs fail.
- Release, 2080, examples/managed_sync_out (40 no-copy Managed buffers of 4,399,104 B, 176 MB
synchronized a command buffer), median GPU ms over 20, base
|