Repository navigation
asahi,borealis: raise AGX3 Ioto program buffer capacity for large CProg input sets - #1301
Conversation
…og input sets When an AGX3 native constant program imports a few hundred uniform halves containing 8-bit or 16-bit fields, odd compact TPS alignment forces pack_cprog_copy() to split paired halves into two extended 16-bit COPY instructions (10 bytes each on GPU0 / G16G and G17P). On both dEQP-VK.ubo.random.16bit.nested_structs_arrays_instance_arrays_compute.14 (429 CProg input halves, 57 load chunks) and dEQP-VK.ubo.random.8bit.all_out_of_order_offsets.10 (383 CProg input halves, 53 load chunks), the valid Ioto body composes to 6,488 and 6,410 bytes respectively, exceeding the 6,144-byte software buffer sized before TPS CProg input publication was added. The loader then returns NULL and command-buffer recording fails with VK_ERROR_FEATURE_NOT_PRESENT at vkEndCommandBuffer. Even a worst-case 511-half odd-aligned layout across 16 disjoint ranges composes to 8,470 bytes on GPU0 (G16G/G17P) and 6,696 bytes on GPU1 (M5), with a conservative bound of ~10.1 KiB plus fixed tail/suffix. There is no 6 KiB hardware limit: Ioto programs are linear streams bump-allocated out of 128 KiB USC arena chunks with a uint16_t length. Raise AGX3_G17P_COMPUTE_PROGRAM_MAX_SIZE, AGX3_G17P_GRAPHICS_PROGRAM_MAX_SIZE, their Borealis mirrors (guarded by static_assert), and the stream validator's MAX_IOTO_PROGRAM_SIZE from 6,144 to 12,288 bytes. Also pass cprog_inputs to agx3_ioto_uniform_program_desc_body_bound() in hk_fused_compute_ioto_bound() so fused compute reservations cover large CProg input sets. Add unit tests covering both failing UBO compute layouts on G16G and G17P, the 511-half odd-aligned 16-range worst case, and the fused compute Ioto bound check. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Verdict: FINISH, then merge at a528cf44
Blockers:
- Independent maintainer approval at
a528cf44is required before merge.
Checked: no Apple material, no AI attribution, human DCO Signed-off-by, Borealis naming clean in prose, no chip/board/firmware gates, no parameters or hardcoded hardware-safety limits, full diff (+139/-9 across 8 files) verified against all AGX3_G17P_*_PROGRAM_MAX_SIZE / HK_AGX3_G17P_*_PROGRAM_MAX_SIZE / MAX_IOTO_PROGRAM_SIZE sites in src/asahi/, static_assert enforces compiler/Borealis size parity, uint16_t length fields in hk_agx3_multi_draw_ioto_tpl and agx3_reencode_entry comfortably fit 12288, hk_fused_compute_ioto_bound() now passes cprog_inputs to agx3_ioto_uniform_program_desc_body_bound(), host unit tests (219/219) and exact-head hardware rows on J700 (G17P, both #1169 failing UBO cases flipped Fail -> Pass) and J615 (G15G, full 13,240/13,240 dEQP-VK.ubo.* PASS) are recorded, branch is MERGEABLE against aurora-wip.
Evidence
- Checked all occurrences of
6144andPROGRAM_MAX_SIZEacrosssrc/asahi/andsrc/gallium/drivers/asahi/:src/asahi/compiler/agx3_compute_program.h&agx3_graphics_program.h: raised6144u->12288uwith comments explaining the software composer capacity bound.src/asahi/vulkan/hk_agx3_ioto_program_core.h&.c: raised Borealis mirrors to12288uand addedstatic_assertguards against the compiler header constants.src/asahi/drm-shim/asahi_g17p_stream_validator.c: raisedMAX_IOTO_PROGRAM_SIZEto12288.src/asahi/vulkan/hk_cmd_dispatch.c:3639-3651:hk_fused_compute_ioto_bound()switches fromagx3_ioto_uniform_program_body_bound()toagx3_ioto_uniform_program_desc_body_bound()passingcprog_inputswhens->b.info.has_preamble && s->b.info.agx3_preamble_tps_inputs, keeping the reservation >= emitted size (test-hk-fused-cprog.c:247).- Verified downstream struct length fields (
hk_agx3_multi_draw_ioto_tpl.length,agx3_reencode_entry.{in,out}_length) areuint16_t(max 65,535 >= 12,288) and no other hardcoded6144Ioto program caps remain.
- Regression test
test_g17p_compute_large_cprog_inputs()covers both exact#1169layouts plus a 511-half 16-range odd-aligned worst case on bothAGX_CHIP_G16GandAGX_CHIP_G17P, confirming6144 < length <= 12288. - Non-blocking nit:
## Riskdescribes revertability cleanly; adding the explicittwo-waykeyword keeps it aligned with the org PR template.
satchlj
left a comment
There was a problem hiding this comment.
Reviewed and verified at exact head a528cf44462351e359758bbbcb19e925889abe05 on Apple M5 Max (J775c, G17C B1):
- Code audit: Consistent raise of
AGX3_G17P_{COMPUTE,GRAPHICS}_PROGRAM_MAX_SIZE, their Borealis mirrors (guarded bystatic_assertinhk_agx3_ioto_program_core.c), andMAX_IOTO_PROGRAM_SIZEin the stream validator from6144to12288bytes.hk_fused_compute_ioto_bound()properly switches toagx3_ioto_uniform_program_desc_body_bound()withcprog_inputswhenhas_preamble && agx3_preamble_tps_inputs, and unit coverage exercises both real odd-aligned UBO cases and the 511-half worst case on G16G/G17P plus the fused-bound check. - Unit suite:
meson test -C build --suite asahi— 337/337 PASS (0fail). - Live J775c Borealis overlay (
MESA_SHADER_CACHE_DISABLE=1):dEQP-VK.api.smoke.*: 8/8 PASSdEQP-VK.ubo.random.16bit.*(ASAHI_MESA_DEBUG=verify): 750/750 PASSdEQP-VK.ubo.random.8bit.*(ASAHI_MESA_DEBUG=verify): 750/750 PASSdmesg: 0 GPU/kernel faults or warnings.
Verdict: MERGE at a528cf444623.
|
Merge-train landing at
Revert: |
What
Raises the AGX3 Ioto program software buffer capacity from
6,144to12,288bytes (AGX3_G17P_COMPUTE_PROGRAM_MAX_SIZE,AGX3_G17P_GRAPHICS_PROGRAM_MAX_SIZE, their Borealis mirrors guarded bystatic_assert, andMAX_IOTO_PROGRAM_SIZEin the stream validator), and passescprog_inputstoagx3_ioto_uniform_program_desc_body_bound()inhk_fused_compute_ioto_bound()so fused compute Ioto reservations also cover large constant-program input sets.Fixes #1169.
When an AGX3 native constant program imports a few hundred uniform halves that include 8-bit or 16-bit fields, odd compact TPS alignment forces
pack_cprog_copy()to split paired halves into two extended 16-bitCOPYinstructions (10 bytes each on GPU0 / G16G and G17P). Both failingdEQP-VK.ubo.randomcompute cases compose to valid bodies of6,488bytes (429 CProg input halves, 57 load chunks) and6,410bytes (383 CProg input halves, 53 load chunks), exceeding the6,144-byte buffer sized before TPS CProg input publication was added. There is no 6 KiB hardware limit (Ioto programs are linear streams bump-allocated out of 128 KiB USC arena chunks with auint16_tlength), and12,288bytes covers even a worst-case 511-half odd-aligned 16-range layout (8,470B emitted /10,102B bound on G16G/G17P;6,696B emitted on M5).Tested
a528cf444623):meson test --suite asahi: 219/219 OK, 0 Fail (includes newtest_g17p_compute_large_cprog_inputsverifying both exact Borealis: two dEQP-VK.ubo.random cases fail with VK_ERROR_FEATURE_NOT_PRESENT at vkEndCommandBuffer (G16G, G17P) #1169 layouts on G16G and G17P plus the 511-half 16-range worst case, and ahk_fused_compute_ioto_bound()check inhk_fused_cprog).7.3.0-aurora-fleet89, default cmdline,libvulkan_asahi.soc38f9512c5a4737fata528cf444623,cts-vk43fd4ea31):dEQP-VK.ubo.random.16bit.nested_structs_arrays_instance_arrays_compute.14: baseb605996aFail (VK_ERROR_FEATURE_NOT_PRESENTathk_cmd_dispatch.c:1347) -> heada528cf444623Pass (Full white image ok).dEQP-VK.ubo.random.8bit.all_out_of_order_offsets.10: baseb605996aFail (VK_ERROR_FEATURE_NOT_PRESENTathk_cmd_dispatch.c:1347) -> heada528cf444623Pass (Full white image ok).dEQP-VK.ubo.random.16bit.nested_structs_arrays_instance_arrays_compute.13: Pass;fwcrash=0.7.3.0-aurora-fleet90-airs2, default cmdline, same binaryc38f9512c5a4737fata528cf444623,cts-vk43fd4ea31):dEQP-VK.ubo.*suite (2-shard): 13,240/13,240 Pass, 0 Fail,fwcrash=0,Enforcing,0failed units.Risk
Low. Raises only software staging/validator buffer capacities from 6 KiB to 12 KiB (
hk_cmd_publish_ioto_program()still advances the USC arena by the actual aligned program length, so typical small shaders consume zero extra GPU memory). Temporary stack frames in the Ioto composer grow by 6–12 KiB (up to ~24 KiB inagx3_g17p_compute_program_generate), well within Linux thread stacks. Revert by reverting this single commit.Not yet
dEQP-VK.ubo.*sweep on J700 (G17P) and live G16G (J713/J773g) exclusive-compute-queue run (lab J713 currently runsfleet85withoutDRM_ASAHI_FEATURE_INDEPENDENT_QUEUES; G16G uses the identical GPU0 10-byte COPY path verified in unit tests and on G17P).Root-cause measurements and worst-case sizing
cprog_inputshalvesdesc_body_bound16bit.nested_structs_arrays_instance_arrays_compute.148bit.all_out_of_order_offsets.10