Open
Description
julia> using CUDA, LinearAlgebra
julia> CUDA.allowscalar(false)
julia> U = cu(UpperTriangular(
[1.0 0.0;
0.0 1.0]
))
2×2 UpperTriangular{Float32, CuArray{Float32, 2}}:
1.0 0.0
⋅ 1.0
julia> copyto!(Σ, U')
ERROR: scalar getindex is disallowed
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] assertscalar(op::String)
@ GPUArrays ~/.julia/packages/GPUArrays/4n0iS/src/host/indexing.jl:62
[3] getindex(::CuArray{Float32, 2}, ::Int64, ::Int64)
@ GPUArrays ~/.julia/packages/GPUArrays/4n0iS/src/host/indexing.jl:104
[4] getindex
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:203 [inlined]
[5] getindex
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/triangular.jl:222 [inlined]
[6] _getindex
@ ./abstractarray.jl:1214 [inlined]
[7] getindex
@ ./abstractarray.jl:1170 [inlined]
[8] iterate
@ ./abstractarray.jl:1096 [inlined]
[9] iterate
@ ./abstractarray.jl:1094 [inlined]
[10] copyto_unaliased!(deststyle::IndexLinear, dest::CuArray{Float32, 2}, srcstyle::IndexCartesian, src::LowerTriangular{Float32, Adjoint{Float32, CuArray{Float32, 2}}})
@ Base ./abstractarray.jl:975
[11] copyto!(dest::CuArray{Float32, 2}, src::LowerTriangular{Float32, Adjoint{Float32, CuArray{Float32, 2}}})
@ Base ./abstractarray.jl:950
[12] top-level scope
@ REPL[11]:1
[13] top-level scope
@ ~/.julia/packages/CUDA/LTbUr/src/initialization.jl:81
julia> @which copyto!(Σ, U')
copyto!(dest::AbstractArray, src::AbstractArray) in Base at abstractarray.jl:947
Type is
julia> typeof(U')
LowerTriangular{Float32, Adjoint{Float32, CuArray{Float32, 2}}}
which means that it won't hit
GPUArrays.jl/src/host/linalg.jl
Line 70 in 8e1bde0
Adjoint
is not a subtype of AbstractGPUArray
, nor will it hit GPUArrays.jl/src/host/linalg.jl
Line 70 in 8e1bde0
LowerTriangular
.
Similar issue of course also exists for UpperTriangular
.
Hotfix would be to just add additional impl for UpperTriangular{T, <:Adjoint{T, <:AbstractGPUArray{T,N}}}
, etc. but unclear to me if this is the best approach, e.g. maybe there's a more "generic" solution to these wrappers of wrappers arrays?
Metadata
Metadata
Assignees
Labels
No labels