Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions ext/MatrixAlgebraKitAMDGPUExt/MatrixAlgebraKitAMDGPUExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ MatrixAlgebraKit.supports_svd_full(::ROCSOLVER, f::Symbol) = f in (:qr_iteration
# rocSOLVER's `gesvd*_batched` functions take the batch as an array
# of device pointers, so a group of equally sized matrices
# doesn't need a copy into a 3D ROCArray.
MatrixAlgebraKit.supports_pointer_batch(::AbstractAlgorithm, ::ROCSOLVER, ::Type{<:StridedROCMatrix{<:BlasFloat}}) = true
MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_full!), ::AbstractAlgorithm, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_compact!), ::AbstractAlgorithm, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_vals!), ::AbstractAlgorithm, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
# opt-in per algorithm to avoid picking up `DiagonalAlgorithm`
# which doesn't support batching
for alg in (:Bisection, :Jacobi, :QRIteration, :DivideAndConquer)
@eval MatrixAlgebraKit.supports_pointer_batch(::$alg, ::ROCSOLVER, ::Type{<:StridedROCMatrix{<:BlasFloat}}) = true
@eval MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_full!), ::$alg, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
@eval MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_compact!), ::$alg, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
@eval MatrixAlgebraKit.supports_ragged_batch(::typeof(svd_vals!), ::$alg, ::ROCSOLVER, ::Type{<:AnyROCArray}) = true
end

function gesvd!(::ROCSOLVER, A::StridedROCMatrix, S::StridedROCVector, U::StridedROCMatrix, Vᴴ::StridedROCMatrix; kwargs...)
m, n = size(A)
Expand Down
2 changes: 2 additions & 0 deletions test/decompositions/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ if CUDA.functional()
TestSuite.test_svd_algs_batched_oversized(CuMatrix{T}, (Jacobi(),), batch_size)
TestSuite.test_svd_algs_batched_ragged_support(CuMatrix{T}, (Jacobi(),), batch_size)
TestSuite.test_svd_algs_batched_ragged_support(CuMatrix{T}, (QRIteration(),), batch_size; supported = false)
TestSuite.test_svd_algs_batched_ragged_support(Diagonal{T, CuVector{T}}, (DiagonalAlgorithm(),), batch_size; supported = false)
end

# Randomized SVD:
Expand Down Expand Up @@ -104,6 +105,7 @@ if AMDGPU.functional()
TestSuite.seed_rng!(123)
AMD_SVD_ALGS = (QRIteration(), Jacobi(), DivideAndConquer(), Bisection())
TestSuite.test_svd_algs_batched_ragged_support(ROCMatrix{T}, AMD_SVD_ALGS, batch_size)
TestSuite.test_svd_algs_batched_ragged_support(Diagonal{T, ROCVector{T}}, (DiagonalAlgorithm(),), batch_size; supported = false)
end

@testset "Bisection with min(m, n) == 1 $(testargs_summary(T, sz))" for T in BLASFloats,
Expand Down
Loading