Skip to content

Commit

Permalink
Revert "removing heuristic"
Browse files Browse the repository at this point in the history
This reverts commit 54796ad.
  • Loading branch information
leios committed Sep 16, 2024
1 parent 54796ad commit a28a0fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/gpuarrays.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
# GPUArrays.jl interface

import KernelAbstractions
import KernelAbstractions: Backend

#
# Device functionality
#


## execution

@inline function GPUArrays.launch_heuristic(::oneAPIBackend, obj::O, args::Vararg{Any,N};
elements::Int, elements_per_thread::Int) where {O,N}
ndrange = ceil(Int, elements / elements_per_thread)
ndrange, workgroupsize, iterspace, dynamic = KA.launch_config(obj, ndrange,
nothing)

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

kernel = @oneapi launch=false obj.f(ctx, args...)

items = launch_configuration(kernel)
# XXX: how many groups is a good number? the API doesn't tell us.
# measured on a low-end IGP, 32 blocks seems like a good sweet spot.
# note that this only matters for grid-stride kernels, like broadcast.
return (threads=items, blocks=32)
end

const GLOBAL_RNGs = Dict{ZeDevice,GPUArrays.RNG}()
function GPUArrays.default_rng(::Type{<:oneArray})
dev = device()
Expand Down

0 comments on commit a28a0fc

Please sign in to comment.