Repository navigation
borealis: order whole-tile load hazards in the fragment half only - #1144
Conversation
A render pass instance that loads an attachment an earlier render stored shares every tile with it (its footprint preserves the loaded contents), and the tile hazard made the whole later render wait: its tiling could not start until the earlier render had finished. GTA V's consecutive full-screen passes on the same targets ran one after another this way. When the kernel runs a render's fragment work after the previous render's, partial renders included, a later instance that only loads whole tiles an earlier render stored needs the fragment half ordered, not the tiling: tiling never writes a tile back. Footprints now record whether they preserve because of their area or layers (a partly covered tile, a sparse view mask) or only because they load, and a conflict between two whole-tile footprints whose earlier producer is a render raises only the fragment half's wait: in the command buffer (pass_tile_wait_frag, stream_wait_frag()), against earlier command buffers of the submission and against possibly running earlier submissions. Partly covered tiles, sparse multiview, compute producers (including clears the empty-render optimizer replaced) and resumed instances keep waiting in both halves. The device flag that enables it, hk_device::load_hazard_frag, is set from the kernel's capability; without it nothing changes. Signed-off-by: DjDeveloperr <hey@djdev.me>
Set hk_device::load_hazard_frag from DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS, which the kernel reports where every fragment pass of a render, partial renders included, starts after the fragment work its fragment half is ordered after (single render pair). Without the bit the tile hazards keep waiting in both halves. The bit's definition follows the kernel's uapi header. Signed-off-by: DjDeveloperr <hey@djdev.me>
aurora-wip was rebuilt from 9ca2b09, so its new tip (41fe336) no longer descends from 58e636c, the tip this branch merged last. The merge was resolved against 58e636c: this branch's changes over it, applied onto the new tip. In hk_begin_rendering() the tip renamed the attachment load-preserve flags (preserve_loaded, now also set for depth and stencil loads); the footprint call keeps this branch's separate layer and load arguments with the new flags. Signed-off-by: DjDeveloperr <hey@djdev.me>
…he device hk_CreateDevice() set hk_device::load_hazard_frag from the kernel's feature word before agx_open_device() had read it, so the flag was always false and whole-tile load hazards kept waiting in both halves even on kernels that report DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS. Read it once the device is open, before the queues copy it. Found on J714s with 7.3.0-m5-nots (feature word 0x3d3e7cfe7c07): GTA V frame anatomy showed loading renders' tiling waits unchanged from the base. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
J700 (MacBook Neo, A18 Pro Both arms are release Borealis Vulkan overlays, cross-built off the Mac with the same options and loaded from private prefixes through On the stock VK CTS on head, gpubench-vk smoke ( Fedora 44 Mesa Asahi CI ( Health: 0 GPU faults, 0 recoveries, 0 driver warnings, 0 AVC denials, |
|
J773g (M4 Mac mini, G16G B0, HAL200, second generation) at Both arms are release Borealis Vulkan overlays loaded from private prefixes through
gpubench-vk ABBA, render rows plus
GPU health: 0 faults, 0 recoveries and |
|
Verdict at Blockers None. Checked
Merge-order note. |
…_load Pass preserve_layers (matching hk_begin_rendering()) and preserve_load=false to hk_sync_pass_footprint() in hk_m5_pass_merge_begin() after #1144 added the preserve_load parameter. Signed-off-by: DjDeveloperr <hey@djdev.me>
What: A render pass instance that loads whole tiles an earlier render stored now waits for that render in its fragment half only, where the kernel orders a render's fragment work, partial renders included, after the previous render's (
DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS, bit 45, aurora-silicon/linux#3268, merged). Its tiling no longer waits for the earlier render to finish, so consecutive passes on the same targets overlap as Metal's do. Partly covered tiles, sparse multiview layers, compute producers (including clears the empty-render optimizer runs on compute) and resumed instances keep waiting in both halves; without the kernel capability nothing changes.Tested: J714s (MacBook Pro 14" M5 Pro, G17S) at b6f5316 against aurora-wip 41fe336, isolated Mesa kits, one-shot boots of 7.3.0-m5-nots (linux main 2094ccb, which carries linux#3268; feature word 0x3d3e7cfe7c07, bit 45 set), the default kernel restored after each. Measured on a main-based kernel with bit 45, whose J714s devicetree disables the SLC; the default 7.3.0-m5-cdirect16 (SLC on) does not advertise bit 45. Both arms ran on the same kernel, so the comparison holds; the absolute FPS are lower than on cdirect16 for that reason.
GTA V Enhanced native benchmark (3024x1964, ResScalingType=0, muted, settings restored), one boot, A B B A:
FPS; both runs of this PR beat both base runs on P4, P3 and P2. 0 GPU faults. BeamNG.drive (West Coast USA, 3024x1964, 5 x 170 s windows) on the same kernel, A B B A: 34.35 / 35.94 / 35.97 / 35.66 FPS. Both runs of this PR are above both base runs; the first run after the test boot runs low, so against the second base run alone it is +0.8 % (flat or better). Settings restored, 0 GPU faults. Frame anatomy: renders that load an attachment and whose tiling half waits on an earlier command than their fragment half, 65.5 / 66.3 % (base) -> 76.4 / 76.3 %.
VK CTS on the same kernel, render passes, draw, conditional rendering, synchronization{,2} single_queue/implicit/basic/none_set_reset/internally_synchronized_objects, api.command_buffers, multiview renderpass2/dynamic_rendering, 136,374 cases: this PR 104,896 pass, 31,478 not supported, 0 other; base identical.
--suite asahion the M5 332/332; mirror CI asahi green.Rows at 932b35f ran with the capability unset (b6f5316 fixes reading it before the device was opened) and are not counted.
J700 (MacBook Neo, G17P, HAL200) at b6f5316 against 41fe336, stock 7.3.0-41 without bit 45, so the fallback path (row: #1144 (comment)): VK CTS on the same list, 136,374 cases: 100,194 pass, 36,180 not supported, 0 fail, 0 recoveries; Fedora CI 215/0; gpubench render.pass_split, deferred, postfx, msaa_merge, render.heavy and sync.signal CRCs equal to base; 0 GPU faults.
J773g (Mac mini M4, G16G, HAL200) at b6f5316 against 41fe336, stock kernel, isolated overlays (M4 mini row lane, row comment on this PR):
--suite asahi(host) 212/0; VK CTS at 1 worker, list 1 (136,374 cases, the fallback path) 99,946 pass / 36,426 not supported / 2 fail, the same on base: each fail a different synchronization{,2}.op.single_queue.*buffer_262144 case per arm, all passing when rerun alone; gpubench render rows and render.pass_split A B B A with CRCs equal to base and every row flat; 0 GPU faults or recoveries.Risk: two-way door · Borealis tile-hazard tracking shared by every generation; behaviour changes only where the kernel reports the capability.
Not yet: none.
Details
Hazard source (
hk_sync.h,hk_sync.c,hk_cmd_draw.c):struct hk_sync_footprintgainspartial, set when the footprint preserves pixels or layers because of its area (a partly covered 32x32 cell) or a sparse view mask. A footprint that preserves only because the instance loads its attachment (preserve_load) covers whole tiles of every layer it names. Two footprints that share a tile share it only through a load when neither is partial (footprints_whole_tiles()): neither pass writes back a tile it does not own whole, and the later one reads what the earlier one stored, which needs the earlier render's fragment work before the later one's, not before its tiling.In the command buffer:
hk_sync_pass_footprints_done()splits the earlier producers into those both halves wait for (pass_tile_wait) and the latest render that only the fragment half waits for (pass_tile_wait_frag, throughstream_wait_frag()). A render replaced by compute is promoted back to a both-halves wait (records_replace_stream()).At submission: conflicts with earlier command buffers of the submission (
submitted) and with possibly still running earlier submissions (recent_conflict(), which now also reports the engines whose conflicts are all such loads) raise the render's whole-render barrier or prior and, unless every conflict on that subqueue is a whole-tile load of an earlier render, its tiling barrier or prior. Exact-prior queues keep naming earlier submissions by ordinal.Capability:
hk_device::load_hazard_frag, set fromDRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS(the definition follows linux#3268's uapi header) and copied intohk_sync_queue::load_hazard_fragat queue creation. The kernel reports it where every fragment pass of a render, partial renders included, starts after the fragment work its fragment half is ordered after (single render pair).Tests:
test-hk-sync-priortest_load_hazard_frag: in the command buffer, across command buffers of a submission and across submissions (exact and legacy priors), with and without the capability; a partly covered tile and a compute clear keep both halves.