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
I get MethodError: no method matching __index_Local_Linear() from code that I expect to work (g):
julia>@kernelfunctionf(xs)
i =@index(Local, Linear)
xs[i] =1end
f (generic function with 5 methods)
julia>@kernelfunctiong(xs)
xs[@index(Local, Linear)] =1end
g (generic function with 5 methods)
julia> xs =zeros(3); f(CPU())(xs; ndrange =3) |> wait; xs
3-element Array{Float64,1}:1.01.01.0
julia> xs =zeros(3); g(CPU())(xs; ndrange =3) |> wait; xs
ERROR: TaskFailedException:
MethodError: no method matching __index_Local_Linear()
Looking at @macroexpand, the function f that works contains KernelAbstractions.__index_Local_Linear(var"##I#253") while the function gthat throws contains KernelAbstractions.__index_Local_Linear()
julia>@kernelfunctionh(xs)
@uniform i =@index(Group, Linear)
xs[i] =1end
h (generic function with 5 methods)
julia> xs =zeros(10); h(CPU())(xs; ndrange =10) |> wait
ERROR: TaskFailedException:
MethodError: no method matching __index_Group_Linear()
By the way, I see that the kernel language macros are defined by matching macro names. But, IIUC, they are not implemented in a way that can support
import KernelAbstractions as KA
macromyindex(args...)
esc(:($KA.@index($(args..))))
end
KA.@kernelfunctionf(xs)
KA.@index(Group, Linear)
@myindex(Group, Linear)
end
FYI, I've created https://github.com/tkf/ContextualMacros.jl for supporting cases like these and use them in FLoops.jl, FGenerators.jl, and GeneratorsX.jl. I don't particularity like my solution but I think it's at least robust (so far).
I get
MethodError: no method matching __index_Local_Linear()
from code that I expect to work (g
):Looking at
@macroexpand
, the functionf
that works containsKernelAbstractions.__index_Local_Linear(var"##I#253")
while the functiong
that throws containsKernelAbstractions.__index_Local_Linear()
Full session
The text was updated successfully, but these errors were encountered: