Skip to content

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

Closed

Description

@ali-ramadhan

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

Activity

  1. vchuravy commented on Mar 31, 2021

    @vchuravy
    Member

    Can you check that JuliaLang/julia#40275 fixes the issue?

  2. added theissue type on Oct 19, 2026
  3. added
    kernels
    pocl
    on Oct 19, 2026
  4. maleadt commented on Oct 19, 2026

    @maleadt
    Member

    Fixed by JuliaLang/julia#40275, and since #556 the CPU backend compiles kernels to SPIR-V and runs them with PoCL instead of as Julia code, so --compile=min doesn't affect them anymore. A memcopy.jl-style kernel works with julia --compile=min.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kernelspocl

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions