Skip to content

Multi-axis concatenation errors on 1.12 #672

@AntonOresten

Description

@AntonOresten

Trying to concatenate multiple arrays using square bracket syntax errors on 1.12. After descending with Cthulhu.jl and comparing with Julia master, I'm seeing it may be related to JuliaLang/julia#39729

MWE

Julia v1.11.7:

julia> v = CUDA.zeros(1); [v v; v v]
2×2 CuArray{Float32, 2, CUDA.DeviceMemory}:
 0.0  0.0
 0.0  0.0

Julia v1.12.3:

julia> v = CUDA.zeros(1); [v v; v v]
ERROR: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore should be avoided.

If you want to allow scalar iteration, use `allowscalar` or `@allowscalar`
to enable scalar iteration globally or for the operations in question.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] errorscalar(op::String)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:151
  [3] _assertscalar(op::String, behavior::GPUArraysCore.ScalarIndexing)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:124
  [4] assertscalar(op::String)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:112
  [5] getindex
    @ ~/.julia/packages/GPUArrays/0F4Dn/src/host/indexing.jl:50 [inlined]
  [6] iterate
    @ ./abstractarray.jl:1235 [inlined]
  [7] iterate
    @ ./abstractarray.jl:1233 [inlined]
  [8] hvncat_fill!(A::CuArray{Float32, 2, CUDA.DeviceMemory}, scratch1::Vector{Int64}, scratch2::Vector{Int64}, d1::Int64, d2::Int64, as::NTuple{4, CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ Base ./abstractarray.jl:2723
  [9] _typed_hvncat_dims(::Type{Float32}, dims::Tuple{Int64, Int64}, row_first::Bool, as::NTuple{4, CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ Base ./abstractarray.jl:2613
 [10] _typed_hvncat(::Type, ::Tuple{Int64, Int64}, ::Bool, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::Vararg{CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ Base ./abstractarray.jl:2520
 [11] typed_hvncat(::Type, ::Tuple{Int64, Int64}, ::Bool, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::Vararg{CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ Base ./abstractarray.jl:2351
 [12] typed_hvcat(::Type{Float32}, ::Tuple{Int64, Int64}, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::Vararg{CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ Base ./abstractarray.jl:2193
 [13] hvcat_internal(::Tuple{Int64, Int64}, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::Vararg{CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ SparseArrays ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/SparseArrays/src/sparsevector.jl:1285
 [14] hvcat(::Tuple{Int64, Int64}, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::CuArray{Float32, 1, CUDA.DeviceMemory}, ::Vararg{CuArray{Float32, 1, CUDA.DeviceMemory}})
    @ SparseArrays ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/SparseArrays/src/sparsevector.jl:1289
 [15] top-level scope
    @ REPL[3]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions