You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before eec85d5 the check_invocation function allowed to pass arbitrary objects as long as they were not used by the kernel. This is helpful for passing pure dispatch types f(::Type{something). Currently that's only possible if those types are Core.Compiler.isconstType.
I tried to add it back, however since then check_invocation does not have access to the entry::LLVM.Function anymore, which was used to check if the argument is used. I think this is only generated in the emit_llvm call, which happens after the verification step.
I think this would be a nice feature but there are certainly always ways around it, so feel free to close if out of scope :)
Minimal example / testcase:
using Pkg
pkg"activate --temp"pkg"add KernelAbstractions, CUDA"using KernelAbstractions
using CUDA
abstract type AbstractAction endstruct Addition{M} <:AbstractAction
meta::Mendstruct Multiplication{M} <:AbstractAction
meta::Mend@kernelfunctionkernel!(::Type{T}, z, x, y) where {T<:AbstractAction}
i =@index(Global)
z[i] =apply(T, x[i], y[i])
end@inlineapply(::Type{<:Addition}, x, y) = x + y
@inlineapply(::Type{<:Multiplication}, x, y) = x * y
x =CuArray(1:10)
y =CuArray(1:10)
z =CuArray(zeros(10))
kernel =kernel!(get_backend(x))
# works on concrete typekernel(Addition{:foo}, z, x, y; ndrange=length(z))
kernel(Multiplication{:foo}, z, x, y; ndrange=length(z))
# does not work on abstract typekernel(Addition, z, x, y; ndrange=length(z))
kernel(Multiplication, z, x, y; ndrange=length(z))
The text was updated successfully, but these errors were encountered:
Before eec85d5 the
check_invocation
function allowed to pass arbitrary objects as long as they were not used by the kernel. This is helpful for passing pure dispatch typesf(::Type{something)
. Currently that's only possible if those types areCore.Compiler.isconstType
.I tried to add it back, however since then
check_invocation
does not have access to theentry::LLVM.Function
anymore, which was used to check if the argument is used. I think this is only generated in theemit_llvm
call, which happens after the verification step.I think this would be a nice feature but there are certainly always ways around it, so feel free to close if out of scope :)
Minimal example / testcase:
The text was updated successfully, but these errors were encountered: