diff --git a/.pick_status.json b/.pick_status.json index ec872e118c0..dadf8d280a8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -224,7 +224,7 @@ "description": "rusticl/queue: do not overwrite event error states", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/rusticl/core/event.rs b/src/gallium/frontends/rusticl/core/event.rs index 1a200f5b036..8e11b683069 100644 --- a/src/gallium/frontends/rusticl/core/event.rs +++ b/src/gallium/frontends/rusticl/core/event.rs @@ -193,7 +193,14 @@ impl Event { } pub(super) fn signal(&self) { - self.set_status(self.state(), CL_RUNNING as cl_int); + let state = self.state(); + // we don't want to call signal on errored events, but if that still happens, handle it + // gracefully + debug_assert_eq!(state.status, CL_SUBMITTED as cl_int); + if state.status < 0 { + return; + } + self.set_status(state, CL_RUNNING as cl_int); self.set_status(self.state(), CL_COMPLETE as cl_int); } @@ -212,9 +219,9 @@ impl Event { // We always assume that work here simply submits stuff to the hardware even if it's just doing // sw emulation or nothing at all. // If anything requets waiting, we will update the status through fencing later. - pub fn call(&self, ctx: &QueueContext) { + pub fn call(&self, ctx: &QueueContext) -> cl_int { let mut lock = self.state(); - let status = lock.status; + let mut status = lock.status; let queue = self.queue.as_ref().unwrap(); let profiling_enabled = queue.is_profiling_enabled(); if status == CL_QUEUED as cl_int { @@ -224,7 +231,7 @@ impl Event { } let mut query_start = None; let mut query_end = None; - let new = lock.work.take().map_or( + status = lock.work.take().map_or( // if there is no work CL_SUBMITTED as cl_int, |w| { @@ -250,8 +257,9 @@ impl Event { lock.time_start = query_start.unwrap().read_blocked(); lock.time_end = query_end.unwrap().read_blocked(); } - self.set_status(lock, new); + self.set_status(lock, status); } + status } fn deep_unflushed_deps_impl<'a>(&'a self, result: &mut HashSet<&'a Event>) { diff --git a/src/gallium/frontends/rusticl/core/queue.rs b/src/gallium/frontends/rusticl/core/queue.rs index 28442bcf22e..5fe37734a53 100644 --- a/src/gallium/frontends/rusticl/core/queue.rs +++ b/src/gallium/frontends/rusticl/core/queue.rs @@ -148,7 +148,13 @@ impl Queue { continue; } - e.call(&ctx); + // if there is an execution error don't bother signaling it as the context + // might be in a broken state. How queues behave after any event hit an + // error is entirely implementation defined. + let err = e.call(&ctx); + if err < 0 { + continue; + } if e.is_user() { // On each user event we flush our events as application might