Skip to content

borealis: compress private 1x 2D colour images on G15G - #1352

Merged
RyanTheTide merged 2 commits into
aurora-wipfrom
feat/borealis-g15g-color-2d-compression
Nov 30, 2026
Merged

RyanTheTide merged 2 commits into
aurora-wipfrom
feat/borealis-g15g-color-2d-compression

Conversation

@RyanTheTide

Copy link
Copy Markdown

Borealis twin of #1341: lossless compression for G15G (M3) private colour images. The design was agreed with Dj on the agents channel.

What changes

  • New cap AGX_CAP_HAL200_COLOR_2D_COMPRESSION (bit 31): the private single-sample colour subset of the HAL200/Gen9 policy. G15G gets only this cap; AGX_CAP_HAL200_LOSSLESS_COMPRESSION implies it. The GL predicate (agx_chip_gen9_color_compression()) stays independent.
  • hk_hal200_compression_eligible() with only the narrow cap admits plane 0 of an optimal 1x 2D image with one level and one layer, in the existing 1-8B colour allowlist, with no CUBE_COMPATIBLE. The common usage, flag, store-class, import/WSI and sparse checks still apply.
  • Stays off on G15G: depth/stencil (ZLS carries its own compression metadata), MSAA, layered, 3D, mip chains, 16-byte formats, shared modifiers, compressed storage.
  • Untouched, per Dj: the compressed compute blit (hk_cmd_meta.c:2257), its pair-store shortcut (:2965) and the direct compressed block-mip store (hk_g17p_meta_copy_core.h:277) keep their HAL200 gates. G15G copies take the existing compressed-image graphics fallback. hk_image.c:610 (M5 storage) and :1267 (cube) need nothing.
  • Tests:
    • New check_g15g_color_2d: positive 1x 2D. Negative: plane 1, mips, layers, MSAA, linear, cube, 3D, 16-byte, storage, external memory, D32, D32S8 (both planes), G15S/G15C.
    • The chip-wide eligibility, format-sweep and host-image-copy contract expectations now include G15G's subset.
  • G15S and G15C are unmeasured and stay off.

Rows (J615, MacBook Air M3, G15G, saved 7.3.0-aurora-edge, isolated ICDs; base aurora-wip 8bad0a5)

Host tests: 329 Ok / 26 Fail, the same 26 as base.

Engagement, debug ICD that prints every compressed image. Every compressed image is samples=1 plane=0 2D levels=1 layers=1, a colour format (R8G8B8A8_UNORM here), and all cases pass.

group compressed images result
simple_draw 4 4/4
clear_color_image.2d 61 0 F
mipmap.2d.basic 36 (only single-level images) 72/72
raster_samples 14 (1x only; 2x/4x stay plain) 0 F
depth.format.d32_sfloat 224 (all the colour target; D32 stays plain) 0 F
stencil.format.d32_sfloat_s8_uint 4,177 (colour target; both D32S8 planes stay plain) 4,177/4,177
host_image_copy 2,278 0 F
external.memory.opaque_fd 0 (imports stay plain) 46/46

A/B on the same list Dj asked for:

  • groups: upload (buffer_to_image), image_to_buffer, image_to_image and blit simple tests, blit r8g8b8a8 all-formats, clear_color_image.2d, clear_color_attachment, draw.renderpass, texture.filtering.2d, texture.mipmap.2d, multisample raster_samples, depth d32, host_image_copy, external memory opaque_fd, occlusion;
  • result: 34,336 Pass -> Pass, 0 Fail, 0 GPU fault lines.

There are 4 Pass -> NotSupported, all host_image_copy.identical_memory_layout.optimal.{r16_sfloat,r16_unorm,r16g16_uint,r8g8b8a8_unorm} ("identicalMemoryLayout not supported for this format"). Host image copy now reports identicalMemoryLayout false for formats whose optimal images can be compressed. That's the same contract the chips that already compress report (query_hic_detects_compression in the contract test).

Neo (G17P) no-change: 34,334 Pass -> Pass, 0 transitions. J713 (G16G): row to follow when the Mac is free.

Restored: Enforcing, 0 failed units. Traces: traces/gpu/20261129-gpu-ungate-g15vc/{j615-g15g,j615-g15g-ab,neo-g17p} (kit kits/test/20261129-gpu-ungate-g15vc).

G15G (M3) had no lossless compression in Borealis. Add
AGX_CAP_HAL200_COLOR_2D_COMPRESSION, the private single-sample colour
subset of the HAL200/Gen9 policy, and give it to G15G alone. With it,
hk_hal200_compression_eligible() admits plane 0 of an optimal 1x 2D
image with one level and one layer in a 1-8B colour format, without
cube compatibility; the common usage, flag, store-class, import/WSI and
sparse checks still apply. Depth and stencil (whose ZLS data carries its
own compression metadata), MSAA, layered, 3D, mip chains, 16-byte
formats, shared modifiers and compressed storage stay off. The
compressed compute blit, its pair-store shortcut and the direct
compressed block-mip store keep their HAL200 gates, so G15G copies go
through the existing compressed-image graphics fallback.

Measured on J615 with the macOS 27.2 firmware: every image the driver
compresses is 1x 2D colour, and the upload, clear, draw, sample,
copy/blit, host-image-copy and import groups pass unchanged. Host image
copy now reports identicalMemoryLayout false for those formats, as on
the chips that already compress.

G15S and G15C are unmeasured and stay off.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 29, 2026 12:12

@aurora-silicon-review aurora-silicon-review Bot 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.

Verdict: MERGE at 7ae7f27e

Blockers: None.

Checked:

  • AGX_CAP_HAL200_COLOR_2D_COMPRESSION = 1u << 31 (src/asahi/lib/agx_chip_caps.h) occupies the remaining unique bit in the 32-bit unsigned capability mask (all_caps updated in test-chip-caps.c) and is enabled on G15G alone, keeping G15S and G15C off.
  • hk_hal200_compression_eligible() (src/asahi/vulkan/hk_g17p_compression.h) computes color_2d_only = !lossless && agx_chip_has_cap(chip, AGX_CAP_HAL200_COLOR_2D_COMPRESSION), leaving G16G/G17P (lossless == true) unchanged while restricting G15G to plane 0 of optimal 1x single-level single-layer 2D 1–8B colour images without VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, followed by all common pNext (external/WSI), flag, usage, minimum-extent, hk_mip_level_through_pbe(), hk_g17p_store_class_matches(), and hk_can_compress() guards.
  • Audited HAL200-only paths (hk_cmd_meta.c:2257, :2965, hk_g17p_meta_copy_core.h:277, hk_image.c:610, :1267, hk_chip_shared_compression_supported()): all remain gated on AGX_CAP_HAL200_LOSSLESS_COMPRESSION, so G15G takes the existing compressed graphics fallback and leaves depth/stencil, MSAA, layered, 3D, mip chains, 16-byte formats, shared modifiers, and compressed storage plain.
  • Unit test updates (test-chip-caps.c, test-hk-compression-contract.c, test-hk-g16s-compression.c where all check_shape() formats are 1–8B colour, and test-hk-g17p-compression.c check_g15g_color_2d positive + negative matrix) match the policy.
  • J615 M3 Air G15G hardware rows confirm engagement strictly on 1x 2D plane-0 colour images across 8 CTS groups and 34,336 Pass -> Pass, 0 Fail, 0 GPU faults (with the 4 expected Pass -> NotSupported host_image_copy.identical_memory_layout transitions matching compressed-chip contract), plus Neo G17P 34,334 Pass -> Pass, 0 transitions.
Evidence
  • src/asahi/lib/agx_chip_caps.h: verified all 32 capability bits 0..31 are distinct (unsigned mask in agx_chip_has_cap and test-chip-caps.c). Note for future PRs: bit 31 fills the 32-bit mask, so the next cap added will require widening to uint64_t.
  • src/asahi/vulkan/hk_g17p_compression.h & src/asahi/vulkan/hk_image.c: verified color_2d_only early rejection and preservation of AGX_CAP_HAL200_LOSSLESS_COMPRESSION gates on compute blit / block-mip / shared-modifier / storage paths.
  • Reported verification at 7ae7f27e: host tests 329 Ok / 26 Fail (matching base 8bad0a57), J615 G15G A/B 34,336 Pass -> Pass / 0 Fail / 0 GPU faults, Neo G17P 34,334 Pass -> Pass / 0 transitions (traces/gpu/20261129-gpu-ungate-g15vc/).

@RyanTheTide

Copy link
Copy Markdown
Author

J713 (M4 Air, G16G) no-change row, saved 7.3.0-aurora-fleet85, isolated ICDs, base 8bad0a5, same list: 21,989 Pass -> Pass, 0 regressions. 6 Fail -> Fail and 4 DeviceLost -> DeviceLost are the same cases on both arms, pre-existing on this older kernel. Restored: Enforcing, 0 failed units. The rows now cover G15G (on), G16G and G17P (unchanged). Traces: traces/gpu/20261129-gpu-ungate-g15vc/j713-g16g.

@RyanTheTide

Copy link
Copy Markdown
Author

The 4 host_image_copy.identical_memory_layout Pass -> NotSupported are expected. G15G now matches G16G and G17P.

identical_memory_layout.optimal.* results from this PR's own row logs (traces/gpu/20261129-gpu-ungate-g15vc):

format J615 G15G base J615 G15G this PR J713 G16G Neo G17P
r8g8b8a8_unorm Pass NS NS NS
r16_sfloat Pass NS NS NS
r16_unorm Pass NS NS NS
r16g16_uint Pass NS NS NS
d32_sfloat Pass Pass NS NS
r32g32b32a32_sfloat Pass Pass NS NS
d24_unorm_s8_uint NS NS NS NS
b8g8r8a8_sint, bc5, bc7 Pass Pass Pass Pass

A compressed optimal image isn't byte-identical to the host layout, so the driver drops identicalMemoryLayout and the test reports NotSupported. That's the same contract G16G and G17P already follow. The 4 cases that moved are the 8-byte-or-smaller colour formats this PR compresses. d32 and rgba32f stay Pass on G15G because depth and 16-byte formats stay uncompressed here (narrower than G16G/G17P, as scoped). No Pass became Fail.

That answers the question I'd asked Dj. With App approval and rows on G15G, G16G and G17P, this is ready for the merge train.

…15g-color-2d-compression

# Conflicts:
#	src/asahi/lib/agx_chip_caps.h
#	src/asahi/vulkan/hk_image.c
@RyanTheTide

Copy link
Copy Markdown
Author

Forward-merged aurora-wip (bb858c3) to clear the conflict. No force push.

Two conflicts, both resolved by keeping both sides:

  • agx_chip_caps.h: G15G now carries AGX_CAP_HAL200_COLOR_2D_COMPRESSION (this PR) and AGX_CAP_TRI_MERGE_ACROSS_SIDE_EFFECTS (asahi: merge triangles across fragment side effects on G15G #1347, merged).
  • hk_image.c hk_can_compress_create_info(): aurora-wip's new VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT early-out comes first, then this PR's comment. hk_chip_zeroed_compression_reads_zero() is M5-only, so a zero-initialised image on G15G stays uncompressed, the same as on G16G/G17P.

Host tests on the merged tree: 330 Ok / 26 Fail. The 26 are the same set as the previous head; nothing new fails and nothing new passes.

The functional diff against base is unchanged from the rowed head 7ae7f27: the only additions are the two merged-in sides above.

@aurora-silicon-review aurora-silicon-review Bot 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.

Verdict: MERGE at bb858c3f

Blockers: none

Checked:

  • Audited the forward-merge commit bb858c3f (origin/aurora-wip 082b9e9c into previously approved 7ae7f27e) and full PR diff (+120/-14 across 7 files):
    • src/asahi/lib/agx_chip_caps.h: verified every bit 0..31 in enum agx_chip_cap remains unique (AGX_CAP_HAL200_COLOR_2D_COMPRESSION = 1u << 31), and G15G cleanly preserves both AGX_CAP_HAL200_COLOR_2D_COMPRESSION and merged AGX_CAP_TRI_MERGE_ACROSS_SIDE_EFFECTS (#1347).
    • src/asahi/vulkan/hk_image.c: verified VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT early-out (!hk_chip_zeroed_compression_reads_zero(dev->chip)) remains ahead of the AGX3 compression path, so zero-initialized images stay plain on G15G just like G16G/G17P.
    • Confirmed the functional diff against aurora-wip (agx_chip_caps.h, test-chip-caps.c, hk_g17p_compression.h, hk_image.c, test-hk-compression-contract.c, test-hk-g16s-compression.c, test-hk-g17p-compression.c) is unchanged from 7ae7f27e.
  • Verified host tests at bb858c3f (330 Ok / 26 Fail, identical pre-existing baseline) and carry-over of the multi-chip hardware rows (J615 G15G 34,336 Pass -> Pass / 0 Fail / 0 GPU faults with the 4 expected host_image_copy.identical_memory_layout Pass -> NotSupported matching G16G/G17P; J713 G16G 21,989 Pass -> Pass / 0 regressions; G17P unchanged).
  • Confirmed DCO Signed-off-by on feature commit 7ae7f27e and MERGEABLE on aurora-wip.
Evidence
  • bb858c3f5595deb02b5500289282527aa6efacfc: merge of origin/aurora-wip (082b9e9c) onto 7ae7f27e, resolving only src/asahi/lib/agx_chip_caps.h and src/asahi/vulkan/hk_image.c by retaining both sides.
  • Verified all 32 enum bits (1u << 0 through 1u << 31) in src/asahi/lib/agx_chip_caps.h at bb858c3f have zero collisions.

@RyanTheTide

Copy link
Copy Markdown
Author

@DjDeveloperr, code-owner heads-up: App approval at bb858c3f5595 from a different lane. This PR goes into the merge train's next combined A/B (aurora-wip 59328582 + #1352 #1361 #1362) on M1 Pro G13S + M4 G16G. If that row is clean, I plan to land it via --admin under the 6-point rule no earlier than one hour from now, unless you post a hold.

@RyanTheTide

Copy link
Copy Markdown
Author

Merge-train landing at bb858c3f5595.

Revert: git revert -m 1 <merge commit> on aurora-wip. A regression gets reverted first and fixed after.

@RyanTheTide
RyanTheTide merged commit 9b2702f into aurora-wip Nov 30, 2026
@RyanTheTide
RyanTheTide deleted the feat/borealis-g15g-color-2d-compression branch November 30, 2026 01:36
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.

1 participant