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.
[LAA] Don't assume libcalls with output/input pointers can be vectorized #108980
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
[LAA] Don't assume libcalls with output/input pointers can be vectorized #108980
Changes from all commits
5ac4c73
b200ddf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
One thing that is a bit surprising here is that functions without pointer arguments are marked as mayReadFromMemory. If they don't access memory, shouldn't they be marked as not reading from memory?
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.
Perhaps
errno
? Although I'd expect that to be write only.It's also possible that we're back in a position of effectively preventing all functions that access memory but given we have this finer control is there harm in keeping it?
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.
It is a bit, this seems to allow vectorizing some library calls without
-fno-math-errno
https://godbolt.org/z/KM4Pv6Pfn (though it seems to depend on the call not returningfloat
).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.
(without this patch that includes functions like sincos)
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.
Functions might read from other parts of memory like globals or TU-local data (think lookup tables for some math functions). Or a system clock for a function like
omp_get_wtime()
, where not marking it as reading from memory led to failed tests since it was hoisted out of a loop.There's the
ArgMemOnly
attribute to indicate that the only memory accesses are through pointers passed as arguments.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.
It would still be good to know if there is any justification for vectorizing cases with custom veclibs for functions that may access errno
but as I said earlier, fixing this can be done as follow up
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.
-fveclib
has to be intentionally set by the user, which means they probably know what they're doing, and would like to force the use of the vector library calls (so don't care abouterrno
). So one possible path forward is to move this check from undermayReadFromMemory()
and allow it to apply more generally. This may also require updating the documentation of-fveclib
to state this is intentional.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.
If this is intentional, this should definitely be documented.
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.
(and then
fveclib
in clang should probably imply-fno-math-errno
, so we don't need special handling in LLVM for that but can rely on the attributes set for the functions)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.
I've posted a short RFC on this here: https://discourse.llvm.org/t/rfc-should-fveclib-imply-fno-math-errno-for-all-targets/81384