Skip to content

Commit 1bcbe28

Browse files
kshyattKatharine Hyatt
authored andcommitted
Remove batched and non-batched bisection for now
1 parent 8d6e22d commit 1bcbe28

3 files changed

Lines changed: 2 additions & 43 deletions

File tree

‎ext/MatrixAlgebraKitAMDGPUExt/MatrixAlgebraKitAMDGPUExt.jl‎

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ for f in (:geqrf!, :ungqr!, :unmqr!)
4646
@eval $f(::ROCSOLVER, args...) = YArocSOLVER.$f(args...)
4747
end
4848

49-
MatrixAlgebraKit.supports_svd_full(::ROCSOLVER, f::Symbol) = f in (:qr_iteration, :jacobi, :divide_and_conquer, :bisection)
49+
MatrixAlgebraKit.supports_svd_full(::ROCSOLVER, f::Symbol) = f in (:qr_iteration, :jacobi, :divide_and_conquer)
5050

5151
# rocSOLVER's `gesvd*_batched` functions take the batch as an array
5252
# of device pointers, so a group of equally sized matrices
@@ -93,22 +93,6 @@ gesvdj_batched!(::ROCSOLVER, As::AbstractVector{<:StridedROCMatrix}, Ss::Strided
9393
gesvdj_batched!(::ROCSOLVER, As::StridedROCArray{T, 3}, Ss::StridedROCMatrix, Us::StridedROCArray{T, 3}, Vᴴs::StridedROCArray{T, 3}; kwargs...) where {T <: BlasFloat} =
9494
YArocSOLVER.gesvdj_strided_batched!(As, Ss, Us, Vᴴs; kwargs...)
9595

96-
function gesvdx_batched!(::ROCSOLVER, As::AbstractVector{<:StridedROCMatrix}, Ss::StridedROCMatrix, Us::StridedROCArray{T, 3}, Vᴴs::StridedROCArray{T, 3}; kwargs...) where {T <: BlasFloat}
97-
YArocSOLVER.gesvdx_batched!(As, Ss, Us, Vᴴs; kwargs...)
98-
_complete_svd_basis!(Us, Vᴴs, size(Ss, 1))
99-
return Ss, Us, Vᴴs
100-
end
101-
function gesvdx_batched!(::ROCSOLVER, As::StridedROCArray{T, 3}, Ss::StridedROCMatrix, Us::StridedROCArray{T, 3}, Vᴴs::StridedROCArray{T, 3}; kwargs...) where {T <: BlasFloat}
102-
YArocSOLVER.gesvdx_strided_batched!(As, Ss, Us, Vᴴs; kwargs...)
103-
_complete_svd_basis!(Us, Vᴴs, size(Ss, 1))
104-
return Ss, Us, Vᴴs
105-
end
106-
107-
function gesvdx!(::ROCSOLVER, A::StridedROCMatrix, S::StridedROCVector, U::StridedROCMatrix, Vᴴ::StridedROCMatrix; kwargs...)
108-
YArocSOLVER.gesvdx!(A, S, U, Vᴴ; kwargs...)
109-
_complete_svd_basis!(U, Vᴴ, length(S))
110-
return S, U, Vᴴ
111-
end
11296
gesdd!(::ROCSOLVER, A::StridedROCMatrix, S::StridedROCVector, U::StridedROCMatrix, Vᴴ::StridedROCMatrix; kwargs...) =
11397
YArocSOLVER.gesdd!(A, S, U, Vᴴ; kwargs...)
11498

‎src/implementations/svd.jl‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -249,31 +249,6 @@ function complete_svd_basis!(U::AbstractMatrix, Vᴴ::AbstractMatrix, minmn::Int
249249
return U, Vᴴ
250250
end
251251

252-
# Some methods (e.g. `gesvdx`) only compute the leading `min(m, n)` singular vectors.
253-
# If `U` or `Vᴴ` is square (`(batched_)svd_full!`), the remaining columns (row) of
254-
# `U` (`Vᴴ`) need to be filled with an orthonormal basis for the complement of the
255-
# computed singular vectors.
256-
function _complete_svd_basis!(U::AbstractMatrix, Vᴴ::AbstractMatrix, minmn::Int)
257-
if size(U, 2) > minmn
258-
N = qr_null!(copy(view(U, :, 1:minmn)))
259-
copyto!(view(U, :, (minmn + 1):size(U, 2)), N)
260-
end
261-
if size(Vᴴ, 1) > minmn
262-
V = view(Vᴴ, 1:minmn, :)
263-
N = qr_null!(adjoint!(similar(V, reverse(size(V))), V))
264-
adjoint!(view(Vᴴ, (minmn + 1):size(Vᴴ, 1), :), N)
265-
end
266-
return U, Vᴴ
267-
end
268-
function _complete_svd_basis!(U::AbstractArray{<:Any, 3}, Vᴴ::AbstractArray{<:Any, 3}, minmn::Int)
269-
(size(U, 2) > minmn || size(Vᴴ, 1) > minmn) || return U, Vᴴ
270-
for (u, vᴴ) in zip(eachslice(U, dims = 3), eachslice(Vᴴ, dims = 3))
271-
_complete_svd_basis!(u, vᴴ, minmn)
272-
end
273-
return U, Vᴴ
274-
end
275-
276-
277252
"""
278253
requires_tall(alg) -> Bool
279254

‎test/decompositions/svd.jl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if AMDGPU.functional()
8787
for T in BLASFloats, m in (0, 23), n in (0, 17, m, 27)
8888
TestSuite.seed_rng!(123)
8989
TestSuite.test_svd(ROCMatrix{T}, (m, n))
90-
AMD_SVD_ALGS = (QRIteration(), Jacobi(), DivideAndConquer(), Bisection())
90+
AMD_SVD_ALGS = (QRIteration(), Jacobi(), DivideAndConquer())
9191
TestSuite.test_svd_algs(ROCMatrix{T}, (m, n), AMD_SVD_ALGS)
9292
TestSuite.test_svd_batched(ROCMatrix{T}, (m, n), batch_size)
9393
TestSuite.test_svd_batched_algs(ROCMatrix{T}, (m, n), batch_size, AMD_SVD_ALGS)

0 commit comments

Comments
 (0)