Skip to content

norm on ROCArrays fails because of scalar indexing #843

@abussy

Description

@abussy

Calling norm on Hermitian typed ROCArrays leads to scalar indexing errors, because the generic_norm2 function is called under the hood.

Reproducer:

using AMDGPU
using LinearAlgebra

X = ROCArray(randn(Float64, 100, 40))
O = Hermitian(X' * X)

@show norm(O)

As a workaround, I currently use the following:

function LinearAlgebra.norm2(A::Hermitian{T, <:AMDGPU.ROCArray}) where {T}
    upper_triangle = sum(abs2, triu(parent(A)))
    diago = sum(abs2, diag(parent(A)))
    sqrt(2upper_triangle - diago)
end

This issue is possibly related to #734.

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