Skip to content

Commit 63267c2

Browse files
committed
Allow CPU kernels to depend on default events
With the addition of the default event (used to synchronize the CUDA kernels with the default stream), `CPUEvent`s come in two flavors. This change allows CPU kernels to depend on the flavor that comes from `event = Event(CPU())` where `event.task === nothing`.
1 parent 1786c57 commit 63267c2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/backends/cpu.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function __run(obj, ndrange, iterspace, args, dependencies)
5050
if dependencies !== nothing
5151
cpu_tasks = Core.Task[]
5252
for event in dependencies
53-
if event isa CPUEvent
53+
if event isa CPUEvent && event.task isa Core.Task
5454
push!(cpu_tasks, event.task)
5555
end
5656
end

test/test.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,9 @@ if has_cuda_gpu()
184184
@test event5 isa KernelAbstractions.Event
185185
end
186186
end
187+
188+
@testset "CPU dependencies" begin
189+
event = Event(CPU())
190+
event = kernel_empty(CPU(), 1)(ndrange=1, dependencies=(event))
191+
wait(event)
192+
end

0 commit comments

Comments
 (0)