Skip to content

asahi: G17G on #194's M5 submission path, within the kernel's command limit - #207

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:aurora-wipfrom
sithglan:thomas/j813-gallium-render-storage
Nov 12, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:aurora-wipfrom
sithglan:thomas/j813-gallium-render-storage

Conversation

@sithglan

@sithglan sithglan commented Nov 10, 2026 •

Copy link
Copy Markdown

Base: aurora-wip 10161a7, with #194. Branch thomas/j813-gallium-render-storage (da9a77f), 2 commits.

Rebased onto #194 as asked. The separate G17G storage array and submit path are gone. G17G uses #194's m5_render_programs, agx_batch_note_m5_render_program(), the tile record and the SET_RENDER_RESOURCES(_V2) emission. For that part no G17G code is needed. On integration/aurora the J813 runs on the G17 kernel runtime (aurora-silicon/linux#1413), which reports DRM_ASAHI_FEATURE_RENDER_RESOURCES and _V2 for every M5 board. So agx_m5_render_resources() already holds for G17G, and the records go out as V2.

#194 alone was not enough on the J813, though. GLES2 and GLES3 passed, but GLES31 failed by the thousand. The two commits fix that:

  1. asahi: G17G on the G17 runtime submits as the M5 Pro does.
    • m5_split_prepass still took G17G, for the M5 runtime of older kernels, which takes one dispatch per submission.
    • With asahi: native Gallium GL on the M5 Pro and M5 Max (G17S, G17C) #194's command-per-dispatch path also active, the render's CDM barrier was 0, so the render did not wait for the compute commands of its own submission.
    • The submission also pointed the kernel at its output syncs for its input syncs: only the split path clears in_sync_count.
    • The split path now applies only where the kernel does not take mixed command arrays. The comments that said G17G reports none of this now describe both runtimes.
  2. asahi: keep an M5 submission within the kernel's command limit.
    • The kernel takes at most max_commands_per_submission (64) render and compute commands in one submission. It refuses a longer one with EINVAL: "refused a submission ... at its command of type 1 ... barriers [0x0, 0x40]".
    • asahi: native Gallium GL on the M5 Pro and M5 Max (G17S, G17C) #194 sends one compute command per recorded dispatch, all in the render's submission, so any batch with more dispatches was lost. GLES31 has many such batches.
    • The leading dispatches now go in submissions of their own, as many as fit in each, before the render's. Each repeats the compute storage list. Barrier 0 on its first command keeps the chain in order.
    • The kernel check is the same for every M5 board, so the M5 Pro and M5 Max hit this too. I could not test there.

Testing

J813 (G17G), kernel linux#1413 (7.3.0-aurora-j813-oni4s+), 4 jobs:

build GLES2 GLES3 GLES31
aurora-wip 10161a7 (#194) 16956 / 0 44409 / 0 4353 fail in the first 18658 cases (run cut short)
+ commit 1 28561 / 8587 / 61 flakes
+ commits 1 and 2 (this PR) 16956 / 0 44409 / 0 37352 / 0

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

@RyanTheTide

Copy link
Copy Markdown

This now conflicts with aurora-wip 10161a7 (#194) in agx_batch.c and agx_state.c: #194 added the M5 render storage list for G17S/G17C (m5_render_programs, agx_batch_note_m5_render_program(), the tile entry and SET_RENDER_RESOURCES(_V2) emission keyed on DRM_ASAHI_FEATURE_RENDER_RESOURCES). Could you rebase so G17G uses the same list and helpers (with RENDER_RESOURCES_V2 for G17G), instead of a second m5_render_resources array and submit path? On rebase: unit tests (meson test --suite asahi) and a G17G render submit with the kernel accepting it.

On integration/aurora the J813 (G17G) runs on the G17 kernel runtime
(aurora-silicon/linux#1413), which reports DRM_ASAHI_FEATURE_RENDER_RESOURCES
and _V2 for every M5 board. agx_m5_render_resources() then holds for G17G
as well, so its renders send aurora-silicon#194's program storage lists and its compute
goes as one command per dispatch in the render's submission.

m5_split_prepass still took G17G, for the M5 runtime of older kernels,
which takes one dispatch per submission. With both set:
- the render command's CDM barrier was 0, so the render did not wait for
  the compute commands of its own submission;
- the submission pointed the kernel at its output syncs for its input
  syncs. The split path clears in_sync_count after its per-dispatch
  submissions, but this path made none, so a batch with input syncs
  would have named its own unsignalled output syncobj as an input.

Take the split path only where the kernel does not take mixed command
arrays, and say in the comments that G17G takes the G17 runtime's lists
where it runs on it.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On the G17 runtime a batch's compute goes as one command per recorded
dispatch, all in the render's submission. The kernel takes at most
max_commands_per_submission (64) render and compute commands in one
submission and refuses a longer one with EINVAL ("refused a submission
... at its command of type 1 ... barriers [0x0, 0x40]"). A batch records
as many dispatches as its draws and launches need, and every batch with
more was lost.

Send the leading dispatches in submissions of their own, as many as fit
in each, before the render's. Each repeats the compute storage list. Its
first command waits on the queue's earlier submissions (barrier 0) and
each other one on the command before it, so the chain stays in order.
The render's submission keeps the last dispatches. The chunks signal one
syncobj; a failure waits for the chunks already accepted before the
batch is retired.

J813 (G17G) on linux#1413, GLES31 at 4 jobs: 28561 pass / 8587 fail /
61 flakes before this change, 37352 / 0 / 0 with it.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/j813-gallium-render-storage branch from 8cff908 to da9a77f Compare November 10, 2026 14:24
@sithglan sithglan changed the title asahi: declare an M5 render's program storage to the kernel (Gallium) asahi: G17G on #194's M5 submission path, within the kernel's command limit Nov 10, 2026
@sithglan

Copy link
Copy Markdown
Author

Done, @RyanTheTide: rebased onto 10161a7, and force-pushed 8cff908 -> da9a77f. G17G now uses #194's list and helpers, V2 included, with no array or submit path of its own. On integration/aurora the J813 runs on the G17 runtime (linux#1413), which reports RENDER_RESOURCES and _V2, so agx_m5_render_resources() already holds for G17G.

#194 alone was not enough on the J813, though. GLES2 (16956 / 0) and GLES3 (44409 / 0) were clean, but GLES31 failed by the thousand. The kernel refused submissions at their 64th command: #194 sends one compute command per dispatch, and the kernel takes at most 64 commands per submission, the same on every M5 board. G17G also still took m5_split_prepass beside #194's path. That left the render not waiting for its own submission's compute, and pointed the kernel at the output syncs for the input syncs. The two commits fix both (details in the description).

On the J813, with both commits: GLES2 16956 / 0, GLES3 44409 / 0, GLES31 37352 / 0, with no refused submissions and no recoveries. meson test --suite asahi passes 126 / 126.

@DjDeveloperr

Copy link
Copy Markdown

Reviewed, and tested on an M5 Pro (G17S). Commit 2 changes the G17S/G17C submission path, and the M5 Pro hits the same 64-command limit.

Review

  • Commit 1 only changes G17G/G18G: m5_split_prepass was already false on G17S/G17C. Fine.
  • Commit 2: for batches up to 63 dispatches (64 without a render), agx_append_m5_compute_commands() emits exactly what the old loop did: barrier i, ts.start only on command 0, and ts.end only on the last. So the common case is unchanged.
  • Chunking: after the loop, exactly tail dispatches remain for the render's submission, never zero, so it still owns the output syncs. Barrier 0 on each chunk's first command orders it after the earlier chunks on the queue. The chunks take the full input-sync list, shared-BO syncs included.
  • Error path: accepted/error syncobjs are passed correctly for a first-chunk failure and for a later-chunk failure. A failure of the final submission waits on compute_syncobj, which carries the chunks' fence.
  • MAX2(max_commands_per_submission, 2) can't reach a kernel that reports 1 here: on integration/aurora, only the G17 runtime reports RENDER_RESOURCES, and it reports 64.

Test, M5 Pro (integration/aurora-based kernel; native build of aurora-wip 7f7a7ff with this PR merged as GitHub would merge it; gallium + Vulkan asahi, LLVM 22, asserts on). Each run is the full 37,653-case GLES31 list, with GLES3 at every 10th case.

build meson test --suite asahi dEQP-GLES31 pass / fail refused compute SUBMITs (EINVAL) in the run logs dEQP-GLES3 GPU recoveries
aurora-wip 126 / 126 13,934 / 22,931 366 2,666 / 1,606 0
+ this PR 126 / 126 35,928 / 1,481 (2 flakes) 1 case 2,666 / 1,606 0

By group, pass counts before → after: compute 9 → 192, ssbo 62 → 2,046, atomic_counter 17 → 297, synchronization 4 → 103, tessellation 265 → 413, builtin_functions 2,250 → 2,876. GLES3 is identical case by case.

Three cases went Pass → Fail in that run, in deqp-runner's failure-rerun groups: geometry_shading.emit.points_emit_0_end_0 and two primitive_bounding_box point cases. Rerun one process per case, aurora-wip, this PR and this PR + #219 all agree. points_emit_0_end_0 passes, and both bbox cases fail on aurora-wip as well. So these were run-order artifacts. A one-process-per-case run of the whole rerun group gives the same result on all three builds.

The one refused submit left comes from compute.basic.empty, and aurora-wip refuses it the same way. That's a pre-existing gap with a dispatch that has nothing to run, not this PR. With this PR, two builtin_functions.precision.*_compute QualityWarnings that also logged a refused submit on aurora-wip pass cleanly.

aurora-wip has since moved to be147e3. The real merge results (be147e3 + this PR, then + #219) build, pass meson test --suite asahi 126 / 126, and give dEQP-GLES31 35,924 / 1,485 with 0 recoveries. The few differences from the earlier run are all in shaders.sample_variables.*multisample_texture*, which fail on aurora-wip and flip from run to run.

CI: GitHub Actions doesn't run on this repository, so per the maintainers' rule for this repo the CI is:

  • your fork's asahi run on the exact head (asahi run 42833840032 on da9a77f, success), with its asahi.yml identical to aurora-wip's;
  • agent-policy.sh pr run locally, which reports a clean PR head. The fork's own policy job fails only because it checks out the fork's default branch, which has no .github/aurora;
  • the merge-result build and the tests above.

Merging, then #219.

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