Repository navigation
asahi: share AGX3 compiler target selection, preamble sizing and Gallium path checks - #1097
Conversation
Resolve the physical chip and its ISA before constructing the compiler key. AGX3D still packs as G17G/AGX3C and transcodes the result. Query compression support on the physical chip and preserve caller-specific runtime properties. Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
Both callbacks reserve the same descriptor payload and widen the same scalar half exports. Use one sizing callback and keep the encoding-specific cost callbacks. Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
Use the admitted AGX3 paths for precompile keys and the HAL200/HAL300 paths for linked geometry varyings. Read the native mixed-epilog capability when constructing the two fragment keys. Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
|
|
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at f6977235ad64
Blockers:
- Hardware evidence: add a second-generation exact-head hardware row at
f6977235ad64(for example, M5 / G17S AGX3C alongside the existing M4 Pro J616s AGX3B row), because the 5 touched files are shared across AGX2, AGX3B, AGX3C, and AGX3D generations.
Checked:
- Full diff audited across all 3 commits and 5 files (
src/asahi/clc/asahi_clc.c,src/asahi/compiler/agx_compile.h,src/asahi/compiler/agx_nir_opt_preamble.c,src/asahi/lib/agx_device.c,src/gallium/drivers/asahi/agx_state.c): every consolidated target selector, preamble sizing callback, and Gallium path/capability predicate is proven equivalent across all 19enum agx_chiprows plusAGX_CHIP_UNKNOWNand all 8asahi_clctargets. - Commit DCO (
Signed-off-by) verified on all 3 commits; no AI attribution, no Apple or decompiled material, removes raw chip-equality checks in favor of encoding/path/capability queries, no hardcoded safety limits, Borealis naming clean in prose. - CI waiver applied (Mesa repository has no GitHub CI gate); author reports 322/322
asahisuite passes in assert and release builds plus byte-identical generatedlibagxsource/header against base. - Hardware rows at head
f6977235ad64: 1st-generation row present on J616s (M4 Pro, G16S, AGX3B, 995/995 Vulkan CTS pass, 0 assertions/GPU faults/kernel errors/AVC denials/failed units); 2nd-generation exact-head row still pending.
Evidence
- Predicate equivalence verified across all
AGX_CHIPSentries (G13G..G18G,AGX_CHIP_UNKNOWN) and allasahi_clctargets (g13g,g13x,g17p,g15s,g15g,g16g,g17g,g18g):src/asahi/compiler/agx_compile.h,src/asahi/lib/agx_device.c,src/asahi/clc/asahi_clc.c:agx_device_key_set_target()mapsAGX_ISA_ENCODING_AGX3D(G18G) tochip=AGX_CHIP_G17G,encoding=AGX_ISA_ENCODING_AGX3C,emit_agx3d=true, and keeps physicalchip/encodingwithemit_agx3d=falsefor all other chips.target_chip("g18g")returningAGX_CHIP_G18Gkeepstarget_is_native_agx3(),target_is_native_hal200(),target_is_agx3(), andtarget_has_spill_decompress()identical for all 8 targets without string special-casing.src/asahi/compiler/agx_nir_opt_preamble.c:def_size_agx3()merges the identicaldef_size_agx3b()anddef_size_agx3c()callbacks while keepinginstr_cost_cbandrewrite_cost_cbsplit as before.src/gallium/drivers/asahi/agx_state.c:agx_chip_has_cap(dev->chip, AGX_CAP_NATIVE_MIXED_EPILOG)matchesdev->chip == AGX_CHIP_G18G;agx_chip_agx3_path(dev->chip)matchesnative_agx3 || g17_m5 || G18G;agx_chip_native_hal200(dev->chip) || agx_chip_hal300_path(dev->chip)matchesG18G || native_hal200 || g17_m5.
- Hardware row on PR at
f6977235ad64:- J616s (
Apple M4 Pro (G16S B1), AGX3B,7.3.0-aurora-fleet89, assert-enabled isolated Borealis overlay): 995/995 Vulkan CTS pass / 0 fail, 0 assertions, 0 GPU faults, 0 new kernel errors, 0 new AVC, 0 failed units, Enforcing.
- J616s (
- Once a second-generation exact-head hardware row at
f6977235ad64(e.g., M5 / G17S AGX3C) lands, code requires no changes and this is ready to merge.
|
PASS on J714s (MacBook Pro 14-inch M5 Pro, T6050, G17S/AGX3C) at
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict MERGE at f6977235ad64 once merge-result CI passes.
Blockers None.
Checked The shared target helper produces the same compiler keys for all eight precompiled targets. The Gallium predicates agree across all 20 chip identities, and the two preamble sizing callbacks reserve the same slots.
Evidence
The J616s run passed 995 Vulkan CTS cases with no failures. The J714s A/B matched all 48,381 CTS outcomes, including 96 assertion crashes present on both builds, and both builds passed 207 unit tests. J616s result, J714s result
What
Share compiler target selection between runtime shaders and the offline compiler. AGX3D still packs through the AGX3C backend and transcodes the output. Compression queries use the physical target. AGX3B and AGX3C now share their identical preamble export sizing callback.
Gallium uses the admitted AGX3 command paths for shader-state keys and the existing native mixed-epilog capability for fragment compile and link keys.
Tested
Tested: aarch64 Linux, Clang 23.1.5, head
f6977235ad6441023195ef3a2cc23c670b97ce30. Full Asahi Gallium and Vulkan builds with Wayland/X11, EGL and DRM shim. All 322 Asahi tests passed with assertions enabled and all 322 passed in release, including 110 explicitly shim-configured cases per run.The generated libagx source and header matched the base byte for byte. All 22 chip and boundary values matched the previous compiler and Gallium selectors. The unchanged base also passed all 322 tests in both configurations. Base and head each emitted 123,956 warning lines from the same 20 tests in each profile, with identical per-test counts.
Risk
Risk: a change to compiler target selection could select the wrong packer or enable a shader-state path on an unqualified device. The chip rows, runtime capabilities, command layouts and compiler-key representation are unchanged. The three commits can be reverted independently.
Not yet
Physical hardware rows at the head on a target Mac and a second Mac sharing the affected code are pending before merge.