Conversation
cuSOLVER's `ormqr` needs a workspace of ~2*m*n elements whose size can only be queried through a 32-bit integer, so it becomes unusable past m ~ 35000. `orgqr` needs no workspace and is faster, but generates Q in the array holding the reflectors, which the old order (construct Q, then copy R out of the packed A) could not combine with returning R. Extracting R/L first lifts the restrictions on an inplace Q (`Q === A`): it now combines with computing R/L and with `positive = true`. The blocked path keeps constructing Q first, as R doubles as workspace for T there. The CUSOLVER driver now always constructs Q with `ungqr!`. Also fixes LQ gauge fixing running with `positive = false` when L is not computed, and makes the Native and GLA drivers reject `Q === A` instead of silently returning garbage. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
They are no longer used now that the CUSOLVER driver always constructs Q with `ungqr!`. Inline the ungqr!-based Q construction into `_qr_buildQ!`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lkdvos
force-pushed
the
ld-qr
branch
2 times, most recently
from
August 12, 2026 14:48
cc06e89 to
e164200
Compare
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ormqr(unmqr!) requires a workspace of ~2·m·n elements whose size can only be queried through a 32-bit integer, and cuSOLVER exposes no 64-bit variant.Past m ≈ 35000 the query itself returns
CUSOLVER_STATUS_INVALID_VALUE, soqr_compact/qr_fullon a largeCuMatrixcannot constructQat all.orgqr(ungqr!) needs no workspace and measured 1.15–1.5× faster at every size tested on my GPU — but it generatesQin the array holding the reflectors, which the old order (constructQ, then copyRout of the packedA) could not combine with returningR.Note that the old order was there for the blocked version reasons, which is not on the GPU anyways and still exists for that reason.
qr_householder!/lq_householder!extractR/Lbefore constructingQ.An inplace
Q(Q === A) therefore now combines with computingR/Land withpositive = true; onlyblocksize = 1, a tall (wide)A, andR/Lnot aliasingAremain required. The blocked path still constructsQfirst, sinceRdoubles as workspace forTthere.CUSOLVER now always constructs
Qwithungqr!. LAPACK keepsunmqr!, where the comparison is mixed (unmqr!up to 6× faster for small/skinny,ungqr!up to 1.9× faster from ~2000 up).qr_nullkeepsunmqr!regardless:Nholds the trailing columns ofQ, whichorgqrcannot generate.Also fixed: LQ gauge fixing ran even with
positive = falsewhenLwas not computed;Native/GLAsilently returned garbage forQ === A.🤖 Generated with Claude Code