Skip to content

Support Bisection for ROCSOLVER - #281

Merged
kshyatt merged 8 commits into
mainfrom
ksh/bisection
Sep 23, 2026
Merged

kshyatt merged 8 commits into
mainfrom
ksh/bisection

Conversation

@kshyatt

@kshyatt kshyatt commented Sep 17, 2026

Copy link
Copy Markdown
Member

Moving this out of #275 since it's not really batching.

Wrapped the Bisection() algo for ROCm, and added some helper functions in src/implementations/svd.jl so that it can also be used for svd_full!. I put the helpers there since NVIDIA might add a similar algorithm someday, or we could also allow LAPACK users to combine the two. Can remove that if we don't want it. Also added tests.

@kshyatt
kshyatt requested review from Jutho and lkdvos September 17, 2026 14:35
Comment thread ext/MatrixAlgebraKitAMDGPUExt/yarocsolver.jl Outdated
Comment thread ext/MatrixAlgebraKitAMDGPUExt/yarocsolver.jl Outdated
Comment thread ext/MatrixAlgebraKitAMDGPUExt/yarocsolver.jl
Comment thread src/implementations/svd.jl Outdated

function gesvdx!(::LAPACK, A, S, U, Vᴴ; kwargs...)
YALAPACK.gesvdx!(A, S, U, Vᴴ; kwargs...)
_complete_svd_basis!(U, Vᴴ, length(S))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might have to go inside of the YALAPACK implementation, I think that one checks that the rows/columns of V,U are not larger than minmn:

length(S) == minmn ||
throw(DimensionMismatch("length mismatch between A ($minmn) and S ($(length(S)))"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm quite confused actually why the tests are passing, it seems like that shouldn't be happening 😕

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Wait, I'm confused about what's confusing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Me too, the checks on the number of column of U and the number of rows of Vᴴ are inequality checks, so more columns/rows then necessary are allowed:

size(U, 2) >= (range == 'I' ? iu - il + 1 : minmn) ||

size(Vᴴ, 1) >= (range == 'I' ? iu - il + 1 : minmn) ||

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yes this is again for svd_full where we want size(U, 2) to be m, but I should explicitly check it's not > m also.

@lkdvos lkdvos Sep 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this mean we are now allowing cases like size(A) = (m, n) with m < n, size(U, 2) = k with m <= k <= n as a valid input?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh yea I see, sorry, it should indeed not be >=. The range == 'I' case throws this stuff off, it's annoying

Comment thread src/implementations/svd.jl Outdated
Comment thread src/implementations/svd.jl Outdated
Comment thread src/implementations/svd.jl Outdated
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.41096% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ext/MatrixAlgebraKitAMDGPUExt/yarocsolver.jl 88.88% 5 Missing ⚠️
src/yalapack.jl 66.66% 2 Missing ⚠️
Files with missing lines Coverage Δ
...ixAlgebraKitAMDGPUExt/MatrixAlgebraKitAMDGPUExt.jl 65.57% <100.00%> (+2.41%) ⬆️
src/implementations/svd.jl 95.76% <100.00%> (+0.30%) ⬆️
src/yalapack.jl 91.77% <66.66%> (+0.03%) ⬆️
ext/MatrixAlgebraKitAMDGPUExt/yarocsolver.jl 88.26% <88.88%> (+0.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/implementations/svd.jl Outdated
Comment thread src/implementations/svd.jl Outdated
@kshyatt
kshyatt merged commit 322f673 into main Sep 23, 2026
48 checks passed
@kshyatt
kshyatt deleted the ksh/bisection branch September 23, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants