KernelAbstractions.get_backend keyword arguments

CUDABackend accepts two keyword arguments. the default for prefer_blocks is false. i have a custom kernel for which i need that to be true. KernelAbstractions.get_backend has no way to pass that in. so how do i write vendor agnostic code then?

it seems to me that get_backend needs to accept keyword argments too. so in KernelAbstractions.jl:

get_backend(::Array; kwargs...) = CPU()

and in CUDAKernels.jl:

KernelAbstractions.get_backend(::CUDA.CuArray; kwargs...) = CUDABackend(kwargs)

does that make sense? happy to submit a PR if so.

Hm …

The issue is that the keyword arguments each backend may accept are indeterminate.

In DiffEqGPU.jl (where I prototyped some of these ideas) I used a package extension: DiffEqGPU.jl/CUDAExt.jl at 6abad672269e1bd0c57eb0c1b48149a32f04213f · SciML/DiffEqGPU.jl · GitHub

We could “standardize” this in KA as similar(backend; kwargs...) and each backend could discard the keyword arguments that don’t apply to it.

Not sure what the best design here is.