-
Notifications
You must be signed in to change notification settings - Fork 13.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
floor
function missing from libm offloaded on OpenMP (nvptx)
#132456
Comments
@llvm/issue-subscribers-openmp Author: None (KaruroChori)
The function is missing, however `__builtin_elementwise_floor` works fine with nvptx as target.
Not sure what else is missing, I just found out this one because glm::fract was failing while linking.
|
This normally comes from
-nogpuinc . It's also provided as a symbol in the GPU libm from the libc project. How are you compiling this?
|
This should be the typical command, sorry for the "noise", but I am not writing it manually as it is generated via meson/ninjia
I have not manually added that flag, and I cannot find it anywhere. |
@jhuber6 I think I was able to find a bit more of the issue.
The first is valid, the second is not. If run on the host that code is fine. If in the second entry |
Ah, yeah that's probably not handled correctly in the GPU wrapper headers. They're extremely hacky. I believe the |
In theory, according to the reference it should be there since C99. |
Hm, weird. I was looking at https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf and couldn't find it. Either way, it's probably something we can fix in the GPU headers by adding https://godbolt.org/z/obzr7z6c8 or something. |
It actually does, around page 499 when it talks about So to be precise precise, according to the document you posted, it is To be honest it is the first time I even heard about that header, I always worked under the assumption Not sure on what the best approach would be. On one hand "as it is" follows the standard it seems. Yet, de facto everywhere else it is implemented differently. |
Right, totally forgot about that. It's a resource directory header too. it lowers to the C library calls, wondering if those shouldn't use builtins where possible. Anyways, for standards related questions I usually defer to @AaronBallman, but to me this looks like it's 'supposed' to work like that. |
I've always been a bit surprised that we supply https://codebrowser.dev/glibc/glibc/include/tgmath.h.html But regardless, in terms of implementation, the standard requires that the macros in tgmath.h call the library functions defined in math.h. C23 Clause 7.27 is what specifies this. |
Thanks for the input. Speaking of, we should probably copy the Should we close this issue? Since this seems to be the intended behavior when feeding a float constant to |
Answer a bit unclear. The command line was executing If @KaruroChori can provide a small reproducer, that would be helpful. |
Yeah it seems like #include <glm/glm.hpp>
#include <cstdio>
int main(){
#pragma omp target
{
printf("%f",glm::fract(1.0f));
}
return 0;
} This works. Replacing
However if removing the |
Weird, I don't have any issues with |
Which version of nvlink do you have? Mine is a bit old on this workstation
I am also rebuilding clang as I am a bit behind with commits and I will check again. |
I can confirm it is a bug because of the older cuda sdk. Just tested on the latest version and it works. Clang had no fault of its own. |
The function is missing, however
__builtin_elementwise_floor
works fine with nvptx as target.Not sure what else is missing, I just found out this one because glm::fract was failing while linking.
The text was updated successfully, but these errors were encountered: