Skip to content

asahi: use disjoint staging banks for 2D-array samples and texel fetches - #752

Merged
DjDeveloperr merged 2 commits into
aurora-wipfrom
perf/agx3-2d-array-banks-only
Nov 23, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-wipfrom
perf/agx3-2d-array-banks-only

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 22, 2026 •

Copy link
Copy Markdown

Use disjoint AGX3 staging banks for 2D_ARRAY texture samples and texel fetches, and widen the AGX3B plain 2D texel-fetch staging ring from 2 to 6 banks.

Motivation

On AGX3 (AGX3B / G17P, G16G and AGX3C / G17G, G17S, G17C), 2D_ARRAY texture samples and immediate-LOD texel fetches previously forced staging coordinates onto bank 0, serializing every consecutive 2D_ARRAY sample/fetch behind a scoreboard retire wait on bank 0 even when independent taps can overlap in flight (such as PCF shadow-array sampling and multi-layer texel fetch loops).

In addition, AGX3B plain 2D texel fetches used only 2 staging banks (plain_banks = 2), capping in-flight plain-2D texel fetch overlap at 2 rather than the 6 8-half banks available in the AGX3B staging file (0..47, bounded by f19 <= 60).

Commits

  1. 7144b33efbc6 — asahi: use disjoint staging banks for 2D-array samples and texel fetches

    • Relocates 2D_ARRAY texture_sample (including shadow PCF, gathers, immediate offsets, immediate bias/LOD, and compute/vertex forms without g17p_uniform_dma) and immediate-LOD 2D_ARRAY texture_load coordinates across disjoint 8-half staging banks on both AGX3B (up to 6 banks, matching 6 scoreboard slots) and AGX3C (up to 8 banks, matching 8 scoreboard slots), while keeping register-addressed descriptor/sampler operands on bank 0.
    • Aligns every span == 8 allocation in agx3_allocate_staging() to 8 halves on AGX3B as well as AGX3C (also 8-aligning existing AGX3B vertex 3D and 2D_ARRAY relocations).
    • Uses agx3_retire_wait_on(emission, enc, I->src[0], bank_retire | wait_mask) for bank_retire on AGX3B (matching AGX3C) and clears wait_mask = 0 afterward so staging_wait does not emit a redundant second wait through r0. Documented in the commit message that this applies to every AGX3B fetch taking bank_retire (consecutive multisample fetches, register-LOD fetches, plain 2D fetches past the ring, and 16-bit coordinate fetches).
    • Adds compiler unit tests (src/asahi/compiler/test/test-agx3-pack-binary.cpp):
      • AGX3PackBinary.TextureSample2DArrayShadowUsesDisjointBanks (staging + encoded SMP coord = bank assertions)
      • AGX3PackBinary.TextureSample2DArrayRegisterOperandStaysOnBankZero
      • AGX3PackBinary.TextureSample2DArrayNewShapesRelocate (staging + encoded SMP coord = bank assertions across all 7 shapes on AGX3B & AGX3C)
      • AGX3PackBinary.TextureSample2DArrayBankOutOfStepWithSlot (2D gradient sample on slot 1 holding halves 0..15, followed by 2D-array samples on slots 2 & 3 encoding SMP with coord = 16 and 24)
      • AGX3PackBinary.TextureFetch2DArrayUsesDisjointBanksAndWraps
      • AGX3PackBinary.TextureFetch2DArrayBankRetireAvoidsR0
      • AGX3PackBinary.TextureFetchBankRetireClearsWaitMask
  2. f014065e27b5 — asahi: expand AGX3B plain 2D texel fetch staging ring from 2 to 6 banks

    • Widens plain_banks on AGX3B from 2 to 6 (bounded by f19 <= 60, matching AGX3B's 6 scoreboard slots).
    • Adds compiler unit test AGX3PackBinary.TextureFetchPlain2DUsesSixBanksOnAGX3B.

Verification (Exact R3 Head f014065e27b5)

  • Policy check: DEFAULT_BRANCH=aurora-wip bash .github/aurora/agent-policy.sh pr HEAD -> PR is clean.
  • Host assert-enabled CI (-Db_ndebug=false, Fedora x86_64, ICD git-f014065e27):
    • meson test --suite asahi: 233/233 PASS (0 Fail / 0 Timeout / 0 Skipped)
    • meson test --suite poly: 5/5 PASS (0 Fail)
  • MacBook Neo (Apple A18 Pro G17P B1, kernel 7.3.0-41.fc44.aurora.aarch64, ICD git-f014065e27):
    • 9-case standalone Vulkan multi-op CPU-readback probe (64x64 = 4,096 px/case, distinct per-layer weights, 9/9 PASS, 0 mismatches, max_err = 0 across 36,864 pixels):
      • fetch_2d_array_8_wrap (8 live 2D_ARRAY texelFetch calls wrapping the 6-bank AGX3B ring)
      • sample_2d_array_9_wrap (9 live 2D_ARRAY texture calls wrapping the 6-bank ring)
      • shadow_2d_array_9_wrap (9 live 2D_ARRAY shadow PCF samples wrapping the 6-bank ring)
      • fetch_plain_2d_8_wrap (8 live plain 2D texelFetch calls exercising Commit 2's 6-bank ring + wrap)
      • offset_2d_array_4, shoff_2d_array_4, gather_2d_array_4, biaslod_2d_array_4
      • grad_fetch_2d_array_7 (textureGrad holding halves 0..15 ahead of 7 2D_ARRAY fetches so bank_retire != 0 runs)
    • AGX_MESA_DEBUG=shaders on device: confirmed 8/9 post-RA texture ops allocated across disjoint banks 0, 8, 16, 24, 32, 40 with wrap and bank_retire waits.
    • Vulkan CTS 1.4.7.1 (5,992 Pass / 16,048 NotSupported / 0 Fail across 22,040 cases in 14 groups):
      • Original 4 PR-body groups (638 Pass / 1,014 NotSupported / 0 Fail):
        • dEQP-VK.glsl.texture_functions.texelfetch.*2darray*: 16 Pass / 8 NotSupported / 0 Fail (24)
        • dEQP-VK.glsl.texture_functions.texture.*2darray*: 26 Pass / 12 NotSupported / 0 Fail (38)
        • dEQP-VK.texture.shadow.*2d_array*: 192 Pass / 576 NotSupported / 0 Fail (768)
        • dEQP-VK.texture.filtering.2d_array.*: 404 Pass / 418 NotSupported / 0 Fail (822)
      • 5 newly relocated 2D_ARRAY sample groups (798 Pass / 954 NotSupported / 0 Fail):
        • dEQP-VK.glsl.texture_gather.*2d_array*: 564 Pass / 846 NotSupported / 0 Fail (1,410)
        • dEQP-VK.glsl.texture_functions.textureoffset.*2darray*: 130 Pass / 60 NotSupported / 0 Fail (190)
        • dEQP-VK.glsl.texture_functions.texturelod.*2darray*: 16 Pass / 8 NotSupported / 0 Fail (24)
        • dEQP-VK.glsl.texture_functions.texturelodoffset.*2darray*: 80 Pass / 40 NotSupported / 0 Fail (120)
        • dEQP-VK.glsl.texture_functions.texture.*2darray*bias*: 8 Pass / 0 NotSupported / 0 Fail (8)
      • 5 AGX3B bank_retire / plain-2D / multisample fetch groups (4,556 Pass / 14,080 NotSupported / 0 Fail):
        • dEQP-VK.glsl.texture_functions.texelfetch.*sampler2d_*: 16 Pass / 8 NotSupported / 0 Fail (24)
        • dEQP-VK.glsl.texture_functions.texelfetch.* (full group): 64 Pass / 32 NotSupported / 0 Fail (96)
        • dEQP-VK.texture.multisample.*: 0 Pass / 10 NotSupported / 0 Fail (10)
        • dEQP-VK.renderpasses.renderpass2.depth_stencil_resolve.*: 4,295 Pass / 13,822 NotSupported / 0 Fail (18,117)
        • dEQP-VK.image.load_store.*2d_array*: 181 Pass / 208 NotSupported / 0 Fail (389)
    • gpubench-vk exact-head interleaved ABBA (4 rounds vs aurora-wip 7248af95852, valid=true on all runs):
      • render.shadow (fmt=d32f, mode=depth_only, CRC c0fb9993 exact):
        • depth=1: 1984.13 -> 1824.82 us (-8.03% wall; gpu_us: 1803.54 -> 1656.83 us, -8.13%)
        • depth=2: 1644.74 -> 1497.01 us (-8.98% wall; gpu_us: 1830.36 -> 1687.17 us, -7.82%)
      • render.shadow (fmt=d16, mode=depth_only, CRC c0fb9993 exact):
        • depth=1: 1366.12 -> 1282.05 us (-6.15% wall; gpu_us: 1293.79 -> 1220.69 us, -5.65%)
        • depth=2: 1136.36 -> 1063.83 us (-6.38% wall; gpu_us: 1321.68 -> 1244.33 us, -5.85%)
      • compress.bw (kind=array, valid=true):
        • depth=1: 556.17 -> 551.88 us (-0.77% wall; -1.58% GPU)
        • depth=2: 388.57 -> 382.61 us (-1.53% wall; -0.49% GPU)
    • Kernel health: kfaults_delta = 0 (45 -> 45), avc_delta = 0.

Still to run

  • Apple M5 (AGX3C / G17S): hardware verification of 9-case multi-op readback probe + CTS groups at exact R3 head f014065e27b5 (queued).
  • Second AGX3B SoC (M4 Pro G16S): reviewer-side hardware verification of items 1–3 at exact R3 head f014065e27b5.

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

@RyanTheTide

Copy link
Copy Markdown

Review at 7fef5b0.

Note: this is a scheduling change, not a fix. 2D_ARRAY samples and fetches used to be pinned to staging bank 0, so each one waited for the one before. The logic holds up: the layer goes to bank+6 and the compare value to bank+4 relative to the chosen bank, !(bank_base & 7) is required, the fetch coord stays <= 60 when staging_base is 16, staged_end feeds agx3_staging_halfs, and G18G keeps its own fetch emitter. What's missing is hardware coverage for the new forms.

  1. agx3_pack_binary.c:15108-15118 also turns on relocation for AGX3C (G17G/G17S) 2D_ARRAY samples, and :2359/:2365 for AGX3C array fetches. Before this PR, AGX3C never encoded a 2D_ARRAY SMP at bank != 0. Every row in the PR is from A18 Pro (AGX3B). Please add an M5 row: the render.shadow / compress.bw kind=array CRCs, plus the CTS groups below.
  2. The CTS groups listed (texture.shadow.2d_array, texture.filtering.2d_array.*, texture_functions.texelfetch/texture 2darray) issue one texture op per shader, so they only ever use bank 0 and never reach the new path. Only the two benchmark CRCs cover it. Please add a readback test with more than 6 outstanding 2D_ARRAY fetches/samples on different layers in one shader, so it wraps the AGX3B bank ring and goes through the bank_retire path.
  3. The relocatable_2d_array predicate (:15108) now also admits shapes that never relocated before. None of them has a unit test or a row: 2D_ARRAY gathers (AUTO_LOD), immediate-offset arrays (including shadow + immediate offset on AGX3B, which the old AGX3B clause excluded), immediate bias/LOD arrays, and compute/vertex arrays without g17p_uniform_dma. Please run dEQP-VK.glsl.texture_gather.2darray, texture_functions.textureoffset/texturelod/texturelodoffset.2darray and texture_functions.texture.2darraybias* on both gens.
  4. The AGX3B plain 2D fetch ring grows from 2 banks to 6 (:2365). That is a separate change from the array work; the only basis given is fetch_ok's coord <= 60 bound. Please cite a witness or test row with more than 2 outstanding plain 2D fetches on AGX3B. Splitting it into its own commit would make a bisect clearer.
  5. agx3_allocate_staging (:8324) now 8-aligns every span==8 allocation on AGX3B. That includes the existing vertex 3D and 2D_ARRAY relocations, which used to be 4-aligned. Please say so in the commit message.
  6. Nit: the comment at :2352-2357 still says "a read with PACK_SMPIR operands keeps the base bank and occupies halves 0..7". That is no longer true for array fetches.

@DjDeveloperr
DjDeveloperr force-pushed the perf/agx3-2d-array-banks-only branch from 7fef5b0 to 942f1fd Compare November 22, 2026 23:55
@DjDeveloperr

Copy link
Copy Markdown
Author

@RyanTheTide Thanks for the detailed review — R2 is pushed at 942f1fd3d647 (2-commit split on aurora-wip) addressing all 6 items:

  1. M5 (AGX3C / G17S) hardware row: Queued with our M5 Pro lane at exact R2 head 942f1fd3d647; we will post the exact-head AGX3C row here as soon as it finishes.
  2. Multi-op CPU-verified readback test (>6 live 2D_ARRAY ops + bank_retire wrap):
    • Ran a 9-case standalone Vulkan CPU-readback suite (64x64 = 4,096 px/case, 36,864 total pixels) on MacBook Neo (Apple A18 Pro G17P B1, ICD git-942f1fd3d6) — 9/9 PASS, 0 mismatches, max_err=0:
      • fetch_2d_array_8_wrap (8 live 2D_ARRAY fetches wrapping all 6 AGX3B banks)
      • sample_2d_array_9_wrap (9 live 2D_ARRAY samples wrapping all 6 AGX3B banks)
      • shadow_2d_array_9_wrap (9 live 2D_ARRAY shadow PCF samples wrapping all 6 banks)
      • grad_fetch_2d_array_7 (textureGrad + 7 2D_ARRAY fetches forcing bank_retire != 0)
      • offset_2d_array_4, shoff_2d_array_4, gather_2d_array_4, biaslod_2d_array_4
      • fetch_plain_2d_8_wrap (Commit 2 plain-2D 6-bank wrap witness)
    • Verified on device via AGX_MESA_DEBUG=shaders that fetch_2d_array_8_wrap, fetch_plain_2d_8_wrap, grad_fetch_2d_array_7, and sample_2d_array_9_wrap actually emit 8/9 post-RA texture ops across disjoint banks 0, 8, 16, 24, 32, 40 with bank wrap and scoreboard retire waits.
    • Also tightened agx3_emit_texture_fetch to use agx3_retire_wait_on(emission, enc, I->src[0], bank_retire | wait_mask) on both AGX3B and AGX3C (avoiding r0 write hazards on AGX3B), covered by unit tests TextureFetch2DArrayUsesDisjointBanksAndWraps and TextureFetch2DArrayBankRetireAvoidsR0.
  3. All 5 newly relocated 2D_ARRAY Vulkan CTS 1.4.7.1 groups on Neo (G17P B1) at exact R2 head 942f1fd3d647:
    • dEQP-VK.glsl.texture_gather.*2d_array*: 564 Pass / 846 NotSupported / 0 Fail (1,410 total)
    • dEQP-VK.glsl.texture_functions.textureoffset.*2darray*: 130 Pass / 60 NotSupported / 0 Fail (190 total)
    • dEQP-VK.glsl.texture_functions.texturelod.*2darray*: 16 Pass / 8 NotSupported / 0 Fail (24 total)
    • dEQP-VK.glsl.texture_functions.texturelodoffset.*2darray*: 80 Pass / 40 NotSupported / 0 Fail (120 total)
    • dEQP-VK.glsl.texture_functions.texture.*2darray*bias*: 8 Pass / 0 NotSupported / 0 Fail (8 total)
    • Combined: 798 Pass / 954 NotSupported / 0 Fail across 1,752 cases (kfaults_delta=0, avc_delta=0), plus compiler unit test TextureSample2DArrayNewShapesRelocate.
  4. Split plain-2D 2 -> 6 fetch bank widening into its own commit:
    • Commit 1 (998425c868df): asahi: use disjoint staging banks for 2D-array samples and texel fetches (keeps plain_banks = 2 on AGX3B).
    • Commit 2 (942f1fd3d647): asahi: expand AGX3B plain 2D texel fetch staging ring from 2 to 6 banks, with unit test TextureFetchPlain2DUsesSixBanksOnAGX3B and Neo readback witness fetch_plain_2d_8_wrap PASS.
  5. Commit 1 span == 8 alignment note: Documented explicitly in Commit 1 (998425c868df) that agx3_allocate_staging now 8-aligns every span == 8 allocation on AGX3B (including existing vertex 3D and 2D_ARRAY relocations).
  6. Stale comment cleanup: Updated the comments at src/asahi/compiler/agx3_pack_binary.c (:2352-2357 and :2391) in Commit 1.

Host assert-enabled CI (-Db_ndebug=false, Fedora x86_64) is 233/233 PASS (0 Fail) and agent-policy.sh pr HEAD is clean at 942f1fd3d647.

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

@RyanTheTide

Copy link
Copy Markdown

Re-review at 942f1fd (998425c + 942f1fd), compared with 7fef5b0. Read only; I did not build or run the host tests at this head.

The code reads correctly to me. The caller predicate and the emitter predicate agree on every admitted 2D-array shape, the sample span is 8 for all of them so the 8-half alignment holds, G18G still takes its own sample and fetch emitters, and AGX2 never reaches this file. What is still open is hardware evidence: the PR body is unchanged from 7fef5b0 (it names a test that no longer exists and lists no result at 942f1fd), so everything new in this push has host unit tests only.

Status of the six points from the first review:

  • Point 5 (8-half alignment of existing AGX3B vertex 3D / 2D-array relocations) is now in the 998425c message. Done.
  • Point 6 (comment at agx3_pack_binary.c:2352) is rewritten. Done.
  • Point 4: the plain 2D ring is its own commit now, thanks. The witness is still only the coord <= 60 bound plus a host test (test-agx3-pack-binary.cpp:17476). See 3 below.
  • Points 1, 2, 3: host tests were added (17225, 17307, 17393), but there is no M5 row, no readback test and no CTS row for the new shapes. See 1 to 3 below.

Remaining requests:

  1. agx3_pack_binary.c:2425-2428: bank retirement on AGX3B now goes through agx3_retire_wait_on(I->src[0], bank_retire | wait_mask) instead of the r0 carrier. I agree with the reason (the old head would have raced an in-flight r0 result on ring wrap, and the new test at 17393 shows it), but this is a third change inside 998425c and it is not limited to arrays. Every AGX3B fetch that takes the bank_retire path changes its code: consecutive multisample fetches and register-LOD fetches (max_banks is 1 for them at :2395, so they retire on every repeat), and plain 2D fetches past the ring. The carrier also rewrites the coordinate register, which was only proven on M5 so far, and for 16-bit coordinates it uses the half form that always waits slot 6. Please say this in the commit message and add an AGX3B row that covers it: dEQP-VK.renderpasses.renderpass2.depth_stencil_resolve.*, the sampler2DMS texelFetch groups, and dEQP-VK.image.load_store.2d_array (array image loads are banked from half 16 now).
  2. Points 1 and 3 again, now at this head: an M5 row (AGX3C 2D-array samples and fetches at bank != 0 have never run on hardware), and on both generations dEQP-VK.glsl.texture_gather.2darray, texture_functions.textureoffset/texturelod/texturelodoffset.2darray, texture_functions.texture.2darraybias*, plus the four groups already in the PR body rerun at 942f1fd. AGX3B is also G15 and G16, not only A18 Pro; a second AGX3B SoC row would help.
  3. Point 2 again: the CTS groups use one texture op per shader, so only a custom shader reaches the ring. Please add a readback test: 8 or more texelFetch (and, separately, texture / textureOffset / shadow) calls on a 2D array with a different layer each, results summed with distinct weights and compared to the expected value, once plain and once with a textureGrad in front so a bank is already held and bank_retire runs (the shape of the test at 17393). The same shader with a plain 2D texture is the witness for 942f1fd.
  4. test-agx3-pack-binary.cpp:17132-17304: the sample tests search for the layer and reference staging only. They never check that the SMP itself names coord = bank, and in every case bank equals 8 * (slot - 1), which is also where the AGX3C staged-block scheme for 2D puts things. Please assert the encoded sample, and add one case where bank and slot are out of step (for example a 2D gradient sample first).
  5. Nit, agx3_pack_binary.c:2440-2451: after the carrier at :2426 has waited bank_retire | wait_mask, staging_wait still holds the rest of wait_mask, so the AGX3B branch at :2448 can emit a second, redundant wait through r0, the carrier the comment above calls unsound here. Clearing wait_mask after the carrier would avoid it. Same on M5 before this PR, so not a blocker.
  6. Please refresh the PR body: test list, host test result and Neo CRC/benchmark rows at 942f1fd.

No chip gates or env knobs added; the !emit_agx3d term at :15114 is an encoding split with its own emitter, which is fine.

We can run the AGX3B rows from 1 to 3 on an M4 Pro (G16S) here and post them.

Assisted-by: LLM (Claude:Opus 5.5)

Allow consecutive 2D-array texture samples (including shadow PCF,
gathers, immediate offsets, immediate bias/LOD, and compute/vertex
forms) and immediate-LOD 2D-array texel fetches to allocate disjoint
8-half staging banks on both AGX3B and AGX3C instead of serializing
through fixed bank 0.

In agx3_allocate_staging(), every span == 8 allocation now aligns to 8
halves rather than 4 on AGX3B as well as AGX3C so consecutive 8-half
banks stay disjoint and satisfy PACK_SMPIR's bank alignment. This also
8-aligns the existing AGX3B vertex 3D and 2D-array relocations, which
previously used 4-half alignment.

In agx3_emit_texture_fetch(), immediate-LOD 2D-array fetches allocate
one 8-half bank per scoreboard slot (6 on AGX3B, 8 on AGX3C) up to the
f19 <= 60 bound and stage their layer into staging_coord + 6. Bank
retirement on AGX3B now uses agx3_retire_wait_on(I->src[0],
bank_retire | wait_mask) rather than the r0 identity carrier so bank
wrap cannot race an unrelated in-flight write to r0, and clears
wait_mask after that carrier so staging_wait does not emit a redundant
second wait through r0. This bank_retire carrier applies to every AGX3B
fetch taking the bank_retire path, including consecutive multisample
fetches and register-LOD fetches (max_banks == 1), plain 2D fetches
past the ring, and 16-bit coordinate fetches (whose half-word carrier
form waits slot 6 as well).

Plain 2D AGX3B fetch bank count is left unchanged here and widened in a
separate follow-up commit.

Signed-off-by: Diljit Singh <hey@djdev.me>
Allow plain 2D texel fetches on AGX3B to allocate up to 6 disjoint
8-half staging banks (bounded by f19 <= 60, matching AGX3B's 6
scoreboard slots) before retiring and wrapping, unifying plain_banks
with the 2D-array fetch ring.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr force-pushed the perf/agx3-2d-array-banks-only branch from 942f1fd to f014065 Compare November 23, 2026 00:29
@DjDeveloperr

Copy link
Copy Markdown
Author

Thanks for the thorough R2 review, @RyanTheTide! R3 is pushed at exact head f014065e27b5 (7144b33efbc6 + f014065e27b5) addressing all six items:

  1. bank_retire commit message & AGX3B hardware coverage: Updated commit 7144b33efbc6 to document that agx3_retire_wait_on(I->src[0], bank_retire | wait_mask) applies to every AGX3B fetch taking bank_retire (consecutive multisample fetches, register-LOD fetches with max_banks == 1, plain 2D fetches past the ring, and 16-bit coordinate fetches). Ran on MacBook Neo (A18 Pro G17P B1, ICD git-f014065e27):
    • dEQP-VK.renderpasses.renderpass2.depth_stencil_resolve.*: 4,295 Pass / 13,822 NotSupported / 0 Fail (18,117 cases)
    • dEQP-VK.image.load_store.*2d_array*: 181 Pass / 208 NotSupported / 0 Fail (389 cases)
    • dEQP-VK.glsl.texture_functions.texelfetch.*sampler2d_*: 16 Pass / 8 NotSupported / 0 Fail (24 cases)
    • Note: dEQP-VK.glsl.texture_functions.texelfetch.*2dms* matched 0 cases in VK CTS 1.4.7.1; I have queued dEQP-VK.texture.multisample.* + full dEQP-VK.glsl.texture_functions.texelfetch.* alongside the gpubench-vk CRC addendum on the next Neo slot.
  2. Exact-head CTS reruns (original 4 + 5 newly relocated groups) & multi-generation rows:
    • All 9 groups passed on MacBook Neo (G17P B1) at f014065e27b5 (1,436 Pass / 1,968 NotSupported / 0 Fail across 3,404 cases; 21,934 total cases across all 12 groups, 0 Fail, kfaults_delta = 0, avc_delta = 0).
    • M5 (AGX3C / G17S) hardware run is queued at exact R3 head f014065e27b5, and we welcome your M4 Pro (G16S) run against f014065e27b5 for the second AGX3B SoC row!
  3. Multi-op CPU-readback probe (wrapping the ring + textureGrad bank_retire + plain 2D witness): Verified on MacBook Neo (G17P B1) at f014065e27b5 — 9/9 PASS (0 mismatches, max_err = 0 across 36,864 CPU-verified pixels): fetch_2d_array_8_wrap, sample_2d_array_9_wrap, shadow_2d_array_9_wrap, fetch_plain_2d_8_wrap (Commit 2 witness), offset_2d_array_4, shoff_2d_array_4, gather_2d_array_4, biaslod_2d_array_4, and grad_fetch_2d_array_7 (textureGrad ahead of 7 2D_ARRAY fetches hitting bank_retire != 0), with AGX_MESA_DEBUG=shaders confirming disjoint banks 0..40 + wrap.
  4. Unit test SMP assertions & out-of-step bank/slot: Updated TextureSample2DArrayShadowUsesDisjointBanks and TextureSample2DArrayNewShapesRelocate to assert agx3_tex_encode_sample() with .coord = bank on both AGX3B and AGX3C, and added TextureSample2DArrayBankOutOfStepWithSlot (2D gradient sample on slot 1 holding halves 0..15, then 2D-array samples on slots 2 & 3 encoding SMP with coord = 16 and 24).
  5. wait_mask = 0 nit (agx3_pack_binary.c:2428): Cleared wait_mask = 0 right after agx3_retire_wait_on(emission, enc, I->src[0], bank_retire | wait_mask) so staging_wait does not emit a redundant second wait through r0, and added TextureFetchBankRetireClearsWaitMask proving the redundant r0 wait is gone.
  6. Refreshed PR body & host CI: Updated the PR body to exact head f014065e27b5 (233/233 asahi + 5/5 poly assert-enabled host CI PASS, agent-policy.sh pr HEAD clean). Will append the gpubench-vk CRC/benchmark + dEQP-VK.texture.multisample.* Neo addendum right after the current Neo slot frees up.

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

@DjDeveloperr

Copy link
Copy Markdown
Author

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

  • meson test --suite asahi: 163 / 163 PASS (0 fail).
  • Standalone 9-case multi-op Vulkan readback probe (test_2d_array_banks): 9 / 9 PASS (0 failures, 0 mismatches, max_err=0 across all 4096 pixels/case):
    • fetch_2d_array_8_wrap, sample_2d_array_9_wrap, shadow_2d_array_9_wrap, fetch_plain_2d_8_wrap, offset_2d_array_4, shoff_2d_array_4, gather_2d_array_4, biaslod_2d_array_4, grad_fetch_2d_array_7.
  • Vulkan CTS 1.4.7.1 (2D_ARRAY 5 relocated + 4 original groups = 3,404 cases, 0 failures):
    • dEQP-VK.glsl.texture_gather.*2d_array*: 880 Pass, 530 NotSupported, 0 Fail
    • dEQP-VK.glsl.texture_functions.textureoffset.*2darray*: 175 Pass, 15 NotSupported, 0 Fail
    • dEQP-VK.glsl.texture_functions.texturelod.*2darray*: 24 Pass, 0 Fail
    • dEQP-VK.glsl.texture_functions.texturelodoffset.*2darray*: 120 Pass, 0 Fail
    • dEQP-VK.glsl.texture_functions.texture.*2darray*bias*: 8 Pass, 0 Fail
    • dEQP-VK.glsl.texture_functions.texelfetch.*2darray*: 24 Pass, 0 Fail
    • dEQP-VK.glsl.texture_functions.texture.*2darray*: 35 Pass, 3 NotSupported, 0 Fail
    • dEQP-VK.texture.shadow.*2d_array*: 192 Pass, 576 NotSupported, 0 Fail
    • dEQP-VK.texture.filtering.2d_array.*: 806 Pass, 16 NotSupported, 0 Fail
  • gpubench-vk (ae90a40) CRCs (status=ok, valid=true):
    • render.shadow (d32f, 2048, depth_only, d=2): crc=c0fb9993 (valid=true, 215.15 us/submit)
    • render.shadow (d16, 2048, depth_only, d=2): crc=c0fb9993 (valid=true, 212.04 us/submit)
    • compress.bw (kind=array, 1440p, d=4): crc=04e09df7 (valid=true, 151.61 us/submit, 359.65 GB/s)
  • Kernel dmesg GPU/MMU faults: 0 (FAULTS_DELTA=0).

@DjDeveloperr

Copy link
Copy Markdown
Author

MacBook Neo (Apple A18 Pro G17P B1, kernel 7.3.0-41.fc44.aurora.aarch64) addendum at exact R3 head f014065e27b5 (ICD git-f014065e27, LIBHK_SHA256=f72c2fe48f8e888bb2cb9d11129cc0d98afdbf459a6a27b3fcadb85caebb8fe3) is complete and clean (kfaults_delta=0, avc_delta=0):

  • CTS 1.4.7.1:
    • dEQP-VK.glsl.texture_functions.texelfetch.* (full group): 64 Pass / 32 NotSupported / 0 Fail (96)
    • dEQP-VK.texture.multisample.*: 0 Pass / 10 NotSupported / 0 Fail (10)
  • gpubench-vk 4-round interleaved ABBA vs aurora-wip 7248af95852 (valid=true on all runs):
    • render.shadow (fmt=d32f, mode=depth_only, CRC c0fb9993 exact):
      • depth=1: 1984.13 -> 1824.82 us (-8.03% wall; gpu_us: 1803.54 -> 1656.83 us, -8.13%)
      • depth=2: 1644.74 -> 1497.01 us (-8.98% wall; gpu_us: 1830.36 -> 1687.17 us, -7.82%)
    • render.shadow (fmt=d16, mode=depth_only, CRC c0fb9993 exact):
      • depth=1: 1366.12 -> 1282.05 us (-6.15% wall; gpu_us: 1293.79 -> 1220.69 us, -5.65%)
      • depth=2: 1136.36 -> 1063.83 us (-6.38% wall; gpu_us: 1321.68 -> 1244.33 us, -5.85%)
    • compress.bw (kind=array, valid=true):
      • depth=1: 556.17 -> 551.88 us (-0.77% wall; -1.58% GPU)
      • depth=2: 388.57 -> 382.61 us (-1.53% wall; -0.49% GPU)

PR body updated with these exact-head Neo addendum results.

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

@RyanTheTide

Copy link
Copy Markdown

Review at f014065.

What changed since 942f1fd (I rebuilt the old R2 pair on the same base, 4c0b0109, and diffed): the code changes only in agx3_emit_texture_fetch, where wait_mask = 0 now follows the bank-retire carrier. The rest is tests and the commit message. Clearing it is safe. The carrier has already waited on bank_retire | wait_mask, so the staging COPYs and the fetch's own wait have nothing left to wait for. It is also the same pattern as the existing pre-staging retire at :2386.

Status of the six R2 points:

  1. Bank-retire scope: the 7144b33 commit message now lists every AGX3B fetch that takes this path. Neo rows: renderpass2.depth_stencil_resolve.* 4,295/0 fail, image.load_store.2d_array 181/0 fail, and the full texelfetch group 64/0 fail. texture.multisample.* is all NotSupported, so the sampler2DMS repeat path is covered only through the resolve group. That is acceptable. Done.
  2. M5 and the new shapes: there is now an M5 Pro (G17S, AGX3C) row with all 9 CTS groups at 0 fail, the same CRCs as Neo (c0fb9993 d32f/d16), the readback probe and 0 faults, plus Neo reruns of all 9 groups at this head. Done. One small thing: the M5 row was run with ASAHI_M5_BRINGUP=1. That variable is not in this tree, so I read it as a kernel or harness setting, not a Mesa knob. Please say so in the row if that is right.
  3. Readback test: 9/9 with 0 mismatches on both Neo and M5. It covers the >6-op wrap for fetch, sample and shadow, the textureGrad-first bank_retire case, and the plain 2D witness for f014065. Done.
  4. SMP assertions: the shadow and new-shape tests now encode and find the SMP with coord = bank, and TextureSample2DArrayBankOutOfStepWithSlot checks banks 16/24 on slots 2/3 on both encodings. Done.
  5. Redundant r0 wait: fixed, with TextureFetchBankRetireClearsWaitMask. Done.
  6. PR body: refreshed for this head. Done.

New issues: none. Both commits carry only the author's Signed-off-by, and there are no chip gates or env knobs.

Verdict: APPROVE. Still owed: the second AGX3B SoC row (M4 Pro G16S: the readback probe and the bank_retire CTS groups at f014065). That one is on us, since we offered to run it, and we will post it here.

@DjDeveloperr

Copy link
Copy Markdown
Author

@RyanTheTide Confirmed: ASAHI_M5_BRINGUP=1 is a legacy bring-up harness environment variable that is not read by aurora-wip Mesa or the kernel (pure no-op here, not a Mesa knob). I'll drop it from our M5 verification harness going forward.

@RyanTheTide

Copy link
Copy Markdown

J616s (M4 Pro, G16S) row at f014065.

This is the second AGX3B SoC row. Base 4c0b010 (the PR's merge base) vs head f014065 as private overlays on one boot (kernel 7.3.0-aurora-fleet81, Enforcing, renderer Apple M4 Pro (G16S B1), Borealis Mesa 26.3.0-devel, assert-enabled build). Runs alternated base and head. Trace dir 20261123-r3-j616s-batch2.

Vulkan CTS 1.4.7.1, the 14 groups from the PR body (21,974 cases): 5,942 Pass / 16,032 NotSupported / 0 Fail on both arms, 0 changed cases.

Group Cases Pass NotSupported Fail
glsl.texture_functions.texelfetch.* (full) 96 64 32 0
texelfetch.*2darray* 24 16 8 0
texelfetch.*sampler2d_* 24 16 8 0
glsl.texture_functions.texture.*2darray* 38 26 12 0
texture.*2darray*bias* 8 8 0 0
textureoffset.*2darray* 180 120 60 0
texturelod.*2darray* 24 16 8 0
texturelodoffset.*2darray* 120 80 40 0
glsl.texture_gather.*2d_array* 1,410 564 846 0
texture.shadow.*2d_array* 768 192 576 0
texture.filtering.2d_array.* 822 404 418 0
texture.multisample.* 10 0 10 0
image.load_store.*2d_array* 389 181 208 0
renderpasses.renderpass2.depth_stencil_resolve.* 18,117 4,295 13,822 0

(Sub-groups overlap with the full texelfetch group. The total counts each case once.)

Multi-op readback probe (GL, same compiler path). The standalone Vulkan probe from the Neo and M5 rows isn't in the tree, so this row uses piglit shader_runner (surfaceless) instead. Each fragment runs 8 to 12 texture ops on a 12-layer rgbw 2D array, one layer per op. Layers are solid R/G/B/W repeating, and layers i and i+6 always differ. The results are summed with distinct weights, and the whole 32x32 window is compared with the expected sum. Shaders:

  • fetch_2d_array_8, fetch_2d_array_12_wrap, fetchoffset_2d_array_8
  • sample_2d_array_9_lod, sample_2d_array_9_bias, offset_2d_array_8 (textureLodOffset), gather_2d_array_8
  • grad_then_fetch_2d_array_8 and grad_then_sample_2d_array_8 (a textureGrad first, so a bank is held and bank_retire runs)
  • fetch_plain_2d_8 (plain 2D witness: 8 fetches across the four quadrants)

Result: 10/10 pass on base and on head, 2 rounds each. The negative controls, which make one op read a stale layer (op 6 reads layer 0 in the 8-op fetch, op 7 reads layer 1 in the 12-op wrap), fail as expected (observed 159 128 96 229 and 80 96 80 191), so the compare detects a single wrong-bank read. Shadow 2D-array is covered only by the CTS group above, not by the probe.

Health: 0 GPU fault, recovery or firmware-crash kernel lines, 0 AVC, 0 failed units, kernel unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr merged commit a676ce9 into aurora-wip Nov 23, 2026
@DjDeveloperr

Copy link
Copy Markdown
Author

Merged into aurora-wip at a676ce9856ee0827557245d48cbb27ad644d07b0 (verified tree 5bb7463026cde21146b41a4a274616ad75883425, PR head f014065e27b5ab22de166b75a50cb7b54f88f796).

Gates verified at exact head f014065e27b5ab22de166b75a50cb7b54f88f796:

  • Independent review: @RyanTheTide Verdict: APPROVE (#issuecomment-7089228213) with final M4 Pro (G16S) second-AGX3B-SoC row completed at #issuecomment-7091257495 (21,974 Vulkan CTS cases, 5,942 Pass / 16,032 NotSupported / 0 Fail, 0 changed cases; 10/10 multi-op readback probe with negative controls; 0 GPU faults).
  • Mirror asahi CI (-Db_ndebug=false): run 45090291942 PASS; local merged-commit agent-policy.sh pr PASS; .github/workflows/asahi.yml unchanged.
  • Hardware proof: Neo (G17P), M5 Pro (G17S B1), and M4 Pro (G16S B1) exact-head rows all PASS with 0 regressions.

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

@RyanTheTide
RyanTheTide deleted the perf/agx3-2d-array-banks-only 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.

2 participants