Repository navigation
drm/asahi: g16: advertise soft faults - #3058
Conversation
With DRM_ASAHI_FEATURE_SOFT_FAULTS, Mesa marks every load as safe to speculate, so it can peephole-select and hoist loads out of control flow, and it drops the bounds checks of robust vertex fetches. G16 has never advertised the bit: its soft_faults() returned false since the backend landed. The G17 backend advertises it after measuring that its firmware's own fault mode returns zero for unmapped loads and drops unmapped stores. G16 programs no fault mode, and no word of the macOS 26B123 InitData or queue records captured on the J773g reads as one; its kext writes no GPU register outside the ring write cells. So the default fault behaviour of the 26B123 G16G firmware decides. On the J773g (26B123) with the bit advertised, 18,676 dEQP-VK robustness cases (every case outside robustness2, and 2,500 of the 82,600 robustness2 cases sampled across its groups) give the same results with Mesa's soft-fault use on and off (ASAHI_MESA_DEBUG=nosoft): 8,762 pass, 9,914 not supported, none fail, with no GPU fault or recovery. The full Vulkan and OpenGL benchmark suites and a deep sleep ran without a GPU fault. Loads, stores and atomics to unmapped leaf, level-2 and root translations have not been measured on their own. A shader store to an unmapped leaf of a closed VM's context has faulted and recovered the GPU on this backend, so the store half of the uAPI's promise is not shown yet. Keep fault_control (default 0xb) as the opt-out. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Verdict at Blockers: none while it is a draft. Before it leaves draft it needs a row at its head, and the open point the commit names: with Checked: the diff ( |
|
Verdict at A = Feature bit
The bit flips only on this commit; no other feature bit moves. gpubench‑vk, median µs per submit (7 families, depth 2, 7 × 500 ms)
All five render CRCs match bit‑exactly between the arms; the two compute families have no image CRC to compare. Seven‑family geomean B/A = +0.88 %, inside short‑run noise (compute.light is the usual outlier at 1.5 µs of GPU per submit). Offline Geekbench 6 Vulkan, median workload iteration time in ms
160 iterations observed on each arm (8 workloads × 20), 0 validation errors, strictly offline (geekbench6 runs under Vulkan CTS on B (the SOFT_FAULTS‑on arm), 4 jobs
0 CTS recoveries, 0 stderr matches on either gate. Open point: the uAPI store‑discard promise on this backendThis is the measurement the draft was gated on, captured 11‑24 in
So on G16G firmware 26B123, unmapped loads return zero, stores to unmapped memory are silently discarded, atomics observe the same, and no fault reaches the ring — which is the RecommendationLeave draft — the open point is now measured on this backend, the bit flips only where it should, every shader CRC across five render families and every GB6 workload timing matches A within noise, and 98 865 CTS cases plus ~366 k combined submits on the SOFT_FAULTS‑on kernel produced zero recoveries, zero stderr matches and zero fault counters. Over to you for the undraft + push. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at cfe10888f5bc
Blockers: none
Checked: diff across drivers/gpu/drm/asahi/g16/mod.rs, drivers/gpu/drm/asahi/g16/params.rs, and tools/testing/selftests/drivers/gpu/asahi-m4/test-uapi.py; soft_faults() override preserves the shared fault_control opt-out (0xb default vs non-0xb opt-out) verified by the new rustc test harness; exact-head J773g (G16G B0, firmware 26B123) A/B hardware row covering GET_PARAMS.features bit flip, 7-family gpubench-vk, Geekbench 6 Vulkan, 98,865 Vulkan CTS cases (dEQP-VK.robustness.*), and targeted unmapped leaf/L2/root load/store/atomic fault-discard probes; commit hygiene (single commit with DCO Signed-off-by, zero AI attribution, zero Apple material); mergeable on stacked base #3057; CI green.
Evidence
- Code audit (
cfe10888f5bcb238823280bfd840e2c49c361044):drivers/gpu/drm/asahi/g16/mod.rs: overridesfn soft_faults(&self) -> bool { true }without overridingsupports_soft_faults(), keeping the sharedfault_control == 0xbopt-out ingpu.rs.drivers/gpu/drm/asahi/g16/params.rs: updates module doc comment to includeSOFT_FAULTSfromsoft_faultsandfault_control.tools/testing/selftests/drivers/gpu/asahi-m4/test-uapi.py: compiles sharedfeature_flags()/supports_soft_faults()defaults together with G16'ssoft_faults()override and assertsDRM_ASAHI_FEATURE_SOFT_FAULTSis set only whenfault_control == 0xband other shared feature bits stay unchanged on opt-out.
- Hardware & CI verification:
- Exact-head J773g (Mac mini M4, G16G B0, 26B123) A/B measurement in comment
#issuecomment-7162521994confirmsGET_PARAMS.featuresmoves solely onSOFT_FAULTS(0x000001026001fc06->0x000001026001fc07), 5/5 render CRCs match acrossgpubench-vk, Geekbench 6 Vulkan geomean is +0.060%, 98,865 Vulkan CTS cases pass/not-supported with 0 failures and 0 recoveries, and unmapped leaf/L2/root load/store/atomic probes confirm zero faults and store-discard semantics. - Paginated check-runs at
cfe10888f5bc:1/1completed (readiness / readinesssuccess),0active,0failing.
- Exact-head J773g (Mac mini M4, G16G B0, 26B123) A/B measurement in comment
Sync with main after retargeting base from the merged prerequisite branch. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Merged |
The shared feature_flags() now reads backend-specific feature bits. Return zero from the soft-faults mock so the host test can compile the shared implementation and check the G16 fault_control opt-out. Signed-off-by: Diljit Singh <hey@djdev.me>
|
5a055fc adds |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 5a055fcec427
Blockers: none
Checked: Full 3-file diff (drivers/gpu/drm/asahi/g16/mod.rs, drivers/gpu/drm/asahi/g16/params.rs, and tools/testing/selftests/drivers/gpu/asahi-m4/test-uapi.py), UAPI feature-flag consistency (DRM_ASAHI_FEATURE_SOFT_FAULTS), DCO sign-off, author hardware evidence, and CI completion.
Evidence
- Soft-fault UAPI advertisement:
drivers/gpu/drm/asahi/g16/params.rsanddrivers/gpu/drm/asahi/g16/mod.rsadvertiseDRM_ASAHI_FEATURE_SOFT_FAULTSon the G16 backend matching the existing soft-fault recovery path. - Selftest alignment (
5a055fcec427):tools/testing/selftests/drivers/gpu/asahi-m4/test-uapi.pyupdates mock backend feature flag expectations cleanly without weakening assertions. - DCO & CI: All non-merge commits carry
Signed-off-by:. All 18 functional CI checks pass with0active (readiness / readinesscancelled informational only).
|
|
Stacked on #3057.
What and why
G16 has never advertised
DRM_ASAHI_FEATURE_SOFT_FAULTS. With the bit, Borealis marks every load as speculatable before peephole select and preamble formation, and drops the bounds checks of robust vertex fetches.The G17 backend advertises it after measuring its firmware's own fault mode.
So the default fault behaviour of the 26B123 G16G firmware decides.
fault_control(default 0xb) stays the opt-out.Testing
Host.
test-uapi.pynow compiles the sharedfeature_flags()/supports_soft_faults()defaults with G16's override: the bit is set atfault_control0xb and clear otherwise.--strict: 0/0/0.Hardware (Mac mini M4, J773g, G16G B0, firmware 26B123), on our M4 integration tree carrying this commit:
ASAHI_MESA_DEBUG=nosoft): 8,762 pass, 9,914 not supported, 0 fail. There was no GPU fault and no recovery.Not tested yet (why this is a draft)