Repository navigation
borealis: add 128-bit identical-layout compute image copy for AGX3/M5 - #1172
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict at 7d0376762737: no code blockers found, but this isn't ready to merge. It has no CI run, and no hardware rows on the other chips the new path runs on (see below).
Checked
- Eligibility
- Identical format, type, samples, mips, layers, planes and extent are required.
- Sparse images are refused, and the transfer layouts are checked.
hk_ail_layouts_identical_gpu()requires GPU tiling and the same compression, format, dimensions, samples, levels,size_B, layer stride, metadata offset and compression layer stride, plus the same per-level offsets, strides and tile sizes.- The fields it doesn't compare are either set per device (
policy), set per image type (mipmapped_z, and the type is already checked equal), or covered by the whole-plane copy (level_offsets_compressed_B).
- Regions
- Single-mip copies need zero offsets and whole-level extents, and matching aspect and plane on both sides.
- Partial-layer spans are 2D only. They copy
layers × layer_stride_Bof body, pluslayers × compression_layer_stride_Bof metadata atmetadata_offset_Bwhen the image is compressed. - Multi-mip copies need every level of a plane, all layers and zero base layers, then copy the whole plane.
- Anything else returns false and uses the existing path.
- The overlap check rejects any partial source/destination overlap and skips only exact self-copies.
- Compressed raw copy
- It is self-contained:
libagx_fast_clear's solid mode keeps its colour in the tile body (compression.cl), so copying body plus metadata between identical layouts carries every tile state. - Compressed storage images are excluded, because their
imageStorewrites go through the PBE. Compressed MSAA images are excluded too. - The compute copy goes through
hk_copy_batch, recordscompute_attachmentsfor both planes and is wrapped inhk_meta_begin/end(COMPUTE). That is the same synchronization contract as the existing raw tiled copier.
- It is self-contained:
Before merge
- CI hasn't run at this head. There are 0 checks. The repo's
asahiworkflow is active, so the runs from the fork branch may need a maintainer's approval. - Hardware rows on native AGX3.
agx_chip_native_or_m5()covers the native AGX3 parts (G15/M3, G16/M4, G17P/Neo) as well as the M5 parts. The new path runs ahead ofhk_g17p_copy_raw_image()and the graphics meta copy on all of them, compressed or not.- The only row is on J716c (M5 Max).
- Please add at least one native-AGX3 row at this head, for example a J700 (G17P) or a J773g (G16). It should run the same
copy_and_blit.core.image_to_image.all_formats.*andresolve_image.*CTS set plus a whole-image compressed copy readback.
- The compressed 4x MSAA copy got 7.4% slower in your own table (2.387 to 2.563 ms), on the path this PR says it leaves to fallback. The new checks can't cost 0.17 ms, so this is probably noise, but please re-measure it or explain it. The Mesa train merges with no regressions.
Not blocking
- Doc comment wording: the comment above
hk_agx3_copy_identical_image()lists "MSAA images" among what it copies, but compressed MSAA is excluded. Saying "uncompressed MSAA" would match the code. - Stencil storage usage:
disallow_compressedchecksvk.usageonly. A stencil plane takes its compression fromstencil_usage, so OR-ingstencil_usagein for the stencil plane would close that edge. - Commit: it is signed off, with no attribution.
Add hk_agx3_copy_identical_image() at the front of hk_xfer_copyimage2() on native AGX3 and M5 (agx_chip_native_or_m5()): when source and destination are non-sparse GPU-tiled images with identical format and byte-identical AIL layouts (including single-sample compressed colour attachments, D32S8/D32F/D16 depth+stencil, and uncompressed MSAA images) and the copy covers whole planes, whole single-mip layers, or full multi-mip chains without partial VA overlap, copy the tiled body and compression metadata directly via batched 128-bit uvec4 compute copies (hk_copy_batch), avoiding decompress+recompress and multi-pass graphics render passes. Keep compressed storage images (VK_IMAGE_USAGE_STORAGE_BIT) on the Texture+PBE path for graphics PBE coherency, and keep compressed MSAA images on the compressed meta path where hardware compression avoids copying the full uncompressed sample backing buffer. Signed-off-by: oreater <145754695+oreater@users.noreply.github.com>
7d03767 to
3af09b4
Compare
|
Thanks for the detailed review! Updated at
|
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 3af09b42eafb
Blockers: none
Checked: Read the whole of hk_agx3_copy_identical_image(). Eligibility needs identical AIL layouts (tiling, compression, per-level offsets/strides/tiles, metadata offset and compression layer stride), whole planes, whole layers or the full mip chain, no sparse, transfer layouts checked; compressed storage images (usage and stencil_usage) and compressed MSAA fall back. Partial VA overlap between spans is refused. The compute attachments are added for both images. Selected by agx_chip_native_or_m5(). Gate green. Native-AGX3 row owed as you list; we will run copy_and_blit image_to_image and resolve_image on J700 (G17P) and J713 (G16G).
Evidence
Local Mesa gate (stands in for CI; buildbox x86 docker aurora/hk6356-mesa-x86-tests:local, clang release with asserts, -Dbuild-tests=true -Dtools=asahi,drm-shim, meson test --suite asahi --suite poly):
- base
aurora-wip90211df6816: 335/335 OK. - batch build:
90211df6816with 22 open PR heads merged on top (#1133 #1137 #1155 #1136 #1140 #1157 #1158 #1160 #1164 #1165 #1167 #1168 #1170 #1171 #1172 #1175 #1182 #1183 #1185 #1187 #1190 #1191; each also merges cleanly alone, and into currentaurora-wipd2e883ab2e3): 335/336 OK. The one failure,agx3_cmat_mixed_mma8, reproduces with #1187 alone on the base (329/330) and is caused by that PR's new test; nothing else in the batch fails.
|
|
|
3af09b4 J713 M4 Air (G16G B0, 7.3.0-aurora-fleet85) PASS: api.copy_and_blit.core.image_to_image.* 33,663 pass / 19,029 not supported / 0 fail, api.copy_and_blit.core.resolve_image.* 76 / 164 / 0 (52,932 cases, every listed case ran), 0 GPU faults, Enforcing, 0 failed, 0 AVC; system Mesa untouched Details
|
… it" Restore full shader binary uploads. Commit f5089f1 (Mesa PR aurora-silicon#1127) introduced a deterministic memory mismatch on J773g (M4 mini, G16G) in the Vulkan CTS case: dEQP-VK.synchronization.op.multi_queue.timeline_semaphore.write_image_compute_indirect_read_copy_image_to_buffer.image_128x128_r8_unorm_concurrent With PR aurora-silicon#1172 active, the regression also produced VK_ERROR_DEVICE_LOST and a GPU firmware recovery. Reverting aurora-silicon#1127 alone cleared both failures in five shard runs while retaining aurora-silicon#1172's identical-layout image copy. Signed-off-by: DjDeveloperr <hey@djdev.me>
What: Add
hk_agx3_copy_identical_image()at the front ofhk_xfer_copyimage2()on native AGX3 and M5 (agx_chip_native_or_m5()) to copy whole planes, whole single-mip layers, or full multi-mip chains of GPU-tiled images with byte-identical AIL layouts directly via 128-bit compute copies (dispatching>= 1 MiBfull-plane spans directly viavk_meta_copy_buffer_addresses()and batching smaller spans viahk_copy_batch), while keeping compressed storage (checking bothvk.usageandvk.stencil_usage) and compressed MSAA images on the existing Texture+PBE/meta paths.Tested: J716c Apple M5 Max at 3af09b4: 334/334
asahi+polydebug CI tests pass; steady-state 200-iter 3-round ABBA vs0b8e9b836ccwins-25.3%(1.34x) on 2K compressed RGBA8 copy (9.073 -> 6.781 ms),-9.6%on 2K D32S8 copy (2.636 -> 2.382 ms), and confirms+0.36%(7.766 -> 7.795 ms, identical VDM render passes) on standalone compressed 4x MSAA fallback; Vulkan CTScopy_and_blit.core.{image_to_image.all_formats,resolve_image}.*+synchronization2A/B 163/220 pass (0 fail, 0 status diffs).Risk: two-way door · native AGX3 (M3/M4/A18 Pro) and M5 (
agx_chip_native_or_m5()) — a plain revert restores the priorhk_g17p_copy_raw_image()/ graphics meta copy path; partial VA overlaps, sparse images, compressedSTORAGE_BITimages (includingstencil_usage), and compressed MSAA images fall back to the existing paths.Not yet: Upstream fork CI approval on
aurora-silicon/mesa(passed on fork); native-AGX3 (G17P/J700 or G16/J773g) hardware verification row (copy_and_blit.core.image_to_image.all_formats.*+resolve_image.*+ compressed whole-image copy readback) is still owed before merge.Benchmarks, fallback audit, and CTS details
Live M5 Max 3-round ABBA vs
0b8e9b836cc(MESA_SHADER_CACHE_DISABLE=1, bit-exact readback)9.073 ms6.781 ms1.34x)pr11_copy_resolve_bench)2.636 ms2.382 ms7.766 ms7.795 msHK_FRAME_ANATOMYthat compressed 4x MSAA copies execute identical VDM render passes (fs=1da39fbc,vs=e0c59f0e) on both base and head; the earlier+7.4%delta in the combined benchmark was caused by running the VDM MSAA test immediately after the RGBA8+D32S8 copies (which ran as VDM passes on base vs CDM dispatches on head, changing VDM clock warm-up). Standalone warmed ABBA confirms+0.36%(A=[7.48..7.88]vsB=[7.64..8.00]).>= 1 MiBspans directly viavk_meta_copy_buffer_addresses()avoidshk_copy_batchover-launchingmax_groups * countthreads across mismatched D32 (16 MiB) + S8 (4 MiB) planes.deqp-vk,MESA_SHADER_CACHE_DISABLE=1):163/220 PASS, 0 FAIL, 57 NotSupported(0status diffs vs base) acrosscopy_and_blit.core.image_to_image.all_formats.{depth_stencil,color}.*,resolve_image.*, andsynchronization2.op.single_queue.*write_image_{fragment,tess_eval}_read_copy_image.*.