Skip to content

Fixed reducedim operations for CuQRPackedQ #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/cusolver/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ Base.size(A::CuQRPackedQ, dim::Integer) = 0 < dim ? (dim <= 2 ? size(A.factors,
CUDA.CuMatrix(A::CuQRPackedQ) = orgqr!(copy(A.factors), A.τ)
CUDA.CuArray(A::CuQRPackedQ) = CuMatrix(A)
Base.Matrix(A::CuQRPackedQ) = Matrix(CuMatrix(A))
Base.similar(A::CuQRPackedQ{S,T}) where {S,T} = CuArray{S, ndims(a)}(undef, size(a))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a vs A
T and S are switched around compared to the CuQRPackedQ definition
Also, can't you get N statically from S typevar?


# CuQRPackedQ isn't an AbstractGPUArray, so we miss out on lots of GPU-compatible methods.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want the same for CuQR?

Copy link
Member

@DhairyaLGandhi DhairyaLGandhi Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be an AbstractGPUArray?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? It's currently a AbstractQ already, and presumable that's more useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, that is true

# add a couple common methods here that avoid GPU-incompatible fallbacks.
Base.sum(xs::CuQRPackedQ) = sum(CuArray(xs))
Base.prod(xs::CuQRPackedQ) = prod(CuArray(xs))
Base.maximum(xs::CuQRPackedQ) = maximum(CuArray(xs))
Base.minimum(xs::CuQRPackedQ) = minimum(CuArray(xs))

function Base.getproperty(A::CuQR, d::Symbol)
m, n = size(getfield(A, :factors))
Expand Down