Repository navigation
borealis: drop the load of a covered attachment of a direct-resolve pass - #949
Merged
DjDeveloperr merged 1 commit intoNov 24, 2026
Merged
Conversation
hk_g17p_elide_untouched_color() turns the background load of an attachment that the pass's first draw covers (hk_g17p_note_first_draw()) into a clear. It returned early for every pass with a direct colour resolve on the native AGX3 path, because rebuilding its end-of-tile programs would lose the resolve, so the covered load stayed. Zink resolves a GL multisample framebuffer into its blit target inside the pass and keeps the samples, as GL requires (LOAD/STORE plus an AVERAGE resolve), so such a pass reloaded the whole multisample tile it was about to overwrite on every frame. For such a pass, do not return. Leave its end-of-tile programs, its stores and its partial-render reload as they are, never take the untouched-store branch (dropping a store would drop the resolve with it), and only rebuild the main background program with the covered attachments' loads dropped. A partial render area still returns, since a direct resolve's background program then merges the destination around it. The first draw writes every sample with no blend, logic op, discard, sample mask or rejecting depth or stencil test before anything reads the tile, so dropping the load changes nothing the pass stores or resolves. Signed-off-by: Diljit Singh <hey@djdev.me>
satchlj
approved these changes
Nov 24, 2026
satchlj
left a comment
Member
There was a problem hiding this comment.
Verdict at a2167deffc9e
APPROVED
Blockers
None
Checked
- Audited
hk_g17p_elide_untouched_color()andhk_g17p_note_first_draw()insrc/asahi/vulkan/hk_cmd_draw.c. - Verified
direct_resolve = !m5 && render->g17p_direct_color_resolvesafely bails out onincomplete_render_area(preservingpreserve_resolve_outsidebackground loads), skips attachment store elision (!direct_resolve) so end-of-tile resolves are never dropped, only converts covered attachments'bg_atts[i].loadOptoVK_ATTACHMENT_LOAD_OP_CLEARwhile keeping non-covered attachments intact, leavescs->cr.eot.main,cs->cr.eot.partial, andcs->cr.bg.partialuntouched, and checksvk_command_buffer_has_error(&cmd->vk)before mutatingcs->cr.bg.mainandcs->anatomy_covered. - Built and ran the non-layout
asahitest suite (261/261 PASS) plus Borealis Vulkan compute smoke on Apple M5 Max (G17C B1), Linux 7.3 withMESA_SHADER_CACHE_DISABLE=1and0GPU faults indmesg. - Untested scope: Live G17P hardware execution of the
direct_resolvecovered-load elision path (verified via code audit andasahiunit suite; live hardware check ran on Apple M5 Max (G17C B1)), andasahi_layout_tests(pre-existing GCC C++20 designator-order error insrc/asahi/layout/tests/test-layout.cpp:374).
Evidence
meson test --suite asahi(non-layout):261/261 PASS(0 FAIL)- Live Borealis Vulkan CTS on Apple M5 Max (
G17C B1), Linux 7.3 (MESA_SHADER_CACHE_DISABLE=1,0GPU faults indmesg):dEQP-VK.compute.pipeline.basic.*:80/81 PASS,0 FAIL,1 NotSupported
Author
|
a2167de J773g M4 mini (Apple M4, G16G B0) PASS (550 Pass / 91 NotSupported / 0 Fail across Vulkan and GLES3/Zink MSAA resolve & dynamic-rendering CTS; 6/6 gpubench compress.bw msaa4 ok; 184/184 asahi unit tests; 0 GPU faults/recoveries/dmesg). Exact-head G16G verification details
|
Author
|
Merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Drop the tile load of a colour attachment that the pass's first draw covers, also when the pass resolves that attachment directly in its end-of-tile program. Zink keeps GL multisample framebuffers LOAD/STORE with an AVERAGE resolve inside the pass, so those passes reloaded the whole multisample tile every frame only to overwrite it.
Tested: M4 mini (J773g, G16G B0) with this change on an earlier integration tree, not yet at this head: gpubench gl-zink
compress.bw kind=msaa4 res=1440p d=1+2.65%, and 189/189 GLES3 FBO, multisample and invalidate CTS cases pass. At this head: the asahi meson suite (184 ok, 0 fail) and fork CI (see Evidence). A drm-shim probe at this head drops the covered load on the G16G and G17P profiles and leaves blended and partial-area passes unchanged.Risk: two-way · M3, M4, Neo
Not yet: hardware run at this head on an M4 mini (G16G) and a Neo (G17P); M3 (G15) not run.
Details
hk_g17p_elide_untouched_color()already turns the background load of an attachment that the first draw covers into a clear (hk_g17p_note_first_draw(): a full-screen triangle with no blend, logic op, discard, sample mask, partial write mask or rejecting depth/stencil test, under a viewport and scissor that cover the render area). It returned early for every native AGX3 pass with a direct colour resolve, because its rebuild of the end-of-tile programs would lose the resolve.For a direct-resolve pass this change:
The first draw overwrites every sample before anything reads the tile, so the clear changes nothing the pass stores or resolves. M5 passes keep the existing path (
direct_resolveis only set off M5), and passes without a direct resolve are unchanged.Evidence
a2167deffc9eon aurora-wipd40ba9f9ea2(includes borealis: fix aurora-wip build breaks after #693 and #703 merges #944).asahirun 45415517685 (build-test: success),aurora-agent-policyrun 45415517745 (success).-Db_ndebug=false,meson test --suite asahi): 184 ok, 0 fail.agent-policy.sh pr HEADagainst a local aurora-wip base: clean.ASAHI_SHIM_CHIP=g16gandg17p; 512x512 RGBA8 4x LOAD/STORE with an AVERAGE resolve to 1x, full-screen triangle,ASAHI_MESA_DEBUG=perf):compress.bw kind=msaa4 res=1440p d=1+2.65%; GLES3 FBO / multisample / invalidate CTS 189/189 pass, 0 fail.