Repository navigation
agx: relocate AGX3B 2D_MS and 2D_MS_ARRAY fetch staging banks - #1258
Conversation
Allow AGX3B 2D_MS and 2D_MS_ARRAY texel/image fetches to allocate disjoint 8-half sampler staging banks (banks 0..56 for 2D_MS across 6 scoreboard slots, banks 0..24 for 2D_MS_ARRAY) and hoist them ahead of consumers in fragment shaders, matching AGX3C. Previously, AGX3B pinned every staged multisample fetch to bank 0 and slot 1, forcing an outstanding slot-1 stall and emitting serializing wait carriers between back-to-back MSAA fetches (12 carriers in 4x MSAA deferred lighting shaders across Vulkan, DXVK, and vkd3d-proton). Update agx3_tex_core.c (fetch_ok, agx3_tex_stage_ms_sample_at, agx3_tex_stage_ms_array_sample_at), agx3_pack_binary.c (staging_slot, agx3_ms_banks, fetch_wait), and agx_pressure_schedule.c (ilp_agx3b_sample_relocatable), with unit tests covering encoding, bank relocation, zero-carrier multi-slot packing, and fragment hoisting. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
|
…chedule test Signed-off-by: DjDeveloperr <hey@djdev.me>
|
|
There was a problem hiding this comment.
Verdict: FINISH, then merge at f03bc80d4fd9.
Blocker: Please add a G16G hardware row for the newly enabled AGX3B fetch path. The exact-head J700 result exercises the change on G17P. The J615 and J316s results cover older encodings.
Checked: I checked the bank and slot bounds, reuse and wait logic, and the 2D multisample array fixture correction. The corrected test passes in the assert-enabled suite at this commit. The exact-head J700 comparison shows an improvement with matching CRCs and zero CTS failures.
|
Heads-up on a Under Why: |
|
J773g PASS at The 292 targeted GPUBench
All eight CRCs matched |
Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
The J773g row closes the G16G coverage request. The reported assert-enabled integration test with #1255 still aborts when the fourth MSAA sample puts an AGX3B ST_TILE payload at reg24. Please update against aurora-wip and account for the parent vector footprint when deciding which sample loads may move. Include a regression that exercises the four-sample hoist with the split texture-load payloads, and rerun asahi-g17p-mrt-mixed and the Asahi suite on the integrated head. Reproducer and analysis are in #1258 (comment).
On AGX3, RA places the whole vector of a stored split channel in the
tile-store bank: a split channel takes its vector's register (low_gpr in
agx_ra()). A per-sample reload of an R32 target stores channel 0 of each
eight-half 2D_MS texel fetch, so ilp_tile_store_bank_overflows() saw
four two-half payloads (8 halves) where RA needs four eight-half vectors
(32 halves) of the 16-half bank.
With 2D_MS fetches now relocatable, ILP hoisted all four fetches ahead of
the first ST_TILE, pushing a payload to reg24 and aborting the compile
in agx3_pack_binary ("no grounded AGX3 encoding for st_tile") in
asahi-g17p-mrt-mixed test_multisample_background_load() under
-Db_ndebug=false.
Mirror RA's rule: also count a stored channel's parent vector while it
is live. Shaders without ST_TILE (normal deferred MSAA fragments) are
unaffected.
Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
The new check includes the SPLIT parent vector in the low-bank estimate, and the two fixtures directly exercise four R32 MSAA fetches through the scheduler and register allocator. Please post the assert-enabled integrated results for both new fixtures, asahi-g17p-mrt-mixed and the Asahi suite at this head. The prior J773g result predates the scheduler fix.
|
J773g (Mac mini M4, T8132 / G16G B0, firmware Native build on J773g; stock Timed ABBA (
|
| Row | A1 (c9ec6b97) |
B1 (ef6a2e39) |
B2 (ef6a2e39) |
A2 (c9ec6b97) |
Latency Δ (B1/A1, B2/A2) |
CRC |
|---|---|---|---|---|---|---|
render.deferred dram msaa4 1080p d=1 |
1785.7 µs |
1689.2 µs |
1712.3 µs |
1785.7 µs |
−5.41% / −4.11% | 7c09507f |
render.deferred dram msaa4 1080p d=2 |
1412.4 µs |
1315.8 µs |
1315.8 µs |
1412.4 µs |
−6.84% / −6.84% | 7c09507f |
render.deferred tile msaa4 1080p d=1 |
581.4 µs |
577.4 µs |
577.4 µs |
576.0 µs |
−0.69% / +0.23% |
6dc74b48 |
render.deferred tile msaa4 1080p d=2 |
329.4 µs |
329.4 µs |
329.4 µs |
329.4 µs |
0.00% / 0.00% |
6dc74b48 |
render.postfx msaa4 1080p d=2 |
724.6 µs |
726.7 µs |
728.9 µs |
724.6 µs |
+0.29% / +0.58% |
668d6f0a |
Vulkan CTS (--jobs 1, 500/500 cases on both arms)
- Both
c9ec6b9774db(base) andef6a2e39f01b(head): 92 Pass, 406 NotSupported, 2 Crash — 0 head-only failures or crashes. - Both arms hit the exact same 2 pre-existing base cases (
shader_object_unlinked_spirv.multisample.m10_resolve.resolve_cmd.b8g8r8a8_unorm.color.average.region.no_flagsand.d16_unorm_s8_uint.stencil.max.regions_multilayer_rem.no_flags).
Health
0GPU faults,0recoveries,0hang kills,0quarantined owners,0failed units.
There was a problem hiding this comment.
The reported assert-enabled integrated run reproduces asahi-g17p-mrt-mixed on the unfixed merge and passes the full 219-test Asahi suite with the SPLIT parent-vector fix, including the new bank fixtures. The newer-base integration passed on rerun. J773g exact-head ABBA has matching CRCs and no head-only CTS failures or crashes; the two crashes match baseline. This clears my integration blocker. Code approved at this commit. Record any remaining current-head peer coverage in the landing decision.
|
Second-generation non-regression row on J714s (M5 Pro, G17S), kernel
|
|
Merge-train note: App approval at |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at ef6a2e39f01bca395210c4b1619a38383cd903b0
Blockers: none
Checked: I read the whole diff against the merge base c9ec6b9774db, using the same checks as the #1237 review.
- Encoding: at bank 0 / slot 1 the new AGX3B paths of
agx3_tex_stage_ms_sample_at()andagx3_tex_stage_ms_array_sample_at()produce the same fields as the fixed encoders they replace. KV(56)/KV(57) are moved to the tail and dropped on AGX3B, and the test compares the bytes. - Bounds on AGX3B: bank 8-aligned and at most 56 (2D_MS) or 24 (2D_MS_ARRAY), slot 1..6, wait mask 0x3f.
packed_layerkeeps the old limit of 190.fetch_ok()and thems_bankscounts agree with these limits. - Sample operand: the immediate-sample
out[5] & 0x06check now only applies to non-staged fetches. The dynamic sample (third coordinate) still goes through the integer PACK_SMPIR operand at the relocated bank. For 2D_MS_ARRAY, the layer and sample packing still goes throughms_array_scratch. That pack has no scoreboard slot, the same shape AGX3C already uses with distinct slots. - Waits: staging and the fetch now share
slot, and the fetch waits on1 << (staging_slot - 1). With that wait in place, dropping the AGX3B slot-1 pin and theoutstanding_here & 1stall is sound. The AGX3D stall is unchanged, and AGX3C is unchanged. - Gating: the change is keyed on the ISA encoding (AGX3B/AGX3C), not on chip or board, so there is no NO-GATES problem.
- ILP: the split-parent accounting in
ilp_tile_store_bank_overflows()mirrors RA's low_gpr rule. The scratch array is freed on every path.
Local x86 drm-shim gate, meson test --suite asahi --suite poly with asserts on:
- Head merged into current
aurora-wip73bfd33b46e9(clean merge): 342/342. aurora-wipalone: 342/342.
Tests against the change:
- With the three compiler sources reverted and the new tests kept,
agx3_tex_corefails, and so doAGX3PackBinary.TextureFetch2DMSRelocatesBanksAcrossSlots,AGX3PackBinary.TextureFetchRepeatedWaitKeepsCoordinateUntilFinalCopyandM5CopySchedule.AGX3BFragmentImageLoadsHoist. - With only the split-parent hunk reverted,
BgShaderSchedule.SplitMsR32ReloadKeepsTileStoreBankOnG16G,...OnG17Pandasahi-g17p-mrt-mixedfail.
Rows at this exact head cover both AGX3B generations: J700 G17P (description: CTS 333/0, render.deferred msaa4 +4..5 %, exact CRCs) and J773g G16G (ABBA with matching CRCs, no head-only CTS failures). J714s G17S is a non-regression check on the unchanged AGX3C path. AGX2 code is not touched.
Non-blocking nit: no unit test pins the fetch_ok() rejection of coord 64 (2D_MS) or 32 (2D_MS_ARRAY) on AGX3B, or packed_layer > 190 on the relocatable array publisher. The limits are correct; a test would only lock them in.
Evidence
- merge tree:
aurora-wip73bfd33 + ef6a2e3 -> tree 790b52a0ca48, no conflicts - gate merged: Ok 342, Fail 0
- gate tip: Ok 342, Fail 0
- mutant (3 sources at tip, tests kept): Fail 2 (agx3_tex_core; agx_tests: 3 tests listed above)
- mutant (split_parent hunk reverted): Fail 2 (asahi-g17p-mrt-mixed; agx_tests: BgShaderSchedule.SplitMsR32ReloadKeepsTileStoreBankOn{G16G,G17P})
|
Merge-train landing at
Revert: |
What: Allow AGX3B
2D_MSand2D_MS_ARRAYtexel/image fetches to allocate disjoint 8-half sampler staging banks (banks0..56across 6 scoreboard slots for2D_MS, banks0..24for2D_MS_ARRAY), remove the legacy slot-1 pin and forced slot-1 stall, and hoist them ahead of consumers in fragment shaders, matching AGX3C (sibling of #1237).Details
src/asahi/compiler/agx3_tex_core.c:fetch_ok(): accept relocated 8-half aligned banks (<= 56for2D_MS,<= 24for2D_MS_ARRAY) onAGX3Bstaged multisample fetches.agx3_tex_encode_fetch(): guard the immediate-sampleout[5] & 0x06check with&& !d->staged_sampleso relocatedf19bank bits onAGX3Bep3immediate-texture fetches are not misclassified.agx3_tex_stage_ms_sample_at()andagx3_tex_stage_ms_array_sample_at(): encodeAGX3Bat arbitrary 8-half banks (KV(5, bank + 4)) and slots1..6(KV(12, slot)), matching fixedbank=0, slot=1bit-for-bit.src/asahi/compiler/agx3_pack_binary.c:staging_slot: letms_arrayuseslot(1..6) onAGX3B.agx3_ms_banks: allocate disjoint 8-half banks onAGX3B(6banks for2D_MS,4for2D_MS_ARRAY).agx3_slot_plan/fetch_wait: remove theAGX3Bslot-1 pin and forcedoutstanding_here & 1ustall on2D_MS/2D_MS_ARRAYso back-to-back MSAA fetches issue concurrently across distinct scoreboard slots (eliminating12 -> 0serializing wait carriers and-12native instructions /-120 Bcode size in 4x MSAA deferred lighting fragment shaders across Vulkan and DXVK with zero GPR increase).src/asahi/compiler/agx_pressure_schedule.c:ilp_agx3b_sample_relocatable(): allowAGX_DIM_2D_MSandAGX_DIM_2D_MS_ARRAYonTEXTURE_LOAD/IMAGE_LOADfor fragment sample hoisting.ilp_tile_store_bank_overflows()(merge fix with agx: bound AGX3 ILP schedule by tile-store payload bank #1255): RA places the whole vector of a stored split channel in the tile-store bank (low_gpr/split_sourceinagx_ra()), so the bank check now also counts a stored channel's parent vector while it is live. Before this, a per-sample reload of an R32 target (channel 0 split from each 8-half2D_MStexel fetch) counted as 4x2 = 8 halves; RA needed 4x8 = 32 halves of the 16-half bank, so ILP hoisted all four fetches and a payload landed at reg24 ("no grounded AGX3 encoding for st_tile",asahi-g17p-mrt-mixedtest_multisample_background_load()under-Db_ndebug=false). Shaders withoutST_TILE(normal 4x MSAA deferred fragments) are unaffected.test-agx3-tex-core.c,test-agx3-pack-binary.cpp,test-m5-copy-schedule.cpp): cover bank/slot encoding and rejection bounds, 4-fetch zero-carrier multi-slot bank relocation, non-pinned slot assignment, and fragment hoisting. NewBgShaderSchedule.SplitMsR32ReloadKeepsTileStoreBankOnG17P/G16Gcover hoisted2D_MSTEXTURE_LOAD->SPLIT->ST_TILE; with the scheduler fix reverted they fail (all 4 fetches hoisted,st_tilesource at reg24 and reg16).Tested:
ef6a2e39f01=f03bc80d4fd+ forward merge ofaurora-wipc9ec6b9774d(includes agx: bound AGX3 ILP schedule by tile-store payload bank #1255, borealis: extend AGX3 root-bypass and fast-path push/descriptor-buffer draw updates #1257; no rebase, no force push) + the bank-check fix.-Db_ndebug=false, clang, fedora x86_64): the unfixed merge7b1766149a4reproduces the failure (asahi-g17p-mrt-mixedFAIL at line 1962). With the fix atef6a2e39f01: full--suite asahi219/219pass,0fail, includingasahi-g17p-mrt-mixed,BgShaderSchedule.*andM5CopySchedule.*(38/38, includingLayered8xRgba32ReloadKeepsTileStoreBankOnG17S/G17Gand the 2 new tests);0warnings in touched files.ef6a2e39f01):219/0.aurora-wipa0164c9101c(includes asahi,borealis: speed up cold AGX3/Borealis pipeline compilation #1245's ILP bitset rework of the same file):219/0(mergef477411b3af; a first run hit onehk_pack30 s timeout under load, which also happens on other PRs merged onto this base; the rerun passed all219andhk_pack/agx_tests/asahi-g17p-mrt-mixedagain with a longer timeout).J700, Apple A18 ProG17P B1, stock7.3.0-41.fc44.aurora.aarch64,stock.shPRE=0/POST=0, same boot,0new GPU faults/recoveries/AVCs,0failed units), exact-head ABBA+BAAB,ef6a2e39f01vsaurora-wipc9ec6b9774d, 100% exact CRCs across all 11 cases:gpubench-d3d11 render.deferred mode=dram res=1080p msaa=4:3315.5 -> 3155.8 us(1.051x,+5.1%; settled arms 2..8 non-overlapping: base3315.2..3318.8vs cand3152.8..3159.2, CRCEXACT(7c09507f))gpubench-vk render.deferred mode=dram res=1080p msaa=4:3261.7 -> 3133.6 us(1.041x,+4.1%; settled arms 2..8 non-overlapping: base3243.2..3283.1vs cand3046.1..3142.3, CRCEXACT(7c09507f))d12_def_dram_m4+0.1%,vk_def_dram_m10.0%,vk_uber_ilp0.0%,d11_fill_m40.0%,d12_fill_m40.0%,d11_postfx_m4+0.2%,d12_postfx_m40.0%,vk_postfx_m4+0.4%,vk_def_tile_m1+1.9%(overlapping).g17p-vulkan-clear-pass-load:0/8frames wrong (2x D32S8 and 1x D32) on base and on cand (x2).ef6a2e39f01:333passed,0failed,4not supported (texelfetch.*96/96,robustness2 r32i sampled_image.*108/108,robustness2 rgba32f sampled_image.*108/108,image_robustness r32f samples_4.*12/12,rasterization_order_attachment_access attachments_8_samples_4.*1/1+4NS (extension not exposed),multiview.renderpass2.multisample_resolve.no_queries.*8/8).0e6f072a12c(vscb40d4645ab): Fedora CI218/218; J700 d11+5.0%, vk+3.1%, same CTS set333/0.Risk: two-way · M3, M4, Neo, M5
Not yet: Hardware-measured on M4 (
G16G, sameAGX3Bencoding) or M5 (G17S/G17G,AGX3Cpath unchanged); full Vulkan CTS run on M4/Neo.