KernelAbstractions.jl icon indicating copy to clipboard operation
KernelAbstractions.jl copied to clipboard

Accept static sizes as keyword arguments

Open maleadt opened this issue 9 months ago • 2 comments

Kernel closures support passing ndrange and workgroupsize as keyword arguments: https://github.com/JuliaGPU/KernelAbstractions.jl/blob/97419620494baa2e45541a6f2015413d6fa9315b/src/KernelAbstractions.jl#L661

The kernel function itself probably should too, while it currently only accepts positional versions of these arguments (used to construct static sizes): https://github.com/JuliaGPU/KernelAbstractions.jl/blob/97419620494baa2e45541a6f2015413d6fa9315b/src/macros.jl#L42-L44

IMO this makes the code more readable.

maleadt avatar Feb 17 '25 17:02 maleadt

Hello @maleadt . This might be a novice question, but here we go. I tried solving this by adding the following

function $name(dev::Dev, sz::Union{S, Nothing}=$nothing, range::Union{NDRange, Nothing}=nothing) where {S <: $_Size, NDRange <: $_Size, Dev}
                return $construct(dev, sz, range, $gpu_name)
end

I keep getting the same error. ERROR: Method overwriting is not permitted during Module precompilation. Use __precompile__(false) to opt-out of precompilation.

I tried searching through a lot of resources, but couldn't find any working solutions. I would appreciate any help to understand this problem. Thank you in advance!

Komal0103 avatar Mar 31 '25 20:03 Komal0103

Method overwriting is not permitted during Module precompilation.

Are you defining those methods from the REPL? You have to dev the package and edit its sources.

There's several topics on this error on Discourse, so I'd recommend reading those for some more insights.

maleadt avatar Apr 01 '25 07:04 maleadt