Skip to content

Commit 56b5b97

Browse files
committed
mimicking CUDA
1 parent 490f309 commit 56b5b97

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/gpuarrays.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import KernelAbstractions: Backend
1010

1111
## execution
1212

13-
@inline function GPUArrays.launch_heuristic(::oneAPIBackend, f::F, args::Vararg{Any,N};
14-
elements::Int, elements_per_thread::Int) where {F,N}
15-
ndrange, workgroupsize, iterspace, dynamic = KA.launch_config(obj, nothing,
13+
@inline function GPUArrays.launch_heuristic(::oneAPIBackend, obj::O, args::Vararg{Any,N};
14+
elements::Int, elements_per_thread::Int) where {O,N}
15+
ndrange = ceil(Int, elements / elements_per_thread)
16+
ndrange, workgroupsize, iterspace, dynamic = KA.launch_config(obj, ndrange,
1617
nothing)
1718

1819
# this might not be the final context, since we may tune the workgroupsize
1920
ctx = KA.mkcontext(obj, ndrange, iterspace)
2021

21-
kernel = @oneapi launch=false f(ctx, args...)
22+
kernel = @oneapi launch=false obj.f(ctx, args...)
2223

2324
items = launch_configuration(kernel)
2425
# XXX: how many groups is a good number? the API doesn't tell us.

0 commit comments

Comments
 (0)