Repository navigation
Bring up T6041 M4 Max on G17P - #85
Conversation
e5dabf4 to
f81076a
Compare
f81076a to
96cff5b
Compare
Add T6041 admission/UAPI compatibility, four-cluster USC slots, Gen9 linear PBE pitch correction, shim coverage and Rusticl preflight checks. Rebase PR aurora-silicon#85 onto aurora-wip cf4e081. Resolve the Zink comment conflict while retaining the Borealis driver ID, helper rename and M4 Max device ID. Preserve the other 15 PR file blobs. The rebased commit still requires hardware verification before merge. Software tests and clean merge checks do not establish hardware validation. Original PR head: 96cff5b Assisted-by: LLM
96cff5b to
6916d73
Compare
|
Rebased onto Resolved the sole conflict in Hardware verification is still required before merge for this exact rebased commit. No hardware testing was performed on the rebased head. The previous head's hardware results and the reported 119 software test passes do not validate this rebase on hardware. Local verification: clean merge against the target, patch applicability and whitespace checks passed; the existing chip-admission test passed in a standalone GNU C build; a compiled comparison of the Zink predicate covered 4,194,304 driver/device combinations, with only Borealis/T6041 changing. A full Mesa build/test suite was not rerun for this rebase. Before merge, rerun the relevant software suites and validate the exact head on M4 Max with the paired kernel and documented serial-render workaround, plus affected M4 Pro/M5 regression checks, especially shared Gen9 pitch and M5 USC/Gen10 behavior. This does not qualify Vulkan/OpenCL or full CTS, and does not resolve the known concurrent-render firmware restart/recovery issues. |
ca90d8c to
e6e04a9
Compare
RyanTheTide
left a comment
There was a problem hiding this comment.
Thanks. The four-cluster helper-slot sizing is the core of this, and the tests around it are good. A few things need to change before it can go into aurora-wip.
Required fixes
- Signed-off-by (hard blocker). e6e04a9 has
Assisted-by: LLMbut noSigned-off-by:. Please add yours, same as on the kernel PRs. - Gen9 linear PBE stride bias (
src/asahi/lib/agx_pbe_agx3_core.c,stride_bias()/linear_stride_bias()). This changes the linear bias from 16 to 4 for everyAGX_PBE_AGX3_GENERATION_9descriptor, which includes the A18 Pro (MacBook Neo) and the M4 Pro, not only T6041. The PR body says this still needs a check on other Gen9 devices. We're running a linear-target render test on our M4 Pro and Neo, and results follow in a comment. Unless they come back identical, please scope the change to the chip that needs it, or show why 16 was wrong everywhere. Either way, please remove theASAHI_G17P_LINEAR_PBE_STRIDE_BIASoverride, since we don't add env knobs for hardware encodings. ASAHI_T6041_PROFILE=g16g(src/asahi/lib/agx_chip.c, inagx_chip_from_params) is a debug override for chip identification. Please drop it, along with the0x6041branch in theAGX_CHIP_G16Gadmission that exists only for it.- New VA hole
0x7100000000..0x7300000000(src/asahi/lib/agx_va_runtime_hole.c) applies to every G17P device and has no comment. What reserves that range on the kernel side? If it's the T6041 split firmware area from aurora-silicon/linux PR 525, please document it there and scope the hole to T6041. - Unrelated changes in the same commit. The Rusticl local-memory checks (
CL_INVALID_ARG_SIZEfor a zero-size local arg, the overflow-checked layout) andagx_params_fixup_upstream_uapi()are reasonable, but they aren't T6041 bring-up. Please split them into their own commits so each can be reviewed and reverted on its own. - Commit message. Please replace "The commit still requires hardware verification before merge" with what you ran on the M4 Max.
What passed so far: an A/B on our M4 Pro (J616s, fleet16 kernel, SELinux enforcing), comparing aurora-wip 05ddb00 with and without this PR, built as overlays from the same tree.
- glmark2 full set: 18543 (base) vs 18704 (this PR); the packaged system Mesa scored 18649.
- Vulkan smoke (compute plus a draw readback) passes on all three.
The Neo and linear-target results follow in a comment. The kernel side (PR 525) isn't mergeable yet, and 0x6041 admission is only useful together with it, so this waits for 525 either way.
|
These are the A/B results promised in the review. Both runs use aurora-wip 05ddb00, without this PR (base) and with it, built from the same tree as overlays. The kernel is fleet16 (no kernel changes), with SELinux enforcing.
The Neo is fanless and sat at 91 to 95 C, so its spread is wider. Neither machine shows a regression. Linear colour targets. This is the case the stride-bias change targets. I rendered the same triangle into None of this changes the blockers in the review: the Signed-off-by, the env knobs, the VA hole and splitting the commit. |
clSetKernelArg must return CL_INVALID_ARG_SIZE when arg_size is zero for an argument declared with the local qualifier. The comment above the match already says so, but MemLocal has no check. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
An oversized local argument is only known at enqueue, and the launch closure cannot return an OpenCL error once it is queued. Pick the kernel variant before building the closure and fail the enqueue with CL_OUT_OF_RESOURCES when static local memory plus the local arguments, laid out with the alignment the launch uses, exceed the device's local memory. Use the same checked helper for the argument offsets at launch so a huge size cannot wrap them. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
The G17P slot rule 0x100 + 16 * (16 * cluster + core) puts clusters 2 and 3 of a four-cluster part at +0x300..+0x390 and +0x400..+0x490, past both helper tables. Give native AGX3 parts with more than two clusters the return fill G15C already has, starting after the second table's terminals. Two cluster parts keep the plain page and G15C's page does not change. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Generation 16 variant C with chip 0x6041, one die, four clusters, USC 3 and HAL 200 takes the G17P contract, as the M4 Pro does. Admit it in Zink's Borealis G17P check too. Run on the M4 Max (J616c, 25F84 firmware) with an earlier revision of this series as the system Mesa, which also carried a Gen9 linear PBE stride bias of 4 and a VA hole at 0x7100000000 that this series no longer has, on a kernel with aurora-silicon/linux PRs 525, 732, 749 and 920 and local opt-in GPU switches: - Installed desktop profile with serial rendering on: renderer "Apple M4 Max (G16C B1)", display manager and both connected outputs up, no GPU recoveries. - Ten boots with serial rendering off, three with no switch and seven with a local switch dropping the firmware's QoS preemption: the niri desktop on GLES 3.2 while whisper.cpp ran twenty times per boot on Honeykrisp (Vulkan compute). 200/200 transcripts correct, no GPU recoveries or faults. - The same load with the QoS switch, stopped by request after 152 runs, no GPU recoveries. glmark2 and the Rusticl verifier did not run on that revision. They ran on Mesa f2c9dc3 with these changes as separate patches and serial rendering on: glmark2 33/33 scenes, and Rusticl with 32 KiB of local memory, 32 rounds, no mismatches and four invalid requests rejected. This final tree has not run on hardware. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
ASAHI_SHIM_CHIP=t6041 reports the T6041 on the G17 kernel: variant C, USC 3, HAL 200, the G17 feature word and queue limits, and the G17 render aux alias and stream validation rules. Run the Gallium shim tests against it. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
A kernel built against the upstream UAPI ends drm_asahi_params_global at command_timestamp_frequency_hz, so usc_generation and gpu_hal_generation stay zero, and its feature bits above SOFT_FAULTS mean something else here. When usc_generation is zero, mask the features to SOFT_FAULTS and, for the T6041 only, imply USC 3 and HAL 200. Admit variant X, which the out-of-tree asahi_m4 T6041 kernel reports, and add a t6041x shim identity. Kernels that report usc_generation are untouched, including aurora-silicon/linux with its variant C T6041, so no hardware run on this tree reaches this path. It last ran on the M4 Max with asahi_m4 on an earlier Mesa base. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
e6e04a9 to
53b30c6
Compare
RyanTheTide
left a comment
There was a problem hiding this comment.
Thanks, every point from the review is done. The stride bias is back at 16, the env switches and the VA hole are gone, and the Rusticl and UAPI pieces are their own commits now.
Here, on aurora-wip c175370 with and without this PR: the asahi and vulkan suites are 76/76 on both, Rusticl builds clean, no new warnings. For the M4 Pro and the Neo the GL and Vulkan paths are the same as before, since the base page fill only kicks in above two clusters and the upstream UAPI fixup only runs when the kernel reports usc_generation 0, which none of ours do. The earlier A/B on both machines covered a bigger version of this. The kernel side is merged as of aurora-silicon/linux#958, so merging!
One small question for later. Variant X and the upstream UAPI path are for the out-of-tree asahi_m4 kernel, which nothing here ships. If nobody needs it anymore I'd rather drop it than carry it, what do you think?
aurora-wip gained the T6041 G17P path (#85). It adds agx_params_fixup_upstream_uapi() in agx_chip.c and agx_chip.h at the spot where this branch adds agx_params_native_kernel_abi_supported(). The two are independent; keep both, this branch's first. They do not interact. agx_open_device() calls the ABI check only for G15G, so the T6041 upstream UAPI path, whose features the fixup masks to SOFT_FAULTS, never reaches it. The fixup only acts on parameters with usc_generation 0, and G15G is admitted only with usc_generation 3.
Why
Mesa's AGX driver already carries the M4 Pro (G17P, two clusters). The M4 Max is the same generation with four clusters and reports chip 0x6041. The USC helper tables assume at most two clusters, and the chip isn't admitted.
What
asahi: fill the USC base page on parts with more than two clusters; the two-cluster layout is unchanged.asahi: admit the T6041 on the G17P path; add a drm-shim identity.asahi: accept upstream UAPI parameters on the T6041. No aurora-silicon kernel reaches this path; it last ran withasahi_m4on an earlier Mesa base.rusticl: reject a zero-size local kernel argument; check local memory against the device limit at enqueue.The linear PBE stride bias stays at 16. Every switch from earlier revisions is gone.
Testing
Mesa is this PR on a merge of the kernel PRs (aurora-silicon/linux#525 and its stack), no local patches, on a J616c running NixOS. Logs are at https://gist.github.com/astaff/d1f649ba0d29f5279762e2baa427e732.
Limits
aurora, Rusticl needsRUSTICL_ENABLE=aurora;RUSTICL_ENABLE=asahifinds no device.🤖 Generated with Claude Code