@@ -39,13 +39,11 @@ function wait(::CPU, ev::CPUEvent, progress=nothing)
39
39
end
40
40
end
41
41
42
- function async_copy! (:: CPU , A, B; dependencies= nothing )
43
- wait (CPU (), MultiEvent (dependencies), yield)
44
- copyto! (A, B)
45
- return CPUEvent (nothing )
42
+ function async_copy! (:: CPU , A, B; dependencies= nothing , progress= yield)
43
+ Event (copyto!, A, B, dependencies= dependencies, progress= progress)
46
44
end
47
45
48
- function (obj:: Kernel{CPU} )(args... ; ndrange= nothing , workgroupsize= nothing , dependencies= nothing )
46
+ function (obj:: Kernel{CPU} )(args... ; ndrange= nothing , workgroupsize= nothing , dependencies= nothing , progress = yield )
49
47
if ndrange isa Integer
50
48
ndrange = (ndrange,)
51
49
end
@@ -65,13 +63,12 @@ function (obj::Kernel{CPU})(args...; ndrange=nothing, workgroupsize=nothing, dep
65
63
ndrange = nothing
66
64
end
67
65
68
- t = Threads . @spawn __run ( obj, ndrange, iterspace, args, dependencies, Val (dynamic))
69
- return CPUEvent (t )
66
+ Event (__run, obj, ndrange, iterspace, args, Val (dynamic),
67
+ dependencies = dependencies, progress = progress )
70
68
end
71
69
72
70
# Inference barriers
73
- function __run (obj, ndrange, iterspace, args, dependencies, :: Val{dynamic} ) where dynamic
74
- wait (CPU (), MultiEvent (dependencies), yield)
71
+ function __run (obj, ndrange, iterspace, args, :: Val{dynamic} ) where dynamic
75
72
N = length (iterspace)
76
73
Nthreads = Threads. nthreads ()
77
74
if Nthreads == 1
0 commit comments