Skip to content

borealis: enable single-level depth-array compression across G17P - #692

Closed
DjDeveloperr wants to merge 1 commit into
aurora-wipfrom
fix/g17p-depth-array-compression
Closed

DjDeveloperr wants to merge 1 commit into
aurora-wipfrom
fix/g17p-depth-array-compression

Conversation

@DjDeveloperr

Copy link
Copy Markdown

Summary

Remove the M4 Pro (g16s) gate on depth_array in hk_hal200_compression_eligible() so all G17P GPUs admit single-sample, single-level depth arrays (VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM, VK_FORMAT_D32_SFLOAT_S8_UINT), while keeping mipmapped, multisampled, and cube-compatible depth images plain.

The shared G17P metadata-stride, ZLS, PBE, texture, fast-clear, and single-layer meta copy/upload/blit paths do not depend on M4 Pro; previously, shadow-map cascades and other layered depth targets fell back to uncompressed ZLS on A18 Pro and M4 Max, paying ~2× bandwidth on D32_SFLOAT arrays relative to D16_UNORM.

Updates test-hk-g17p-compression.c and test-hk-g16s-compression.c for the widened policy and negative checks (mipmapped, multisampled, cube-compatible depth arrays stay plain).

Verification

Unit tests & policy

  • DEFAULT_BRANCH=aurora-wip bash .github/aurora/agent-policy.sh pr HEAD: PR head is clean
  • fedora-mesaci.sh (c46f292a2b2): 156/156 PASS, 0 FAIL

Hardware qualification on Apple A18 Pro (G17P B1, kernel 7.3.0-41.fc44.aurora.aarch64, MESA_SHADER_CACHE_DISABLE=true)

  • Layered depth compression oracle (g17p-vulkan-layered-depth --expect-compressed): layered depth: PASS (G17P compression enabled confirmed on z32_float, z16_unorm, z32_float + s8_uint arrays).
  • Interleaved ABBA (gpubench-vk --test render.shadow, 4 rounds, res=2048, inst=2048, origin/aurora-wip f3016978f09 vs c46f292a2b2): all runs bit-exact CRC-32 PASS (c0fb9993 / 7be9463a):
    Case Depth Base (us/sub) Head (us/sub) Speedup GPU time (gpu_us)
    depth_only d32f 1 3289.47 1984.13 1.658× (-39.7%) 3147.82 -> 1797.23 (1.751×)
    depth_only d32f 2 2976.19 1644.74 1.810× (-44.7%) 3153.25 -> 1828.56 (1.724×)
    depth_only d16 1 1811.59 1366.12 1.326× (-24.6%) 1681.16 -> 1291.79 (1.301×)
    depth_only d16 2 1552.80 1136.36 1.366× (-26.8%) 1709.58 -> 1309.29 (1.306×)
    alpha_test d32f 1 3846.15 3425.30 1.123× (-10.9%) 3724.16 -> 3291.85 (1.131×)
    alpha_test d32f 2 3649.83 3205.66 1.139× (-12.2%) 3812.74 -> 3402.10 (1.121×)
    alpha_test d16 1 3144.78 2976.19 1.057× (-5.4%) 2940.21 -> 2792.76 (1.053×)
    alpha_test d16 2 2941.18 2777.78 1.059× (-5.6%) 3074.56 -> 2853.20 (1.078×)
  • Targeted Vulkan CTS (dEQP-VK.pipeline.monolithic.depth.format.{d32_sfloat,d16_unorm,d32_sfloat_s8_uint}.*, dEQP-VK.multiview.depth*, dEQP-VK.renderpass.suballocation.multisample_resolve.*d32*, dEQP-VK.api.copy_and_blit.core.copy_image.inline_copy_image.*{d32_sfloat,d16_unorm}*2d_array*): 673 Pass, 0 Fail, 736 NotSupported (1409 total).
  • System health: kfault_delta=0, avc_delta=0, PMU=30 00 unchanged.

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

@RyanTheTide

Copy link
Copy Markdown

Removing the M4 Pro condition is the right direction. Note that it only changes the A18 Pro and the M4 Max. On the M4 Pro, depth formats always took the !g16s branch with m4_pro captured before g16s = g16s && color, so single-level depth arrays were already compressed there and this change does nothing on T6040.

  • Evidence: the old comment named what was missing on the other two SoCs: a run of the layered paths. Most of the listed CTS does not reach the new shape. pipeline.monolithic.depth.format.* is single-layer, and renderpass.suballocation.multisample_resolve.* is multisampled, which depth_array excludes. Only multiview.depth* and the inline_copy_image *2d_array* subset are layered. Rows at this head on the A18 Pro that touch the per-layer metadata paths:
    • partial and multi-layer depth/stencil clears (dEQP-VK.api.image_clearing.*clear_depth_stencil_image* with layer ranges)
    • dEQP-VK.api.copy_and_blit.*{blit_image,image_to_buffer,buffer_to_image,resolve_image}* on 2d_array depth
    • dEQP-VK.geometry.layered.*
    • dEQP-VK.texture.shadow.2d_array.*
    • attachment-feedback-loop depth arrays (allowed_usage admits ATTACHMENT_FEEDBACK_LOOP for depth, hk_g17p_compression.h:252, and test-hk-g16s-compression.c:395 asserts those are eligible)
      The commit also covers the M4 Max, which has no row yet.
  • hk_g17p_compression.h:47: the file header still says depth arrays are M4 Pro only.
  • hk_g17p_compression.h:357: "Preserve the qualified Neo policy for every pre-existing caller" no longer holds, because hk_g17p_compression_eligible() now admits depth arrays. Only tests call it, but the comment should change with the policy.

The shadow-cascade numbers on the A18 Pro look good. With layered clear/copy/sample rows I would be happy with this.

Assisted-by: LLM (Claude:Opus 5.5)

hk_hal200_compression_eligible() gated single-sample, single-level depth
arrays behind the M4 Pro (g16s) flag even though the shared G17P
metadata-stride, ZLS, PBE, texture, fast-clear, and single-layer meta
copy/upload/blit paths do not depend on M4 Pro. As a result, shadow-map
cascades and other layered depth targets fell back to uncompressed ZLS
on A18 Pro and M4 Max, paying nearly 2x bandwidth for D32_SFLOAT arrays
relative to D16_UNORM.

Remove the M4 Pro guard on depth_array so all G17P GPUs admit
single-sample, single-level depth arrays (D32_SFLOAT, D16_UNORM,
D32_SFLOAT_S8_UINT), while keeping mipmapped, multisampled, and
cube-compatible depth images plain. Update the G17P and G16S policy unit
tests accordingly.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr force-pushed the fix/g17p-depth-array-compression branch from c46f292 to 22d001a Compare November 22, 2026 09:30
@DjDeveloperr

Copy link
Copy Markdown
Author

Updated on exact PR head 22d001a3e4f18fd5f7a29349c8f2db9838995d88 (fix/g17p-depth-array-compression) with full MacBook Neo (G17P B1, Borealis Vulkan, MESA_SHADER_CACHE_DISABLE=true, PMU=30 00, 0 GPU faults, 0 AVC denials) verification across all five layered depth/stencil CTS groups plus the targeted layered-depth probe:

  • g17p-vulkan-layered-depth --expect-compressed: PASS (z32_float 129x127 compressed)
  • Group 1 (dEQP-VK.api.image_clearing.*clear_depth_stencil_image*): 508 Pass / 0 Fail (590 NotSupported, 1,098/1,098 ran)
  • Group 2 (dEQP-VK.api.copy_and_blit.core depth/stencil & array operations): 539 Pass / 0 Fail (561 NotSupported, 1,100/1,100 ran):
    • blit_image.all_formats.depth_stencil.*: 84 Pass / 0 Fail (36 NotSupported)
    • buffer_to_depthstencil.*: 30 Pass / 0 Fail (14 NotSupported)
    • depthstencil_to_buffer.*: 30 Pass / 0 Fail (14 NotSupported)
    • image_to_image.(all_formats.depth_stencil.*|array.array_to_array_whole_mipmap_{d*,s8*}): 279 Pass / 0 Fail (121 NotSupported)
    • depth_stencil_msaa_copy.* (including array_to_array): 96 Pass / 0 Fail (336 NotSupported)
    • resolve_image.(whole_array_image*|layer_copy_before_resolving*): 20 Pass / 0 Fail (40 NotSupported)
  • Group 3 (dEQP-VK.geometry.layered.*): 90 Pass / 0 Fail (10 NotSupported, 100/100 ran)
  • Group 4 (dEQP-VK.texture.shadow.2d_array.*): 192 Pass / 0 Fail (576 NotSupported, 768/768 ran)
  • Group 5 (attachment_feedback_loop / feedback depth/stencil): 9,180 Pass / 0 Fail (2,904 NotSupported, 12,084/12,084 ran)
  • fedora-mesaci (20261122-043102-22d001a3e4f1): 156/156 Pass (includes new ail and hk layered depth-compression unit tests).

Note: Mac Studio M4 Max (G16D) has no hardware verification row on this PR yet — all hardware rows above are MacBook Neo (G17P B1).

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

@RyanTheTide

Copy link
Copy Markdown

Same-boot perf row on the MacBook Neo (G17P B1): head 22d001a3 merged onto current aurora-wip c0b51ef2455 (clean merge 322825a8a99), against c0b51ef2455. This adds the performance side to the CTS rows above.

Depth-array compression makes the gpubench shadow-map rows 1.1-1.8x faster on G17P, with CRC-32 matching base. No other row in the set moves.

render.shadow res=2048 inst=2048 depth base (mean +- sd, n=10) #692 ratio CRC-32
depth_only d32f 1 3,276.7 +- 19.6 us 1,971.6 +- 6.2 us 0.602 match
depth_only d32f 2 2,976.3 +- 15.8 us 1,640.4 +- 5.3 us 0.551 match
depth_only d16 1 1,820.9 +- 8.5 us 1,364.6 +- 4.5 us 0.749 match
depth_only d16 2 1,551.9 +- 6.7 us 1,135.8 +- 1.5 us 0.732 match
alpha_test d32f 1 3,671.3 +- 29.0 us 3,285.2 +- 12.8 us 0.895 match
alpha_test d32f 2 3,315.8 +- 21.5 us 2,934.3 +- 13.7 us 0.885 match

render.deferred (4 configs), render.postfx (3) and compress.bw (8), each at 2 depths, are within 2.6% of base except two noisy depth-1 compress.bw msaa4 rows (1440p +5.0%, where base itself drifted +6.2% between its first and last pass; 2160p -4.5%). An independent CTS 1.4.7.1 pass on the same boot over 3,213 vk-default cases (depth formats x array/layer) is identical to base per case: 1,579 Pass / 0 Fail / 1,634 NotSupported. For scale: macOS 26.6.2 on the same Mac runs depth_only d32f at 1,024.6 / 704.2 us (d1 / d2), so this moves the Neo from 3.2x / 4.2x of Metal to 1.9x / 2.3x.

Method

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken

Copy link
Copy Markdown

J616C (Apple MacBook Pro 16", M4 Max, 32-core T6041, 0x6041 / G16C B1, 7.3.0-j616c-ia34) exact-head hardware verification at 22d001a3e4f1:

  • Overlay resolution: Mesa 26.3.0-devel (git-22d001a3e4), Borealis, derived from Honeykrisp (apiVersion = 1.4.363, vendorID = 0x10005, deviceID = 0x6041).
  • Layered depth compression oracle (g17p-vulkan-layered-depth --expect-compressed, ASAHI_MESA_DEBUG=perf, MESA_SHADER_CACHE_DISABLE=true): PASS — confirmed G17P compression enabled: z32_float 129x127 on J616C with exact readback parity.
  • Vulkan CTS 14-group layered/depth/shadow/feedback matrix (9,679 total cases — 6,414 Pass / 3,265 NotSupported / 0 Fail):
    • dEQP-VK.api.image_clearing.*clear_depth_stencil_image*: 508 Pass / 590 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.depth_stencil.*: 84 Pass / 36 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.buffer_to_depthstencil.*: 30 Pass / 14 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.depthstencil_to_buffer.*: 30 Pass / 14 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats.depth_stencil.*: 276 Pass / 120 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.image_to_image.array.array_to_array_whole_mipmap_d*: 2 Pass / 1 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.image_to_image.array.array_to_array_whole_mipmap_s8*: 1 Pass / 0 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.depth_stencil_msaa_copy.*: 96 Pass / 336 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.resolve_image.whole_array_image*: 16 Pass / 32 NS / 0 Fail
    • dEQP-VK.api.copy_and_blit.core.resolve_image.layer_copy_before_resolving*: 4 Pass / 8 NS / 0 Fail
    • dEQP-VK.multiview.depth*: 2 Pass / 1 NS / 0 Fail
    • dEQP-VK.geometry.layered.*: 90 Pass / 10 NS / 0 Fail
    • dEQP-VK.texture.shadow.2d_array.*: 192 Pass / 576 NS / 0 Fail
    • dEQP-VK.*feedback*depth*: 5,183 Pass / 1,428 NS / 0 Fail
  • gpubench-vk render.shadow (CRC_OK c0fb9993): d1 936.3 us (17.50 Mtri/s, 19.04 Gpix/s), d2 335.6 us (48.82 Mtri/s, 53.12 Gpix/s).
  • Health: 0 GPU faults/hangs delta, 0 failed systemd units, 0 SELinux AVC denials.

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

@DjDeveloperr

Copy link
Copy Markdown
Author

Closing as superseded on aurora-wip (efabab38502d):

Thank you @AxxzyWasTaken and @RyanTheTide for the reviews and J616C M4 Max / Neo verification rows! No remaining functional delta exists vs aurora-wip.

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

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