Query SGELQF workspace in SGELSS, as D/C/ZGELSS do - #1428
Merged
Merged
Conversation
Path 2a computed the SGELQF workspace as M*ILAENV(1,'SGELQF',...), which duplicates SGELQF's own formula. Use a workspace query instead, as DGELSS, CGELSS and ZGELSS do. The returned LWORK is unchanged.
langou
approved these changes
Sep 26, 2026
langou
left a comment
Contributor
There was a problem hiding this comment.
This is great. Thanks @kyungminlee
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1428 +/- ##
==========================================
- Coverage 69.36% 69.33% -0.03%
==========================================
Files 6122 6122
Lines 486717 487029 +312
Branches 23268 23268
==========================================
+ Hits 337590 337688 +98
- Misses 148689 148903 +214
Partials 438 438
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
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.
SGELSS still computes the SGELQF term of its Path 2a workspace as M*ILAENV(1, 'SGELQF', ...), which repeats the formula inside the reference SGELQF instead of asking SGELQF. Commit 9e96fbe (bug 0065, LAPACK 3.4.0) replaced the ILAENV workspace formulas in DGELSS, CGELSS and ZGELSS with workspace queries, and they have asked ?GELQF since then. In SGELSS it converted the SGEBRD, SORMBR, SORGBR and SORMLQ terms but left this one, the only workspace formula still in the file:
lapack/SRC/sgelss.f
Lines 323 to 324 in 9e518f1
With the reference SGELQF the formula and the query agree, because the query returns M*NB from the same ILAENV call whenever MIN(M, N) > 0, and Path 2a is only taken then. So the LWORK that SGELSS returns does not change. Workspace queries at a few Path 2a sizes return the same LWORK before and after the change.
Replace the formula with a workspace query, as 9e96fbe did in dgelss.f, so that SGELSS no longer depends on how SGELQF sizes its workspace.