From f827ee78f62a6aa79771d3e24c659ae4c34dfb2c Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Fri, 23 Oct 2026 13:59:09 +0200 Subject: [PATCH] Test KernelAbstractions launches by their behavior, not the launch kind The launch configuration tests asserted which kind of launch KernelAbstractions picks for a few shapes. That is KernelAbstractions' policy, not something the back end controls, and the assertions break whenever it changes (JuliaGPU/KernelAbstractions.jl#912 launches 4-d ranges on the N-d grid). Keep the checks of what the back end does affect: that a dynamic 3-d range is indexed without divisions, and that iteration spaces too large for 32-bit indices are indexed correctly, now also one that is only large along its last dimension. --- test/kernelabstractions.jl | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/test/kernelabstractions.jl b/test/kernelabstractions.jl index a78dfa6a..72640048 100644 --- a/test/kernelabstractions.jl +++ b/test/kernelabstractions.jl @@ -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) @@ -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