-
-
Notifications
You must be signed in to change notification settings - Fork 615
Closed
Description
julia> using CUDA
julia> device!(0)
CuDevice(0): NVIDIA GeForce RTX 4060 Ti
julia> using Flux
julia> cua = [CartesianIndex((3, 2, 1, 2)), CartesianIndex((2, 2, 2, 3))] |> gpu
2-element CuArray{CartesianIndex{4}, 1, CUDA.DeviceMemory}:
CartesianIndex(3, 2, 1, 2)
CartesianIndex(2, 2, 2, 3)
julia> MLDataDevices.Internal.unsafe_free!(cua)
ERROR: GPU compilation of MethodInstance for (::GPUArrays.var"#gpu_broadcast_kernel_linear#38")(::KernelAbstractions.CompilerMetadata{…}, ::CuDeviceVector{…}, ::Base.Broadcast.Broadcasted{…}) failed
KernelError: passing non-bitstype argument
Argument 4 to your kernel function is of type Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1, CUDA.DeviceMemory}, Tuple{Base.OneTo{Int64}}, Functors.var"#recurse#27"{Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, IdDict{Any, Any}}}}, Tuple{Base.Broadcast.Extruded{CuDeviceVector{CartesianIndex{4}, 1}, Tuple{Bool}, Tuple{Int64}}}}, which is not a bitstype:
.f is of type Functors.var"#recurse#27"{Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, IdDict{Any, Any}}}} which is not isbits.
.walk is of type Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, IdDict{Any, Any}}} which is not isbits.
.cache is of type Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, typeof(MLDataDevices.Internal.unsafe_free_internal!), typeof(Functors.isleaf)}, IdDict{Any, Any}} which is not isbits.
.cache is of type IdDict{Any, Any} which is not isbits.
.ht is of type Memory{Any} which is not isbits.
Only bitstypes, which are "plain data" types that are immutable
and contain no references to other values, can be used in GPU kernels.
For more information, see the `Base.isbitstype` function.
Stacktrace:
[1] check_invocation(job::GPUCompiler.CompilerJob)
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/validation.jl:108
[2] macro expansion
@ ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:87 [inlined]
[3] macro expansion
@ ~/.local/share/julia/packages/Tracy/GcShf/src/tracepoint.jl:158 [inlined]
[4] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:85
[5] compile_unhooked
@ ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:80 [inlined]
[6] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:67
[7] compile
@ ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:55 [inlined]
[8] #1181
@ ~/.local/share/julia/packages/CUDA/ja0IX/src/compiler/compilation.jl:250 [inlined]
[9] JuliaContext(f::CUDA.var"#1181#1184"{GPUCompiler.CompilerJob{…}}; kwargs::@Kwargs{})
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:34
[10] JuliaContext(f::Function)
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/driver.jl:25
[11] compile(job::GPUCompiler.CompilerJob)
@ CUDA ~/.local/share/julia/packages/CUDA/ja0IX/src/compiler/compilation.jl:249
[12] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(CUDA.compile), linker::typeof(CUDA.link))
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/execution.jl:245
[13] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
@ GPUCompiler ~/.local/share/julia/packages/GPUCompiler/aNr5U/src/execution.jl:159
[14] macro expansion
@ ~/.local/share/julia/packages/CUDA/ja0IX/src/compiler/execution.jl:373 [inlined]
[15] macro expansion
@ ./lock.jl:273 [inlined]
[16] cufunction(f::GPUArrays.var"#gpu_broadcast_kernel_linear#38", tt::Type{…}; kwargs::@Kwargs{…})
@ CUDA ~/.local/share/julia/packages/CUDA/ja0IX/src/compiler/execution.jl:368
[17] macro expansion
@ ~/.local/share/julia/packages/CUDA/ja0IX/src/compiler/execution.jl:112 [inlined]
[18] (::KernelAbstractions.Kernel{…})(::CuArray{…}, ::Vararg{…}; ndrange::Tuple{…}, workgroupsize::Nothing)
@ CUDA.CUDAKernels ~/.local/share/julia/packages/CUDA/ja0IX/src/CUDAKernels.jl:122
[19] _copyto!
@ ~/.local/share/julia/packages/GPUArrays/u6tui/src/host/broadcast.jl:71 [inlined]
[20] copyto!
@ ~/.local/share/julia/packages/GPUArrays/u6tui/src/host/broadcast.jl:44 [inlined]
[21] copy
@ ~/.local/share/julia/packages/GPUArrays/u6tui/src/host/broadcast.jl:29 [inlined]
[22] materialize(bc::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{…}, Nothing, Functors.var"#recurse#27"{…}, Tuple{…}})
@ Base.Broadcast ./broadcast.jl:872
[23] broadcast_preserving_zero_d(f::Function, As::CuArray{CartesianIndex{4}, 1, CUDA.DeviceMemory})
@ Base.Broadcast ./broadcast.jl:861
[24] map
@ ~/.local/share/julia/packages/GPUArrays/u6tui/src/host/broadcast.jl:89 [inlined]
[25] _map
@ ~/.local/share/julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
[26] DefaultWalk
@ ~/.local/share/julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
[27] ExcludeWalk
@ ~/.local/share/julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
[28] (::Functors.CachedWalk{…})(::Function, ::CuArray{…})
@ Functors ~/.local/share/julia/packages/Functors/LbNAu/src/walks.jl:177
[29] execute
@ ~/.local/share/julia/packages/Functors/LbNAu/src/walks.jl:55 [inlined]
[30] #fmap#41
@ ~/.local/share/julia/packages/Functors/LbNAu/src/maps.jl:11 [inlined]
[31] fmap
@ ~/.local/share/julia/packages/Functors/LbNAu/src/maps.jl:3 [inlined]
[32] unsafe_free!(x::CuArray{CartesianIndex{4}, 1, CUDA.DeviceMemory})
@ MLDataDevices.Internal ~/.local/share/julia/packages/MLDataDevices/gyWcF/src/internal.jl:260
[33] top-level scope
@ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
versioninfo:
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × 12th Gen Intel(R) Core(TM) i5-12600KF
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores)
Environment:
JULIA_PKG_SERVER = https://mirrors.nju.edu.cn/julia
JULIA_DEPOT_PATH = /home/zaynchen/.local/share/julia
Metadata
Metadata
Assignees
Labels
No labels