-
Notifications
You must be signed in to change notification settings - Fork 26
[Downstream change][LV] Workaround for sincos vectorization on aarch64-amazon-linux triple #279
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
When the `aarch64-amazon-linux` triple is specified LLVM currently does not think it has a GNU environment, so looking up the "sincos" library function names via RTLIB::SINCOS_F32/64 fails, which prevents vectorizing sincos with vector libraries. The function names are needed only to find the corresponding vector mapping, so it does not matter if the scalar function exists. Given this, we can work around this issue by hardcoding names for SINCOS_F32/64 when we know we're using the name to find a vector mapping.
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.
LG
@paulwalker-arm @mgabka Is this patch OK? We decided to go with a downstream fix since this is a regression between ACfL and ATfL. |
Not really. To me this patch is simply perverting an existing interface to achieve the desired result. It would be better to figure out why this interface (or its dependent) is not already able to lookup the required system library function. Also, for systems where this function is genuinely not available we'll erroneously return a match. My worry is that we're simply papering over missing integration required to support Amazon linux. |
The basic issue is that the Amazon Linux triple is not hooked up in I avoided fixing that for this workaround as it's not necessary if the name is only needed to find a vector mapping. Before adding the intrinsic for sincos the mappings would be found even though This is where the names are registered (which is not working for Amazon Linux): Note: Using a triple like |
Can this not be fixed upstream instead? The other changes in #87 were in the process of upstream review, and the changes were only made to our release branch because they missed the upstream branch date. Downstream changes should be a last resort, so there should be an attempt to upstream the work, or justify why it can't be done. |
This PR probably is not acceptable upstream. I had another look at this and I think a "correct" fix is fairly simple. I've posted that in #286, and I believe that patch may be acceptable upstream too. |
Note: This this is cherry-picking into a release branch (which won't happen upstream) so a downstream change is needed if a fix is desired for LLVM 20. |
Closing in favour of #286 (as I believe that's less of a hack). |
When the
aarch64-amazon-linux
triple is specified LLVM currently does not think it has a GNU environment, so looking up the "sincos" library function names via RTLIB::SINCOS_F32/64 fails, which prevents vectorizing sincos with vector libraries. The function names are needed only to find the corresponding vector mapping, so it does not matter if the scalar function exists. Given this, we can work around this issue by hardcoding names for SINCOS_F32/64 when we know we're using the name to find a vector mapping.Downstream change: #87