Repository navigation
drm/asahi: g16: never run compute beside another VM's compute - #3087
Conversation
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Verdict at Blockers:
Checked: the one commit against the base: compute now drains behind any flight of another VM, in both |
publish_checked() marks a ready job that it could not publish for want of TA wave headroom (ta_wave_wait) or pass and flight headroom (slot_wait). A poll pass that sees either flag repolls after repoll_us (8 us by default), so the job publishes as soon as TA progress or a retirement makes room. A SUBMIT that publishes inline and leaves the same state behind did not do this. It rearmed the poll timer with rearm_us(false), which is half the flight duration EWMA clamped to resnap_us, so 100 us for renders longer than 200 us. Unless a stage event arrived first, the job waited that long after the room appeared. This is the case for the later passes of a multi-pass render that does not fit in one TA wave. Treat the two flags in submit_locked() as poll_step() does: rearm soon when the engine is not frozen and a job is still pending. Signed-off-by: Diljit Singh <[email protected]>
poll_step() ran the full idle housekeeping on every pass that started with nothing in flight: Session::check() (an ASC control read, a powered SGX pstate read and a walk of the adopted UAT bindings), Objects::health(), service_power() and a drain of every receive ring, including the nine log sub-rings and ktrace. A pass with work in flight holds the same checks to their cadence, 5 ms while active. Shallow back-to-back submissions reach the idle state after every completion, and idle_resnap() keeps a short poll timer armed across that gap. The timer pass then repeated all of these checks under the device lock, between one completion and the next SUBMIT, which waits on the same lock. Inside the 1 ms idle cadence, drain only the event and statistics rings, which carry completion and recovery notifications, then check for a pending recovery. A recovery or a receipt fault still runs the full pass at once. The skipped housekeeping is owed: run_poll() queues the backup poll for the end of the cadence, and the owed state clears when any full or periodic housekeeping runs. The backup poll may replace a later idle power poll; that pass calls service_power() and arms the power poll again. Signed-off-by: Diljit Singh <[email protected]>
hold[0] counts publication passes that stopped at a ready job behind in-flight work, but it lumps together a job that must wait for an empty engine and one that waits for headroom. The two are released by different events, so the counter cannot say which one a stalled multi-pass render is waiting for. Count each such hold once more by its cause, and print the split as a hold_causes line of aurora-g16/stats: - drain_failed: the VM failed, or a flight is doomed or recovery-suspect; - drain_initbm: a cold InitBM render is in flight; - drain_cross: render and compute of different VMs; - drain_pb: no warm PB/UMA allocator slot of the VM can take the render; - ta_wave: the TA wave window is full; - slot: flight, render pass or compute unit headroom; - dependency: the job's dependency check failed; - other: any other refusal behind in-flight work. The cause is evaluated only when a pass holds. The PB pipelining test that needs_engine_drain() and can_queue_behind_with_ta() each spelled out moves to render_can_pipeline(), which the classification uses too. hold[0] keeps its meaning. Signed-off-by: Diljit Singh <[email protected]>
When publish_checked() stops at a ready job, the poll repolls after repoll_us only if it set slot_wait or ta_wave_wait. A job held for any other reason waits for the next retirement poll. That is an EP 0x20 event, or the poll timer: rearm_us(false) is half the flight-duration EWMA clamped to resnap_us, so 100 us for renders longer than 200 us. An event for a stage that is not terminal is also not allowed to spin the receipt tail. A multi-pass render held this way behind its own earlier passes can therefore be published up to resnap_us after the retirement that frees it, with the GPU idle in between. Mark such holds held_wait when every flight belongs to the held job's VM and the cause is not a failure, a cross-VM overlap or a failed dependency. The job's own VM's retirements are then what releases it. held_wait is treated like the two existing flags: poll_step() repolls at repoll_us and keeps stage events eligible for the receipt tail, submit_locked() rearms soon, and busy coalescing does not hold behind it. publish_checked() clears it with them. A hold behind another VM's work keeps the existing cadence, so a long cross-VM drain does not repoll every few microseconds. Signed-off-by: Diljit Singh <[email protected]>
Compute commands queued behind compute flights of any VM, so the CDM pipes ran dispatches of different VMs at once, without a barrier between them. With six dEQP-VK processes, about one draw in 285 of dEQP-VK.glsl.texture_functions.* then read back zero or a partial image, with no fault and no recovery: the readback copy, running beside another VM's compute, lost its results. One process never fails, every failed case passes alone, and the failures stop entirely once compute waits for other VMs' flights, over three full runs. gpubench compute.long showed the same loss: a ray-query dispatch that another VM's compute overlapped was reported complete with its results unwritten. Let compute publish behind its own VM's flights only, on either pipe, as it already did behind another VM's render, and as G15 runs one VM at a time. Compute of one VM still pipelines on both pipes, and renders still pipeline across VMs. Signed-off-by: Diljit Singh <[email protected]>
04671de to
d77b0f0
Compare
9f1dc2f to
6c6dac6
Compare
What: On the g16 (M4) backend, compute now publishes only behind its own VM's flights.
Before, compute queued behind another VM's compute on the CDM pipes with no barrier between the two. With several clients, the overlapped dispatches occasionally lost their results without a fault: dEQP-VK texture_functions readbacks came back zero or partial, and a ray-query dispatch was reported complete with its results unwritten. Renders still pipeline across VMs, and one VM's compute still pipelines on both pipes.
Stacked on #3074 (
djdev/g16-poll-cadence-hold-causes).Tested:
04671de:checkpatch.pl --strict0/0/0;git diff --checkclean.compute.light [procs]d=2..16: −30 % to −64 %.compute.heavy alu [procs]: −11 % to −25 %.Risk: two-way · M4 (J773g / G16G)
Not yet:
Details
Before.
needs_engine_drain()drained compute only behind another VM's render.can_queue_behind_with_ta()let compute queue behind any healthy compute flight, of any VM, on either CDM pipe.After.
(is_compute || (is_render && f.computes != 0)) && !same VM.publishstops at any flight of another VM.Why one VM at a time and not a barrier.
Cost. Concurrent compute from different processes no longer overlaps; see the slower rows above. Single-process work, and multi-process render, are unchanged.
Also changed.
drain_crosshold cause now documents both cases.FLIGHTScomment.Evidence
djdev/g16-poll-cadence-hold-causesat9f1dc2f59d46(drm/asahi: g16: poll cadence fixes and publication hold causes #3074).04671de4b919drm/asahi: g16: never run compute beside another VM's compute.tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py: 25 ok, 0 not ok.test-publication.py83/83.tools/testing/selftests/drivers/gpu/asahi-g15/run.py: 81 passed, 0 failed, 2 ignored.engine.rschange fails 4 publication tests:cross_vm_render_compute_overlap_matrix,timed_compute_queues_behind_same_vm_and_coexists_with_render,two_pipe_concurrent_compute_dispatch_and_fw_timestamp_safetyandalt_bypass_does_not_starve_cold_cross_vm_initbm_while_warm_overlaps.texture_functions with 6 processes:
gpubench vk-rt (98 rows) and vk-full (202 rows):
crc_bad0, 0 faults, 0 recoveries, 0 dmesg errors;Slower
[procs]compute rows (before → after):