JuliaGPU / JuliaGPU/KernelAbstractions.jl
weird issue with index macro
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 523
- Forks
- 88
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 25
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from examples/unroll_issue.jl, then inspect src/macros.jl and src/backends/cpu.jl, which appear in the stack trace. Trace how @index(Global) is expanded and invoked in the CPU path, and verify that the example completes without the __index_Global_Linear() MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100