-
Notifications
You must be signed in to change notification settings - Fork 159
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
[EPIC]: Hide the visibility of Thrust/CUB symbols in shared object libraries #166
Comments
Okay, I had to prove to myself once and for all the difference between TL;DR: When building a shared object, they have the same end result of making the symbol unique to the shared object. The difference is that To prove this to myself, I have the following:
I build a
Inspecting the symbol table we see:
Important takeaways:
Therefore, my conclusion is that we should annotate everything in CUB with libcu++ already has a |
Note, that this annotation needs to be used not just on CUB's kernels, but all CUB template functions. |
It turns out
If As a result, we should annotate
In short, I think we want this macro:
In addition we use As far as testing goes to ensure all our symbols are hidden as expected, I think a relatively easy thing we could do is write a script that dumps the symbol table for all your existing tests with nm -C and then checks that all CUB symbols have T/t visibility. The namespace is included in the symbol name dumped by
|
This marks all kernels in CUCO as `static` so that they have internal linkage and won't conflict when used by multiple DSOs. I didn't see a single shared/common header in cuco where I could place a `CUCO_KERNEL` macro so I modified each instance instead. While `cccl` went with a `__attribute__ ((visibility ("hidden")))` approach to help reduce RDC size, this approach seemed very invasive for cuco. This is due to the fact that we would need to pragma push and pop both gcc warnings and nvcc warnings in each cuco header so that we don't introduce any warnings. This is needed as the compiler incorrectly state that the `__attribute__ ((visibility ("hidden")))` has no side-effect. Context: rapidsai/cudf#14726 NVIDIA/cccl#166 rapidsai/raft#1722 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Yunsong Wang <[email protected]>
Is this a duplicate?
Area
CUB
Is your feature request related to a problem? Please describe.
Due to kernels having weak external linkage, we have run into problems in the past, like NVIDIA/cub#545
More recently, we ran into another issue that may have the same root cause, where two shared libraries define symbols for the same kernels and the kernels never actually get launched - with no cuda error being reported.
NVIDIA/cub#719
Describe the solution you'd like
Ensuring that our kernels do not have external linkage should resolve the issue. However we want to ensure some unforeseen side-effects may cause issues or regressions.
Tasks
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: