Skip to content

drm/asahi: g17: size clustering metadata for four clusters - #1

Closed
AxxzyWasTaken wants to merge 30 commits into
astaff:t6041/j616c-gpu-audio-video-20261027from
AxxzyWasTaken:j616c/g17-four-cluster-tiling
Closed

AxxzyWasTaken wants to merge 30 commits into
astaff:t6041/j616c-gpu-audio-video-20261027from
AxxzyWasTaken:j616c/g17-four-cluster-tiling

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Oct 30, 2026 •

Copy link
Copy Markdown

On T6041 (M4 Max) some heavy renders never start: their TA and 3D start stamps stay 0, and the firmware kills the render as no-progress (recovery reason 0). This may be the same reason-0 behaviour that aurora-silicon#525 works around with t6041_serial_render=1.

Cause

The 25G83 tiler parameter block in g17/buffer/target.rs gives clustering metadata 1-4 fixed sizes: 0x80, 0xc00, 0xa00, 0x600. Those are the two-cluster M4 Pro's. The four-cluster M4 Max outgrows them on heavy geometry. The driver's own M2 Pro/Max path (hw/t602x.rs) sizes the same buffers larger:

Register Buffer G17 today t602x (M2 Pro/Max)
0x1c948 metadata 2 0xc00 0xc0 × 16 = 0xc00
0x1c888 metadata 3 0xa00 0x280 × 16 = 0x2800
0x16c41 / 0x1ca40 metadata 4 0x600 0x10 × 128 = 0x800
0x1c920 metadata 1 0x80 0x44 per block of tiles

Change

On GPUs with more than two clusters, use the t602x sizes. Metadata 1 is sized per target from the block count the M1/M2 path uses (ceil(align(tiles_x, 2) × align(tiles_y, 4) × utiles / 0x1980)), with a floor of the old 0x80. The M4 Pro (two clusters) keeps its current sizes. No registers change.

Testing

J616C (T6041, 32-core GPU), 25G83 GPU firmware. Kernel 7.2.10 with our G17 tree (which has the same tiler code as this branch), Mesa HoneyKrisp/asahi with ASAHI_MESA_DEBUG=1queue,nocompress. Not tried on a 40-core part or on 25F84 firmware.

  • Hang reproducer: an apitrace replay of Minecraft's first frame with the world loaded (OpenGL, 1690×2122 main pass, heavy multi-draw-indirect chunk geometry), replayed headless.
    • With clustered tiling and the current sizes, 6 of 9 runs hung. In each, the stuck render never started and was killed as reason 0.
    • With these sizes, 0 of 36 runs hung (6 runs each across four register variants, plus 12 with the sizes alone).
    • We also tried the t602x register values (0x1c890 = 0x180340, 0x1c918 = 4, 0x1c9a8 = 0x1c). On top of the sizes they made no difference, so this change leaves registers alone.
  • Speed (vkstress, 3456×2234, no MSAA):
    • Clustered tiling's TA stage is 3.9× faster than non-clustered (0x1c890 bit 0 set): 2M small triangles took 22.2 ms → 5.8 ms per frame.
    • With clustering off, heavy TA passes reach 33-35 ms, right at the no-progress window.
  • Not tested:
    • this exact branch on hardware (the commit was compile-checked here; the testing above ran on our tree with the same change);
    • whether it lets t6041_serial_render go away. That needs a concurrent-render run on this branch.
  • Note: for draw-call-heavy workloads such as Minecraft's Vulkan renderer, clustered tiling isn't faster. It was about 7% slower than non-clustered in one A/B. This PR only fixes clustered mode; it doesn't decide which mode to use.

astaff and others added 15 commits October 28, 2026 17:11
Reuse the existing SoC and PMGR descriptions as the shared T604x base.
The J616s compiled tree keeps every node and property unchanged.

Assisted-by: LLM
Describe the Max CPU, OPP and register-window differences on the shared
base. Preserve the qualified J616c node and property values.

Assisted-by: LLM
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Move identical register-window constructors into a family helper.
The T6040 and T6041 initialization-data checks retain their exact values.

Assisted-by: LLM
Select a static 25F84 profile and admit the normalized loaded image
measured in three qualification boots. Remove exploratory overrides
and unknown-image admission from the support path.

Assisted-by: LLM
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Keep the reason-0 and cancellation handling scoped to 25F84, with
serial rendering explicitly opt-in. Concurrent-render firmware restarts
and complete recovery remain unresolved.

Assisted-by: LLM
Add gated 26.5.2 firmware acceptance and headerless powerlog parsing
for the T6041 display controller.

Assisted-by: LLM
Wait for the flip notification before completing commit cleanup so
framebuffer ownership follows scanout completion.

Assisted-by: LLM
Give bootarg access width its own hardware setting and patch through
one aligned buffer. Preserve surrounding bytes and verify changed words.
Synthetic MMIO checks cover malformed tables, bounds and failed readback.

Assisted-by: LLM
Describe the six amplifiers and headphone jack in the J616c board
DT. Stop playback when the protection lease is lost.

Assisted-by: LLM
Limit admission to the qualified J616c machine and firmware layout.
Apply the capability per device without allocating or changing the
shared variant descriptor.

Assisted-by: LLM
Register the watchdog against its platform device and apply the
configured nowayout policy.

Assisted-by: LLM
Build the production initialization objects with their soft-float types
and compare constants with explicit capture inputs. Keep T6040 per-chip
calibration validation separate; include no captures or local defaults.

Assisted-by: LLM
m1n1 compares DT CPUs with its physical MPIDR enumeration. Appending the Max cores to the Pro topology put CPU 9 out of order and stopped boot before kernel entry.

Define the full family topology in hardware order and remove the extra cores from J616s. Check the compiled DTB order for both SoCs.

Assisted-by: LLM
The 25G83 tiler parameter block gives clustering metadata 2-4 and 1
fixed sizes (0xc00, 0xa00, 0x600, 0x80) that come from the two-cluster
M4 Pro. On the four-cluster M4 Max, clustered tiling outgrows them on
heavy geometry: the firmware never starts the render (TA and 3D start
stamps stay 0) and kills it as no-progress (recovery reason 0).

On GPUs with more than two clusters, size them as the M2 Pro/Max path
does (hw/t602x.rs): metadata 2 0xc00, metadata 3 0x2800, metadata 4
0x800, and metadata 1 at 0x44 per block of tiles. The M4 Pro keeps its
sizes.

Tested on J616C (T6041, 32-core GPU) with an apitrace replay of
Minecraft's first in-world frame, which hung 6 of 9 runs clustered
before and 0 of 36 after; synthetic heavy geometry ran 0 hangs either
way and tiles 3.9x faster clustered than with clustering disabled.
Reuse the existing SoC and PMGR descriptions as the shared T604x base.
Keep the M4 Pro DRAM class in t6040.dtsi on top of it. The J614s and
J616s compiled trees keep every node and property unchanged.

Assisted-by: LLM
@astaff
astaff force-pushed the t6041/j616c-gpu-audio-video-20261027 branch from c048e0e to 3d0938d Compare November 3, 2026 20:33
astaff added 13 commits November 3, 2026 19:09
Describe the Max CPU, OPP and register-window differences on the shared
base. Preserve the qualified J616c node and property values.

Assisted-by: LLM
Move identical register-window constructors into a family helper.
The T6040 and T6041 initialization-data checks retain their exact values.

Assisted-by: LLM
Select a static 25F84 profile and admit the normalized loaded image
measured in three qualification boots. Remove exploratory overrides
and unknown-image admission from the support path.

Assisted-by: LLM
Keep the reason-0 and cancellation handling scoped to 25F84, with
serial rendering explicitly opt-in. Concurrent-render firmware restarts
and complete recovery remain unresolved.

Assisted-by: LLM
Add gated 26.5.2 firmware acceptance and headerless powerlog parsing
for the T6041 display controller.

Assisted-by: LLM
Wait for the flip notification before completing commit cleanup so
framebuffer ownership follows scanout completion.

Assisted-by: LLM
Give bootarg access width its own hardware setting and patch through
one aligned buffer. Preserve surrounding bytes and verify changed words.
Synthetic MMIO checks cover malformed tables, bounds and failed readback.

Assisted-by: LLM
Describe the six amplifiers and headphone jack in the J616c board
DT. Stop playback when the protection lease is lost.

Assisted-by: LLM
Limit admission to the qualified J616c machine and firmware layout.
The qualified image carries no CODECS trailer, which otherwise keeps
T6040 HEVC hidden. Apply the capability per device without allocating
or changing the shared variant descriptor.

Assisted-by: LLM
Register the watchdog against its platform device and apply the
configured nowayout policy.

Assisted-by: LLM
Build the production initialization objects with their soft-float types
and compare constants with explicit capture inputs. Keep T6040 per-chip
calibration validation separate; include no captures or local defaults.

Assisted-by: LLM
m1n1 compares DT CPUs with its physical MPIDR enumeration. Appending the Max cores to the Pro topology put CPU 9 out of order and stopped boot before kernel entry.

Define the full family topology in hardware order and remove the extra cores from T6040. Check the compiled DTB order for both SoCs.

Assisted-by: LLM
Keep the shared firmware profiles' tiler segment control (0x1c890,
0x1c918) and enable mode 1 (0x1c890 = 1, 0x1c918 = 0) only in T6041's
admitted 25F84 build. Pass that device/build policy through RenderArgs
without changing register ordering, merge-buffer writes, fragment
programs or serial-render admission.

Add KUnit coverage for the policy boundary and constructor output,
including SCS array shape and unchanged fragment/G17P arrays.

Motivated by AxxzyWasTaken's separate J616C/25G83 implementation results:
aurora-silicon#525 (comment)
Those results do not validate this branch or its 25F84 firmware; the
cluster merge-buffer explanation remains a hypothesis.

Validation: patch application/reversal, whitespace and source-scope checks.
Not yet compiled, KUnit-executed or hardware-tested. Keep the existing
asahi.t6041_serial_render=1 workaround pending the concurrent-render test
matrix documented in the PR.

Assisted-by: LLM
@astaff
astaff force-pushed the t6041/j616c-gpu-audio-video-20261027 branch from 3d0938d to 84612a4 Compare November 4, 2026 00:40
…r-tiling

The branch's other commits are an old copy of the base, so the tree takes
the base as it is, plus the four-cluster sizes. Metadata 4 now keeps the
base's larger partial-render size where that exceeds 0x800.
@astaff
astaff force-pushed the t6041/j616c-gpu-audio-video-20261027 branch from 84612a4 to 18ca0a6 Compare November 5, 2026 02:49
…r-tiling

The tree is the base plus the tiling change of this branch.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken

Copy link
Copy Markdown
Author

Superseded by aurora-silicon#2021, which carries this metadata sizing together with the four-cluster segment words and a larger tiler heap normal maximum, against current integration/aurora.

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.

2 participants