-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Adjust calling convention of LAPACK functions #38836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I believe this is the right way to do it, and we should do it across the board, but I am no expert on the calling conventions. |
8b64d63 to
929a7f8
Compare
|
Impressive that this was not really an issue so far, and I wonder if this fixes any hiesenbugs in linear algebra. |
|
So the only hesitation I have here is that the ABI that we are explicitly using is the gfortran ABI. IFort allegedly follows the same ABI, but YMMV |
|
IIRC, ifort supports both, the f2c and the gfort ABIs. |
|
So for now we could use this strategy and in the 1.7 time-frame consider adding a calling convention for @ViralBShah any suggestions for who should review this? |
|
I am happy to merge. But perhaps @KristofferC or @andreasnoack for a quick check. |
|
I have little to contrive when it comes to calling convention conversations but I'm curious why this hasn't caused any significant issues. These functions are used by a lot of people all the time. |
|
The issue linked to in OP discusses this and also links to other blogs. I am guessing single character arguments work because they only dereference only the one memory location. |
|
We should also pass the suggested |
|
Based on the R blog post I'd guess the answer to my question is that we compile with version of gfortran prior to version 7. What is the proper way to pass the string length in case of multiple string arguments? |
|
This PR has some cases with multiple arguments - they just all go at the end. |
We actually don't, we use 6, 7, or 8 depending on the GFortran ABI we compile for. |
|
@vchuravy Let's go ahead and merge. While it looks like you have done a pretty thorough scan, It would be good for someone else to scan through all the functions after the merge to see if any were missed. |
|
Also pinging @dkarrasch to see this PR. |
Isn't it a bit surprising that the R world completely broke when they started using 7 and 8 while we've hardly noticed? |
* Adjust calling convetion of dgebal and co * Adjust calling convention of BLAS & LAPACK (cherry picked from commit 9f4a807)
This PR was one of these moments, where I asked myself: How does anything work. I found it surprising as well. |
* Adjust calling convetion of dgebal and co * Adjust calling convention of BLAS & LAPACK (cherry picked from commit 9f4a807)
* Adjust calling convetion of dgebal and co * Adjust calling convention of BLAS & LAPACK
* Adjust calling convetion of dgebal and co * Adjust calling convention of BLAS & LAPACK (cherry picked from commit 9f4a807)
As JuliaLang/LinearAlgebra.jl#650 and the references mentioned in it point out there is a Fortran ABI issue
with characters. In #32390 (review) we fixed it in one
place, but we have yet to fix it across the code-base.
While investigating JuliaLang/LinearAlgebra.jl#717 I minimzed the code to
Which would reliably segmentation fault or return a spurios error code.
Changing this to:
seems to fix that issue and other related ones in our test suite.
So question for the folks who know more about LAPACK/GFortran (@ViralBShah, @vtjnash, @staticfloat)
should we generally fix the way we call LAPACK and pass the hidden argument along? I can got through LinearAlgebra.jl
and do so, but I wanted to get feedback on that first.
To note is that I am using the BinaryBuilder OpenBLAS binaries, which should be using GCC 6, so this might be a pecularity that arises due to PPC.