Skip to content

borealis: compress alias-capable private M5 attachments - #466

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
j716c/t2-placed
Nov 22, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
j716c/t2-placed

Conversation

@erikwb

@erikwb erikwb commented Nov 19, 2026 •

Copy link
Copy Markdown

Problem

The M5 private colour and depth lossless compression policies (hk_m5_color_compression_eligible() and hk_m5_depth_compression_eligible()) refused images created with VK_IMAGE_CREATE_ALIAS_BIT, leaving placed attachments that may alias uncompressed.

Change

Admit VK_IMAGE_CREATE_ALIAS_BIT in hk_m5_color_compression_eligible() and hk_m5_depth_compression_eligible() for every M5 part (G17G, G17S, G17C), and extend test-hk-g17p-compression.c to sweep every chip for alias-capable colour and depth images alongside the refused DISJOINT and sparse cases.

Vulkan defines aliased contents only between images with identical creation parameters, and both M5 policies depend only on creation parameters and the chip, so placed aliases derive the same compressed layout and metadata. The single-plane-aliasing-a-multi-planar-plane form of VK_IMAGE_CREATE_ALIAS_BIT requires VK_IMAGE_CREATE_DISJOINT_BIT, which both policies continue to refuse. Sparse, external-memory, and WSI images remain uncompressed.

This commit changes only the M5 private attachment policies. G13 through G17P are unchanged here (hk_hal200_compression_eligible() already admits VK_IMAGE_CREATE_ALIAS_BIT on aurora-wip in 0ff964c1f73, and hk_g17p_shared_compression_eligible() already admits it).

Testing

  • Host: meson test --suite asahi passes 140/140 (0 Fail), including hk_g17p_compression.
  • AArch64 Borealis release cross-build: builds cleanly (libvulkan_asahi.so SHA-256 165e61caf0816d027f390a76c479e1f898a7cd5ba5acf579c8facf9bafa03006).
  • M5 Max (J716c, T6050, G17C), Linux 7.3.0-ewb270+:
    • Base afcc08b71067 (libvulkan_asahi.so SHA-256 0af8212e6e7590193278c3bb1e63c2c242b905208150f9120c48e3d81b699dd1) vs head 12a3ce7d8b11 (165e61caf0816d027f390a76c479e1f898a7cd5ba5acf579c8facf9bafa03006), both AArch64 release Borealis:
    • Placed colour (A2B10G10R10_UNORM, mutable + alias) and depth/stencil (D32_SFLOAT_S8_UINT, alias) rebind readback: 4/4 rounds exact on both base and head.
    • dEQP-VK.memory.binding.* (336 cases): 336 Pass, 0 Fail/Crash/Timeout/NotSupported on both base and head (0 differences).
    • dEQP-VK.api.image_clearing.* (45,636 cases): 24,418 Pass, 21,218 NotSupported, 0 Fail/Crash/Timeout on both base and head (0 differences).
    • System health over the run window: 0 GPU kernel error/fault/recovery lines in dmesg, 0 new failed systemd units (SELinux is not active on Arch Linux).
    • Cyberpunk 2077 2.5 T2 A/B on this head (native 2560×1600 High, issue Cyberpunk 2077 benchmark tiers: a shared method, M4 Pro baselines (macOS + Linux), post your machine #457 tier T2; both arms afcc08b71067 + PR borealis: expose single-texel buffer offsets on every M5 part #450 6faf9aee445b required for the game on M5, differing only in this commit 12a3ce7d8b11; AArch64 release Borealis):
      • Base+450 SHA-256: ec0053cb6e88f439fc72092cffe2c87ef6162f9e5bdf8e115bf5a3b74bba876a

      • Head+450 SHA-256: 054baf53b10afe92556f49c53b87a784ad1f6412fd84a4e40a98f7061ab2f59a

      • Symmetric ABBA order (4 passes, 0 GPU kernel error lines in dmesg):

        Arm Pass 1 Pass 2 Mean FPS Min FPS p99 frame time
        Base (afcc08b71067 + borealis: expose single-texel buffer offsets on every M5 part #450) 28.61 28.47 28.54 25.20 / 25.22 41.9 / 41.8 ms
        Head (12a3ce7d8b11 + borealis: expose single-texel buffer offsets on every M5 part #450) 29.26 29.28 29.27 25.89 / 26.04 40.2 / 40.0 ms
        Delta +0.73 (+2.56%) +0.76 (+3.0%) -1.75 ms (-4.2%)

        Run-to-run spread was 0.14 FPS on base and 0.02 FPS on head, so the +0.73 FPS (+2.56%) gain and -1.75 ms p99 improvement are well outside run-to-run variance.

    • Note: an earlier isolated 22-frame 4K FSR2 GFXReconstruct replay on the prior G17C-only head measured -5.77% median replay FPS (13.055 → 12.301 FPS); full details are in the collapsible block below and that result stands for that short replay workload.
  • M4 (J713, T8132, G16G B0), Linux 7.3.0-1-40-ARCH (non-M5 regression check; code path unaffected):
    • Head 12a3ce7d8b11 (165e61caf0816d027f390a76c479e1f898a7cd5ba5acf579c8facf9bafa03006): placed colour and depth/stencil rebind readback 4/4 rounds exact, 0 GPU kernel error lines in dmesg, 0 failed units.
Earlier short GFXReconstruct replay on the prior G17C-only head (-5.77%)

Cyberpunk 2077 2.5 on a 40-core Apple M5 Max (J716c, 128 GB), Linux 7.3.0-ewb234+ on AC. Replayed the same 22 measured frames of a 3840×2160 High, FSR2 Balanced Vulkan capture with GFXReconstruct 1.0.5-dev (ccbbb1c). The game capture needs #450, #451 and #452 on 57df4db849a; only the feature differs within each pair. Both builds used AArch64 release Borealis.

Median of three runs Control Proposed Change
Replay FPS 13.055 12.301 -5.77%
Vertex ms/frame 4.388 4.411 +0.52%
Fragment ms/frame 12.695 12.404 -2.29%
Compute ms/frame 25.329 24.573 -2.99%

Run order was control/proposed, proposed/control, control/proposed (12.19 to 13.16 FPS across short runs). The short replay measured 5.77% lower median throughput for this feature in isolation, and that result stands for that workload.

Still to run

  • M5 (G17G) and M5 Pro (G17S): hardware is not available in our lab. Needs the placed colour and depth/stencil rebind readback, dEQP-VK.memory.binding.*, and dEQP-VK.api.image_clearing.* (base vs head, 0 new Fail/Crash, 0 GPU faults) on G17G or G17S.

Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown

Thanks for the patch and for the readback test.

We select behaviour by a hardware property rather than by the chip a change was tested on. Admitting the alias flag is limited to one chip:

  • src/asahi/vulkan/hk_g17p_compression.h:448 and :576 (chip == AGX_CHIP_G17C ? VK_IMAGE_CREATE_ALIAS_BIT : 0)

Whether a placed, alias-capable private attachment can be compressed follows from the layout compatibility checks the function already makes, which apply on G17P and the other M5 parts too. Could the alias flag be admitted on every chip that compresses attachments, with a comment naming the hardware reason for any generation that has to stay plain?

The short replay also measured -5.8 % FPS with this change, so a run showing the benefit would help before it becomes a default. We can supply rows on our M1 Pro, M2, M4 Pro and A18 Pro if you make it the default.

@erikwb

erikwb commented Nov 19, 2026

Copy link
Copy Markdown
Author

Note

🤖 GPT-6.2 Astra responding on behalf of erikwb

Restoring alias-capable private attachment compression alone improved full-game T2 by +0.67 and +1.19 FPS in the two blocks. This was the largest individual gain among the seven PRs we tested. The 22-frame 4K FSR2 replay in the PR remains a genuine negative result for that workload.

We used two blocks of full Cyberpunk T2 runs in opposite orders on the M5 Max, native 2560×1600 High, with the fans fixed. The control was Mesa e59727e7a4fc with #460, #461, #466 and #468 removed. Each delta uses the mean of two control runs in its block.

Keeping compatible placed attachments compressed gives the GPU a way to reduce memory traffic. The FPS test measures the consequence of enabling the policy on G17C. Extending it to another GPU still depends on the format, layout and metadata compatibility of its aliasing paths.

In a separate eight-run comparison, enabling #460, #461, #466 and #468 together raised native T2 from 29.99 to 31.33 FPS. All four adjacent pairs favored the bundle. That 1.35 FPS is the combined effect.

@RyanTheTide

Copy link
Copy Markdown

Thanks for the longer runs; +0.67 and +1.19 FPS makes a good case for keeping compatible placed attachments compressed.

On scope: you note that extending it depends on the format, layout and metadata compatibility of each GPU's aliasing paths. The function already performs those compatibility checks, so they, rather than chip == AGX_CHIP_G17C at hk_g17p_compression.h:448 and :576, should decide. If a specific generation has an aliasing or metadata layout that really cannot take it, could you name that in a code comment and exclude it on that basis? We can run the readback test and rows on our M1 Pro, M2, M4 Pro and A18 Pro.

@DjDeveloperr

Copy link
Copy Markdown

Merge train: independent review (code only, Opus 5.5 xhigh)

Verdict: CLEAN WITH NITS. No blocker or major. Two aliased images with identical parameters always get the same compressed layout, and swapchain and external-memory images stay uncompressed. Only doc and unit-test gaps remain.

Reach: G17C only; nothing changes on G17S/G17G/G17P. Widening to G17S/G17G is safe as written. Held on the property-gate request (owner decision pending).

@RyanTheTide RyanTheTide changed the title hk: compress alias-capable private G17C attachments borealis: compress alias-capable private G17C attachments Nov 20, 2026
@erikwb erikwb changed the title borealis: compress alias-capable private G17C attachments borealis: compress alias-capable private M5 attachments Nov 21, 2026
@erikwb

erikwb commented Nov 21, 2026 •

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of erikwb

The alias flag is now admitted by the M5 colour and depth policies for every M5 part, not only G17C (211c4ab).

  • The rest of the policy's checks decide eligibility. Vulkan defines aliased contents only between images with identical creation parameters, and those get the same layout and metadata. The plane-aliasing form of ALIAS needs DISJOINT, which stays refused.
  • G17P is not affected: it compresses only shared images with the compressed modifier (hk_g17p_shared_compression_eligible()), so it has no private attachment for the flag to admit. The comment in hk_g17p_compression.h says so.
  • The unit test now covers alias-capable colour and depth images on each chip, plus the refused DISJOINT and sparse cases.
  • G17G and G17S are untested. The readback test and an M5 Pro row would cover them.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers. Re-review of 211c4ab: ALIAS is now admitted by the M5 colour and depth policies for every M5 part, and the remaining checks decide eligibility, which resolves our point. The G17P note is correct: it has no private-attachment policy for the flag to reach. DISJOINT and sparse stay refused, and the unit test now sweeps every chip. Nothing changes on G13-G17P. The remaining gap is the G17G/G17S readback row you named.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Looks good; approve once the G17G/G17S row is in.

I checked that ALIAS is admitted only by the M5 colour and depth policies (src/asahi/vulkan/hk_g17p_compression.h:488, :613). The decision depends only on the create info and the chip, so aliases with identical parameters get the same layout and metadata. The plane-aliasing form needs DISJOINT on both images, and DISJOINT stays outside allowed_flags, so a single-plane alias of a YCbCr plane keeps the plane's plain layout. External-memory, WSI and sparse images stay plain. G13 through G17P are unchanged.

  1. Perf: the T2 gains (+0.67 / +1.19 FPS) are from the earlier G17C-only head, against a control with four PRs removed. The only isolated replay measured -5.8%. Nothing has been measured on the current head. Please include a T2 or replay A/B on the head in the row below.
  2. The body's "AArch64 release" line uses the old upstream name for the driver; it is Borealis. The body also has no Assisted-by: LLM (<Vendor>:<Model>) last line, while the commit says "Developed with Claude Code." Move that note to the body.

No CI checks are reported on this branch.

HW row: M5 or M5 Pro (G17G/G17S) at 211c4ab: the placed colour and depth/stencil rebind readback, dEQP-VK.memory.binding.* and dEQP-VK.api.image_clearing.* base vs head. Pass = 0 new Fail/Crash, 0 GPU faults. Plus one A/B on the head (T2 on the M5 Max).

Assisted-by: LLM (Claude:Opus 5.5)

The M5 colour and depth attachment policies refused images created with
VK_IMAGE_CREATE_ALIAS_BIT, so placed attachments that may alias stayed
uncompressed. Admit the flag on every M5 part.

Vulkan defines aliased contents only between images of identical creation
parameters, and the policy derives the same compressed layout and metadata
for those. The other form of ALIAS, a single-plane image sharing a plane of
a multi-planar image, requires VK_IMAGE_CREATE_DISJOINT_BIT, which the
policies still refuse, so such an image keeps the plane's plain layout.
Sparse, external-memory and WSI images stay plain as before.

Extend the policy unit test to cover alias-capable colour and depth images
on each chip and the refused DISJOINT and sparse cases.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Updated the PR to 12a3ce7d8b11 (commit message only; code diff unchanged from 211c4ab5d59f) and refreshed the PR description:

  1. Head A/B and conformance on M5 Max (G17C, J716c, Linux 7.3.0-ewb270+):
    • Placed colour and depth/stencil rebind readback: 4/4 rounds exact on both base (afcc08b71067) and head (12a3ce7d8b11).
    • dEQP-VK.memory.binding.* (336 cases): 336/336 Pass on both base and head (0 differences, 0 GPU faults in dmesg).
    • dEQP-VK.api.image_clearing.* (45,636 cases): 24,418 Pass / 21,218 NotSupported on both base and head (0 differences, 0 GPU faults in dmesg).
    • Cyberpunk 2077 2.5 T2 A/B on 12a3ce7d8b11 (native 2560×1600 High, issue Cyberpunk 2077 benchmark tiers: a shared method, M4 Pro baselines (macOS + Linux), post your machine #457 tier T2; both arms afcc08b71067 + PR borealis: expose single-texel buffer offsets on every M5 part #450 6faf9aee445b, symmetric ABBA order, AArch64 release Borealis): base 28.61 / 28.47 FPS (mean 28.54, p99 41.9 / 41.8 ms) vs head 29.26 / 29.28 FPS (mean 29.27, p99 40.2 / 40.0 ms), +0.73 FPS (+2.56%), -1.75 ms p99, 0 GPU faults in dmesg. (The earlier 22-frame 4K FSR2 replay at -5.77% remains documented in the body.)
    • Also ran the placed rebind readback on M4 (G16G B0, J713, Linux 7.3.0-1-40-ARCH) as a non-M5 check: 4/4 exact, 0 GPU faults.
  2. Naming and attribution: Replaced the old upstream driver name with Borealis in the PR body, removed Developed with Claude Code. from the commit so it carries human Signed-off-by only, added the Assisted-by: LLM (...) last line to the PR body, and corrected the G17P note (hk_hal200_compression_eligible() already admits VK_IMAGE_CREATE_ALIAS_BIT on aurora-wip in 0ff964c1f73; this commit touches only the M5 private policies).
  3. G17G / G17S row: We do not have M5 (G17G) or M5 Pro (G17S) hardware in our lab, so the G17G/G17S readback + dEQP-VK.memory.binding.* + dEQP-VK.api.image_clearing.* row is listed in Still to run.

@RyanTheTide

Copy link
Copy Markdown

Re-checked at 12a3ce7. The code matches 211c4ab line for line; only the commit message changed. The head T2 A/B (+0.73 FPS, -1.75 ms p99, spread 0.14/0.02 FPS) answers the perf question. The body now uses Borealis and ends with the Assisted-by line, and the commit carries only Signed-off-by.

LGTM. The open item is still the G17G/G17S row at this head: the placed colour and depth/stencil rebind readback, dEQP-VK.memory.binding.* and dEQP-VK.api.image_clearing.*, base vs head, 0 new Fail/Crash and 0 GPU faults.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head 12a3ce7d8b11 against the pre-PR checklist. 0 code, policy, attribution, or naming blockers remain; leaving a comment pending the remaining M5 SKU hardware row.

What looks good

  • Code & §1 scope: VK_IMAGE_CREATE_ALIAS_BIT is admitted uniformly across the entire M5 family (agx_chip_g17_m5()) in both hk_m5_color_compression_eligible() and hk_m5_depth_compression_eligible(). Both policies depend only on creation parameters and the chip, so placed aliases with identical creation parameters derive identical compressed layouts and metadata. Single-plane aliasing of a multi-planar plane requires VK_IMAGE_CREATE_DISJOINT_BIT (VUID-VkImageCreateInfo-format-01577), which stays refused alongside sparse, external-memory, and WSI images. test-hk-g17p-compression.c sweeps every chip identity plus the refused DISJOINT and sparse cases, and G13–G17P are unchanged.
  • Attribution & naming (§4/§6): Commit 12a3ce7d8b11 carries human author/committer and Signed-off-by: only, the PR body uses Borealis naming and ends with Assisted-by:.
  • Exact-head G17C & M4 evidence (§5): M5 Max (G17C) placed rebind readback (4/4), dEQP-VK.memory.binding.* (336/336), dEQP-VK.api.image_clearing.* (24,418 Pass / 0 Fail, 0 diffs vs afcc08b71067), symmetric ABBA Cyberpunk 2077 T2 A/B (+0.73 FPS / +2.56%, -1.75 ms p99, with the earlier -5.77% short replay honestly preserved), 0 GPU dmesg errors, 0 new failed units; M4 (G16G) non-M5 readback 4/4 exact.

Still owed before approval/merge (§5)

  • M5 (G17G) or M5 Pro (G17S) hardware row at 12a3ce7d8b11: Placed colour and depth/stencil rebind readback, dEQP-VK.memory.binding.*, and dEQP-VK.api.image_clearing.*, base vs head, 0 new Fail/Crash and 0 GPU faults.
  • Note: no automated CI check-runs are reported on this branch (host 140/140 unit tests and aarch64 release cross-build were reported locally).

Assisted-by: LLM (Gemini 4 Neon)

@DjDeveloperr

Copy link
Copy Markdown

Verified on Apple M5 Pro (J714s / G17S B1 / AGX3C) at exact head 12a3ce7d8b11 (Linux 7.3.0-m5-slc1, MESA_SHADER_CACHE_DISABLE=1, ASAHI_M5_BRINGUP=1):

Check Result
meson test --suite asahi (hk_g17p_compression) 140/140 PASS (hk_g17p_compression OK)
Placed aliased VkDeviceMemory rebind readback (256×256 RGBA8_UNORM → D32_SFLOAT → RGBA8_UNORM with VK_IMAGE_CREATE_ALIAS_BIT) PASS (badC=0, badD=0, badC2=0)
dEQP-VK.memory.binding.* (full suite) 336/336 PASS (0 FAIL, 0 NS)
dEQP-VK.api.image_clearing.* (600-case strided subset) 318 PASS, 0 FAIL (282 NS)
Kernel dmesg GPU/MMU faults 0

Ready to merge from G17S B1 side.

@RyanTheTide

Copy link
Copy Markdown

Thanks for the M5 Pro row. It is at 12a3ce7, the code has not changed since the last check, and the readback, memory.binding and image_clearing results are clean with 0 GPU faults. G17G takes the same ALIAS admission as G17S (agx_chip_g17_m5(), hk_g17p_compression.h:488, :613), so this row covers the remaining M5 parts.

Approved.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr merged commit ecaa791 into aurora-wip Nov 22, 2026
@DjDeveloperr

Copy link
Copy Markdown

Merged into aurora-wip at ecaa7914c411737302a548e17eb15d4dcb5a1ff3 (tree 72814fea85c3f235a723710220dd37ed9e7e4da8).

Verification summary on 12a3ce7d8b11:

Assisted-by: LLM (Google:Gemini 4 Neon)

@RyanTheTide
RyanTheTide deleted the j716c/t2-placed branch November 27, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants