-
Notifications
You must be signed in to change notification settings - Fork 754
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
[SYCL][libdevice] Don't force linkage to weak #14096
Conversation
Signed-off-by: Sarnie, Nick <[email protected]>
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. Adding @jinge90 for awareness just in case if there are some concerns.
Thanks, I will wait a bit for any feedback from @jinge90 before merging. |
Hi, @sarnex and @againull |
@jinge90 Thanks for the response. It seems like the relevant SYCL spec document is here It seems the problem in question could happen with separate translation units, one that does not include My understanding of the current behavior/design as explained above is that we explicitly mark all device lib functions as weak linkage so that in the above case, both translation units will end up using the user defined This seems really strange to me. My initial reaction is that an error is the correct behavior, overwriting the function from another TU seems weird. @gmlueck @intel/dpcpp-specification-reviewers Can you guys comment if the SYCL spec and/or our SYCL extensions give an idea of what should happen in this case? If not, can you give your opinion on what should happen? |
This isn't really a spec question. The spec does not say that you can define your own version of a standard library. Strictly speaking, I think this is UB by the C++ language. However, if customers are doing it now, and you cause that code to break, then those customers will be unhappy. What is the motivation for removing the "weak"? It sounds like thinLTO doesn't work with weak symbols? However, weak symbols are a pretty common C/C++ feature. Does thinLTO not work for regular C/C++ programs when there are weak symbols?
I think @jinge90 is saying that the problem occurs even with a single TU that defines a a function like |
don't want this to be merged accidentally
Thanks Greg. It looks like it actually thinLTO with weak symbols does work for pure x86 code, so let me investigate why the upstream community clang-linker-wrapper thinLTO doesn't work but the upstream community x86 thinLTO linker plugin does work. I'll come back to this PR if I think we really do need this change. Thanks to everyone for giving me a better place to investigate. Marking as a draft for now. |
This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be automatically closed in 30 days. |
This pull request was closed because it has been stalled for 30 days with no activity. |
I'm working on thinLTO and weak symbols are not guaranteed to be the same everywhere, so the thinLTO infrastructure does not link them in so devices libraries don't work.
I don't know of any reason to explicitly mark them as weak and in reality these functions should follow ODR, so just remove the specification.