Repository navigation
borealis: share runtime attachment elision, stencil export, PBE fill, and WSI bounds across native AGX3 - #931
Conversation
… and WSI bounds across native AGX3 Remove G17P-only and G17P/M5-only gates on shared Borealis runtime paths so G15 (M3), G16 (M4), and AGX2 (M1/M2) share the same correctness fixes and fast paths: - preserve_loaded_color (hk_cmd_draw.c): preserve loaded attachment producers against compute-lowered clears across all generations. - use_stencil_export (hk_cmd_meta.c): enable single-pass MSAA depth/stencil resolve uniformly across all generations (adding G15 and G16 to AGX2, G17P, M5, and G18G). - hk_g17p_elide_untouched_color, hk_g17p_note_first_draw, and vs_covers: share untouched-color and full-screen-triangle load-op elision across all native AGX3 and M5 chips. - hk_g17p_fill_buffer_pbe_supported: share large (>=64 MiB) linear PBE buffer fills across all native AGX3 and M5 chips. - hk_queue_admits_at_entry and hk_wsi_allocate_memory: share entry-time queue admission and native UMA WSI allocation bounds across all native AGX3 chips. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Exact-head
0 Fail, 0 GPU faults, 0 AVCs, SELinux Enforcing, 0 failed units. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Source review of exact head 3ee8572242b7. No code defect. One changed path has no working row on the chips it newly reaches.
Checked.
use_stencil_export = trueon G15/G16 uses the same fragment stencil export thatEXT_shader_stencil_exportalready advertises there. The old exclusion was a qualification limit, not a missing capability.hk_queue_admits_at_entry()moves kernel-queue admission on G15/G16 to the API entrypoint, before semaphore payloads move. That is the stronger ordering.rq_capablestays false on those chips, so the render-RQ scan is unchanged.preserve_loaded_coloris pure footprint tracking.- The
hk_g17p_elide_untouched_color()path for non-M5 chips still refuses spilling tilebuffers and direct resolves. G15/G16 have the smaller tilebuffer, so that refusal is the check that matters there.
- MSAA depth/stencil resolve on G15/G16 is not covered. The visible effect of
use_stencil_exporton G15/G16 is that stencil blits and the MSAA depth+stencil resolve go single-pass. That is where a wrong stencil would show up. On J713 theb3_runtimegroup ran only 2 cases, becausedepth_stencil_resolve.samples_4hits the pre-existing fleet85 EINVAL, and the J615 G15 row is still queued. Please rundEQP-VK.renderpass2.depth_stencil_resolve.*anddEQP-VK.api.copy_and_blit.*stencil*(includingresolve_image.*with D32S8/D16S8 if present) on a G16G kernel without that EINVAL, plus the J615 row, before merge. The EINVAL row shows the old and new code fail the same way; it does not exercise the new single-pass resolve. - Stale comments.
hk_queue.c(~1314) still says "M5 and G17P admit GPU work at the API entrypoint ... Other devices retain admission in the serialized driver callback".hk_cmd_meta.cstill says "Other native chips lower a stencil blit to eight bit-selective discard passes". Both now describe the old behaviour. - WSI selector.
hk_wsi_allocate_memory()moves fromG17Ptoagx_chip_native_agx3(). That still leaves M5 and AGX2 out of the cgroup-bounded WSI path, even though the logic is CPU-side and the problem it bounds (creation peak against the process limit) is the same on UMA parts. If the scope is deliberate, say why in the comment. Otherwise key it on what matters: not virtio, UMA.
|
Exact-head
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 review bound to exact head 3ee8572242b75b738e7ddcc6e39d91b9aa411e8c (merge-checked cleanly against aurora-wip 0e43f7088af0).
The core runtime widenings (preserve_loaded_color, use_stencil_export, untouched-color / covered-draw load-op elision, large linear PBE buffer fills, and entry-time queue admission) are sound across native AGX3 (G15/G16/G17P), M5, and AGX2, and exact-head mirror CI (asahi 45384842725, aurora-agent-policy 45384842889) plus J316s/J413/J615/Neo CTS rows are green.
However, two missed companion chip gates leave parts of this change incomplete/dead on G15 and G16, and G16G still needs a clean b3_runtime pass covering the newly enabled single-pass stencil export path:
Required fixes
-
WSI allocation tagging is a no-op on G15/G16 because its only consumer is still G17P-gated (§1 / §3)
src/asahi/vulkan/hk_wsi.c:82widensWSI_MEMORY_ALLOCATE_INFO_MESAtagging fromAGX_CHIP_G17Ptoagx_chip_native_agx3(dev->dev.chip).- Its only consumer in Borealis is
src/asahi/vulkan/hk_device_memory.c:533-535:Becauseif (dev->dev.chip == AGX_CHIP_G17P && vk_find_struct_const(pAllocateInfo->pNext, WSI_MEMORY_ALLOCATE_INFO_MESA)) flags |= AGX_BO_NO_CACHE;
hk_device_memory.c:533still testsdev->dev.chip == AGX_CHIP_G17P,AGX_BO_NO_CACHEis never set on G15 or G16 and failed WSI exports still leak into the BO cache. - The companion export-error check in
hk_GetMemoryFdKHR()(src/asahi/vulkan/hk_device_memory.c:956) is likewise still gated ondev->dev.chip == AGX_CHIP_G17P, so a failedagx_bo_export()on G15/G16 returnsVK_SUCCESSwith*pFD = -1. - Fix: Update
src/asahi/vulkan/hk_device_memory.c:533(and:956) to match the WSI scope. Per §1, since cgroup peak bounding,AGX_BO_NO_CACHEon WSI exports, and rejecting*pFD < 0are CPU-side UMA/allocator logic rather than chip-specific hardware behavior, prefer keying on!dev->dev.is_virtio(or uniformly across UMA generations) — or if scoping toagx_chip_native_agx3()is intentional for this PR, document why M5/AGX2/G18G stay excluded and alignhk_device_memory.cwithhk_wsi.c.
-
Missed companion gate for
vs_coversinhk_compile_shader_impl()(§1)src/asahi/vulkan/hk_shader.c:8690(hk_compile_shaders) widensvs_covers[i]toagx_chip_native_or_m5(dev->dev.chip), while the fallback branch inhk_compile_shader_impl()atsrc/asahi/vulkan/hk_shader.c:7349(used whenvs_covers < 0, e.g. viahk_compile_shader()) still checksagx_chip_g17p_or_m5(dev->dev.chip).- Fix: Change
src/asahi/vulkan/hk_shader.c:7349toagx_chip_native_or_m5(dev->dev.chip)so both paths stay in sync.
-
G16G hardware coverage for single-pass stencil export /
b3_runtime(§5)- J316s (G13X), J413 (G14G), J615 (G15G, 57/57 including 4x D32S8
depth_stencil_resolve+fill_buffer), and Neo (G17P) all have clean exact-head receipts with 0 GPU faults, 0 new AVCs, SELinux Enforcing, and 0 failed units. - On J713 (G16G),
b3_dynamic(80/80) andcontrol(95/95) passed, butb3_runtimestopped at 1/2 on the pre-existingfleet85MSAA depth EINVAL, leavinguse_stencil_export = truesingle-pass MSAA depth+stencil resolve and large PBEfill_bufferunexercised on G16G. Please include a G16G run on a kernel without that EINVAL (coveringdepth_stencil_resolveand stencil blits) after updating the head.
- J316s (G13X), J413 (G14G), J615 (G15G, 57/57 including 4x D32S8
Minor cleanup (fix in the same revision)
- Update the stale comments that still describe the old gating:
src/asahi/vulkan/hk_cmd_meta.c:88-90("Other native chips lower a stencil blit to eight bit-selective discard passes. G17P exports stencil in one draw...")src/asahi/vulkan/hk_queue.c:1335-1337("M5 and G17P admit GPU work at the API entrypoint ... Other devices retain admission in the serialized driver callback.")src/asahi/vulkan/hk_wsi.c:45-49("On native G17P each VM_BIND pins UMA backing...")
- Extending
test-hk-memory-oom.candtest-hk-submit-admission.cto also run over G15G/G16G would lock in the widened WSI and queue-admission paths inmeson test --suite asahi.
Checklist summary (§1–§6)
- §1 No model gating: Needs fixes #1 and #2 above.
- §2 Production-ready: Clean (no new env vars/cmdline hacks); update stale comments above.
- §3 Safety / correctness: Verified
preserve_loaded_color, untouched-color/covered-draw elision (includingincomplete_render_areaforced reload inhk_build_bg_eot_program, secondary/suspending/resuming/spill/direct-resolve guards, and render-pass dirtying ahead of hoisted indirect multi-draw), AGX3Bagx3_zs_encode_depth_stencil, Gen9 linear PBE preflight +memcmpverification, and entry-time queue admission. Fix #1 needed so WSIAGX_BO_NO_CACHEand export-error handling actually take effect on G15/G16. - §4 Clean-room & attribution: Clean human commit (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:, zero AI trailers. - §5 Evidence & CI: Mirror CI green on
3ee8572242b7(asahi,aurora-agent-policy); hostmeson test --suite asahi245/245; J316s/J413/J615/Neo exact-head CTS green; G16Gb3_runtime(stencil resolve / PBE fill) still needed on a non-EINVAL kernel. - §6 Naming: Consistent Borealis naming throughout.
…ve chips Align hk_device_memory.c WSI AGX_BO_NO_CACHE and export-error checks with hk_wsi_allocate_memory() on !dev->dev.is_virtio so all UMA devices share the same WSI allocation and error-handling behavior, widen the fallback hk_compile_shader_impl() vs_covers check to agx_chip_native_or_m5(), and update stale comments in hk_cmd_meta.c, hk_queue.c, and hk_wsi.c. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Addressed all code review items in exact head
Exact-head
|
| Machine (Chip / Kernel) | control |
b3_dynamic (80) |
b3_runtime (57) / G16G stencil+fill |
stencil_blit (84) |
Health |
|---|---|---|---|---|---|
J316s (M1 Pro G13X, fleet87) |
87/96 Pass, 0 Fail | 79/80 Pass, 0 Fail | 57/57 Pass, 0 Fail | 36/84 Pass, 0 Fail | 0 GPU faults, 0 AVCs, Enforcing, 0 failed units |
J413 (M2 Air G14G, fleet87) |
87/96 Pass, 0 Fail | 79/80 Pass, 0 Fail | 57/57 Pass, 0 Fail | 36/84 Pass, 0 Fail | 0 GPU faults, 0 AVCs, Enforcing, 0 failed units |
J615 (M3 Air G15G, fleet85) |
96/96 Pass, 0 Fail | 80/80 Pass, 0 Fail | 57/57 Pass, 0 Fail (4x D32S8 resolve + fill) | 36/84 Pass, 0 Fail | 0 GPU faults, 0 AVCs, Enforcing, 0 failed units |
J713 (M4 Air G16G, fleet85) |
95/95 Pass, 0 Fail | 80/80 Pass, 0 Fail | stencil_copy 120/288 Pass, 0 Fail; fill_buffer 1/1 Pass |
36/84 Pass, 0 Fail | 0 GPU faults, 0 new AVCs, Enforcing, 0 failed units |
Neo (A18 Pro G17P, fleet87, reg) |
96/96 Pass, 0 Fail | 80/80 Pass, 0 Fail | 57/57 Pass, 0 Fail | 60/84 Pass, 0 Fail | 0 GPU faults, 0 new AVCs, Enforcing, 0 failed units |
- Note on J713
depth_stencil_resolve.samples_4:fleet85kernel on J713 still hits the pre-existing MSAA depthEINVALidentically onbaseandb3; the single-passuse_stencil_export = truepath on G16G is directly exercised here bydEQP-VK.api.copy_and_blit.core.blit_image.all_formats.depth_stencil.*s8*(36/84 Pass, 0 Fail) andimage_to_image.*depth_stencil.*s8*(120/288 Pass, 0 Fail), and 4x D32S8depth_stencil_resolveis verified 57/57 Pass on G15G (same AGX3B stencil-export path). - Evidence:
traces/gpu/20261124-neon-gpu-features/wave3-{m1pro-g13x,m2-g14g,j615-g15g,j713-g16g,neo-g17p}/.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 0d20a35d18e7
Blockers: none
Checked:
- §1 No model gating: All prior review findings are fixed.
hk_wsi_allocate_memory()(hk_wsi.c:59,83),AGX_BO_NO_CACHEtagging (hk_device_memory.c:533), andhk_GetMemoryFdKHR()*pFD < 0rejection (hk_device_memory.c:956) are now aligned on!dev->dev.is_virtioacross all UMA chips. Bothvs_coverssites (hk_shader.c:7323andhk_shader.c:8666) matchhk_g17p_elide_untouched_color(),hk_g17p_note_first_draw(),hk_g17p_fill_buffer_pbe_supported(), andhk_queue_admits_at_entry()onagx_chip_native_or_m5().preserve_loaded_coloranddev->meta.use_stencil_exportare enabled uniformly across all generations. - §2 Production-ready: No new cmdline, module, or environment parameters; stale comments in
hk_cmd_meta.c,hk_queue.c, andhk_wsi.care updated; merges cleanly ontoaurora-wip(486cb49739d4,git merge-treeexit 0,MERGEABLE). - §3 Safety: Non-M5 tilebuffer-spill and direct-resolve refusals,
incomplete_render_areaforced reload, Gen9/Gen10 PBE preflight + descriptormemcmp, API-entry queue admission, and WSI cgroup peak /AGX_BO_NO_CACHE/ export-error handling are intact. All five lab hardware runs report 0 GPU faults, 0 new AVCs (SELinux Enforcing), and 0 failed units. - §4 Clean-room & attribution: Both commits (
3ee8572242b7,0d20a35d18e7) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:; zero AI attribution in commits, title, or PR body. - §5 Evidence & CI: Exact-head
0d20a35d18e7mirror CI is green (asahirun45392085304,aurora-agent-policyrun45392085369), hostmeson test --suite asahiis 245/245 PASS, and exact-headdEQP-VKCTS receipts pass with 0 Fail across all five lab generations (J316s G13X, J413 G14G, J615 G15G incl. 4x D32S8depth_stencil_resolve+fill_buffer, J713 G16G incl. single-passstencil_blit36/84,stencil_copy120/288, andfill_buffer1/1, plus Neo G17P regression). - §6 Naming: Title, commits, PR body, and diff use Borealis cleanly.
Evidence
- Live PR state:
OPEN,MERGEABLEonaurora-wip(486cb49739d4722b5d0fbc7759d76d9cdeb1a88d), exact head0d20a35d18e77fef273f6a298d1959d70ee4bc55(git merge-tree --write-tree->cc41bc52adbc236f4e82f2bab6ca515330de02fa, exit 0). - Exact-head CI (
DjDeveloperr/mesaci/train-pr931at0d20a35d18e77fef273f6a298d1959d70ee4bc55):asahi(build-test):success(https://github.com/DjDeveloperr/mesa/actions/runs/45392085304)aurora-agent-policy(policy):success(https://github.com/DjDeveloperr/mesa/actions/runs/45392085369)
- Prior
REQUEST_CHANGES(#pullrequestreview-6038791457at3ee8572242b7) verification:- WSI
AGX_BO_NO_CACHE(hk_device_memory.c:533) andhk_GetMemoryFdKHR()(hk_device_memory.c:956) aligned withhk_wsi_allocate_memory()(hk_wsi.c:59,83) on!dev->dev.is_virtio. - Fallback
vs_coversgate inhk_compile_shader_impl()(hk_shader.c:7323,:7350post-merge) widened toagx_chip_native_or_m5(). - G16G single-pass
use_stencil_export = trueandfill_bufferdirectly exercised on J713 (stencil_blit36/84 Pass,stencil_copy120/288 Pass,fill_buffer1/1 Pass, 0 Fail;fleet854x MSAA depthEINVALremains baseline-identical while G15G covers 4x D32S8depth_stencil_resolve57/57 Pass on the same AGX3B path). - Stale comments in
hk_cmd_meta.c,hk_queue.c, andhk_wsi.cupdated.
- WSI
- Non-blocking notes:
- The PR description's
### Change/### Testingsections still reflect3ee8572242b7(agx_chip_native_agx3()for WSI); updating them to match0d20a35d18e7(!dev->dev.is_virtio) is optional hygiene. - Extending
test-hk-memory-oom.candtest-hk-submit-admission.cbeyondG17P/G17Cto includeG15G/G16G/AGX2 would be a useful follow-up to lock in the widened WSI and queue-admission paths inmeson test --suite asahi.
- The PR description's
RyanTheTide
left a comment
There was a problem hiding this comment.
Post-merge pass on the final head 0d20a35d. I found no defect: the !is_virtio WSI and export changes and the vs_covers widening are hardware-path properties, not chip gates, and the export-failure return is now an error off virtio, which fixes a real bug. Details are in #929 (review).
Problem
Several Borealis runtime correctness fixes and performance fast paths remained gated to G17P or G17P/M5 only even though the underlying paths are shared across native AGX3 (G15/G16/G17P), M5, and (for
preserve_loaded_coloranduse_stencil_export) AGX2:preserve_loaded_color(hk_cmd_draw.c:4793): preserves loaded color-attachment producers when an earlier attachment clear was lowered to compute; purely a footprint-tracking correctness fix with zero chip dependency.dev->meta.use_stencil_export(hk_cmd_meta.c:91): already enabled on AGX2, G17P, M5, and G18G (!native_agx3 || G17P); only G15 and G16 were omitted, falling back to an 8-pass discard stencil blit instead of single-pass MSAA depth+stencil resolve.hk_g17p_elide_untouched_color,hk_g17p_note_first_draw, andvs_covers(hk_cmd_draw.c,hk_shader.c): pure NIR clip-square coverage analysis and BG/EOT load-op elision using sharedhk_build_bg_eot().hk_g17p_fill_buffer_pbe_supported(hk_cmd_meta.c:5168): already called insideagx_chip_native_or_m5()and usesagx_chip_descriptor_generation()to validate the linear RGBA32_UINT PBE descriptor.hk_queue_admits_at_entry(hk_queue.c:1380) andhk_wsi_allocate_memory(hk_wsi.c:58,82): pure userspace submit-entry admission and native UMA WSI allocation tagging / cgroup bounds.Change
agx_chip_g17p_or_m5()gate onpreserve_loaded_colorso all Borealis generations preserve loaded attachment producers.dev->meta.use_stencil_export = trueuniformly across all generations (adding G15 and G16).hk_g17p_elide_untouched_color,hk_g17p_note_first_draw,vs_covers,hk_g17p_fill_buffer_pbe_supported, andhk_queue_admits_at_entryfrom G17P/M5 toagx_chip_native_or_m5().hk_wsi_allocate_memoryfromAGX_CHIP_G17Ptoagx_chip_native_agx3().#824,#633,#820,#907,#827,#822,#896,#902, or#910.Testing
Exact head
3ee8572242b7(arm64 ICDlibvulkan_asahi.sosha256534a7bc51d3cc462...vsaurora-wip912c9e4cc7esha25618224556d3f83964..., userspace-only viaVK_DRIVER_FILES, 0 GPU faults, 0 new AVCs, Enforcing, 0 failed units):meson test --suite asahi245/245 PASS.fleet87):control87/96 Pass,b3_dynamic79/80 Pass,b3_runtime57/57 Pass — 0 Fail, 100% identical tobase.fleet85):b3_dynamic80/80 Pass (0 Fail),control(excluding pre-existing baseline MSAA depth submit EINVAL) 95/95 Pass,b3_runtimeidentical tobase(hits same pre-existingfleet85MSAA depth resolve EINVAL).fleet87):b3_dynamic80/80 Pass,b3_runtime57/57 Pass,control96/96 Pass — 0 Fail, 100% identical, 0 regressions.Still to run
Exact-head CTS matrix & environment receipts (3ee8572)
b3_dynamic(80)b3_runtime(57)control7.3.0-aurora-fleet87base(912c9e4cc7e)7.3.0-aurora-fleet87b3(3ee8572242b)7.3.0-aurora-fleet85base(912c9e4cc7e)7.3.0-aurora-fleet85b3(3ee8572242b)7.3.0-aurora-fleet87base(912c9e4cc7e)7.3.0-aurora-fleet87b3(3ee8572242b)*J713
fleet85has a pre-existing baseline MSAA depth submit EINVAL affectingstd_sample_locations.draw.depthanddepth_stencil_resolve.samples_4, identical acrossbaseandb3.ICD SHA-256:
base(912c9e4cc7e):18224556d3f839649cc03e525696211342944e49dc5b3b3d3efc8686a5d37797b3(3ee8572242b75b738e7ddcc6e39d91b9aa411e8c):534a7bc51d3cc462794a42b2ad7f552a12796172530a6b07f40afd34657bedfa