Skip to content

Commit 0732ae0

Browse files
committed
Fix backend
1 parent ff3b077 commit 0732ae0

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/pocl/backend.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,23 @@ function KI.kifunction(::POCLBackend, f::F, tt::TT = Tuple{}; name = nothing, kw
146146
return KI.KIKernel{POCLBackend, typeof(kern)}(POCLBackend(), kern)
147147
end
148148

149-
function (obj::KI.KIKernel{POCLBackend})(args...; numworkgroups = nothing, workgroupsize = nothing)
150-
local_size = isnothing(workgroupsize) ? 1 : workgroupsize
151-
global_size = if isnothing(numworkgroups)
152-
1
153-
else
154-
numworkgroups * local_size
149+
function (obj::KI.KIKernel{POCLBackend})(args...; numworkgroups=nothing, workgroupsize=nothing)
150+
local_size = StaticArrays.MVector{3}((1,1,1))
151+
if !isnothing(workgroupsize)
152+
for (i, val) in enumerate(workgroupsize)
153+
local_size[i] = val
154+
end
155155
end
156156

157-
return obj.kern(args...; local_size, global_size)
158-
end
157+
global_size = StaticArrays.MVector{3}((1,1,1))
158+
if !isnothing(numworkgroups)
159+
for (i, val) in enumerate(numworkgroups)
160+
global_size[i] = val * local_size[i]
161+
end
162+
end
159163

164+
obj.kern(args...; local_size, global_size)
165+
end
160166

161167
function KI.kernel_max_work_group_size(::POCLBackend, kikern::KI.KIKernel{<:POCLBackend}; max_work_items::Int = typemax(Int))::Int
162168
wginfo = cl.work_group_info(kikern.kern.fun, device())

0 commit comments

Comments
 (0)