[BLAS] Fix missing logic path in xrotmg.f#455
[BLAS] Fix missing logic path in xrotmg.f#455langou merged 2 commits intoReference-LAPACK:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
+ Coverage 81.86% 83.25% +1.38%
==========================================
Files 1863 1808 -55
Lines 181096 170263 -10833
==========================================
- Hits 148263 141747 -6516
+ Misses 32833 28516 -4317
Continue to review full report at Codecov.
|
|
Hmm - if a code path is unreachable and was removed by a cleanup, I am not sure it should be put back "for completeness" unless there is evidence that it is actually reachable ? (At the very least, nobody appears to have missed it since its removal, 9 years ago ?) |
|
Hi @timleslie, you write: |
|
Here's the correct link to the paper I referenced rather than a local copy 😅 https://www.researchgate.net/publication/2388100_Restructuring_the_BLAS_Level_1_Routine_for_Computing_the_Modified_Givens_Transformation
Yep, I think you're probably right. if the code path isn't reachable then the alternate change here would be to simply remove the check of I don't have any evidence that the check is necessary, but I also haven't run any experiments to try to find a set of values which can trigger the code path.
Calling it a bug is perhaps overstating the situation. The potential bug in this case is that if we have As noted above, this is just a potential bug, I don't have any evidence yet that indicates it can possibly be triggered. This extract from linked article notes that it would require some very specific rounding conditions to exist. That said, if we think there is an outside chance that the condition could be met then the code should account for it explicitly. I found this issue by inspection of the code. I'm trying to gain a deep understanding of the BLAS library for my own interest and I noticed this missing logic path. The algorithm involved is best described here (see Appendix): https://www.researchgate.net/publication/220492248_Basic_linear_algebra_subprograms_for_FORTRAN_usage It notes that |
|
Thanks @timleslie for explaining. This helps a lot. So we have a condition that we do not think will ever happen. (Per the paper that you quote.) And the current code has a conditional Note: I was surprised to see that the CODECOV report did not report a decrease in code coverage. This PR should decrease the code coverage since we now have some line of codes that our test suite is not entering. Maybe |
Yep, I think that sounds good, I'll add that comment and add a reference to the Hopkins paper for the next person who encounters this code.
I'm not yet familiar enough with the test suite to say for sure, but I agree that it makes sense that the coverage would decrease with this change. |
[BLAS] Fix missing logic path in xrotmg.f

This fixes a bug in
SROTMGandDROTMGwhere there is a missing code path.I traced the bug back to the following commit: 1767365#diff-17bc8cba27cfa755d1503dee5651235a35de951b677ecaa5f3adb596137005a2
In particular, the original code had:
The code at
60provided theZERO-H-D-AND-DX1operations, which is what was lost in the referenced commit. This PR puts this code path back in.It's worth noting that according to file:///Users/timl/Downloads/Restructuring_the_BLAS_Level_1_Routine_for_Computi.pdf (bottom of page 7) this code path may not actually be reachable, so this change is possibly just for completeness, it may not fix any real world cases.