Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions test/kernelabstractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,8 @@ end

@testset "launch configuration" begin
backend = oneAPIBackend()
function select(kernel, ndrange, workgroupsize=nothing)
ndrange, workgroupsize, iterspace, _ = KA.launch_config(kernel, ndrange, workgroupsize)
KA.select_launch(kernel, workgroupsize, iterspace)
end

# kernels are launched on an N-d grid, computing indices in 32 bits
# a dynamic N-d range is indexed without divisions
kernel = store_global_linear!(backend)
@test select(kernel, (64, 32, 16)) === KA.NDLaunch{Int32}()
@test select(kernel, (4, 4, 4, 4)) === KA.LinearLaunch{Int32}()

# which doesn't need divisions to compute the index of a dynamic N-d range
A = oneAPI.zeros(Int, 64, 32, 16)
ir = sprint(io -> oneAPI.@device_code_llvm io=io kernel(A; ndrange=size(A)))
@test !occursin(r"\b[us](div|rem) ", ir)
Expand All @@ -53,12 +44,10 @@ end
# tuning for more work-groups (the testsuite above uses the default)
Testsuite.launch_testsuite(()->oneAPIBackend(; prefer_blocks=true), oneArray)

# iteration spaces that don't fit 32 bits use 64-bit indices
# iteration spaces that don't fit 32-bit indices
kernel = store_last_index!(backend)
A = oneAPI.zeros(Int, 2)
for (dims, launch) in (((2^16 + 1, 2^15), KA.NDLaunch{Int}()),
((2^11 + 1, 2^10, 2^10, 1), KA.LinearLaunch{Int}()))
@test select(kernel, dims) === launch
for dims in ((2^16 + 1, 2^15), (2^11 + 1, 2^10, 2^9, 2), (1, 1, 1, 2^31 + 1))
kernel(A; ndrange=dims)
@test Array(A) == [prod(dims), dims[2]]
end
Expand Down
Loading