Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/gpu/drm/asahi/g17/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ pub(crate) trait Backend: Send + Sync {
fn supports_submission(&self) -> bool { true }
/// Whether this backend's scheduler workers run in their queue creator's cluster (M5).
fn creator_cluster_scheduling(&self) -> bool { false }
/// Whether to keep compute input completion waits and wait on the host for other-engine
/// prefix producers: without the G17D forms an M5 kick may start while its ring
/// predecessor still runs.
fn host_producer_waits(&self) -> bool { false }
/// The reclaim-safe queue for the scheduler's timeout work, whose handler signals the
/// fences of timed-out jobs.
fn fence_queue(&self) -> Arc<workqueue::OwnedQueue>;
Expand Down
31 changes: 25 additions & 6 deletions drivers/gpu/drm/asahi/g17/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ impl<B: Backend> Queue<B> {
if engine == Engine::Compute {
super::trace::inputs(self.context.id(), order.sequence, 0, inputs.len(), None);
}
let sources = if engine == Engine::Compute
// Ring order completes a converted input only if a kick waits for its
// ring predecessor; without that, keep the input's completion wait.
let host_waits = self.backend.host_producer_waits();
let sources = if !host_waits
&& engine == Engine::Compute
&& !inputs.is_empty()
&& !destinations.has_outputs()
&& self.frontiers[0].iter().all(|(sequence, fences)| {
Expand Down Expand Up @@ -325,9 +329,17 @@ impl<B: Backend> Queue<B> {
inputs.len() + count + timestamp_count + failure_count,
GFP_KERNEL,
)?;
let mut checked_inputs =
KVec::with_capacity(inputs.len() + timestamp_count + failure_count, GFP_KERNEL)?;
let mut firmware = KVec::with_capacity(count, GFP_KERNEL)?;
// Host-waited producers are checked on the host instead of in firmware.
let (host_count, firmware_count) = if host_waits {
(count, 0)
} else {
(0, count)
};
let mut checked_inputs = KVec::with_capacity(
inputs.len() + host_count + timestamp_count + failure_count,
GFP_KERNEL,
)?;
let mut firmware = KVec::with_capacity(firmware_count, GFP_KERNEL)?;
for fence in failures.into_iter().flatten() {
checked_inputs.push(fence.clone(), GFP_KERNEL)?;
dependencies.push(fence.clone(), GFP_KERNEL)?;
Expand All @@ -348,8 +360,15 @@ impl<B: Backend> Queue<B> {
if fences.status() > 0 {
continue;
}
dependencies.push(fences.ready.clone(), GFP_KERNEL)?;
firmware.push(fences.completed.clone(), GFP_KERNEL)?;
if host_waits {
// Keep other-engine producers on the host until completion, and
// propagate their errors before publishing the consumer.
dependencies.push(fences.completed.clone(), GFP_KERNEL)?;
checked_inputs.push(fences.completed.clone(), GFP_KERNEL)?;
} else {
dependencies.push(fences.ready.clone(), GFP_KERNEL)?;
firmware.push(fences.completed.clone(), GFP_KERNEL)?;
}
}
// Each command owns every input fence; independent engines may publish in
// either order and must each consume an input's error status before running.
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/asahi/g17/runtime/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ impl job::Backend for Backend {
fn creator_cluster_scheduling(&self) -> bool {
self.shared.follows_submitter()
}
fn host_producer_waits(&self) -> bool {
self.shared.m5_board.is_some_and(|board| !board.g17d_forms())
}
fn fence_queue(&self) -> Arc<kernel::workqueue::OwnedQueue> {
self.shared.fence_queue()
}
Expand Down