Skip to content

borealis,agx: lower color subpass input attachments to on-chip tile memory on AGX3 - #703

Merged
DjDeveloperr merged 6 commits into
aurora-wipfrom
perf/borealis-local-read-tilebuffer
Nov 24, 2026
Merged

DjDeveloperr merged 6 commits into
aurora-wipfrom
perf/borealis-local-read-tilebuffer

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 22, 2026 •

Copy link
Copy Markdown

Summary

Implements general, spec-compliant TBDR on-chip tile-memory lowering for Vulkan color input attachments in Borealis on AGX3 (agx_chip_local_read_tilebuffer(): G16G, G17P, and M5 / G17G/G17S/G17C), keeping eligible BY_REGION color input-attachment barriers within a single on-chip render pass instead of splitting through DRAM.

Scope of on-chip vs memory-backed paths:

  • On-chip tile memory: VK_KHR_dynamic_rendering_local_read color reads after an in-pass BY_REGION color input-attachment barrier, as well as traditional render-pass in-subpass self-dependencies (BY_REGION).
  • Still memory-backed: Traditional multi-subpass G-buffer → lighting passes currently still go through memory because common vk_render_pass lowers subpass transitions outside CmdBeginRendering/CmdEndRendering, and M5 pass merge treats INPUT_ATTACHMENT_READ as an ordered dependency. Depth/stencil input attachments, spilled tilebuffers, non-BY_REGION barriers, and view/format/swizzle mismatches also fall back cleanly to DRAM.

Architecture (5 commits)

  1. agx: support multi-block local_read tile protocol on AGX3 (6d0f68466e8)

    • Adds key.agx3_local_read enabling multi-block LD_TILE / ST_TILE ordering (agx3_g17p_local_read_protocol()) across arbitrary control flow and read-only partitions, grouping single-sample entry-block LD_TILEs and phase-splitting colour class lifetimes (early release of load-only pairs retiring all in-flight load-only scoreboard slots, including shared AGX3B slot 6 reissues; deferred wait for store-only pairs).
    • Preserves per-sample register-mask LD_TILE/ST_TILE ordering for MSAA (msaa > 1) and retires any incoming scoreboard wait before register-sample tile loads.
  2. borealis: keep BY_REGION color input-attachment barriers on-chip when eligible (d0ddf30770a)

    • Extends hk_barrier_classify() with color_input_local_read, color_attachment_count, and depth_stencil_writes so BY_REGION in-pass barriers targeting VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT stay on-chip when the active pass is eligible.
    • Non-BY_REGION, depth/stencil input-attachment barriers, aliasing attachments, spilled tilebuffers, and mixed non-tile accesses still split safely to DRAM.
  3. borealis: lower color subpass input attachments to on-chip tile memory (b29dfcfd694)

    • Preserves a serialized pre-lowering fragment NIR payload and input-attachment descriptor metadata for shaders with color subpassLoad (single-sample and per-sample MSAA), with shader binary cache version bumps.
    • At draw time, validates that bound input-attachment descriptors match active render pass color attachments (matching image, format compatibility, layer/mip/sample counts, identity swizzle, non-spilled tilebuffer), then compiles and caches a monolithic AGX3 fragment program reading directly from tile memory (load_local_pixel_agx) with an inlined color epilog.
    • Tracks kept_local_read_barrier per render pass so any subsequent draw that cannot safely use on-chip tile reads splits the pass cleanly to DRAM before issuing texture-backed reads.
  4. nir/agx: forbid reordering and sinking local_pixel_agx tile accesses (dfc6bd0ab3f)

    • Removes CAN_REORDER from load_local_pixel_agx and store_local_pixel_agx in nir_intrinsics.py and removes nir_intrinsic_load_local_pixel_agx from nir_opt_sink.c.
    • Fixes the tilebuffer WAR hazard on cross-RT VK_KHR_dynamic_rendering_local_read input attachment mappings (e.g. pColorAttachmentInputIndices = {1, 0, 2, 3}, caught by M5 Pro CTS 1.4.7.1 attachment_mapping_input_attachments*), where NIR could sink load_local_pixel_agx(RT0) past store_local_pixel_agx(RT0).
  5. asahi,borealis: gate on-chip local_read with capability predicate and tighten barrier tracking (9f53266b749)

    • Adds agx_chip_local_read_tilebuffer() in agx_chip.h (G16G, G17P, and M5 / G17G/G17S/G17C, excluding unverified G15* and G18G) and routes all Vulkan and compiler local-read gates through it, removing raw AGX_CHIP_G17P checks in hk_prepare_local_read_nir(), bumping HK_CLASSIC_SHADER_BINARY_VERSION (34 -> 35), and failing closed in agx3_pack_binary() if key.agx3_local_read is passed on an unsupported chip.
    • Adds hk_barrier_classify_ex(..., bool *used_local_read) so kept_local_read_barrier is set only when the local-read rule actually kept the barrier, and extracts hk_barrier_local_read_draw_needs_split() with focused unit coverage in test-hk-barrier.c.
    • Expands test-inline-mrt.cpp across G16G, G17P, and G17S plus negative G15*/G18G gating and {1, 0, 2, 3} cross-RT swap WAR regression tests.

Verification

Host CI (fedora-mesaci.sh)

  • Exact HEAD 9f53266b74914bbb8d559e4eeb0da99fc74901b6 (ICD git-9f53266b74): 155/155 PASS (0 fail, 0 timeout, 0 skipped), including agx_tests, hk_barrier, and hk_execution_allowance.
  • DEFAULT_BRANCH=aurora-wip .github/aurora/agent-policy.sh pr HEAD: PR head is clean.

Physical Hardware — MacBook Neo (Apple A18 Pro / G17P B1)

  • R1 ABBA (aurora-wip 9b918e130f5 vs R1 b29dfcfd694) and R2 verification at exact HEAD 9f53266b749 (ICD git-9f53266b74):

gpubench-vk render.deferred (100% bit-exact CRC-32: 16/16 EXACT at R2 9f53266b749)

Res MSAA Mode Depth aurora-wip (us/submit) PR R2 9f53266b749 (us/submit) Speedup vs aurora-wip R2 gpu_us CRC-32
1080p 4x tile 1 11,111.1 3,149.6 3.53x (2.15x faster than dram) 3,050.5 5e4130ce EXACT
1080p 4x tile 2 10,818.7 2,898.6 3.73x (2.19x faster than dram) 3,033.6 5e4130ce EXACT
720p 4x tile 1 5,031.6 1,532.6 3.28x (2.02x faster than dram) 1,409.8 665b6e78 EXACT
720p 4x tile 2 4,735.2 1,360.5 3.48x (2.06x faster than dram) 1,401.1 665b6e78 EXACT
1080p 1x tile 1 1,726.1 1,282.1 1.35x 1,160.0 2cfe9a54 EXACT
1080p 1x tile 2 1,460.0 995.0 1.47x 1,231.8 2cfe9a54 EXACT
720p 1x tile 1 845.2 655.7 1.29x 612.2 db6d5fea EXACT
720p 1x tile 2 730.0 557.1 1.31x 662.4 db6d5fea EXACT
1080p 4x dram 1 6,779.7 6,779.7 1.00x (control) 6,608.0 7c09507f EXACT
1080p 4x dram 2 6,349.2 6,349.2 1.00x (control) 6,399.4 7c09507f EXACT
720p 4x dram 1 3,112.9 3,100.8 1.00x (control) 3,025.5 22db814d EXACT
720p 4x dram 2 2,797.2 2,797.2 1.00x (control) 2,852.5 22db814d EXACT
1080p 1x dram 1 864.2 840.3 1.03x (control) 813.8 2cfe9a54 EXACT
1080p 1x dram 2 707.4 651.5 1.09x (control) 694.1 2cfe9a54 EXACT
720p 1x dram 1 451.0 455.6 0.99x (control) 436.5 db6d5fea EXACT
720p 1x dram 2 337.6 336.7 1.00x (control) 342.5 db6d5fea EXACT

Vulkan CTS on MacBook Neo at exact R2 HEAD 9f53266b749 (8,877 passed, 0 failed, 0 warnings)

CTS Pattern Passed Failed Not Supported
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.local_read.* 23 0 6
dEQP-VK.renderpasses.dynamic_rendering.partial_secondary_cmd_buff.local_read.* 19 0 6
dEQP-VK.renderpasses.renderpass1.suballocation.formats.*.input.* 5,544 0 396
dEQP-VK.renderpasses.renderpass2.suballocation.formats.*.input.* 2,772 0 198
dEQP-VK.renderpasses.renderpass1.suballocation.attachment_allocation.input_output.* 38 0 62
dEQP-VK.renderpasses.renderpass2.suballocation.attachment_allocation.input_output.* 38 0 62
dEQP-VK.renderpasses.renderpass1.dedicated_allocation.attachment_allocation.input_output.* 38 0 62
dEQP-VK.renderpasses.renderpass2.dedicated_allocation.attachment_allocation.input_output.* 38 0 62
dEQP-VK.renderpasses.renderpass1.suballocation.subpass_dependencies.* 32 0 10
dEQP-VK.renderpasses.renderpass2.suballocation.subpass_dependencies.* 41 0 10
dEQP-VK.renderpasses.renderpass1.suballocation.multisample.* 114 0 201
dEQP-VK.renderpasses.renderpass2.suballocation.multisample.* 114 0 201
dEQP-VK.renderpasses.renderpass1.suballocation.*input_attachment* 7 0 0
dEQP-VK.renderpasses.renderpass2.suballocation.*input_attachment* 7 0 0
dEQP-VK.image.general_layout.input_attachment.* 12 0 0
dEQP-VK.multiview.*input_attachments* 40 0 0
Total (R2 9f53266b749) 8,877 0 1,280

The 6 NotSupported cases in both primary_cmd_buff.local_read.* and partial_secondary_cmd_buff.local_read.* are all NotSupported (dynamicRenderingLocalReadDepthStencilAttachments not supported at vktDynamicRenderingLocalReadTests.cpp:2503):

  • depth_stencil_mapping_to_no_index
  • depth_stencil_mapping_to_no_index_depth_clear
  • depth_stencil_mapping_to_no_index_stencil_clear
  • depth_stencil_mapping_to_same_index
  • depth_stencil_mapping_to_large_index
  • depth_mapping_stencil_not

(Note: Neo's installed CTS build does not contain graphics_pipeline_library.local_read.* or attachment_mapping_input_attachments*; those are covered by unit regression test LocalRead.CrossRtSwapPreservesLoadBeforeStore and M5 Pro CTS 1.4.7.1.)

Hardware Health

  • FAULTS_DELTA=0, AVC_DELTA=0, PMU 30 00, neo-no-idle-sleep.service active.

@RyanTheTide

Copy link
Copy Markdown

Thanks, the Neo CRC-exact render.deferred rows and the fallback design (draw-time split whenever a kept input-attachment barrier meets a texture-path read) look good. Some scope and coverage questions before this goes in:

  • Chip scope: the Vulkan gates are all agx_chip_native_or_m5() (hk_cmd_buffer.c:1218, hk_cmd_draw.c:11091, hk_shader.c:6276/7633/8991). The compiler admits any AGX3B encoding (agx_compile.c:12274, agx3_pack_binary.c:10275). agx_chip_native_agx3() includes G15G/S/C and G16G (agx_chip.h:299-322), so this also turns on for M3 and M4. The commit messages and description say G17P and M5. The unit tests cover only G17P/G17S, and the only hardware row is Neo. The pixel-class and scoreboard assumptions (e.g. the shared slot 6 note at agx3_pack_binary.c:14155) are not shown to hold on G15/G16G. Please either restrict this to the proven chips through one capability predicate named for the feature (agx_chip.h:835-841 asks new sites for that rather than a chip set; there is also a new dev->dev.chip == AGX_CHIP_G17P at hk_shader.c:6334), or add rows on M3/M4 hardware. There is no AGX3C hardware row yet either.
  • "Traditional render passes": vk_render_pass emits subpass dependencies outside CmdBeginRendering/CmdEndRendering, so they never reach the in-pass classifier (hk_cmd_buffer.c:1305-1328). The M5 pass merge still treats INPUT_ATTACHMENT_READ as an ordered dependency. As far as I can tell, only in-subpass self-dependencies and dynamic_rendering_local_read stay on-chip. A multi-subpass G-buffer -> lighting pass still goes through memory. Could the description say that?
  • Deferred split: a kept barrier records its dependency while the stream is still open (hk_cmd_buffer.c:1320-1328). The split happens later, at the first fallback draw (hk_cmd_draw.c:12694). The ordering looks right from hk_sync_pass_barrier(), but nothing tests that path: test-hk-barrier.c only covers classification. Could you name CTS cases that hit "barrier kept, then a texture-path input-attachment draw" (depth input attachment after a memory barrier, a different view of the same image, a constant-sample MSAA read), or add a small test?
  • CTS coverage: the listed renderpass1/renderpass2 input-attachment rows are 7 suballocation tests each. Please include renderpasses.renderpass{1,2}.formats..input., attachment_allocation.input_output., subpass_dependencies. and the multisample groups. Please also name the 6 NotSupported local_read cases.
  • Minor: kept_local_read_barrier is set for any kept barrier with INPUT_ATTACHMENT_READ in dst (hk_cmd_buffer.c:1323), even when color_input_local_read was false or no attachment write was involved. Later texture-path draws then split the pass needlessly. Setting it only when the local-read rule actually kept the barrier would avoid that.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Author

Clean-room Apple M5 Pro (J714s / G17S B1 / AGX3C) runtime verification at exact head b29dfcfd6942189e736cf92a6f3317e015b0c44e vs origin/aurora-wip (c0b51ef24) on Linux 7.3.0-m5-slc1 (-Dbuildtype=release -Db_ndebug=true, MESA_SHADER_CACHE_DISABLE=1, taskset -c 12-17 4608 MHz Super cores, exclusive quiet GPU slot):

  • Unit tests (meson test --suite asahi): 154 / 154 PASS (0 fail, including agx_tests, hk_barrier, hk_execution_allowance).
  • Kernel health: 0 new dmesg lines, 0 GPU faults, 0 recoveries across all benchmarks and CTS runs.

1. gpubench-vk render.deferred (5 runs x 200 ms, 16/16 bit-exact CRC-32 match)

On M5 Pro G17S B1, mode=tile at 4x MSAA reaches up to 4.116x faster than origin/aurora-wip and 1.65x faster than mode=dram:

Res MSAA Mode Depth aurora-wip (c0b51ef2) #703 (b29dfcfd) Speedup vs base vs dram gpu_us (base -> #703) CRC-32
1080p 4x tile 1 1,960.78 us 555.56 us 3.529x 1.50x 1,839.25 -> 545.67 us (3.37x) 6dc74b48 EXACT
1080p 4x tile 2 1,652.89 us 401.61 us 4.116x 1.65x 1,749.71 -> 530.54 us (3.30x) 6dc74b48 EXACT
720p 4x tile 1 921.66 us 325.73 us 2.829x 1.33x 924.83 -> 329.88 us (2.80x) cd0ee709 EXACT
720p 4x tile 2 746.27 us 187.44 us 3.981x 1.51x 797.65 -> 241.44 us (3.30x) cd0ee709 EXACT
1080p 1x tile 1 414.08 us 347.22 us 1.193x 0.75x 426.75 -> 354.58 us (1.20x) 2cfe9a54 EXACT
1080p 1x tile 2 270.27 us 210.75 us 1.282x 0.63x 351.08 -> 262.92 us (1.34x) 2cfe9a54 EXACT
720p 1x tile 1 260.42 us 258.06 us 1.009x 0.76x 283.67 -> 229.75 us (1.24x) db6d5fea EXACT
720p 1x tile 2 137.17 us 108.58 us 1.263x 0.72x 169.38 -> 157.38 us (1.08x) db6d5fea EXACT
1080p 4x dram 1 / 2 843.88 / 666.67 us 833.33 / 664.45 us 1.01x / 1.00x (ctrl) — 868.96->866.25 / 737.79->733.75 7c09507f EXACT
720p 4x dram 1 / 2 433.84 / 284.09 us 431.97 / 283.29 us 1.00x / 1.00x (ctrl) — 457.46->452.67 / 349.33->343.67 22db814d EXACT
1080p 1x dram 1 / 2 261.78 / 137.27 us 261.44 / 133.07 us 1.00x / 1.03x (ctrl) — 289.83->291.42 / 210.83->203.29 2cfe9a54 EXACT
720p 1x dram 1 / 2 195.50 / 77.88 us 195.69 / 77.76 us 1.00x / 1.00x (ctrl) — 216.50->215.54 / 154.38->155.33 db6d5fea EXACT

2. Vulkan CTS (deqp-vk 1.4.7.1) — Blocker Found: 30 Regressions on Cross-RT attachment_mapping_input_attachments*

CTS Group (G17S B1) Pass Fail NotSupported
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.local_read.* (53 total; baseline 47/0/6) 32 15 6
dEQP-VK.renderpasses.dynamic_rendering.partial_secondary_cmd_buff.local_read.* 19 0 6
dEQP-VK.renderpasses.dynamic_rendering.graphics_pipeline_library.local_read.* 26 15 6
dEQP-VK.renderpasses.renderpass1.suballocation.*input_attachment* 7 0 1
dEQP-VK.renderpasses.renderpass2.suballocation.*input_attachment* 7 0 1
dEQP-VK.image.general_layout.input_attachment.* 12 0 0
dEQP-VK.multiview.*input_attachments* 40 0 0
dEQP-VK.pipeline.*.attachment_feedback_loop_layout.* (1,000/9,504 sample) 124 0 876

Root Cause of the 30 Regressions (Tilebuffer WAR Hazard — Affects Both G17P & M5!)

All 15 failures in primary_cmd_buff.local_read.* (and the matching 15 in graphics_pipeline_library.local_read.*) are the CTS 1.4.7.1 attachment_mapping_input_attachments* tests (attachment_mapping_input_attachments{,_4,_6,_all*,_superset*}), which all pass on baseline (47 Pass / 0 Fail / 6 NotSupported).

In attachment_mapping_input_attachments, pColorAttachmentInputIndices = {1, 0, 2, 3} swaps RT 0 and RT 1, and frag1 executes:

outColor0 = subpassLoad(inColor0); // reads RT 1 (offset 0x4), writes RT 0 (offset 0x0)
outColor1 = subpassLoad(inColor1); // reads RT 0 (offset 0x0), writes RT 1 (offset 0x4)

AGX_MESA_DEBUG=shaders shows a direct write-after-read (WAR) tilebuffer hazard — st_tile to RT 0 (#0x0) is emitted before ld_tile from RT 0 (#0x0), overwriting RT 0 before it is read:

   wait_pix #0x8
   r0l...r0h = ld_tile #255, _, xyzw, #0x4     ; reads RT 1 (GREEN)
   ...
   wait_pix #0x4
   st_tile ^r1l...r1h, #255, _, xyzw, #0x0     ; OVERWRITES RT 0 (offset 0x0) WITH GREEN!
   r0l...r0h = ld_tile #255, _, xyzw, #0x0     ; READS RT 0 AFTER OVERWRITE (gets GREEN instead of BLUE)
   ...
   st_tile ^r1l...r1h, #255, _, xyzw, #0x4     ; writes GREEN to RT 1 -> max diff (0, 1, 1, 0)

Ensuring all load_local_pixel_agx loads are scheduled / ordered strictly before any store_local_pixel_agx to the same (or any) tilebuffer attachment (e.g. preventing load_local_pixel_agx from sinking past store_local_pixel_agx or keeping load_local_pixel_agx non-reorderable relative to store_local_pixel_agx) should fix all 30 failures across both G17P and M5. Happy to re-verify on M5 Pro as soon as R2 is pushed!

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

@DjDeveloperr

Copy link
Copy Markdown
Author

Pushed R2 at 9f53266b74914bbb8d559e4eeb0da99fc74901b6 addressing all 5 points from @RyanTheTide and the CTS 1.4.7.1 cross-RT WAR hazard caught by [M5 Pro] (#issuecomment-7078008581).

Changes in R2

  • CTS 1.4.7.1 cross-RT WAR hazard (dfc6bd0ab3f — nir/agx: forbid reordering and sinking local_pixel_agx tile accesses):

    • Removed CAN_REORDER from load_local_pixel_agx and store_local_pixel_agx in src/compiler/nir/nir_intrinsics.py, and removed nir_intrinsic_load_local_pixel_agx from src/compiler/nir/nir_opt_sink.c.
    • Prevents NIR from sinking load_local_pixel_agx(RT0) past store_local_pixel_agx(RT0) when pColorAttachmentInputIndices swaps/remaps render targets (e.g. {1, 0, 2, 3} in attachment_mapping_input_attachments*).
    • Added LocalRead.CrossRtSwapPreservesLoadBeforeStore in test-inline-mrt.cpp across {G16G, G17P, G17S} × {1x, 4x}, explicitly running nir_opt_sink(nir_move_all) + nir_opt_move(nir_move_all) and asserting every load_local_pixel_agx precedes every store_local_pixel_agx before full compilation.
  • All 5 review points (9f53266b749 — asahi,borealis: gate on-chip local_read with capability predicate and tighten barrier tracking):

    1. Single capability predicate & no raw G17P check: Added agx_chip_local_read_tilebuffer() in src/asahi/lib/agx_chip.h admitting G16G (M4) + G17P (A18 Pro / M4 Pro / M4 Max) + M5 (G17G/G17S/G17C), excluding unverified G15* and G18G. Routed all Vulkan and compiler gates through it, removed raw AGX_CHIP_G17P checks in hk_prepare_local_read_nir(), added a fail-closed check in agx3_pack_binary(), bumped HK_CLASSIC_SHADER_BINARY_VERSION (34 → 35 for G16G cache safety), and added G16G + negative G15*/G18G checks in test-inline-mrt.cpp.
    2. Precise kept_local_read_barrier tracking: Replaced hk_dependency_has_input_attachment_read() with hk_barrier_classify_ex(..., bool *used_local_read) so kept_local_read_barrier is set only when the local-read rule itself kept the barrier.
    3. Deferred draw-time fallback split tests: Extracted hk_barrier_local_read_draw_needs_split() and added unit coverage in test-hk-barrier.c exercising used_local_read precision and the full kept_local_read_barrier → texture-path input-attachment split → flag-clear state machine. On Neo's installed CTS build, all 23 passing primary_cmd_buff.local_read.* and 19 passing partial_secondary_cmd_buff.local_read.* cases stayed on-chip without requiring a DRAM fallback split (AGX_MESA_DEBUG=perf).
    4. PR description scope: Updated the PR borealis,agx: lower color subpass input attachments to on-chip tile memory on AGX3 #703 body to state clearly that traditional multi-subpass G-buffer → lighting passes still go through memory (vk_render_pass lowers subpass transitions outside CmdBeginRendering/CmdEndRendering, and M5 pass merge treats INPUT_ATTACHMENT_READ as an ordered dep), while VK_KHR_dynamic_rendering_local_read and in-subpass self-deps stay on-chip.
    5. Broader CTS & exact 6 NotSupported names on Neo at 9f53266b749:
      • Host CI (fedora-mesaci.sh): 155/155 PASS (0 fail, 0 skip); agent-policy.sh pr HEAD: PR head is clean.
      • Neo render.deferred (9f53266b749): 16/16 bit-exact CRC-32 (1080p 4x tile d=2: 2,898.6 us, 3.73x vs aurora-wip and 2.19x faster than dram; 1080p 1x tile d=2: 995.0 us, 1.47x vs aurora-wip).
      • Neo Vulkan CTS (9f53266b749): 8,877 passed, 0 failed, 0 warnings (FAULTS_DELTA=0, AVC_DELTA=0, PMU 30 00):
        • primary_cmd_buff.local_read.*: 23/29 pass (0 fail, 6 NotSupported)
        • partial_secondary_cmd_buff.local_read.*: 19/25 pass (0 fail, 6 NotSupported)
        • renderpass{1,2}.suballocation.formats.*.input.*: 5,544 + 2,772 pass (0 fail)
        • renderpass{1,2}.{suballocation,dedicated_allocation}.attachment_allocation.input_output.*: 4 × 38 = 152 pass (0 fail)
        • renderpass{1,2}.suballocation.subpass_dependencies.*: 32 + 41 pass (0 fail)
        • renderpass{1,2}.suballocation.multisample.*: 114 + 114 pass (0 fail)
        • renderpass{1,2}.suballocation.*input_attachment* (14), image.general_layout.input_attachment.* (12), multiview.*input_attachments* (40): all pass (0 fail)
      • All 6 NotSupported cases in local_read.* are the depth/stencil local-read mapping tests (NotSupported (dynamicRenderingLocalReadDepthStencilAttachments not supported at vktDynamicRenderingLocalReadTests.cpp:2503)): depth_stencil_mapping_to_no_index, depth_stencil_mapping_to_no_index_depth_clear, depth_stencil_mapping_to_no_index_stencil_clear, depth_stencil_mapping_to_same_index, depth_stencil_mapping_to_large_index, depth_mapping_stencil_not.

Ready for M5 Pro CTS 1.4.7.1 re-verification and M4 mini (G16G) verification on 9f53266b74914bbb8d559e4eeb0da99fc74901b6!

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

@DjDeveloperr

Copy link
Copy Markdown
Author

Re-verified Apple M5 Pro (J714s / G17S B1 / AGX3C) at exact R2 head 9f53266b74914bbb8d559e4eeb0da99fc74901b6 vs origin/aurora-wip (c0b51ef24) on Linux 7.3.0-m5-slc1 (-Dbuildtype=release -Db_ndebug=true, MESA_SHADER_CACHE_DISABLE=1, taskset -c 12-17, exclusive quiet GPU slot):

All 30 previously failing CTS 1.4.7.1 attachment_mapping_input_attachments* cross-RT WAR-hazard cases now PASS (0 failures across all groups)!

  • Unit tests (meson test --suite asahi): 154 / 154 PASS (0 fail).
  • Vulkan CTS (deqp-vk 1.4.7.1): 297 Pass / 0 Fail / 896 NotSupported (0 warnings, 0 waived):
    CTS Group (G17S B1) R1 (b29dfcfd) R2 (9f53266b)
    dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.local_read.* 32 Pass / 15 Fail / 6 NS 47 Pass / 0 Fail / 6 NotSupported (exact base match)
    dEQP-VK.renderpasses.dynamic_rendering.graphics_pipeline_library.local_read.* 26 Pass / 15 Fail / 6 NS 41 Pass / 0 Fail / 6 NotSupported
    dEQP-VK.renderpasses.dynamic_rendering.partial_secondary_cmd_buff.local_read.* 19 Pass / 0 Fail / 6 NS 19 Pass / 0 Fail / 6 NotSupported
    dEQP-VK.renderpasses.renderpass1.suballocation.*input_attachment* 7 Pass / 0 Fail / 1 NS 7 Pass / 0 Fail / 1 NotSupported
    dEQP-VK.renderpasses.renderpass2.suballocation.*input_attachment* 7 Pass / 0 Fail / 1 NS 7 Pass / 0 Fail / 1 NotSupported
    dEQP-VK.image.general_layout.input_attachment.* 12 Pass / 0 Fail / 0 NS 12 Pass / 0 Fail / 0 NotSupported
    dEQP-VK.multiview.*input_attachments* 40 Pass / 0 Fail / 0 NS 40 Pass / 0 Fail / 0 NotSupported
    dEQP-VK.pipeline.*.attachment_feedback_loop_layout.* (1,000/9,504 sample) 124 Pass / 0 Fail / 876 NS 124 Pass / 0 Fail / 876 NotSupported
  • gpubench-vk render.deferred (5 runs x 200 ms, 16/16 bit-exact CRC-32 match):
    Res MSAA Mode Depth aurora-wip (c0b51ef2) #703 R2 (9f53266b) Speedup vs base vs dram gpu_us (base -> R2) CRC-32
    1080p 4x tile 1 1,960.78 us 534.76 us 3.667x 1.57x 1,839.25 -> 541.31 us (3.40x) 6dc74b48 EXACT
    1080p 4x tile 2 1,652.89 us 390.62 us 4.231x 1.71x 1,749.71 -> 504.42 us (3.47x) 6dc74b48 EXACT
    720p 4x tile 1 921.66 us 322.06 us 2.862x 1.35x 924.83 -> 324.94 us (2.85x) cd0ee709 EXACT
    720p 4x tile 2 746.27 us 182.15 us 4.097x 1.56x 797.65 -> 236.44 us (3.37x) cd0ee709 EXACT
    1080p 1x tile 1 / 2 414.08 / 270.27 us 347.22 / 210.75 us 1.193x / 1.282x 0.75x / 0.69x 426.75->354.73 / 351.08->264.19 2cfe9a54 EXACT
    720p 1x tile 1 / 2 260.42 / 137.17 us 259.07 / 116.48 us 1.005x / 1.178x 0.75x / 0.69x 283.67->236.12 / 169.38->148.90 db6d5fea EXACT
    1080p/720p 4x/1x dram 1 / 2 843.9/666.7 · 433.8/284.1 · 261.8/137.3 · 195.5/77.9 840.3/666.7 · 433.8/284.5 · 262.1/144.7 · 195.3/80.8 1.00x (ctrl) — unchanged 8/8 EXACT
  • Kernel health: 0 new dmesg lines, 0 GPU faults, 0 recoveries.

M5 Pro (G17S B1) row is now 100% green.

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

@DjDeveloperr

Copy link
Copy Markdown
Author

Exact-head M4 hardware verification (dcp74d) for R2 9f53266b7491 vs exact merge-base 9b918e130f58 — PASS / READY TO MERGE:

  • Platform: Apple M4 Mac mini (J773g / T8132, Apple M4 G16G B0), kernel 7.3.0-ARCH-m4prod13, libvulkan_asahi.so SHA-256 35ee314ec9bc4010a1c25f884f0d8505e8f630450742acfa3b3374cb15dd9bf1 (base d68ab81f1040b4eafd4332e1070ff0226d9f8b8be779f5e2cb47389a7c8dd80f).
  • Vulkan CTS & health:
    • vk-mustpass-short: 87/87 Pass (0 Fail)
    • All local_read: 148/0 Pass (24 NotSupported), including 45/45 attachment_mapping_input_attachments* (cross-RT WAR hazard cleanly fixed)
    • renderpass input_attachment + multisample_resolve: 641/0 Pass (525 NotSupported)
    • 0 GPU faults, recoveries, hangs, or kernel dmesg GPU errors.
  • Strict 4-round ABBA gpubench render.deferred (16/16 bit-exact CRCs matching base):
Params D Base wall (µs) #703 R2 wall (µs) Wall Speedup Base GPU (µs) #703 R2 GPU (µs) GPU Speedup rec_cpu (µs) CRC (vs base)
mode=dram,msaa=1,res=1080p 1 1355.02 1351.35 1.003× (+0.3%) 965.33 964.06 1.001× (+0.1%) 7.98 → 7.80 MATCH(2cfe9a54)
mode=dram,msaa=1,res=1080p 2 984.27 984.31 1.000× (-0.0%) 976.46 974.21 1.002× (+0.2%) 8.01 → 7.88 MATCH(2cfe9a54)
mode=dram,msaa=1,res=720p 1 843.17 844.59 0.998× (-0.2%) 461.62 459.94 1.004× (+0.4%) 7.82 → 7.91 MATCH(db6d5fea)
mode=dram,msaa=1,res=720p 2 488.76 489.73 0.998× (-0.2%) 464.50 462.73 1.004× (+0.4%) 7.90 → 11.20 MATCH(db6d5fea)
mode=dram,msaa=4,res=1080p 1 3846.15 3876.20 0.992× (-0.8%) 3442.29 3437.06 1.002× (+0.2%) 9.46 → 9.50 MATCH(7c09507f)
mode=dram,msaa=4,res=1080p 2 3496.67 3496.67 1.000× (+0.0%) 3449.19 3444.22 1.001× (+0.1%) 9.47 → 9.45 MATCH(7c09507f)
mode=dram,msaa=4,res=720p 1 1976.32 1976.32 1.000× (+0.0%) 1580.67 1580.10 1.000× (+0.0%) 9.43 → 9.41 MATCH(22db814d)
mode=dram,msaa=4,res=720p 2 1612.97 1607.87 1.003× (+0.3%) 1592.77 1591.59 1.001× (+0.1%) 9.45 → 9.48 MATCH(22db814d)
mode=tile,msaa=1,res=1080p 1 1677.93 806.49 2.081× (+108.1%) 1282.27 500.54 2.562× (+156.2%) 7.15 → 7.25 MATCH(2cfe9a54)
mode=tile,msaa=1,res=1080p 2 1298.78 507.13 2.561× (+156.1%) 1288.10 503.48 2.558× (+155.8%) 7.26 → 7.39 MATCH(2cfe9a54)
mode=tile,msaa=1,res=720p 1 992.06 549.45 1.806× (+80.6%) 606.11 240.60 2.519× (+151.9%) 7.23 → 7.48 MATCH(db6d5fea)
mode=tile,msaa=1,res=720p 2 618.05 300.85 2.054× (+105.4%) 605.60 244.00 2.482× (+148.2%) 10.18 → 7.40 MATCH(db6d5fea)
mode=tile,msaa=4,res=1080p 1 6097.56 1838.24 3.317× (+231.7%) 5668.85 1408.38 4.025× (+302.5%) 18.21 → 13.56 MATCH(5e4130ce)
mode=tile,msaa=4,res=1080p 2 5681.82 1428.57 3.977× (+297.7%) 5673.92 1409.88 4.024× (+302.4%) 12.84 → 13.42 MATCH(5e4130ce)
mode=tile,msaa=4,res=720p 1 2976.19 1039.51 2.863× (+186.3%) 2564.83 682.52 3.758× (+275.8%) 12.76 → 12.97 MATCH(665b6e78)
mode=tile,msaa=4,res=720p 2 2604.45 688.75 3.781× (+278.1%) 2570.58 683.04 3.763× (+276.3%) 12.73 → 12.96 MATCH(665b6e78)
  • Geomeans:
    • mode=tile: 2.700× (+170.0%) wall / 3.137× (+213.7%) GPU — peak 3.977× wall / 4.025× GPU (1080p msaa=4 d=2: 5681.82 → 1428.57 µs, 2.45× faster than dram)
    • mode=dram: 0.9993× (-0.07%) wall / 1.0019× (+0.19%) GPU (neutral)
    • Overall (16 rows): 1.6425× (+64.25%) wall / 1.7730× (+77.30%) GPU, 0 base-vs-head CRC mismatches.

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown

A18 Pro (MacBook Neo, G17P B1) row for R2 9f53266b, merged onto current aurora-wip c0b51ef2455 (clean merge bf31f1759e2), against c0b51ef2455 alone. Same boot, private ICD overlays, no other change.

Perf: on-chip tile memory works on G17P at R2. Deferred tile MSAA4 at 1080p gets 3.6x faster (11,018 -> 3,091 us at depth 1) and the non-tile rows don't move. CTS 1.4.7.1: identical to base per case, including all 60 attachment_mapping_input_attachments* cases that hit the cross-RT WAR hazard before R2. They all pass now; primary_cmd_buff.local_read.* is 47 Pass / 0 Fail / 6 NotSupported, the same as base.

render.deferred 1080p depth base (mean +- sd, n=10) #703 R2 ratio CRC-32
tile, msaa=4 1 11,017.8 +- 226.4 us 3,090.7 +- 35.7 us 0.281 match
tile, msaa=4 2 10,507.2 +- 181.2 us 2,867.3 +- 32.1 us 0.273 match
tile, msaa=1 1 1,542.3 +- 7.9 us 1,282.1 +- 2.9 us 0.831 match
tile, msaa=1 2 1,256.3 +- 5.7 us 993.6 +- 2.6 us 0.791 match
dram, msaa=4 1 / 2 6,721.2 / 6,346.2 us 6,739.0 / 6,378.2 us 1.003 / 1.005 match
dram, msaa=1 1 / 2 794.8 / 631.0 us 801.9 / 634.3 us 1.009 / 1.005 match

render.postfx (3 configs x 2 depths) and compress.bw (8 configs x 2 depths) are within 3% of base except two noisy depth-1 compress.bw rows (msaa4 1440p +5.5%, where base itself drifted +6.2% between its first and last pass; storage 1440p -4.5%). For scale: the same Mac under macOS 26.6.2 runs tile msaa=4 at 925.9 / 668.4 us (d1 / d2), so with R2 the Neo moves from 11.9x / 15.7x of Metal to 3.3x / 4.3x.

Correction (edited): an earlier version of this comment said the new agx_chip_local_read_tilebuffer() leaves the M4 Pro out. That was wrong. On the G17 kernel runtime, agx_chip_from_identity() (src/asahi/lib/agx_chip.h) maps T6040 (gen 16, variant S) to AGX_CHIP_G17P (only the device name reads G16S), so the predicate does admit it, as its comment says. The M4 Pro runs render.deferred tile msaa=4 at 10-21x of macOS 27.0 Metal on the base, so I'll run this same A/B on it and post the row.

Method and raw numbers

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Author

Thanks for running the independent MacBook Neo (G17P B1) verification and confirming the 3.6× MSAA4 gain and 171/0 CTS 1.4.7.1 parity (including all 60/60 attachment_mapping_input_attachments* cases)!

Pushed R3 (986f71bf5a49) addressing the agx_chip_local_read_tilebuffer() scope point:

  • Replaced the explicit chip list with ISA encoding + command-stream generation selection: (AGX_ISA_ENCODING_AGX3B && AGX_CS_GENERATION_HAL200) || (AGX_ISA_ENCODING_AGX3C && AGX_CS_GENERATION_HAL300).
  • This admits G16S (M4 Pro) and G16C (M4 Max) alongside G16G, G17P, and the M5 family — as well as future HAL200/AGX3B and HAL300/AGX3C parts — without chip-list edits, while keeping unverified G15 (M3) and AGX3D (G18G) on the DRAM fallback path.
  • Codegen for G16S is byte-identical (AGX_ISA_ENCODING_AGX3B) to G16G (M4) and G17P (A18 Pro).
  • Pinned agx_chip_local_read_tilebuffer() in test-chip.c ("0000 00000 1111 11111 0 0") and added G16S/G16C gating tests in test-inline-mrt.cpp.
  • Verification: agent-policy.sh pr HEAD clean, fedora-mesaci (155/0 host tests PASS).

Would love M4 Pro (G16S B1) rows whenever you have a chance!

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

@DjDeveloperr

Copy link
Copy Markdown
Author

Clean-room exact-head Apple M5 Pro (J714s, G17S B1, AGX3C, Linux 7.3.0-m5-slc1) verification at 986f71bf5a49b8dc76e02293e4c9163559ab5963 (-Dbuildtype=release -Db_ndebug=true, MESA_SHADER_CACHE_DISABLE=1, taskset -c 12-17):

  • meson test --suite asahi: 154/154 PASS (0 fail)
  • Targeted Vulkan CTS 1.4.7.1 (297/297 supported PASS, 895 NotSupported, 0 fail):
    • dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.local_read.*: 47/47 supported PASS (6 NotSupported, 0 fail)
    • dEQP-VK.renderpasses.dynamic_rendering.partial_secondary_cmd_buff.local_read.*: 19/19 supported PASS (6 NotSupported, 0 fail)
    • dEQP-VK.renderpasses.dynamic_rendering.graphics_pipeline_library.local_read.*: 41/41 supported PASS (6 NotSupported, 0 fail)
    • dEQP-VK.renderpasses.renderpass1.suballocation.*input_attachment*: 7/7 supported PASS (1 NotSupported, 0 fail)
    • dEQP-VK.renderpasses.renderpass2.suballocation.*input_attachment*: 7/7 supported PASS (1 NotSupported, 0 fail)
    • dEQP-VK.image.general_layout.input_attachment.*: 12/12 PASS (0 fail)
    • dEQP-VK.multiview.*input_attachments*: 40/40 PASS (0 fail)
    • attachment_feedback_loop_layout (1,000-case sample): 124/124 supported PASS (876 NotSupported, 0 fail)
  • gpubench-vk render.deferred (16/16 PASS, CRC_BAD=0):
    • 1080p msaa=4 d=2: tile 389.86 us (2,565 fps, crc=6dc74b48) vs dram 664.45 us (1,505 fps, crc=7c09507f) — 1.70× faster
    • 720p msaa=4 d=2: tile 182.82 us (5,470 fps, crc=cd0ee709) vs dram 284.50 us (3,515 fps, crc=22db814d) — 1.56× faster
    • 1080p msaa=1 d=2: tile 210.75 us (crc=2cfe9a54) / dram 132.28 us (crc=2cfe9a54), all valid
    • 720p msaa=1 d=2: tile 109.05 us (crc=db6d5fea) / dram 77.79 us (crc=db6d5fea), all valid
  • Kernel dmesg delta: 0 new lines / 0 GPU faults

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

@RyanTheTide

Copy link
Copy Markdown

M4 Pro (MacBook Pro, T6040, G17P profile on the G17 runtime) row for R2 9f53266b, as promised above. Same method as the A18 Pro row: merged onto aurora-wip c0b51ef2455 (clean merge bf31f1759e2), against c0b51ef2455, same boot, private ICD overlays.

Perf: the tile path engages on the M4 Pro too. Deferred tile MSAA4 at 1080p gets 3.4-3.9x faster (2,857 -> 828 us at depth 1) with CRC-32 matching base. The DRAM-mode rows don't move. CTS 1.4.7.1: identical to base per case. All 60 attachment_mapping_input_attachments* cases pass; primary_cmd_buff.local_read.* is 47 Pass / 0 Fail / 6 NotSupported.

render.deferred 1080p depth base (mean +- sd, n=10) #703 R2 ratio CRC-32
tile, msaa=4 1 2,857.2 +- 16.3 us 827.8 +- 1.7 us 0.290 match
tile, msaa=4 2 2,580.0 +- 8.1 us 664.4 +- 3.1 us 0.258 match
tile, msaa=1 1 488.9 +- 2.4 us 388.3 +- 1.7 us 0.794 match
tile, msaa=1 2 352.8 +- 1.5 us 255.8 +- 0.1 us 0.725 match
dram, msaa=4 1 / 2 1,641.5 / 1,354.3 us 1,642.6 / 1,352.1 us 1.001 / 0.998 match
dram, msaa=1 1 / 2 299.9 / 171.7 us 299.4 / 172.0 us 0.998 / 1.002 match

render.postfx and compress.bw (both depths) stay within 5% of base. For scale: macOS 27.0 on the same Mac runs tile msaa=4 at 278.7 / 124.8 us (d1 / d2), so the M4 Pro goes from 10.3x / 20.7x of Metal to 3.0x / 5.3x. Tile msaa=1 goes from 1.9x / 3.4x to 1.5x / 2.5x.

Method

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr force-pushed the perf/borealis-local-read-tilebuffer branch from 986f71b to 9ffd7a2 Compare November 24, 2026 08:10
@DjDeveloperr

Copy link
Copy Markdown
Author

Rebased onto current aurora-wip at 9ffd7a2edf26 (clean range-diff adapting agx_nir_lower_tilebuffer_with_conversions's ms_whole_sample argument and hk_shader.c context; asahi CI green on 9ffd7a2edf26, conflict-free against 093c57b67e90).

@DjDeveloperr
DjDeveloperr force-pushed the perf/borealis-local-read-tilebuffer branch from 9ffd7a2 to 4708ad9 Compare November 24, 2026 10:09
@DjDeveloperr

Copy link
Copy Markdown
Author

Rebased cleanly onto aurora-wip (905ae8c2f1de) at 4708ad9027f9 (preserving both #885's byte_stencil and #703's local_read/sample_lr parameters and variant_flags2 bits in hk_shader.c, plus agx_chip.h helpers). agent-policy.sh pr is clean; assert-ON CI passes 172/173 tests (all #703 tests pass; the sole hk_sync_stamps failure is the pre-existing aurora-wip regression from #784 / 0d7b6739699).

Add AGX3 compiler support for monolithic fragment shaders that read color
tilebuffer attachments via load_local_pixel_agx (subpassLoad /
VK_KHR_dynamic_rendering_local_read) on G17P (AGX3B) and M5 (AGX3C).

- Add key.agx3_local_read to enable multi-block tile ordering and
  agx3_g17p_local_read_protocol() across arbitrary control flow and
  read-only partitions, while keeping existing inline-MRT and G18G paths
  unchanged.
- Group single-sample entry-block LD_TILE instructions back-to-back and
  split single-sample colour class lifetimes so load-only pairs release
  (retiring their in-flight tile-load scoreboard slots, including shared
  AGX3B slot 6 reissues) ahead of lighting ALU and write/store-only pairs
  wait only before final stores.
- Preserve per-sample register-mask LD_TILE/ST_TILE ordering and retire
  any incoming wait ahead of register-sample MSAA tile loads.
- Cover single-sample, 4x MSAA, multi-block CFG, disjoint phase-split,
  load-only, and mixed 5-RT phase-split protocols in test-inline-mrt.

Signed-off-by: Diljit Singh <hey@djdev.me>
… eligible

Extend hk_barrier_classify() with color_input_local_read,
color_attachment_count, and depth_stencil_writes so BY_REGION in-pass
barriers targeting VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT stay on-chip
within a single TBDR render pass when the caller confirms on-chip color
local_read eligibility.

Non-BY_REGION barriers, depth/stencil input-attachment barriers,
aliasing attachments, spilled tilebuffers, and barriers combining color
input-attachment reads with non-tile accesses continue to split the pass.
Add unit coverage for all keep/split boundaries in test-hk-barrier.

Signed-off-by: Diljit Singh <hey@djdev.me>
Lower Vulkan color subpass input attachment reads (both traditional
render passes and VK_KHR_dynamic_rendering_local_read) to on-chip AGX3
tilebuffer loads (load_local_pixel_agx) in Borealis on G17P and M5.

- Preserve a serialized pre-lowering fragment NIR payload and input
  attachment binding metadata for shaders using color subpassLoad
  (single-sample and per-sample MSAA), bumping the AGX3 shader binary
  version for cache invalidation.
- At draw time, validate that bound input-attachment descriptors match
  the active render pass color attachments with compatible formats,
  layers, mip levels, identity swizzles, and sample counts, then compile
  and cache a monolithic AGX3 fragment program with tile-memory reads
  and inlined color epilog.
- Enable color_input_local_read in hk_classify_pass_barrier() for
  eligible primary render passes and track kept_local_read_barrier so any
  subsequent draw that cannot use on-chip tile reads safely splits the
  pass to DRAM before issuing texture-backed reads.

Signed-off-by: Diljit Singh <hey@djdev.me>
load_local_pixel_agx and store_local_pixel_agx access mutable on-chip tilebuffer memory. Marking them CAN_REORDER and allowing nir_opt_sink / nir_opt_move to sink load_local_pixel_agx let NIR move a tile load past a tile store to the same render target when local-read attachment mapping swaps render targets (e.g. pColorAttachmentInputIndices = {1, 0, 2, 3}), introducing a tilebuffer WAR hazard (30 CTS 1.4.7.1 failures across attachment_mapping_input_attachments*).

Remove CAN_REORDER from load_local_pixel_agx and store_local_pixel_agx and drop nir_intrinsic_load_local_pixel_agx from nir_opt_sink's can_sink_instr().

Signed-off-by: Diljit Singh <hey@djdev.me>
… tighten barrier tracking

- Add a single feature-named capability predicate agx_chip_local_read_tilebuffer() in agx_chip.h admitting verified G16G (M4), G17P (A18 Pro / M4 Pro / M4 Max), and M5 (G17G/G17S/G17C) while leaving unverified G15* (M3) and G18G (M6) on the DRAM fallback path.
- Route all Borealis and compiler local-read gates through agx_chip_local_read_tilebuffer() and remove the raw AGX_CHIP_G17P checks from hk_prepare_local_read_nir().
- Bump HK_CLASSIC_SHADER_BINARY_VERSION to 35 for G16G serialized local_read payloads.
- Track used_local_read in hk_barrier_classify_ex() so kept_local_read_barrier is set only when the local-read rule actually kept the barrier (not on unrelated barriers that happen to carry INPUT_ATTACHMENT_READ).
- Extend test-inline-mrt (G16G matrix, G15/G18 negative checks, and cross-RT swap load-before-store WAR regression) and test-hk-barrier (used_local_read precision and deferred draw-time fallback split).

Signed-off-by: Diljit Singh <hey@djdev.me>
… generation

Select on-chip local_read eligibility by ISA encoding and command-stream generation (HAL200/AGX3B and HAL300/AGX3C) instead of enumerating individual chips. This admits M4 Pro (G16S) and M4 Max (G16C) alongside G16G, G17P, and the M5 family without future chip-list edits, while keeping unverified G15 (M3) and AGX3D (G18G) on the DRAM fallback path.

Pin the predicate in test-chip.c and add G16S/G16C coverage to test-inline-mrt.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr force-pushed the perf/borealis-local-read-tilebuffer branch from 4708ad9 to 60974fa Compare November 24, 2026 12:04
@DjDeveloperr

Copy link
Copy Markdown
Author

Rebased onto aurora-wip (ca812377287, resolving the #910 shader-binary version and hk_shader_info/hk_cmd_draw.c overlap; merge-clean against 4af141fe167). Verified with assert-on unit CI (177/177 pass).

@joshuaswarren joshuaswarren 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: APPROVED at 60974fafd0.

Blockers: none.

Checked:

  • agx_chip_local_read_tilebuffer() now selects by (AGX3B && HAL200) || (AGX3C && HAL300) instead of the G16G || G17P || g17_m5 chip list — newly admits G16S/G16C, which share the AGX3B/HAL200 pixel-class tilebuffer protocol. G15 (unverified) and G18G/AGX3D (no local-read encoder) correctly stay out.
  • The only consumer, agx3_order_g17p_local_read_tile_ops, admits local_read/subpassLoad shapes under the uniform pixel-class transaction; comment updated to match.
  • On G13G/G13X the predicate is false both before and after (AGX2 encoding, not AGX3B/3C): zero behavior change on our chips. The new test-chip row "0000 00000 1111 11111 0 0" pins that.
  • test-inline-mrt gains G16S/G16C EXPECT_TRUE coverage plus chip-gate rows alongside the existing G15G/G18G false cases.
Evidence: builds, unit tests, 13,781-case dEQP-VK.compute diffs on M1 / M1 Max

Exact head 60974faf built aarch64 on mesa-xbuild (pr703-60974faf).

Host Suite dEQP-VK.compute vs aur-base-617c7fe6
jwm1 (T8103/M1) meson test --suite asahi --suite poly: 182/182 (177 asahi + 5 poly) OK 0 diffs / 13,781 cases
jw16 (T6001/M1 Max) — 0 diffs / 13,781 cases

@DjDeveloperr
DjDeveloperr merged commit b66cf01 into aurora-wip Nov 24, 2026
@DjDeveloperr

Copy link
Copy Markdown
Author

Merged into aurora-wip at b66cf010e90f (head 60974fafd0d9, verified tree 55ff21b67ee2) after exact-head asahi CI (45390089360) and aurora-agent-policy (45390089319) passed, exact-head review approval landed, and live A18 Pro, M4, M4 Pro, M5 Pro, and M1/M1 Max hardware verification confirmed on-chip color subpass input attachment local-read lowering.

AxxzyWasTaken pushed a commit to AxxzyWasTaken/mesa that referenced this pull request Nov 24, 2026
PR aurora-silicon#703 copied meta->g17p_colour_unit_range into the old field name
s->info.fs.g17p_colour_unit_range, which was renamed to
s->info.fs.colour_unit_range on aurora-wip. Update the assignment in
hk_g17p_layout_shader_create_local_read() to match hk_shader_info::fs.

Signed-off-by: Diljit Singh <hey@djdev.me>
@RyanTheTide
RyanTheTide deleted the perf/borealis-local-read-tilebuffer 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