Repository navigation
drm/asahi: g17: support staged and compute-prefixed renders in render_direct() - #3388
Conversation
…_direct() Previously render_direct() rejected every render carrying either DRM_ASAHI_RENDER_STAGE_PREFIXES or a non-zero compute prefix (wait_through[1] / tiling_wait_through[1]), forcing them onto the device-mutex prepare_render() path. In GTA V on M5 Pro, 100.0% of renders (77,005/77,005) carry non-zero compute prefixes and 69.4% carry stage_prefixes, leaving render_direct() completely unused (0%) and serializing every render publication and mailbox doorbell under the global device mutex. Populate render_tiling (via tiling_wait_through[0]) and tiling (via wait_through[0]) in Pair::own_dependencies() matching Registry::render_dependencies(), resolve wait_through[1] and tiling_wait_through[1] across all owner compute queues inside Firmware::lend_render() (which already holds the device mutex, returning Ok(None) on EAGAIN or non-zero recovery state to fall back cleanly), and admit both staged and compute-prefixed renders in render_direct(). Add a compiled host test with 5 mutation traps verifying render_direct() admission, lend_render() compute-prefix resolution and EAGAIN fallback, and Pair::own_dependencies() parity for staged and plain renders. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
The newly admitted staged renders use Pair::own_dependencies() for both render prefix scopes. That only sees the lent pair, whereas the mutex path walks the registry, including borrowed siblings. Please coordinate with #3301 and show that fallback covers both wait_through[0] and tiling_wait_through[0] for staged renders, including a live sibling whose dependency belongs to the tiling prefix. Add an exact direct-vs-mutex comparison for that case. The combined J714s A/B also leaves isolated and peer rows open.
…refix work Pair::own_dependencies() only inspects the lent pair, whereas Registry::render_dependencies() walks every render pair of the owner (including pairs lent out for preparation or heap growth via borrowed_dependencies). Coordinating with #3301, add Registry::has_other_pair_dependencies() and call it in lend_render() ahead of Pair::host_growth_target() so any live or borrowed sibling pair holding work covered by either wait_through[0] or tiling_wait_through[0] (including a sibling whose dependency belongs to the tiling prefix) falls back to the device-mutex path. Extend g17-direct-stage-prefixes-tests.py with direct-vs-mutex parity comparisons and live/borrowed/tiling-only sibling fallback tests plus 3 new mutation traps. Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
The new pre-lend guard examines both whole-render and tiling prefixes, including the borrowed snapshot for a sibling whose resident pair is unavailable. A matching sibling falls back before host-growth state is sampled. I ran the exact-head direct-stage-prefix host fixture and verified the resident, borrowed and tiling-only cases. Code approved. The combined benchmark does not isolate this patch. Keep held for exact isolated J714s A/B, affected peers and hosted CI.
|
J700 (MacBook Neo, Apple A18 Pro
|
Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
Verdict: HOLD for hosted CI and final-stack hardware qualification.
Checked: All three PR runtime files and the direct-stage fixture have the same Git blobs as the previously approved head. The merged host-test runner retains the fixture and both sibling-prefix regression controls. The attached J700 combined row is for the older pair of heads. Preserve the isolated comparison and affected-peer gates for the landing stack.
Keep both the direct-stage-prefix and M5 governor-stop host test registrations. Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at dab63909 (wait for queued CI at dab63909 and retain the isolated J714s / peer hardware gates from the prior review)
Blockers: none
Checked:
- Clean forward-merge of
origin/mainintoperf/g17-direct-render-stage-prefixes:- Verified all four PR runtime/test files (
drivers/gpu/drm/asahi/g17/queue/render.rs,runtime/render/dependencies.rs,runtime/render/direct.rs,tools/asahi/g17-direct-stage-prefixes-tests.py) have identical Git blob SHAs to previously approved6d28e86a. - Verified
tools/asahi/run-host-tests.pycleanly retains bothg17-direct-stage-prefixes-tests.pyandg17-m5-governor-stop-tests.py.
- Verified all four PR runtime/test files (
- Checked for Apple material, tool attribution, and private serials: clean;
MERGEABLEonmain; humanSigned-off-bypresent;Tested:andRisk: Two-way doorpresent.
Evidence
- Head:
dab63909(base: main,mergeable: MERGEABLE,+623/-8across 5 files). - Compared blob SHAs between
6d28e86aanddab63909across all 4 code/test files: 4/4 identical. - Hosted CI at
dab63909is currently queued.
|
Merge train note (code-owner ping <@422957901716652033>): |
|
J700 exact-head smoke passed at Stock |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: CODE-CLEAR at dab639093cde4b5d4b8fdf6e72b04f4457ecff8d
Audited all 5 touched files, forward-merge resolution (dab639093cde), dependency parity between Pair::own_dependencies() + Firmware::lend_render() and Registry::render_dependencies(), build, host tests, and negative controls.
Verification Summary
- Merge & hygiene:
dab639093cdeis a clean forward-merge ontoorigin/main(driver filesdrivers/gpu/drm/asahi/g17/{queue/render.rs,runtime/render/dependencies.rs,runtime/render/direct.rs}are byte-identical to334dbc6c7e8b;tools/asahi/run-host-tests.pykeeps bothg17-direct-stage-prefixes-tests.pyandg17-m5-governor-stop-tests.py). All PR commits carry validSigned-off-by,git diff --checkis clean, andscripts/checkpatch.pl --strict --no-treereports0errors /0code warnings (1standard new-fileMAINTAINERSnotice on the test script). - Build & host tests:
LD [M] drivers/gpu/drm/asahi/aurora.ocompiles cleanly with 0 errors and 0 warnings in touched files.g17-direct-stage-prefixes-tests.pypasses (including all 8 mutation traps); an independent negative control substituting the whole-render prefix fortiling_wait_through[0]failed at the expected direct-vs-mutex parity assertion. (Observed Apple DCP host-test failures reproduce identically on unmodifiedorigin/mainbaseline.) - Correctness audit:
Registry::has_other_pair_dependencies()executes ahead ofPair::host_growth_target(), checks bothwait_through[0]andtiling_wait_through[0], and covers both resident pairs andborrowed_dependencies(render and tiling prefixes), guaranteeingPair::own_dependencies()matchesRegistry::render_dependencies().Firmware::lend_render()resolvescompute(tiling_wait_through[1]) andfragment_compute(wait_through[1] != tiling_wait_through[1]) under the device mutex and falls back cleanly (Ok(None)) onEAGAINor non-zerorecovery_state.
Non-blocking Pre-existing Follow-up Found During Audit
- In
drivers/gpu/drm/asahi/g17/queue/render.rs:1094(introduced earlier byef6ed2728bfc1onmain, not this PR),let mut fragment_types = [0u8; 5 + crate::g17::hazard::PUBLICATION_BARRIERS];(len = 12) omits+ crate::g17::pairs::COMPUTE_CHANNELS_MAX, whereasbarriers.fragment_typesis sized4 + COMPUTE_CHANNELS_MAX + PUBLICATION_BARRIERS(len = 14) andbarriers.fragment_countcan reach up to13. On M5 (COMPUTE_CHANNELS_MAX = 3) withfragment_count >= 11(reachable on both the existing device-mutex path and nowrender_direct()), lines1095/1097would panic out of bounds. Worth fixing in a 1-line follow-up (5 + crate::g17::pairs::COMPUTE_CHANNELS_MAX + crate::g17::hazard::PUBLICATION_BARRIERS).
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Admit staged (
DRM_ASAHI_RENDER_STAGE_PREFIXES) and compute-prefixed (wait_through[1]/tiling_wait_through[1]) renders ontorender_direct()instead of forcing them onto the device-mutexprepare_render()path.render_tiling(viatiling_wait_through[0]) andtiling(viawait_through[0]) inPair::own_dependencies()(queue/render.rs), matchingRegistry::render_dependencies().tiling_wait_through[1]andwait_through[1]across every compute queue owned byownerinsideFirmware::lend_render()(runtime/render/direct.rs), which already holds the device mutex (returningOk(None)onEAGAINor non-zero recovery state to fall back cleanly to the mutex path, and handling multiple sibling compute queues per owner).wait_through[1]andstage_prefixesrejections fromrender_direct()and copy the resolved compute dependencies fromLoanintoRenderDependencies.In GTA V Enhanced on M5 Pro,
100.0%(77,005/77,005) of renders carry non-zero compute prefixes and69.4%carrystage_prefixes, leavingrender_direct()completely unused (0%) onmainand serializing every render publication and mailbox doorbell under the global device mutex. Supersedes the staged/compute-prefixed portion of conflicting #2769 with full M5DirectTarget::M5and multi-compute-queue support.Tested:
4d03fcdf4566d:python3 tools/asahi/run-host-tests.py --only g17(237/237pass, including newtools/asahi/g17-direct-stage-prefixes-tests.pywith 5 mutation traps).scripts/checkpatch.pl --strict0 errors, 0 checks. Localasahi.configbuild ofdrivers/gpu/drm/asahi/aurora.osucceeds cleanly.inst-A), same-DTB (origin/mainDTB, MCC/SLC disabled) A/B (notsws2-rescanvsslot3-directadding4d03fcdf4566d+ inline cross-engine pub +WQ_HIGHPRIdrm_schedoverorigin/main + #3319 + #3330 + #3380):1.4.7.1):594/594executed passed,0failures (occlusion_query.copy_*:152/159+ 7 NS;multiview.queries.*:16/16;concurrent_queries.*:2/2;synchronization.smoke.*:12/12;synchronization2.op.single_queue.barrier.*_read_image_compute*:412/412).3024x1964native, Preset 2 Very High, TAA On,ResScalingType=0, no FSR/DLSS, 10 s 24 MHzasahi_hoptrace):P4:54.27(18.427 ms) ->55.07 FPS(18.159 ms,+0.80 FPS/+1.5%);P0=59.54 P1=51.93 P2=52.61 P3=56.05 P4=55.0792.86%->94.72%(+1.86 pp);>1 msblackouts:n=156 (345.6 ms)->n=96 (231.6 ms)LATE_PUB(FR->CO):69.1 ms(n=57) ->0.1 ms(n=6,-99.8%);LATE_PUB(FR->TA):360.0 ms->282.0 ms;0GPU faults,0new kernel errors.chainbench_diag:V0_ALL_BAR 960x540:321.5 us(22.96 us/pass) ->266.5 us(19.03 us/pass,-17.1%);V3_NO_BAR_INDEP 60x33:289.0 us->269.9 us(-6.6%).wcusa(3024x1964):0>1 msGPU-idle blackouts,0GPU faults,0new kernel errors.Risk: Two-way door · G17 direct render lend path only.
lend_render()runs under the device mutex and falls back to the mutex path (Ok(None)) wheneverrecovery_state != 0or any compute queue reportsEAGAIN; orthogonal to #3301's multi-pair sibling render guard.Not yet: Isolated single-commit J714s A/B (measured combined in
slot3-direct), G17P/G17C/G17D hardware rows, and CI.