Skip to content

tensoradd! fails for a 2D StridedView + Diagonal for GPUArrays #298

Description

@kshyatt

Example trace, just so we don't lose track of this:

│ ┌ Error: Exception while generating log record in module PEPSKit at /uni-mainz.de/homes/hyattkat/.julia/dev/PEPSKit/src/algorithms/ctmrg/ctmrg.jl:167                                                                                                                                                                                                                 │ │   exception =                                                                                                                                                                                                                                                                                                                                                       │ │    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/VNJ6B/src/host/indexing.jl:50 [inlined]                                                                                                                                                                                                                                                                                        
│ │      [6] getindex                                                                                                                                                                                                                                                                                                                                                   │ │        @ ~/.julia/juliaup/julia-1.12.6+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/diagonal.jl:182 [inlined]                                                                                                                                                                                                                                         │ │      [7] getindex                                                                                                                                                                                                                                                                                                                                                   
│ │        @ ./permuteddimsarray.jl:70 [inlined]                                                                                                                                                                                                                                                                                                                        │ │      [8] _getindex                                                                                                                                                                                                                                                                                                                                                  │ │        @ ./abstractarray.jl:1388 [inlined]                                                                                                                                                                                                                                                                                                                          │ │      [9] getindex                                                                                                                                                                                                                                                                                                                                                   │ │        @ ./abstractarray.jl:1342 [inlined]                                                                                                                                                                                                                                                                                                                          
│ │     [10] _broadcast_getindex                                                                                                                                                                                                                                                                                                                                        │ │        @ ./broadcast.jl:665 [inlined]                                                                                                                                                                                                                                                                                                                               │ │     [11] _getindex                                                                                                                                                                                                                                                                                                                                                  │ │        @ ./broadcast.jl:696 [inlined]                                                                                                                                                                                                                                                                                                                               
│ │     [12] _getindex                                                                                                                                                                                                                                                                                                                                                  │ │        @ ./broadcast.jl:695 [inlined]                                                                                                                                                                                                                                                                                                                               │ │     [13] _broadcast_getindex                                                                                                                                                                                                                                                                                                                                        │ │        @ ./broadcast.jl:671 [inlined]                                                                                                                                                                                                                                                                                                                               
│ │     [14] _getindex                                                                                                                                                                                                                                                                                                                                                  
│ │        @ ./broadcast.jl:620 [inlined]                                                                                                                                                                                                                                                                                                                               │ │     [15] getindex                                                                                                                                                                                                                                                                                                                                                   │ │        @ ./broadcast.jl:616 [inlined]                                                                                                                                                                                                                                                                                                                               │ │     [16] macro expansion                                                                                                                                                                                                                                                                                                                                            │ │        @ ./broadcast.jl:995 [inlined]                                                                                                                                                                                                                                                                                                                               
│ │     [17] macro expansion                                                                                                                                                                                                                                                                                                                                            
│ │        @ ./simdloop.jl:77 [inlined]                                                                                                                                                                                                                                                                                                                                 
│ │     [18] copyto!                                                                                                                                                                                                                                                                                                                                                    
│ │        @ ./broadcast.jl:994 [inlined]                                                                                                                                                                                                                                                                                                                               │ │     [19] copyto!                                                                                                                                                                                                                                                                                                                                                    │ │        @ ./broadcast.jl:947 [inlined]                                                                                                                                                                                                                                                                                                                               
│ │     [20] materialize!(::Base.Broadcast.DefaultArrayStyle{2}, dest::StridedViews.StridedView{ComplexF64, 2, AMDGPU.ROCArray{ComplexF64, 1, AMDGPU.Runtime.Mem.HIPBuffer}, typeof(identity)}, bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2}, Nothing, typeof(*), Tuple{Int64, PermutedDimsArray{Float64, 2, (1, 2), (1, 2), LinearAlgebra.Diagonal{Float64, AMDGPU.ROCArray{Float64, 1, AMDGPU.Runtime.Mem.HIPBuffer}}}}})                                                                                                                                                                                                                                                                                               
│ │        @ Base.Broadcast ./broadcast.jl:905                                                                                                                                                                                                                                                                                                                          
│ │     [21] materialize!                                                                                                                                                                                                                                                                                                                                               
│ │        @ ./broadcast.jl:902 [inlined]                                                                                                                                                                                                                                                                                                                               
│ │     [22] tensoradd!(C::StridedViews.StridedView{ComplexF64, 2, AMDGPU.ROCArray{ComplexF64, 1, AMDGPU.Runtime.Mem.HIPBuffer}, typeof(identity)}, A::LinearAlgebra.Diagonal{Float64, AMDGPU.ROCArray{Float64, 1, AMDGPU.Runtime.Mem.HIPBuffer}}, pA::Tuple{Tuple{}, Tuple{Int64, Int64}}, conjA::Bool, α::Int64, β::VectorInterface.Zero, ::TensorOperations.BaseView, allocator::TensorOperations.DefaultAllocator)                                                                                                                                                                                                                                                                                                                          
│ │        @ TensorOperations ~/.julia/packages/TensorOperations/I8bVl/src/implementation/base.jl:24                                                                                                                                                                                                                                                                    
│ │     [23] tensoradd!                                                                                                                                                                                                                                                                                                                                                 
│ │        @ ~/.julia/packages/TensorOperations/I8bVl/src/interface.jl:48 [inlined]     

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