Repository navigation
drm/asahi: g16: keep renders of a multisampling VM apart from other VMs - #3180
Conversation
Every VM's render passes go through the one firmware TA/FS queue pair. While passes of two VMs are both published there and one of the VMs renders multisampled, that VM's passes lose coverage: pixels or samples that should be covered come out uncovered or zero (CTS multisample min_sample_shading, alpha_to_coverage, z_export *_atc, mixed_count, standardsampleposition, and resolve_image whole_copy_before_resolving), and its fragment shaders can fault at VA 0 or stall the fragment stage. One VM alone never shows it, nor do VMs that render only single-sampled. Making the later pass's TA wait for the earlier pass's FS with ring barriers does not help: the two passes need not run at the same time, only be published together. Single-sampled passes of a multisampling VM are affected too, such as an attachmentless pass that reads its multisampled images as input attachments. Mark a VM once a multisampled pass of it becomes visible to the firmware, and hold a render while another VM's render flight has not retired if either VM is marked or the render itself is multisampled. Apply the same rule to every member the same-submit and cross-job render folds append, so a multisampled member never joins a prefix beside another VM's render. Renders of one VM, and of VMs that never render multisampled, still queue behind each other. Signed-off-by: Diljit Singh <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
9c3c459 J616s (T6040, M4 Pro, G16S B1) PASS: guarded one-shot (batch bc86f31c475b over main 5a4b951, 0 merge-tree diffs on 4 changed files, default cmdline, stock Stage 2 1.0.0b17, boot 54953f36-9276-4713-b89d-4d2b31756795): 6 concurrent deqp-vk processes (--jobs 6) over dEQP-VK.renderpass*.multisample* + dEQP-VK.pipeline..multisample. (50,260 cases in 14 s): 15,350 Pass / 0 Fail / 34,910 NS / 0 Warnings / 0 Waived; Borealis VK api.smoke 8/8 pre, post-MSAA, and post-1/1 rtc1 s2idle; Asahi GL gl-smoke 32/32 pre & post; 0 GPU faults/recoveries, 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; stock 7.3.0-aurora-fleet89 restored. |
|
Verdict at Blockers: none. Checked:
Evidence
|
|
J516s (MacBook Pro 16" M3 Pro, 27.2 stub) row for |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict at 9c3c459d: MERGE.
Blockers: none.
Checked (adversarial)
- Every way a render gets published goes through the new VM-separation check: the lead pass (
can_queue_behind_with_taand thebehindcheck inpublish_prefix_body),needs_engine_drain, the same-submit fold, and the cross-job fold, which only folds same-VM/queue jobs. - The check is symmetric: either VM is marked, or the render itself is multisampled. It reads the VM's mark each time, so older flights of a VM marked later are caught.
- The mark is set under the device lock before the flight is pushed, and stays set if publication fails, which is the safe side.
- A held render goes through the existing drain-to-empty path (
DrainCross), so there's no deadlock, and starvation is no worse than the existing cross-VM rule. - The flag is an
AtomicBool, and flights hold the VM through anArc, so there is no address reuse. - There are no gates, params, delays or debug leftovers. It merges cleanly into main, and the
asahi-m4host test passes. - Rows: J516s and J616s at this head. J773g at
a3916405; this head differs only in two moved doc-comment lines and the selftest.
Non-blocking
- On J516s it's 72 fails with the PR against 75 on main, so on M3 it fixes nothing and only adds the cost. Please say in the body that the M3 cause is different.
- The J616s row has no stock control.
- A process that once renders multisampled stays marked for life, for example a browser beside the compositor. The compositor frame-time row is still under Not yet.
- It conflicts with #3185, so whichever lands second needs a rebase and a row.
What: On the g16 backend, every VM's render passes share one firmware TA/FS queue pair. When two VMs' renders are in that queue at the same time and one of the VMs renders multisampled, that VM's passes lose coverage. Pixels and samples that should be covered come out uncovered or zero: CTS
pipeline.monolithic.multisamplemin_sample_shading, alpha_to_coverage, z_export*_atc, mixed_count and standardsampleposition, andresolve_image.whole_copy_before_resolving. Its fragment shaders can also read VA 0 (anevent=0x71fault across all 8 banks at VA 0x0..0x380) or stall the fragment stage.One process alone never shows this, and neither do processes that only render single-sampled. It is not about TA and FS running at the same time: making the later pass's TA wait for the earlier pass's FS with ring barriers does not help. The two passes only have to be in the queue together.
This change marks a VM once a multisampled pass of it becomes visible to the firmware. A render then waits for another VM's render flight to retire if either VM is marked or the render itself is multisampled. Admission, the same-submit fold and the cross-job fold apply this to every member, so a multisampled member never joins a prefix that is already beside another VM's render. Renders of one VM, and of VMs that never render multisampled, overlap as before.
Tested:
a39164050e257, kernel origin/main6d6e5366aab95+ this change, built on the J773g. This head differs froma39164050e257only in two moved doc-comment lines and the selftest (diff below), so that run is the row for this head.pipeline.monolithic.multisample, 4 deqp-vk processes): 32 process runs, 340,352 results, 0 non-pass.7.3.0-ARCH-m4mainefed1ae3) fail within seconds:c091c85500ad3had the same per-VM rule without the fold checks. It ran 100 X7 process runs (1,063,600 results), E2, the resolve family and the 24-case list with a single-sampled neighbour, all with 0 non-pass.run-host-tests.pyon the J773g at this head: 26/26.test-publication.py: 89 passed. The new tests compile production code verbatim: the same-submit fold loop, the cross-job fold block and the publication prologue through the VM mark.c091c85500ad3, not on this head. Single-sampled work takes the same path here, because no VM is ever marked.--strictclean.Risk: two-way door. It changes render admission on the g16 backend only, so it reaches every GPU that backend runs (M4, and the M3 parts on the 26B123 protocol). Cost: a process that renders multisampled no longer overlaps its renders with other processes' renders. An all-MSAA 4-process stress runs about 25% slower per iteration. Multi-process single-sampled rows are unchanged.
Not yet:
Details
How the mechanism was isolated: a diagnostic-only kernel (never for merge) switched admission at runtime, and the 24-case list ×4 ran for 45 s per mode, about 8,250 results each.
So the cause is the two VMs' renders being published together, not execution overlap, stale USC caches or partial work-image rewrites.
A rule keyed only on the pass's sample count was not enough. On the resolve family it still left 13 failures in 97,976 results, all
whole_copy_before_resolving.2_bit. Its check pass is attachmentless and reads the MSAA images as input attachments, and Borealis gives such a pass sample count 1 until a draw sets it. That is why the VM is marked.Excluding every cross-VM render overlap would also fix it, but render.light procs d4 went from 83.3 to 130.0 µs per submit, so it was rejected.
Runtime code compared with the tested
a39164050e257(git diff a39164050e257 HEAD -- . ':(exclude)tools/testing'):The firmware or hardware state behind this is not identified. Giving each VM its own render queue, as macOS gives each command queue its own, would be the architectural follow-up and would let this rule go.