From ddcfd032128ae968039a2f5195f9150a5826f0f1 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sun, 11 Jun 2023 21:58:54 +0200 Subject: [PATCH] rusticl/event: ensure even status is updated in order There was a race between the worker thread and flush, which could lead to the last event flushed getting its status set to CL_SUCCESS before any other event. Just wait on all flushed events in order to solve this. The current queue/event implementation isn't the best and we want to rework it, so this is good enough for now. Fixes: 47a80d7ff4f ("rusticl/event: proper eventing support") Signed-off-by: Karol Herbst Part-of: (cherry picked from commit da4b27452b3cd169298012cc88d5ed19bbaa30b9) --- .pick_status.json | 2 +- src/gallium/frontends/rusticl/core/queue.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 24d7d524380..087265dd6ec 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2326,7 +2326,7 @@ "description": "rusticl/event: ensure even status is updated in order", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "47a80d7ff4f966e3839640efd5f9d75e36af8906" }, diff --git a/src/gallium/frontends/rusticl/core/queue.rs b/src/gallium/frontends/rusticl/core/queue.rs index aa23b397972..a826c63134d 100644 --- a/src/gallium/frontends/rusticl/core/queue.rs +++ b/src/gallium/frontends/rusticl/core/queue.rs @@ -82,14 +82,14 @@ impl Queue { pub fn flush(&self, wait: bool) -> CLResult<()> { let mut p = self.pending.lock().unwrap(); - let last = p.last().cloned(); + let events = p.clone(); // This should never ever error, but if it does return an error self.chan_in .send((*p).drain(0..).collect()) .map_err(|_| CL_OUT_OF_HOST_MEMORY)?; if wait { - if let Some(last) = last { - last.wait(); + for e in events { + e.wait(); } } Ok(())