Repository navigation
agx: one chip table instead of chip lists typed across the driver (no behaviour change) - #588
Conversation
|
@jgoyvaerts, Dj likes this change and asked us to test it across the board. In progress:
I'll post one consolidated review here when the rows are in. Nobody has offered G18G (M6) hardware yet. If you know who has one, the 123 Assisted-by: Claude Opus 5.5 |
|
J616C row (M4 Max, T6041, G17P, 25G83). Base aurora-wip afcc08b and head 0d0eab5, built side by side in private prefixes with the same options as the Max's host Mesa. Both ran on one boot through pinned ICDs (
So it's no behaviour change on T6041. Disclosure: prepared with an AI tool; tested as described. |
|
Claude Opus 5.5 on @satchlj's behalf. M5 Max (J775c, "lobata") row for this PR: no behaviour change found. Base Setup.
The 2 VK DeviceLost cases ( gpubench. There's no fixed "quick" set in the tree, so I used
|
|
M1 Pro (G13S) and M2 (G14G) rows: no behaviour change found. Base Setup. Both Macs ran our default kernel and system Mesa, untouched and checked after. Base and head were built with identical options (release with asserts, Vulkan and gallium, each tree's own
So the AGX2 path (G13/G14) behaves as before, which matches the table rows: path AGX2, no records, no quirks. I also checked the claim separately from the PR's own test. I compiled On the table and the remaining gates. One row per chip is a clear improvement over the copied lists. Some of the new predicates still name chip sets rather than what the hardware has, and several could be fields in the row. Suggestions, roughly in order of reach (none is needed for this PR, which is right to change nothing):
These look like identity that should stay as it is: chip identification and the decoder's 'X' alias, names, deviceID/UUIDs, the shader binary version, and SoC admission. Smaller notes
gpubench-vk, median over reps, M2Of the rows outside ±2 % here, buf2buf, fill and the light rows are back within ±2 % in a 6-rep recheck. The two that stay out scatter just as much in base: gpubench-vk, median over reps, M1 ProThe depth-1 rows alternate between two GPU clock states in both arms. Method
|
|
Tested on the M5 Ultra (G17D, Mac Studio), with #362's five G17D commits rebased onto this branch. The rebase was mechanical: every conflict was a chip list this PR folds into the table, so G17D needed only its row (G17C's), No change for G17D. Same kernel, firmware and boot for both trees; "before" is aurora-wip afcc08b with the same five commits:
No GPU fault, recovery or lost device in either tree. The
All results validated compatible with the firmware on the hardware. Two notes for whichever of #588 and #362 lands second. Nothing here needs work from you; a look at note 1 is all we'd ask.
We'll send the fragment-span change ourselves as a follow-up once #588 and #362 are in: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Interim review: no behaviour change found, on hardware or in code
@jgoyvaerts, thanks. Dj asked us to test this across the board, and so far everything agrees with "no behaviour change". This is an interim review: I'll approve once the remaining rows (M6 G18G, M5 Pro G17S, Neo T8140) are in.
Hardware A/B rows: base afcc08b vs head 0d0eab5, same boot
| Chip | Mac | By | vulkaninfo | dEQP-VK smoke | GLES31 sample | gpubench | Faults |
|---|---|---|---|---|---|---|---|
| G13S | M1 Pro | Ryan | identical | 31,778 cases, 0 differ | 757, 0 differ | within ±2 % | 0 |
| G14G | M2 (J413) | Ryan | identical | 31,778, 0 differ | 757, 0 differ | within ±2 % | 0 |
| G17P, T6041 | M4 Max (J616C) | Axxzy | identical | 16,935, 0 differ | not run | within ±0.8 % | 0 |
| G17C | M5 Max (J775c) | satchlj | identical | 32,152, 0 differ | 757, 0 differ | GPU time within ±2 % | 0 |
| G17D | M5 Ultra | funkzy | n/a | render 628 + compute 119, identical | n/a | n/a | 0 |
| G17P, T6040 | M4 Pro (J616s) | you | identical | 61.6k, 0 differ | GL pixel-identical | n/a | 0 |
The M5 Ultra row ran with #362's five G17D commits rebased on top, and only needed a table row. Ryan also dumped 58 predicates from both trees for chip values −1 to 21 and got byte-identical output. Both are in the comments above.
Still to come: Joshua's M6 (G18G), which matters most for the 123 agx_chip_native_or_m5 sites; our M5 Pro (J714s, G17S); and our Neo (T8140). Joshua's M1 13" and M2 Max follow on Saturday. The M4 Air/mini (T8132) and M3s can't run until their GPUs come up on 27.2.
Independent code check
Separately from your truth table:
- Changed regions: I extracted every changed region from the diff (539 outside
test-chip), compiled the old text against afcc08b and the new text against 0d0eab5, and evaluated both for chip values 0–21 and 255. No differences. - Shared functions: the 48
agx_chip.[ch]functions match for every value, out-of-range ones included. - Parameter mapping:
agx_chip_from_paramsandagx_params_*agree on 2.4 M parameter sets. The decoder mapping, including'X'/0x6041, agrees on 774k identities. - Codec gates: every record allowlist and Ioto/PPP selector matches when the base and head codec functions are called directly.
- Truth table: your new table, compiled against the base tree, passes all 392 checks.
- Build and suite: the asahi suite passes before and after, and the precompiled libagx kernels are byte-identical. The header table costs about 16 KB in the Vulkan driver at
-O1, under your ~70 KB estimate. It has internal linkage, nothing takes its address, and no OpenCL-callable path indexes it.
Notes, all small
decode.c: the removedagxdecode_chip_name()returned"unknown"for the AGX2 chips. All five call sites (639, 689, 698, 922, 999) are on AGX3-only paths, so nothing visible changes. Still, it's the one place where the old and new helpers disagree.agx3_compute_program_core.c:290/361:agx_chip_m5_paths()→agx_chip_hal300_records()covers the same chips (G17G, G18G), but it merges two predicates with different meanings. If another chip ever gets the native-capture record bit, the G17G compute-dispatch gate widens with it. Consider a record bit of its own, or keeping the separate predicate.- Coverage: the decoder mapping (
agxdecode_chip_from_params, including'X'/0x6041),hk_shader_binary_version()and the Ioto preshader/state/program selectors have no truth-table rows. Adding them would pin down the rest of what this PR rewrites. - Repo policy:
.github/aurora/AGENTS.mdasks agent-authored Mesa PRs for a before/after hardware benchmark. The table reads sit on per-draw predicates, so one G17P CPU-overhead run would cover it;hk-cpu-upload-benchis in the tree.
Also worth folding in, as non-blocking follow-ups:
- Ryan's list of predicates that name chip sets and could become capability fields, such as
agx_chip_native_or_m5→ an encoding property andagx_chip_hal300_path→cs_generation; - funkzy's note on the leftover local
g18ginhk_cs_init_graphics().
Assisted-by: Claude Opus 5.5
0d0eab5 to
b0476f8
Compare
|
Thanks, all, for the rows and the reading. The amended series is head b0476f8, rebased onto 7ba2957 (the CI fix only). Against 0d0eab5 the range-diff is 10 files, +238 / −53, most of it new truth-table rows. The description is updated. Interim review
Ryan's notes
M5 Ultra notes: both tests in Hardware: the rows posted so far are for 0d0eab5. The amended head has run on the M4 Pro only, with the same checks as before and 0 differences. Whether the earlier rows carry over to the range-diff above is your call. CI: the new head passes on my fork, 213 of 213: https://github.com/jgoyvaerts/mesa/actions/runs/44865621725 |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review of b0476f8: no behaviour change holds on every chip
@jgoyvaerts, thanks for the amended series. I re-ran the harness against b0476f8.
-
Range-diff onto 7ba2957: the code changes are the ones your comment lists:
agx_chip_m5_paths()is its own bit, used by bothagx3_compute_program_core.cgates;- the four raw
G17G || G18Gchecks are converted, andhk_cs_init_graphics()is updated; agxdecode_chip_from_params()is exported throughdecode.h;- the 823-check truth table is added.
The
AGX_CHIPS(X, ...)forwarding and two comment-only changes also come in. The commit-message edits in 9 of the 13 commits are all descriptive. -
Per-chip evaluation, over the whole enum G13G..G18G plus UNKNOWN and out-of-range values:
- every hand conversion gives the same value as the raw check it replaces;
- across the whole PR, 545 regions outside
test-chip.cshow no difference; agx_chip_from_paramsand friends agree on 2,433,024 parameter sets;- the decoder mapping agrees on 774,145 identities;
- all 36 codec allowlist and Ioto/PPP gates match.
-
Machine code (12 TUs, clang and gcc
-O3): the untouched TUs are identical. The differences are confined to the touched functions, and.creverts alone restore 0d0eab5's code exactly, so the header rework emits nothing new.agx3_cdm_barrier_packmatches on all 22,528 inputs, and the seven compute-dispatch entry points match over 2.8M calls. libagx's precompiled kernels are byte-identical. -
Truth table: your new
test-chip.c, built against afcc08b with the old chains standing in, passes all 823 checks. Each of five bit mutations fails its own row: M5_PATHS moved, native-capture moved, G18G gainingVDM_STREAM_LINK, G16G losing inexact FMA, and G17C Ioto GPU1→0. -
Suggestion 6: your reason holds.
agx_gather_device_key()maps G18G to G17G before reading.encoding(agx_device.c:1950-1961). Testingagx_chip_isa_encoding(dev->chip) == AGX_ISA_ENCODING_AGX3Dwould be the behaviour-neutral form for a follow-up. -
CI: your fork run 44865621725 on b0476f8, 213/213.
Hardware: the 0d0eab5 rows carry over, because the converted sites give the same answers on every chip. That covers Ryan's G13S and G14G, Axxzy's G17P T6041, satchlj's G17C and your G17P T6040. funkzy's G17D row ran with #362 on top.
Before merge, commit metadata only. Aurora's pre-PR checklist (https://github.com/aurora-silicon/agent-guidelines/blob/main/pre-pr-checklist.md) has been in force since today, and two of its hard rules apply:
- Attribution (item 4): commits carry human identity only. Drop the
Assisted-by: LLMtrailer from all 13 commits and keep your Signed-off-by. The PR body's last line should beAssisted-by: LLM (<Vendor>:<Model>), in place of the "Generated with" line. - Naming (item 6): 30b4406 and 38fa7ab use
hk:and say Honeykrisp in their messages. Useborealis:and Borealis. Code identifiers are unaffected.
With only messages changing, the tree should stay identical to b0476f8. I'll re-check that and approve.
For #362's rebase: every AGX_CHIPS row now has to end in __VA_ARGS__, so its G17D row needs it.
Assisted-by: LLM (Claude:Opus 5.5)
b0476f8 to
5a78b7f
Compare
|
Commit messages only, for the pre-PR checklist: the commits no longer carry Assisted-by: LLM (Claude:Opus 5.5) |
|
Thanks. I checked 5a78b7f: the tree is byte-identical to b0476f8 ( Two prose mentions of the old name are left, and item 6 of the checklist is a hard rule:
Please make both "Borealis". With the tree unchanged again, I'll approve straight away. The code review and the carried-over hardware rows stand. Assisted-by: LLM (Claude:Opus 5.5) |
|
T8140 (MacBook Neo J700, A18 Pro, G17P B1) row: no behaviour change. Setup:
Assisted-by: LLM (Claude:Opus 5.5) |
|
J773g (M4 Mac mini, macOS 27.2 firmware 26B123, Linux 7.3.0-ARCH-m4drv8 010c3eb7) row for mesa#588
Assisted-by: LLM (Claude:Opus 5.5) |
|
Both prose mentions now say "Borealis" (87fd4df and e37050a, previously ff0d3a0 and 2164981). Commit messages only: the head 2a799a5 has tree The PR also conflicts with aurora-wip |
5a78b7f to
2a799a5
Compare
|
No blockers. The no-behaviour-change claim is well covered: the 823-check truth table passes against the old code, there are independent per-chip evaluations, and same-boot rows on G13S, G14G, G17P (T6040, T6041, T8140), G17C, G17D and T8132 are on tree
It can leave draft once rebased. The G18G and G17S rows are still missing. G18G matters most for the HW row: after rebase, G18G (M6) and G17S (J714s) same-boot A/B: vulkaninfo identical, dEQP-VK every-100th 0 case differences, 0 GPU faults/recoveries. Assisted-by: LLM (Claude:Opus 5.5) |
2a799a5 to
06b56e0
Compare
|
Rebased onto aurora-wip b8762aa. New head is 06b56e0, tree @DjDeveloperr, your rows were on tree
Results on M4 Pro (G17P), m4.177:
Not rerun after the rebase: the 24,262-case graphics sample and the CPU benchmark. G18G and G17S rows are still open. Assisted-by: LLM (Claude:Opus 5.5) |
RyanTheTide
left a comment
There was a problem hiding this comment.
No blockers. Re-checked at 06b56e0 (rebase onto b8762aa).
- The rebase point from my last comment is resolved.
git range-diff 7ba295723..2a799a516 b8762aab9..06b56e082shows only what the reply lists.agx3_ssbo_vecinhk_shader.cisagx_chip_g17p_or_m5(), which is the same set as theG17P || agx_chip_g17_m5()that #413 wrote.hk_device.h:566reads the same predicate.hk_device.h:577(G17A) is listed as identity. The compiler test takes its encoding fromagx_chip_isa_encoding()(AGX3B for G17P, AGX3C for G17G and G18G, as before). The truth-table row foragx_vdm_barrier_core_word(c, false)keeps its expected string. Apart from that, every commit differs from the reviewed tree31451cdaonly in its message. - aurora-wip has 11 more commits since b8762aa (up to ce4db96). The PR merges into it without conflicts. Those commits add no chip comparisons in the directories this series converts, and nothing calls
agx_native_graphics()or the removed_referencetables. The only new chip list is the shader-binary-version assert intest-hk-execution-allowance.c(43 -> 44 from d56b317). That is identity, and the truth table reads theHK_*_SHADER_BINARY_VERSIONconstants by name, so the bump does not affect it. - On the table's direction: the header comment above the chip-set predicates (
agx_chip.h:835) says they name chips and not reasons, and that a new site should get a predicate named for its reason. Together with the "Not in this PR" list, that keeps the table from becoming the place to add new gates. Small nit for the follow-up:agx_chip_native_or_g18g()andagx_chip_g17p_or_m5()still comparechip ==directly instead of reading a row bit. The answer is the same, and they would be the first ones to turn into capability fields.
The hardware rows on 31451cda still apply because the table rows did not change. G18G and G17S remain the open rows and need not block.
HW row: M1 Pro (G13S) and M2 (G14G), after it lands in the train: same-boot base/head vulkaninfo --json identical and dEQP-VK every-100th with 0 case differences, 0 GPU faults. This only confirms the rebase, since the conflict was in AGX3-only code.
Assisted-by: LLM (Claude:Opus 5.5)
|
J714s hardware A/B row (Apple M5 Pro,
|
|
@jgoyvaerts With the fresh J714s |
The chip tables are about to move into one row per chip. Before that, record what the code answers today: tests/test-chip.c gets one row for every chip predicate and table accessor in agx_chip.h and agx_chip.c and for every per-record allowlist in lib/*_core.[ch] and genxml/agx3_cmdstream.h, with its value for all 19 chips and AGX_CHIP_UNKNOWN. A value outside the enum must answer as UNKNOWN does. The expected strings were printed by this code, at aurora-wip 7ba2957, and not written by hand. The rows show where today's lists disagree, which the refactor has to keep: - agx_isa_is_agx3 is false for AGX3D, agx_encoding_is_agx3 is true. - The VDM stream link, tessellate and direct Index List records, the CDM stream link, link padding and substream barrier, and the Ioto target and profile control refuse G18G. The VDM stream terminate, barrier, PPP state and vertex pipeline pair and the CDM launches and barrier accept it. - agx_chip_hal300_records is G17G and G18G; agx_chip_g17_m5 is G17G, G17S and G17C. Three things outside agx_chip.[ch] that the series also rewrites get rows: - The chip the command-stream decoder takes a kernel identity as. decode.c has its own mapping: it has no cluster-count check, and it takes variant 'X' with chip id 0x6041 on the G17 runtime as G17P, which device open refuses. agxdecode_chip_from_params() is declared in decode.h so the test can call it, and test_decoder_identity() checks every identity, the M4 Pro and M4 Max ones and the 'X' cases against both mappings. - The shader binary version hk_shader_binary_version() gives a chip, as one of its three classes. test-hk-execution-allowance.c already asserts it for the 19 chips, but not for AGX_CHIP_UNKNOWN, and a release build compiles its asserts out. - The Ioto encoding the preshader, state and program codecs select. Their selectors are static, so the rows read it from what each codec packs or accepts. The test now links libasahi_lib, which holds the record cores. The checks that only restated single cells of the table are gone from test-chip.c and test-chip.cpp. The kernel identity mapping, the per-SoC parameter contracts and the G16G compute launch bytes stay, and so does test-chip-admission.c. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. This is CPU-only code; no other machine has run it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
agx_chip.h said what a chip is in several places: three positional arrays for the command-stream, descriptor and sampler generations, with a static_assert on the enumerator order, a *_reference switch for each in agx_chip.c that only the test read, switches for the instruction set, encoding, submission model and name, and a chip list in each predicate. The five native chips were typed three times. Put it in one row per chip. AGX_CHIPS() is an X-macro that enum agx_chip and agx_chip_infos[] are both expanded from, so the enum and the table cannot fall out of step. A row has the name, instruction set, encoding, command-stream, descriptor and sampler generation, submission model, path (AGX2, native AGX3, HAL300 or none), the records the chip is witnessed to take and one named bit per quirk predicate. The table is initialised by position because the C++ units that include the header reject designators. The OpenCL units get the rows but not the table. The precompiled libagx kernels take the chip as a run-time argument, and asahi_clc does not finish compiling a kernel that indexes a table (stopped after 11 minutes and 14.8 GiB). So the predicates those units can call, agx_chip_native_agx3() and agx_chip_has_record(), expand AGX_CHIPS() into the comparisons of the chips whose row passes, which is what the hand-written lists compiled to. They do so in C and C++ as well, so the test covers what the kernels run. AGX_CHIPS() passes its extra arguments on to the row macro, which is how that expansion is given the chip and the test. Every predicate keeps its name, signature and answers and now reads the row, so no call site changes. agx_chip_isa(), agx_chip_isa_encoding(), agx_chip_submission_model() and agx_chip_name() become inline row reads. Predicates that were derived from other predicates stay derived. The record bits are in the rows already; the record allowlists start reading them in the next commit, and until then the test checks each bit against its allowlist. agx_chip_m5_paths() and agx_chip_hal300_records() had the same body, G17G or G18G, and do not mean the same: one says which paths the driver runs, the other which record layouts native captures witness. They stay two predicates and each reads a bit of its own, so a chip that gains one does not get the other. Removed as dead: the *_reference switches, the positional arrays and their static_assert. The three chip ids of the G17P SoCs get names. Comments only: agx_chip_cdm_wide_visibility() and the record bit AGX_RECORD_CDM_BARRIER_WIDE_VISIBILITY say that they differ on G16G, as they did before, and the header's opening comment calls the Vulkan driver Borealis. Two lists that look alike and are not stay apart: agx_isa_is_agx3() is AGX3B and AGX3C, agx_encoding_is_agx3() also AGX3D. No behaviour change is intended for any chip. The truth table passes with its rows unedited (a path row is new), and the precompiled libagx kernels are byte-identical to those built from b8762aa. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
decode.c had its own copy of agx_chip_from_params(), because the decoder library does not link agx_chip.c, plus a list of the AGX3 chips and a chip name table. Move the generation/variant switch into an inline, agx_chip_from_identity(), that both use. agx_chip_from_params() is that plus its cluster-count check. The decoder's AGX3 list was every chip whose instruction set is AGX3, so it asks agx_chip_isa(). The copy had diverged, and the differences are kept: - It maps gpu_generation 16, variant 'X', chip id 0x6041 on the G17 runtime to G17P. agx_chip_from_params() accepted 'X' in 53b30c6 and dropped it three days later in b45e4ec ("drop legacy T6041 X and upstream UAPI compatibility"), with a test that 'X' is unknown. cea3f4d then added 'X' to the decoder, and its message says agx_chip_from_params() maps "variant C or X", which was no longer true. So device open is right to refuse 'X', and the decoder still accepts it: a trace from a kernel that names the M4 Max that way decodes as G17P. Whether it should is a separate change. - It has no cluster-count check and takes NULL parameters as unknown. Old and new mapping agree on 184,320 identities (generation 11-20, every 7-bit variant, six chip ids, USC 2/3, three HAL generations, four cluster counts), and on NULL. The truth table's decoder row and test_decoder_identity() pass unedited. One difference between the removed helpers and the shared ones cannot be reached. agxdecode_chip_name() said "unknown" for G13G, G13X, G14G, G14X and G15P, and agx_chip_name() names them. All five calls print the chip in a message of an AGX3 decoder: - agxdecode_cdm_agx3() (two calls) and agxdecode_vdm_agx3(), which agxdecode_cdm() and agxdecode_vdm() enter only when the chip's instruction set is AGX3; - agxdecode_ppp_agx3(), which only agxdecode_vdm_agx3() calls; - agxdecode_ioto(), the pipeline decoder of those two and of agxdecode_drm_cmd_render() for a native AGX3 chip or G18G. Those five chips execute AGX2, so none of them gets to a call and no output changes. AGX_CHIP_UNKNOWN is "unknown" under both names. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
agx_gallium_descriptor_generation() was a fourth copy of the per-chip descriptor generation, with the same answer as agx_chip_descriptor_generation() for all 19 chips and AGX_CHIP_UNKNOWN. Its sixteen callers use the shared accessor. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216, and the gallium driver builds. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Twenty record codecs in lib/*_core.[ch] and genxml/agx3_cmdstream.h each carried the list of chips they accept: the same twelve chips ten times, and five times the same list without G18G. Each now reads its own bit of the chip's row through agx_chip_has_record(). The lists that disagree keep disagreeing, because every record has its own bit. For G18G the VDM stream link, tessellate and direct Index List records, the CDM stream link, link padding and substream barrier and the Ioto profile control stay refused, as the truth table in tests/test-chip.c shows row by row. Whether G18G should take them is for someone with the hardware. agx_vdm_index_list_direct_target_supported_inline() is compiled into the libagx kernels. Under OpenCL C agx_chip_has_record() expands to the comparisons of the chips that have the bit, and the precompiled kernels are byte-identical to those built from b8762aa. Left as they are: agx_ppp_viewport_payload_core_supported() and agx_ioto_target_supported(), which answer through a layout or encoding selector and have no list of their own, and agx_ppp_legacy_payload_supported() and agx_ppp_hal200_graphics_core_supported(), which already ask a chip predicate. The test that checked each bit against its allowlist goes; the truth table rows are unedited. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Call sites spell out which chips they mean, and "runs an AGX3 path" is written with different chips left out: native or M5 (123 times in the tree), native or M5 or G18G (36), native or G18G (12). The sets are not the same, so each gets its own predicate and every site keeps the set it had: agx_chip_agx3_path() native AGX3, M5 or G18G agx_chip_native_or_m5() not G18G agx_chip_native_or_g18g() not M5 agx_chip_hal300_path() M5 or G18G agx_chip_g17p_or_m5() G17P or M5 They name which chips, not why. Which of the sites that leave G18G or M5 out mean to is not decided here. Convert src/asahi/lib, genxml and libagx. A chain is replaced only when it has the same answer as the predicate for all 19 chips and AGX_CHIP_UNKNOWN: each chain was compiled against agx_chip.h and evaluated for every chip before it was rewritten, and a chain that already asks a capability by name (agx_chip_native_preamble() || agx_chip_g17_m5()) keeps its words. tests/test-chip.c has a row for each new predicate and checks it against the chain it replaces. Also here, each with the same answers as before: - Three local "is HAL300" helpers go: the Ioto profile one was agx_chip_g17_m5(), the VDM decode and state update ones agx_chip_hal300_path(). - agx3_cdm_direct_g15x_bit31_allowed() asks for the G15 command-stream generation instead of listing G15G/S/C/D. - agx3_cdm_barrier_flags_grounded() had the same flags for G18G and for the default case. - libagx's agx_vdm_barrier() repeated the VDM barrier allowlist; it asks agx_chip_has_record(). Not converted: agx_vdm_index_list_direct_is_hal300_inline() stays a comparison chain. It is compiled into the libagx kernels, and written as agx_chip_g17_m5() the kernels come out different. With this commit they are byte-identical to those built from b8762aa. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Five comparison chains in the compiler become the predicate with the same answer for all 19 chips and AGX_CHIP_UNKNOWN: !agx_chip_native_or_m5() in agx3_graphics_program.c, and agx_chip_g17p_or_m5() in the register allocator and the spiller. Each chain was compiled against agx_chip.h and evaluated for every chip before it was rewritten. test-agx3-g17p-task-kernel-shared.c takes its encoding from the chip table: agx_chip_isa_encoding() of the chip it compiles as, G17G for G18G, as agx_gather_device_key() does. That is AGX3B for G17P and AGX3C for G17G and G18G, the three chips it runs, as before. The single-chip comparisons stay: they are chip identity. So do the per-encoding chip lists of agx3_pack.c, which are not the encoding column of the chip table (they omit chips). Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
162 comparison chains in Borealis become the predicate with the same answer for all 19 chips and AGX_CHIP_UNKNOWN. Most are "native or M5", spelled agx_native_graphics(&dev->dev) || agx_chip_g17_m5(dev->dev.chip), and "G17P or M5". Each chain was compiled against agx_chip.h and evaluated for every chip before it was rewritten; one in hk_cmd_meta.c, whose two terms named the same chip differently, was done by hand. hk_shader_binary_version() listed the AGX2 chips and G17P plus M5. It asks agx_chip_isa() and agx_chip_g17p_or_m5(), with the same three answers. Four more sites are converted by hand, each to a predicate with the same answers: - hk_cs_init_graphics() spelled two sets through a local `g18g`. The fragment-span capture tested native or G18G, which is agx_chip_native_or_g18g(), and the context selector native, M5 or G18G, which is agx_chip_agx3_path(). - Two gates were written "G17G or G18G", the chips of both agx_chip_m5_paths() and agx_chip_hal300_records(). hk_agx3_g17g_basic_graphics_program_generate() builds the G17G-form Ioto program, which G18G runs re-encoded: that is a path the driver takes, so agx_chip_m5_paths(), whose comment now names it. hk_agx3_g17g_vertex_program_info() admits the vertex program words of the VDM state update and holds G17G to the layouts its captures witness: that is agx_chip_hal300_records(). Every site keeps its set. In particular the 102 "native or M5" sites still leave G18G out, and the five "native or G18G" ones still leave M5 out. Chains that ask a capability by name (agx_chip_sampler_has_lod_bias(), agx_chip_native_preamble()) and single-chip comparisons are unchanged. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
46 comparison chains in the Gallium driver become the predicate with the same answer for all 19 chips and AGX_CHIP_UNKNOWN: agx_chip_hal300_path() for "M5 or G18G", agx_chip_agx3_path(), agx_chip_native_or_m5() and agx_chip_native_or_g18g(). Each chain was compiled against agx_chip.h and evaluated for every chip before it was rewritten. Two more in agx_batch.c were written "G17G or G18G" and become agx_chip_m5_paths(), by hand. One splits a compute prepass into a submission per dispatch, which is the M5 kernel contract that G18G's bring-up path follows. The other logs a batch that lists a BO another active batch writes, a diagnostic of the Gallium M5 paths. Neither is about which record layouts captures witness, so neither is agx_chip_hal300_records(), which has the same chips. Every site keeps its set: the seven "native or G18G" sites still leave M5 out. Single-chip comparisons are unchanged. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216, and the Gallium driver builds. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
agx_native_graphics(dev) is agx_chip_native_agx3(dev->chip) and nothing else (agx_device.h), so the tree had two names for one predicate. Keep the one that needs only a chip, which the compiler, the record codecs and asahi_clc can also call. This is the Borealis half: 123 calls, rewritten by script from agx_native_graphics(&x) to agx_chip_native_agx3(x.chip). The lines that grew past 80 columns are re-wrapped. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
The Gallium half of the previous commit: 66 calls of agx_native_graphics(dev) become agx_chip_native_agx3(dev->chip), rewritten by script. The lines that grew past 80 columns are re-wrapped. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216, and the Gallium driver builds. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Its last callers now call agx_chip_native_agx3(), which it wrapped. A comment in agx_compile.h that named it names the predicate. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216, and the Vulkan and Gallium drivers build. No hardware has run this commit and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
After the allowlists, one chip list was still typed seven times in lib: G15G, G15S, G15C, G15D, G16G, G16S, G16C and G17P select the GPU0 Ioto encoding in agx_ioto_core.c, agx_ioto_load_core.c, agx_ioto_preshader_core.c, agx_ioto_state_core.c and agx_ioto_program_core.c, and the PPPEncoderGen6 header in the viewport and W-clamp/cull2 payload codecs. The M5 parts select GPU1 five times. The Ioto encoding follows the instruction set generation, as the comment in the preshader codec says, so it becomes a column of the chip table: agx_chip_ioto_generation() is GPU0, GPU1 or none, and each codec maps it to its own enum. G16P, G17A and G18G stay refused. The two PPP payloads get a record bit each, like the other record codecs, and pick the Gen7 header on the HAL300 path and Gen6 otherwise. That is the split they had: G17G, G17S, G17C and G18G are Gen7. tests/test-chip.c gets a row for the Ioto generation and one for the generation each PPP payload codec packs. The two payload rows were printed by the old switches before they were removed. The rows for the encoding the preshader, state and program codecs select pass unedited. No behaviour change is intended for any chip. Tested on J616s (M4 Pro, T6040): the asahi suite passes, 216 of 216, which includes the Ioto load, preshader and program codec tests, and the precompiled libagx kernels are byte-identical to those built from b8762aa. This is the last commit of the chip table series, and the series was checked as a whole at this commit, against b8762aa: - Under the no-op DRM shim, for all 17 ASAHI_SHIM_CHIP profiles: vulkaninfo is the same apart from the build UUIDs. 258 dEQP-VK cases per profile (glsl, compute, tessellation, geometry, draw, ubo, ssbo, texture, SPIR-V and others) submit the same kernel command buffers and the same bytes in every mapped BO, 8,047 submits in all. One case differs between two runs of the same build and was compared on its stable lines. An offscreen GLES 3.1 program submits the same bytes on every profile (the compile-only G17G one submits nothing). The registered tests that submit through the shim, base and head built in the same tree, submit the same bytes (17), or the same on every line that is stable between runs (4); hk-g17p-cross-queue times out under the shim on both and is not comparable. - On hardware, J616s only (G17P): 37,339 dEQP-VK compute, SSBO and GLSL cases give the results stored for aurora-wip fa9a676, with no GPU recovery, and the offscreen GLES program renders the same pixels as on b8762aa. Before the rebase, 24,262 passing pipeline, shader object, transform feedback, tessellation, clipping and geometry cases also gave the results stored for aurora-wip 4596393. This version of the series has run on J616s only: G13, G14, G15, G16G, the M5 parts and G18G are covered by the shim comparison and the unit tests, and no other machine has built it. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
06b56e0 to
2a31495
Compare
|
Rebased onto
|
RyanTheTide
left a comment
There was a problem hiding this comment.
No blockers. Re-checked the rebase onto aurora-wip ee3abd0 (06b56e0 to 2a31495).
git range-diff b8762aab9..06b56e082 ee3abd081..2a31495fashows only rebase changes. Commits 3-9, 11 and 12 are unchanged. In commit 1, thetest-chip.cppconflict with #603 keeps the newTextureDescriptorSpareWordIsM5Gen10test. In commit 10, the newsupports_gs_main_cdmsite that aurora-wip added inhk_shader.cis converted fromagx_native_graphics(&dev->dev)toagx_chip_native_agx3(), the same mapping as the rest of that commit. Commit 12 then removesagx_native_graphics()without leaving a caller behind.- A new chip comparison arrived with the base.
agx_chip_texture_descriptor_spare_word()(agx_chip.h:944-949) isdescriptor_generation == GEN10 && chip != AGX_CHIP_G18G. It is not from this series and has its own test, so it does not block. Please add it to the "Not in this PR" / identity list in the body, or turn it into a table bit in the follow-up along withagx_chip_native_or_g18g()andagx_chip_g17p_or_m5()(my earlier nit, still open). - No suite or truth-table result has been posted for 2a31495 yet. Please post asahi+vulkan and the 823-check truth table on this head before it goes in the train. The hardware rows carry over, since the table rows are unchanged.
HW row: none new. The rebase only touches a test and one call site that is already proven equivalent. The G18G row is still open and need not block.
Assisted-by: LLM (Claude:Opus 5.5)
This replaces the chip lists typed out across the driver with one table that has one row per chip. It is meant to change nothing: every predicate, allowlist and converted comparison gives the same answer as before for all 19 chips and
AGX_CHIP_UNKNOWN.The series is on
aurora-wipb8762aa (rebased in review round 3; see "Rebase onto b8762aa" below).Hardware rows in the comments: the first-round head 0d0eab5 on M1 Pro (G13S), M2 (G14G), M4 Max (G17P), M5 Max (G17C) and M5 Ultra (G17D, with #362 on top); tree
31451cda(b0476f8 .. 2a799a5) on G17P (T6040, T6041, T8140) and T8132, no behaviour change. The rebased head 06b56e0 has run on G17P (M4 Pro) only. M6 (G18G) and M5 Pro (G17S) are still open.Why
On
aurora-wipb8762aa the driver has 1,053 raw== AGX_CHIP_*/!= AGX_CHIP_*/case AGX_CHIP_*comparisons outside tests andagx_chip.[ch], althoughagx_chip.hsays chip identity is never tested at the call site. The same facts are written several times and have started to drift:agx_chip.h,_referenceswitches inagx_chip.c, a copy indecode.c, a copy in the gallium descriptor header);*_supported(chip)allowlists retype the same 12-chip list, 10 times with G18G and 5 times without;agx_native_graphics(dev)andagx_chip_native_agx3(dev->chip)are the same test under two names.Adding a chip today means finding every copy.
What changes
04ea12aa72ed0cf8c2struct agx_chip_info, one row per chip. Existing predicates keep their names and read the row. The duplicate tables go.1fad7d2c1,9f630958d,d5a4e4b7cdecode.c, the gallium descriptor header and the per-record allowlists read the table.7a6073086..966f8febef96db0541..c6898ead1agx_native_graphics()is removed;agx_chip_native_agx3()is the one spelling.06b56e082Raw comparisons, counted as above, go from 1,053 to 544. What is left is mostly single-chip identity (G18G, G17P, and G17A in
hk_cdm_caches_pending()) and is deliberately not touched.Where today's lists disagree
Nothing is merged. Where two lists differ today, or mean different things, both are kept and named:
agx_chip_native_or_m5(no G18G) is called on 121 lines,agx_chip_agx3_path(native, M5 and G18G) on 40,agx_chip_native_or_g18g(no M5) on 13. These names say which chips, not why. Whether eachagx_chip_native_or_m5site means to leave G18G out is a question for someone with M6 hardware.agx_chip_m5_paths(takes the M5 driver paths) andagx_chip_hal300_records(HAL300 records witnessed by a native capture) are both G17G and G18G today. They are separate bits in the table, each with its own truth-table row, so one can change without the other.agx_isa_is_agx3(AGX3B, AGX3C) andagx_encoding_is_agx3(also AGX3D) both stay.'X'with chip id 0x6041 as G17P, which device open stopped accepting in b45e4ec. Kept as is, and now pinned by the truth table.agx_chip_name()names them. All five call sites are on AGX3-only paths.Rebase onto b8762aa
hk_shader.c: fa9a676 (asahi, borealis: AGX3 compute shader vectorization, op_timings register-cache hints, unary bitop wait folding, and group_count upload cache #413) moved the storage-result-select test intoagx3_ssbo_vec, which also gates SSBO vectorization before lowering. That structure is kept, andagx3_ssbo_vecis nowagx_chip_g17p_or_m5(): the same set, read from the table.hk_device.h:566hk_cdm_memory_scope_form()(G17P or M5) was alreadyagx_chip_g17p_or_m5()in this series, which converts the line it came from.hk_shader.c:3252(G17P or M5) isagx_chip_g17p_or_m5(), as above.test-agx3-g17p-task-kernel-shared.c: the encoding isagx_chip_isa_encoding()of the chip it compiles as (G17G for G18G, asagx_gather_device_key()does): AGX3B for G17P, AGX3C for G17G and G18G, as before. Itsg18gstays: identity, like the device key's.hk_device.h:577hk_cdm_caches_pending()(== AGX_CHIP_G17A) stays: single-chip identity, next to the G18G and G17P ones.src/asahi, it also findsasahi_clc.c:95(native or M5, from 10-15, outside those directories); left as it is.agx_vdm_barrier_core_word()akernel_admits_invalargument. The truth-table row now asksagx_vdm_barrier_core_word(c, false), the chip-dependent fallback, with the same expected row (plain word on G15S, G15C and G16G).31451cda.Testing (rebased head 06b56e0 against base b8762aa)
MacBook Pro 16" M4 Pro (J616s, T6040, G17P), kernel 7.3.0-m4.177, release builds with the options below, 2026-11-21:
--suite asahi --suite vulkan219/219, truth table 823 checksASAHI_SHIM_CHIPprofiles, base vs headvulkaninfo --jsonidentical apart from build UUID and driver infohk-g17p-cross-queuenot comparable (it times out under the shim on base and head alike, and most of its dump lines vary between runs of one build)Since b8762aa, the gallium registered tests submit different shader bytes from two build trees of the same commit (one bit in the first instruction of each shader), so base and head were compared built one after the other in the same tree. Built in two trees, plain aurora-wip already differs from itself. The 24,262-case graphics sample and the CPU benchmark below were not rerun after the rebase.
Testing before the rebase
MacBook Pro 16" M4 Pro (J616s, T6040, G17P), head b0476f8 against base 7ba2957:
ASAHI_SHIM_CHIPprofiles, before vs aftervulkaninfo --jsonidentical apart from build UUID and driver infoThe shim has no shader-binary dump, so shaders are compared through the BO contents at submit; a shader that never reaches a submit is covered only by the case status being equal. The hardware Vulkan runs are samples of two stored lists, not a full CTS pass.
Hardware benchmark (base against proposed)
Result: no measurable change. The median time per draw of
hk-cpu-upload-benchmoves by +0.08%, -0.39% and -0.08% in its three workloads, against a run-to-run standard deviation of 1 to 5%.Hardware: Apple MacBook Pro 16-inch, M4 Pro (J616s, T6040), which the driver runs as G17P. One machine; no other chip ran the benchmark.
Software: Arch Linux ARM, kernel 7.3.0-m4.177 (aarch64), GCC 16.1.1 20260430, meson 1.12.1, ninja 1.13.2. Both trees built with the same options:
-Dbuildtype=release -Dgallium-drivers=asahi -Dvulkan-drivers=asahi -Dplatforms=x11,wayland -Dbuild-tests=true -Dtools=drm-shim -Dllvm=enabled -Dmesa-clc=enabled -Dprecomp-compiler=enabled.Mesa commits: base
7ba2957236186a832843b7fd9badf00462c10a9b(aurora-wip), proposedb0476f89f48f4c4b3e2f028e48a665fc6c525b05(head of this PR).Benchmark:
src/asahi/vulkan/tests/hk_cpu_upload_bench.c(documented insrc/asahi/vulkan/tests/README.cpu-uploads.md), git blob2a4b30c07de94fe4b10dafef48f45d8f0db3433c, the same file in both trees. It is host-only: it runs the driver's descriptor-bind and upload code for a G17P device against preallocated command-buffer storage, creates no device and submits nothing. So it measures CPU time on the M4 Pro and not GPU work. Three workloads of 16 draws per simulated command buffer: descriptor offsets and draw parameters identical, changed every four draws, changed every draw.Command and settings: per run, pinned to one performance core (cpu13, 4.512 GHz maximum,
schedutilgovernor):200,000 command buffers, 3.2 million draws per workload per run. 30 runs of each build, alternating base and head, with the first build of each pair alternating too (
bench.shbelow).Measurements: nanoseconds per simulated draw, lower is better.
Variability: the standard deviation over the 30 runs is 0.7 to 2.2 ns (1 to 5%). The machine was not idle: the load average was 16 at the start and 11 at the end, from other builds. The outliers of the
identicalworkload (52.63 ns on base, 49.41 ns on head) come from that. The medians of the two builds differ by at most 0.39%, well inside the spread, in both directions. No regression.The benchmark runs code this series changes, on both builds:
hk_cmd_buffer_upload_root(),hk_cmd_upload_constants(),hk_cmd_upload_draw_params()andhk_cmd_upload_draw_id()each testagx_chip_native_agx3(), which the series now expands from the chip table. Both builds compile it to the same test of the chip against a bit mask of the five native chips (mov #0x24e0; lsr; tbzon base, the inverted mask on head).hk_cmd_buffer_upload_root()testsagx_chip_g17_m5()on every root upload. On base that is a range comparison (sub w0, w0, #0xf; cmp w0, #0x2). On head it is a bounded load from the chip table (cmp/cselagainst 19, row address,ldr w1, [x0, #12]), the kind of read the review asked about.Limits: this is the upload and bind path only. The benchmark does not build full draw state, compile shaders or submit, so the many converted predicates in
hk_cmd_draw.candhk_shader.care not timed by it.Raw results, all 60 runs
Every run also prints the upload counters; they are identical in all 60 runs.
bench.sh and bench_summary.py
Changes since the first review
git range-diff afcc08b71..0d0eab53d 7ba295723..b0476f89f: 10 files, +238 / -53, most of it new truth-table rows.agx_chip_m5_paths()is back as its own table bit. The two compute-dispatch gates inagx3_compute_program_core.cuse it again instead of the native-capture record bit.G17G || G18Gchecks are converted to whichever of the two they mean:hk_agx3_ioto_program_core.c(the G17G-form Ioto program G18G runs re-encoded) and both sites inagx_batch.c(the one-dispatch-per-submission contract, and a diagnostic of the M5 paths) toagx_chip_m5_paths();hk_agx3_vdm_decode.c(the vertex program words of the VDM state update) toagx_chip_hal300_records().'X'with 0x6041, the shader binary version class, and the Ioto encoding the preshader, state and program codecs select.hk_cs_init_graphics(): the two tests spelled with a localg18gareagx_chip_native_or_g18g()andagx_chip_agx3_path().AGX_CHIP_ROW_TESTtakes the chip and the test as arguments. Comments:agx_chip_cdm_wide_visibility()andAGX_RECORD_CDM_BARRIER_WIDE_VISIBILITYdiffer on G16G, and the header says Borealis..emit_agx3d = (encoding == AGX3D)inagx_gather_device_key(). The function swaps G18G to G17G before it reads the encoding, so the key's encoding is AGX3C there and the test would be false on G18G.asahi-egl-priority-*tests.Not in this PR
dev->backendselector and per-backend files.emit_agx3d).hk_g17p_*/hk_m5_*functions that serve other chips.agx_chip_native_or_m5,cs_generationbehindagx_chip_hal300_path, per-feature bits behindagx_chip_g17p_or_m5).agx3_pack.c, and the ones compiled into libagx kernels where a rewrite changes the kernel bytes (agx_vdm_index_list_direct_is_hal300_inline,agx_vdm_barrier_core_wordand the other switches inlibagx_dgc.h). Theagx_vdm_barrierallowlist inlibagx_dgc.hdoes read its record bit now; the kernels are byte-identical.Notes for review
static constinagx_chip.h, because the decoder library and about twenty unit tests build withoutagx_chip.c. A reviewer measured about 16 KB for it in the Vulkan driver at-O1.asahi_clcthen does not terminate (stopped after 11 minutes at 14.8 GB). The header says so, and no OpenCL-callable predicate reads the table.test-chip.cincludesasahi/vulkan/hk_agx3_vdm_decode.h(header-only) for the shader-binary-version row.Assisted-by: LLM (Claude:Fable 5.2)