From a52e795c9f5757061273868c979bc011322f8e20 Mon Sep 17 00:00:00 2001 From: Christian Guinard <28689358+christiangnrd@users.noreply.github.com> Date: Fri, 1 Aug 2025 16:59:44 -0300 Subject: [PATCH] Revert "Synchronize via MTLSharedEvents (#633)" This reverts commit 194296871068a39eec434c7f9338fa0d50cfc049. --- lib/mtl/events.jl | 4 ---- src/state.jl | 17 +---------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/lib/mtl/events.jl b/lib/mtl/events.jl index 374f42857..b3b9cb7bf 100644 --- a/lib/mtl/events.jl +++ b/lib/mtl/events.jl @@ -29,10 +29,6 @@ function MTLSharedEvent(dev::MTLDevice) return obj end -function waitUntilSignaledValue(ev::MTLSharedEvent, value, timeoutMS=typemax(UInt64)) - @objc [ev::id{MTLSharedEvent} waitUntilSignaledValue:value::UInt64 - timeoutMS:timeoutMS::UInt64]::Bool -end ## shared event handle diff --git a/src/state.jl b/src/state.jl index 0782db68f..3a0512e52 100644 --- a/src/state.jl +++ b/src/state.jl @@ -55,17 +55,6 @@ function global_queue(dev::MTLDevice) end::MTLCommandQueue end -""" - queue_event(queue::MTLCommandQueue)::MTLSharedEvent - -Return the `MTLSharedEvent` used to synchronize a queue -""" -function queue_event(queue::MTLCommandQueue) - get!(task_local_storage(), (:MTLSharedEvent, queue)) do - MTLSharedEvent(queue.device) - end::MTLSharedEvent -end - # TODO: Increase performance (currently ~15us) """ synchronize(queue) @@ -77,13 +66,9 @@ and simply wait for it to be completed. Since command buffers *should* execute i First-In-First-Out manner, this synchronizes the GPU. """ @autoreleasepool function synchronize(queue::MTLCommandQueue=global_queue(device())) - ev = queue_event(queue) - val = ev.signaledValue + 1 cmdbuf = MTLCommandBuffer(queue) - MTL.encode_signal!(cmdbuf, ev, val) commit!(cmdbuf) - MTL.waitUntilSignaledValue(ev,val) - return + wait_completed(cmdbuf) end """