Skip to content

drm/asahi: admit compute sampler heaps on G14 firmware 27.2 - #3198

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/g14-v27-2-compute-samplers
Nov 26, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/g14-v27-2-compute-samplers

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

What: G14 firmware 27.2 queues refused every compute command that names a sampler heap (M3 compute rejected: flags=0x0 samplers=1024 heap=…, ENOTSUPP, VK_ERROR_DEVICE_LOST in Borealis), because the 27.2 compute command's sampler placement was not known. The firmware loads the heap, count and bound of every command type through one handler; for the compute command they sit at +0x284/+0x28c/+0x290. Admit the heap on G14 27.2 compute, as render already does, and write it there.

Tested: J313 M1 Air (G13G, fw 27.2) at 0ed56efa on the #199 tree (#3178 dbb7b44b + #3171 3577ce0e): before, sampler_mutable.compute.single_descriptor.2d lost the device with 1 rejection; after, 3421/3425 dEQP-VK binding_model compute sampler cases pass (4 not supported, 0 fail), 954/954 fragment sampler controls pass, then 2 deep-sleep cycles and 3408/3408 compute sampler cases pass again after the wake. 0 compute rejected, 0 GPU faults, 0 kernel WARN/BUG; only failed unit aurora-sep (pre-existing, also on #199).

Risk: two-way · M1 and M2 on firmware 27.2 (the G14 27.2 runtime); M3 queues unchanged (still refuse compute sampler heaps)

Not yet: M2 (T8112) on 27.2 — needs a row from someone with one.

Details
  • Where the words are. In the G13G 27.2 firmware, the handler that programs a data master's sampler state branches on the command type and reads, from the command: microsequence pointer, sampler heap (u64), sampler count, sampler bound. TA: +0x46c, +0x558, +0x560, +0x564. 3D: +0x14, +0x8bc, +0x8c4, +0x8c8. Compute: +0x1e8, +0x284, +0x28c, +0x290. Count and bound are 11-bit fields of the same state word. The compute microsequence pointer (+0x1e8) is the one encode_compute already writes, which identifies the branch; the TA and 3D words are the ones the G14 27.2 render builders already write (g14_v27_2_render.rs).
  • Layout check. These are the 13.5 EncoderParams sampler words moved 0x10 bytes further on, the same shift as the 3D command (13.5 +0x8ac → 27.2 +0x8bc). They fall between the encoder mask (+0x270) and the JobMeta stamps (+0x298), in no word the compute encoder otherwise writes; a new g14_v27_2_abi test pins this.
  • Change.
    • m3_submit.rs: compute sampler heaps are refused only on queues whose builders do not encode them (samplers_and_helpers, false for M3). The common translator already validates the heap: at most 1024 samplers, heap and count both set or both zero, 8-byte aligned, readable in the submitting VM.
    • agx_compute::Control and ComputeJob carry the validated heap and count. encode_compute writes heap, count and count + 1 as the bound (the 13.5 compute command's bound), or leaves all three zero without samplers.
  • Why samplers=1024. Borealis names its whole sampler table (1024 entries) on a compute command whose shaders sample through the heap; dEQP's sampler_mutable compute cases reach that path; a plain combined or separate sampler in my own check did not.
  • No new parameters, no chip or firmware gate: the existing per-queue capability decides.
Evidence
Run on J313 #199 (before) j313cmpsmp (after)
binding_model…bind.sampler_mutable.compute.single_descriptor.2d DeviceLost, 1 compute rejected pass
binding_model…bind.*sampler*.compute.single_descriptor.2d* aborted at first case 96/96
all binding_model .compute. sampler cases (3425) not run (aborts) 3421 pass, 4 not supported, 0 fail
fragment sampler controls (954, every 8th binding_model .fragment. sampler case) – 954/954
dEQP-VK.compute.pipeline.basic.* – 64 pass, 5 not supported, 1 harness error (missing .amber data file in the copied CTS)
own compute sampling check (texture + 2 separate samplers, CPU reference) pass, 5 submits (Borealis does not use the heap for it) pass, 200 submits, 0 bad channels
compute stress check, 30 s – 26213 runs, 0 wrong
deep sleep (rtcwake -d rtc1 -m mem -s 30) ×2 – both entered and woke (GPU prepared for deep sleep: submitted=69949 completed=69949 pending=0, wake source PMU RTC); after wake 3408/3408 compute sampler cases, own check and 15 s stress pass
kernel log 1 compute rejected 0 compute rejected, 0 aurora fault/timeout, 0 WARNING/BUG/Oops
  • dEQP-VK from a VK-GL-CTS aarch64 build; Borealis/Mesa mesa-aurora 26.3.0_devel.202611150611.d4ad4a4dce6.
  • Mac returned to the default 7.3.0-j313usb4s2r #199 afterwards; GRUB files match their pre-trial hashes.

The G14 firmware 27.2 queues refused every compute command that names a
sampler heap with ENOTSUPP ("M3 compute rejected: ... samplers=1024"),
because the 27.2 compute command's sampler placement was not known.
On these GPUs Borealis names its sampler heap on every compute command
whose shaders sample through a sampler, so compute work that samples
textures was dropped on the 27.2 firmware (the M2, and the M1 with its
27.2 support).

The firmware loads the sampler heap, the sampler count and the sampler
bound of every command type through one handler, keyed by the command
type, into the data master's sampler state: TA command +0x558/+0x560/
+0x564, 3D command +0x8bc/+0x8c4/+0x8c8, compute command +0x284/+0x28c/
+0x290. The count and the bound are 11-bit fields. The render builders
already write the TA and 3D words. In the compute command these are the
13.5 EncoderParams sampler words, 0x10 bytes further on, as the 3D
command's are (13.5 +0x8ac, 27.2 +0x8bc), between the encoder mask
(+0x270) and the JobMeta stamps (+0x298).

Admit the sampler heap on compute for queues whose builders encode it
(the G14 27.2 queues), as render already does. The common compute
translator validates the heap (at most 1024 samplers, both fields set or
both zero, 8-byte aligned, readable in the submitting VM). Carry it in
the compute control to the 27.2 compute encoder, which writes the heap,
the count, and the count plus one as the bound, as the 13.5 compute
command does; a command without samplers keeps the words zero. The M3
queues still refuse compute sampler heaps.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team and DjDeveloperr as code owners November 26, 2026 06:55
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 0ed56efa: ready to merge

Check Detail
CI at head ok 18 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 0ed56efa
Conflicts ok none
PR text ok Risk: two-way · M1 and M2 on firmware 27.2 (the G14 27.2 runtime); M3 queues unchanged (still refuse compute sampler heaps)

Areas: area:gpu
Merge: gh pr merge 3198 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

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 0ed56efaa6: the code is ready; it needs only a second-generation row at this head.

Blockers: none in the code. Missing row: g14_v27_2 runs M1 and M2, so it needs one M2 (T8112) on firmware 27.2 at this head: compute sampler cases pass with 0 compute rejected and 0 GPU faults, and render stays unchanged. We're asking PEER-ROWS for a J473 or J413 on 27.2.

Checked:

  • The three words sit between the encoder mask and the JobMeta stamps, which is the 13.5 sampler layout shifted by 0x10, matching the shift of the 27.2 fragment words the render builders already write.
  • The 11-bit bound holds at 1024 samplers (1025).
  • A command without samplers stays all zero.
  • Only queues with samplers_and_helpers admit a heap, so the M3 26.x queues still refuse it.
  • The J313 rows cover before and after, plus 2 deep sleeps. No board gates and no new parameters.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@RyanTheTide
RyanTheTide merged commit b48ebb9 into main Nov 26, 2026
20 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

0ed56ef J473 (M2 Mac mini, T8112, G14G fw 27.2, merged main 255761f) PARTIAL-PASS (sampler heap PASS 3408/3408, compute.heavy timeout finding): before on stock fleet89, binding_model...sampler_mutable.compute.single_descriptor.2d failed 1/1 VK_ERROR_DEVICE_LOST + M3 compute rejected samplers=1024; at 0ed56ef, 0 compute rejected, exact repro 1/1 PASS, all 3408/3408 binding_model sampler*.compute.* CTS cases PASS (100.0%), gpubench-vk compute.light PASS; however gpubench-vk compute.heavy timed out (ETIMEDOUT at g14_v27_2.rs:713, FAULT_INFO=0x0, submitted=27605 completed=27604) leaving M3 scheduler returning EIO for subsequent clients including post-s2idle CTS. Enforcing, 0 failed, 0 AVC; fleet89 restored.

RyanTheTide added a commit that referenced this pull request Nov 26, 2026
Brings the G14 firmware 27.2 recovery up to main 255761f (the source of
the m2combo22 kit): pool slot double buffers with the publish-only flip
and cursor re-advance (#3182), compute sampler heaps (#3198), the pool
stall report and the deep-sleep warm restart.

Conflicts were additive: State keeps both the recovery fields and
hardware_unreachable/commit_stop, the ABI file keeps both the recovery
records and the Globals/compute/pool helpers with both test sets, and
run-host-tests.py runs both g14-v27-2-abi-tests.rs and pmp-alloc-tests.rs.
Stopped commands keep #3182's slot rule: their slot is retired the normal
way, and its next command goes to the slot's other buffer, so the stopped
command stays intact until the firmware unlinks the slot again.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the fix/g14-v27-2-compute-samplers branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants