Skip to content

Commit 9b8c604

Browse files
Revert "Synchronize via MTLSharedEvents (#633)" (#645)
1 parent 1942968 commit 9b8c604

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

lib/mtl/events.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ function MTLSharedEvent(dev::MTLDevice)
2929
return obj
3030
end
3131

32-
function waitUntilSignaledValue(ev::MTLSharedEvent, value, timeoutMS=typemax(UInt64))
33-
@objc [ev::id{MTLSharedEvent} waitUntilSignaledValue:value::UInt64
34-
timeoutMS:timeoutMS::UInt64]::Bool
35-
end
3632

3733
## shared event handle
3834

src/state.jl

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ function global_queue(dev::MTLDevice)
5555
end::MTLCommandQueue
5656
end
5757

58-
"""
59-
queue_event(queue::MTLCommandQueue)::MTLSharedEvent
60-
61-
Return the `MTLSharedEvent` used to synchronize a queue
62-
"""
63-
function queue_event(queue::MTLCommandQueue)
64-
get!(task_local_storage(), (:MTLSharedEvent, queue)) do
65-
MTLSharedEvent(queue.device)
66-
end::MTLSharedEvent
67-
end
68-
6958
# TODO: Increase performance (currently ~15us)
7059
"""
7160
synchronize(queue)
@@ -77,13 +66,9 @@ and simply wait for it to be completed. Since command buffers *should* execute i
7766
First-In-First-Out manner, this synchronizes the GPU.
7867
"""
7968
@autoreleasepool function synchronize(queue::MTLCommandQueue=global_queue(device()))
80-
ev = queue_event(queue)
81-
val = ev.signaledValue + 1
8269
cmdbuf = MTLCommandBuffer(queue)
83-
MTL.encode_signal!(cmdbuf, ev, val)
8470
commit!(cmdbuf)
85-
MTL.waitUntilSignaledValue(ev,val)
86-
return
71+
wait_completed(cmdbuf)
8772
end
8873

8974
"""

0 commit comments

Comments
 (0)