Repository navigation
Closed
Labels
kernelsWriting and compiling kernels: kernel language, intrinsics, codegen, back-end interface.
Description
using KernelAbstractions
@kernel function kernel_index!(a)
i = KernelAbstractions.@index(Global)
@inbounds a[i] = i
end
let
a = zeros(1)
kernel! = kernel_index!(CPU(), 1, 1)
event = kernel!(a)
wait(event)
end
fails with
TaskFailedException:
MethodError: no method matching __index_Global_Linear()
Stacktrace:
[1] call at /home/mwarusz/.julia/packages/Cassette/7OymZ/src/context.jl:450 [inlined]
[2] fallback at /home/mwarusz/.julia/packages/Cassette/7OymZ/src/context.jl:448 [inlined]
[3] _overdub_fallback at /home/mwarusz/.julia/packages/Cassette/7OymZ/src/overdub.jl:486 [inlined]
[4] ##cpu_kernel_index!#423 at /home/mwarusz/repos/KernelAbstractions.jl/src/macros.jl:4 [inlined]
[5] (::KernelAbstractions.var"#22#27"{Cassette.Context{nametype(CPUCtx),KernelAbstractions.CompilerMetadata{KernelAbstractions.StaticSize{(1,)},KernelAbstractions.StaticSize{(1,)},false,Int64,Nothing,Nothing},Nothing,KernelAbstractions.var"##PassType#422",Nothing,Cassette.DisableHooks},KernelAbstractions.Kernel{CPU,KernelAbstractions.StaticSize{(1,)},KernelAbstractions.StaticSize{(1,)},var"###cpu_kernel_index!#423"},Tuple{Array{Float64,1}}})() at ./threadingconstructs.jl:113
Stacktrace:
[1] macro expansion at ./task.jl:319 [inlined]
[2] macro expansion at /home/mwarusz/repos/KernelAbstractions.jl/src/backends/cpu.jl:38 [inlined]
[3] (::KernelAbstractions.var"#18#23"{KernelAbstractions.Kernel{CPU,KernelAbstractions.StaticSize{(1,)},KernelAbstractions.StaticSize{(1,)},var"###cpu_kernel_index!#423"},Tuple{Array{Float64,1}},Int64,Bool})() at ./threadingconstructs.jl:113
Stacktrace:
[1] wait at ./task.jl:251 [inlined]
[2] wait at /home/mwarusz/repos/KernelAbstractions.jl/src/backends/cpu.jl:7 [inlined]
[3] wait(::KernelAbstractions.CPUEvent) at /home/mwarusz/repos/KernelAbstractions.jl/src/backends/cpu.jl:6
[4] top-level scope at /home/mwarusz/repos/KernelAbstractions.jl/examples/unroll_issue.jl:13
in expression starting at /home/mwarusz/repos/KernelAbstractions.jl/examples/unroll_issue.jl:9
Activity
vchuravy commentedon Feb 22, 2020
Probably an issue with using the prefix form... The challenge of doing this as a macro, things are not normalized yet.
vchuravy commentedon Feb 29, 2020
Yeah we would need to add a variant of
KernelAbstractions.@indexforKernelAbstractions.jl/src/macros.jl
Lines 160 to 175 in d983201
I am hesitant to do that since people might think
Oceanigans.KernelAbstractions.@indexwould then also work, but on the otherhand maybe we can normalize the name...maleadt commentedon Oct 19, 2026
Fixed by #556, released in 0.10: the PoCL-based
CPUbackend lowersKernelAbstractions.@index(Global)like the GPU backends, and the example works.