Skip to content

asahi: share AGX3 compiler target selection, preamble sizing and Gallium path checks - #1097

Merged
DjDeveloperr merged 3 commits into
aurora-wipfrom
feat/agx3-chip-split-consolidation
Nov 26, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-wipfrom
feat/agx3-chip-split-consolidation

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 25, 2026 •

Copy link
Copy Markdown

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.

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>
@DjDeveloperr
DjDeveloperr requested a review from a team as a code owner November 25, 2026 22:04
@RyanTheTide

Copy link
Copy Markdown

f6977235ad64 (batched cleanly with #1102 on aurora-wip fd5484a244f4, 0 merge-tree diffs across all 5 changed files) J616s (Apple M4 Pro (G16S B1), AGX3B, 7.3.0-aurora-fleet89, assert-enabled isolated Borealis overlay 778fb46e7fb036e9, MESA_SHADER_CACHE_DISABLE=1, zero reboot) PASS: dEQP-VK.glsl.loops.* 624/624, dEQP-VK.ssbo.layout.single_basic_array.* 351/351, dEQP-VK.glsl.matrix.inverse.* 12/12, dEQP-VK.api.smoke.* 8/8 (995/995 Pass / 0 Fail); 0 assertions, 0 GPU faults, 0 new kernel errors, 0 new AVC, 0 failed units, Enforcing; stock Borealis verified after overlay removal.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at f6977235ad64

Blockers:

  1. 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 19 enum agx_chip rows plus AGX_CHIP_UNKNOWN and all 8 asahi_clc targets.
  • 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 asahi suite passes in assert and release builds plus byte-identical generated libagx source/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_CHIPS entries (G13G..G18G, AGX_CHIP_UNKNOWN) and all asahi_clc targets (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() maps AGX_ISA_ENCODING_AGX3D (G18G) to chip=AGX_CHIP_G17G, encoding=AGX_ISA_ENCODING_AGX3C, emit_agx3d=true, and keeps physical chip/encoding with emit_agx3d=false for all other chips. target_chip("g18g") returning AGX_CHIP_G18G keeps target_is_native_agx3(), target_is_native_hal200(), target_is_agx3(), and target_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 identical def_size_agx3b() and def_size_agx3c() callbacks while keeping instr_cost_cb and rewrite_cost_cb split as before.
    • src/gallium/drivers/asahi/agx_state.c: agx_chip_has_cap(dev->chip, AGX_CAP_NATIVE_MIXED_EPILOG) matches dev->chip == AGX_CHIP_G18G; agx_chip_agx3_path(dev->chip) matches native_agx3 || g17_m5 || G18G; agx_chip_native_hal200(dev->chip) || agx_chip_hal300_path(dev->chip) matches G18G || 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.
  • 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.

Copy link
Copy Markdown
Author

PASS on J714s (MacBook Pro 14-inch M5 Pro, T6050, G17S/AGX3C) at f6977235ad6441023195ef3a2cc23c670b97ce30. Kernel 7.3.0-m5-cdirect16. The two isolated, assert-enabled Mesa builds were the exact PR head and its aurora-wip merge-base 262403b7bce17decb625912bcbb1c59d3ac6874f. Both were built on the Mac.

  • Headless Vulkan CTS covered glsl.* (28,399 cases), compute.pipeline.basic.* (81) and spirv_assembly.instruction.compute.* (19,901). All 48,381 case outcomes matched: 34,600 pass, 13,685 skip and the same 96 assertion crashes in both builds. The baseline crashes include NIR divergence analysis on load_mesh_payload_address_agx.
  • Both builds passed 207/207 Asahi unit tests. Each CTS run recorded 0 GPU faults, 0 kernel errors and 0 kernel WARNs. The GPU stayed online.
  • The default boot stayed on cdirect16. All 253 ESP file hashes matched before and after.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@DjDeveloperr
DjDeveloperr merged commit b50202f into aurora-wip Nov 26, 2026
@RyanTheTide
RyanTheTide deleted the feat/agx3-chip-split-consolidation 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.

3 participants