-
Notifications
You must be signed in to change notification settings - Fork 33
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
Maybe issue with MATMUL and -fexternal-blas using Accelerate framework #110
Comments
apropos the bug: It would be very helpful if possible to persevere with getting a reproducer - I will take a look at the _gfortran_matmul_r8 code and see if there's anything in the "known issues" that could explain it. In the absence of a repeatable behaviour, one might look for other explanations - e.g. some uninitialised or random effect that happens to manifest on arm64 + accelerate .. but not elsewhere. Unless your gfortran has been rebuilt since the new inlining cam e into force, I'd not expect that to make any difference ... but IDK when this change occurred. apropos upstreaming: |
HI Ian. Thanks for your quick reply. I'm aware that as-is, this is barely a useful report. I was hoping for a "ah, yes, seen that, it is about XYZ" kind of solution. As I've got a free afternoon, I will try to cut down one of the non-trivial cases. The only "good" thing here is that if it happens, it happens every time. Nothing random about that part. Will come back in a while. |
Got it. It has to be two compilation units, I couldn't make it happen in one. And secondly, the option The test case does not crash if either (1)
|
@fxcoudert - have you seen any other reports and/or do you have any comments on this? |
The backtrace is as follows:
I can make a further reduced test case:
and there the backtrace is the same:
We must be doing something wrong/weird with Accelerate, but I don't know what. I cannot reproduce when linking against openblas, though… |
have any of the interfaces changed? ... or is this a case where our D.3 matters (although, I think it used to work, Dominique gave me a benchmark code early in the devt which contrasted external / internal perf.). edit: it might also help to enumerate the optimisations in effect with "Og" and see if we can pin down which is causing the issue. |
BLAS prototypes pass everything as pointer, so I don't think D.3 matters:
Wait. Those two
I've seen that before, and on most arches, this does not actually create any trouble. Could it be that on the aarch64-darwin ABI it creates an issue? Edit: nope, I tried changing that, and it does not make the bug go away. |
Probably the next step is to make the Fortran code directly call |
OK - but there is some dependency on the optimisation, correct? |
I am on Ventura 13.4 using M1, with FX's 12.2 gfortran binaries installed. Largely things seem to work fine, up to one issue that is driving me mental: non-trivial use of MATMUL with
-fexternal-blas -framework Accelerate
. have a tendency to end up in:Using the libgfortran variants of MATMUL works fine (albeit presumably slower). So do the MATMUL in question on Intel Macs and Linux with BLAS from Intel MKL. That said, this problem does not appear for all MATMUL calls. Anecdotally with one argument being an approximation of the unity matrix (think rotations with near-or-exactly zero Euler angles). Needless to say that any trivial test program I tried to create to isolate the issue works just fine. I have observed that
print *, A
(A the calculated rotation matrix) just beforeC=MATMUL(A,B)
seems to prevent above crash, though.I would keep looking for issues on my side, but recently I found the Ventura 13.3 release notes:
Hence I wonder if the Accelerate libraries may have changed in significant enough ways that the gfortran binaries are incompatible somehow (gfortran November 2022, Ventura 13.3 from March 2023)?
I would appreciate any comments or insights on what might be going on. Thank you!
P.S. If there is anything a volunteer fluent in Fortran, but no experience in ARM, can do to help the project to get included into mainline gcc, let me know.
The text was updated successfully, but these errors were encountered: