Remove IF statement related to initial zeros in X for triangular multiplications and solves ( tbmv, tbsv, tpmv, tpsv, trmm, trmv, trsm, and trsv )#1323
Merged
langou merged 11 commits intoJul 13, 2026
Conversation
…A(J,J) instead of TEMP*B(I,J)
…ike the complex arithmetic one but weird otherwise
…t NaN propagation
amontoison
approved these changes
Jul 13, 2026
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.
Remove IF statement related to initial zeros in B or X for triangular multiplications and solves.
So that's: TBMV, TBSV, TPMV, TBSV, TRMV, TRSV, TRMM, and TRMV.
Note that TRMM is somewhat already done in PR #1301.
For a rationale, see discussion at #636.
There is also a few removals of IF statements for ZEROs in A(I,J) for TRSM and TRMM.
Skipping these multiplications saves FLOPs but the issues are (1) it short-circuits proper NaN propagations, and (2) it is not done consistently across variants of a routine, so a variant would propagate, while another variant would not. With this PR, all variants propagate consistently.
The changes that made me pause are the changes in TRSM from
to
See #e8785e4. On the one hand
B(I,J) = B(I,J)/A(J,J)behaves better with subnormal numbers, on the other hand, we could consider that we do not want to bother with subnormal numbers on the diagonal of a triangular matrix. In any case, (1) the behavior was not consistent for all variants of TRSM and (2) the behavior of Level 3 BLAS TRSM was not consistent with the behavior of the three Level 2 BLAS triangular solvers: TRSV, TPSV and TBSV. With this PR, the behavior is consistent across the board.