diff options
author | Karol Herbst <kherbst@redhat.com> | 2023-04-15 03:48:16 +0200 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2023-04-20 16:05:03 -0700 |
commit | c18c0e2ee17ef2daba14ff6e076bc9e72f5f27db (patch) | |
tree | 320e50f10336f8858de819f7015cfd0113d6e728 | |
parent | 4ee849dd06868d55dc2eb9a4d4a253a58a372265 (diff) | |
download | mesa-c18c0e2ee17ef2daba14ff6e076bc9e72f5f27db.tar.gz |
rusticl/event: drop work item before updating status
This fixes some CTS compiler tests where they relied on the cl_kernel
object to be released in time so it can recompile a program without
throwing CL_INVALID_OPERATION due to still having active kernel objects.
Fixes: 47a80d7ff4f ("rusticl/event: proper eventing support")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22510>
(cherry picked from commit 60cfe15d799fdc5a57a691844cc30e49b3f74a47)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/frontends/rusticl/core/event.rs | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/.pick_status.json b/.pick_status.json index f4210fc310d..d2b4839eea4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2424,7 +2424,7 @@ "description": "rusticl/event: drop work item before updating status", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "47a80d7ff4f966e3839640efd5f9d75e36af8906", "notes": null diff --git a/src/gallium/frontends/rusticl/core/event.rs b/src/gallium/frontends/rusticl/core/event.rs index bc9ffe28204..febcdc27fef 100644 --- a/src/gallium/frontends/rusticl/core/event.rs +++ b/src/gallium/frontends/rusticl/core/event.rs @@ -29,6 +29,7 @@ struct EventMutState { status: cl_int, cbs: [Vec<(EventCB, *mut c_void)>; 3], fence: Option<PipeFence>, + work: Option<EventSig>, } #[repr(C)] @@ -38,7 +39,6 @@ pub struct Event { pub queue: Option<Arc<Queue>>, pub cmd_type: cl_command_type, pub deps: Vec<Arc<Event>>, - work: Option<EventSig>, state: Mutex<EventMutState>, cv: Condvar, } @@ -66,8 +66,8 @@ impl Event { status: CL_QUEUED as cl_int, cbs: [Vec::new(), Vec::new(), Vec::new()], fence: None, + work: Some(work), }), - work: Some(work), cv: Condvar::new(), }) } @@ -83,8 +83,8 @@ impl Event { status: CL_SUBMITTED as cl_int, cbs: [Vec::new(), Vec::new(), Vec::new()], fence: None, + work: None, }), - work: None, cv: Condvar::new(), }) } @@ -161,7 +161,8 @@ impl Event { let mut lock = self.state(); let status = lock.status; if status == CL_QUEUED as cl_int { - let new = self.work.as_ref().map_or( + let work = lock.work.take(); + let new = work.as_ref().map_or( // if there is no work CL_SUBMITTED as cl_int, |w| { @@ -174,6 +175,10 @@ impl Event { res }, ); + // we have to make sure that the work object is dropped before we notify about the + // status change. It's probably fine to move the value above, but we have to be + // absolutely sure it happens before the status update. + drop(work); self.set_status(&mut lock, new); new } else { |