rusticl/queue: do not overwrite event error states

Cc: mesa-stable
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30215>
(cherry picked from commit 25dedee67d)
This commit is contained in:
Karol Herbst 2024-07-16 18:21:19 +02:00 committed by Eric Engestrom
parent 550c965c7b
commit e7338b9a3b
3 changed files with 21 additions and 7 deletions

View file

@ -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

View file

@ -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>) {

View file

@ -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