-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
audit: forbid links to libBLAS and libLAPACK #6174
Conversation
Yes, in this case I'd much rather have false negatives than false positives. |
dlls = obj.dynamically_linked_libraries | ||
# libBLAS and libLAPACK are superseded by functions in OpenBLAS | ||
# This can be linked via multiple paths, so use a wildcard match | ||
dlls.any? { |dll| %r{^/System/Library/Frameworks/Accelerate.framework/.*/(libBLAS|libLAPACK).dylib$}.match dll } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I added some suggestions for the message that I think would be improvements, but you're welcome to take them or leave them.
Updated per review comments. |
object files were linked against system Accelerate | ||
These object files link against outdated BLAS/LAPACK routines provided | ||
by the system Accelerate framework. Core tap formulae should link | ||
against OpenBLAS instead. Removing `depends_on "veclibfort" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we already have a separate audit for this I'm not sure what this check specifically is resolving for us. What's the actual problem users are experiencing that will be solved with this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The original audit for accelerate linkage was rolled back in Allow Accelerate linkage, deny veclibfort & lapack #6168 and replaced with a check for dependencies on
veclibfort
andlapack
. - Some build systems (e.g., python packages according to @jonchang) link directly against BLAS/LAPACK dylibs within the Accelerate framework
- This audit is catching those cases.
- The actual problem would be degraded performance, and occasional build bugs due to out of date BLAS/LAPACK implementation...
FWIW, I think this check probably has marginal benefits in practice, but may still be worth doing to prevent some confusion if we end up tripping over a subtle BLAS/LAPACK bug in a formula in the future due to the antiquated implementation in Accelerate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(So I'm 👍 to 🚢 but won't be devastated if we don', FWIW)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would anyone object to holding on this for e.g. a few weeks and see if we feel like we need it then? I'd like to knowingly avoid more false positives at this point.
Assuming this is 💀 |
brew style
with your changes locally?brew tests
with your changes locally?This pull request partially reverts #6168 to be stricter about the types of undesirable links into Accelerate.framework that we would like to forbid in core formulae.
This diff may be more useful for review purposes.
As outlined in #6130, we would generally like to avoid linking against system Accelerate for core tap formulae as it includes outdated BLAS routines that are being dropped by packages in favor of OpenBLAS.
However, as we discovered in #6168 there are many other non-BLAS routines in Accelerate that can and are used in formula, so the original implementation was too restrictive.
Although many formulae just link to the base Accelerate library (#6168 (comment)), I've found that it's possible for some build systems to do "deep links" into Accelerate. That is, occasionally you see formula linking specifically to e.g.
libLAPACK.dylib
, contrary to the earlier comment. This pull request checks for that case.There is a more precise solution, which is to enumerate symbols exported from
libLAPACK
andlibBLAS
specifically and ensure that formula that link againstAccelerate.framework
aren't using those symbols. This would catch more improper links to Accelerate, but would also be a lot more effort and complexity and would likely also be more fragile. I'm ok with a higher false negative rate if it means easier maintenance.