JuliaGPU / JuliaGPU/KernelAbstractions.jl

`nested task error: unsupported or misplaced expression aliasscope` when using `julia --compile=min`

Open
#232 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
523
Forks
88
Avg merge
1d 11h
Merged PRs (30d)
25

Description

I recently tried using the `julia --compile=min` flag to spend less time compiling (and more time debugging) but KernelAbstractions.jl started erroring.

Turns out I can reproduce the same error by running the simple `memcopy.jl` example: https://github.com/JuliaGPU/KernelAbstractions.jl/blob/8c9d7b48fb3b9dbecc5aae7e30e2758f2f71b6d5/examples/memcopy.jl

Couldn't find the `--compile` flag mentioned in `julia --help` so maybe it's an internal flag I shouldn't be using.

```
$ julia --project --compile=min ─╯
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> include("examples/memcopy.jl")
ERROR: LoadError: TaskFailedException
Stacktrace:
[1] wait(t::Task)
@ Base task.jl:317
[2] wait(::CPU, ev::KernelAbstractions.CPUEvent, progress::Nothing)
@ KernelAbstractions ~/KernelAbstractions.jl/src/cpu.jl:65
[3] wait(ev::KernelAbstractions.CPUEvent, progress::Nothing) (repeats 2 times)
@ KernelAbstractions ~/KernelAbstractions.jl/src/cpu.jl:29
[4] top-level scope
@ ~/KernelAbstractions.jl/examples/memcopy.jl:20
[5] include(fname::String)
@ Base.MainInclude client.jl:444
[6] top-level scope
@ REPL[1]:1

nested task error: unsupported or misplaced expression aliasscope
Stacktrace:
[1] cpu_copy_kernel!(::Matrix{Float64}, ::Matrix{Float64})
@ none:0 [inlined]
[2] overdub(::Cassette.Context{nametype(CPUCtx), KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.NoDynamicCheck, CartesianIndex{1}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(8,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}}, Nothing, KernelAbstractions.var"##PassType#257", Nothing, Cassette.DisableHooks}, ::typeof(cpu_copy_kernel!), ::Matrix{Float64}, ::Matrix{Float64})
@ Cassette none:0
[3] __thread_run(tid::Int64, len::Int64, rem::Int64, obj::KernelAbstractions.Kernel{CPU, KernelAbstractions.NDIteration.StaticSize{(8,)}, KernelAbstractions.NDIteration.DynamicSize, typeof(cpu_copy_kernel!)}, ndrange::Tuple{Int64}, iterspace::KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(8,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}, args::Tuple{Matrix{Float64}, Matrix{Float64}}, dynamic::KernelAbstractions.NDIteration.NoDynamicCheck)
@ KernelAbstractions ~/KernelAbstractions.jl/src/cpu.jl:157
[4] __run(obj::KernelAbstractions.Kernel{CPU, KernelAbstractions.NDIteration.StaticSize{(8,)}, KernelAbstractions.NDIteration.DynamicSize, typeof(cpu_copy_kernel!)}, ndrange::Tuple{Int64}, iterspace::KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(8,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}, args::Tuple{Matrix{Float64}, Matrix{Float64}}, dynamic::KernelAbstractions.NDIteration.NoDynamicCheck)
@ KernelAbstractions ~/KernelAbstractions.jl/src/cpu.jl:130
[5] (::KernelAbstractions.var"#33#34"{Nothing, Nothing, typeof(KernelAbstractions.__run), Tuple{KernelAbstractions.Kernel{CPU, KernelAbstractions.NDIteration.StaticSize{(8,)}, KernelAbstractions.NDIteration.DynamicSize, typeof(cpu_copy_kernel!)}, Tuple{Int64}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(8,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}, Tuple{Matrix{Float64}, Matrix{Float64}}, KernelAbstractions.NDIteration.NoDynamicCheck}})()
@ KernelAbstractions ~/KernelAbstractions.jl/src/cpu.jl:22
in expression starting at /home/alir/KernelAbstractions.jl/examples/memcopy.jl:20
```

Environment:

```
julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
```

```
(KernelAbstractions) pkg> st
Project KernelAbstractions v0.6.0
Status `~/KernelAbstractions.jl/Project.toml`
[79e6a3ab] Adapt v3.2.0
[72cfdca4] CUDAKernels v0.1.0 `lib/CUDAKernels`
[7057c7e9] Cassette v0.3.5
[1914dd2f] MacroTools v0.5.6
[276daf66] SpecialFunctions v1.3.0
[90137ffa] StaticArrays v1.1.0
[b77e0a4c] InteractiveUtils
[cf7118a7] UUIDs
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce with Julia 1.6.0 using --project --compile=min and examples/memcopy.jl. Trace the failure through src/cpu.jl, including wait and __thread_run, and the Cassette overdub shown in the stack trace; done means the example runs without the aliasscope TaskFailedException under this flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers, hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.