-
Notifications
You must be signed in to change notification settings - Fork 234
Convert part of RMM to a precompiled library #1896
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
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
cpp/include/rmm/aligned.hpp
Outdated
| { | ||
| return is_pow2(alignment); | ||
| } | ||
| [[nodiscard]] RMM_EXPORT bool is_supported_alignment(std::size_t alignment) noexcept; |
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.
FWIW, I believe RMM_NAMESPACE already contains the RMM_EXPORT macro, but it's not bad to be explicit. If we wanted to, we could then go back to just saying namespace rmm in this file.
We should, however, probably add RMM_EXPORT to the static symbols as well in that case.
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.
Thanks for the explanation! I was unsure about this. I will think some more about what solution seems the most natural. Related to the other comment below, I would like it if we could use either RMM_NAMESPACE or namespace rmm in both headers and implementation files -- but that is tricky with the need to export things.
What do you think of this proposal:
- get rid of
RMM_NAMESPACE - don't put
RMM_EXPORTon every symbol, just the namespaces as we currently do - use
namespace RMM_EXPORT rmmin the headers andnamespace rmmin the implementation files
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.
On the topic of namespacing, I think there will also be a lot of detail functions that we can move from headers to implementation files in anonymous namespaces. (Currently we can't use anonymous namespaces because it's header-only and that's not good practice.)
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.
wrt the proposal, that sounds reasonable. Ideally we move to a situation where everything in the detail namespace is __attribute__((visibility("hidden"))), similar to cudf last year:
- Hide visibility of non public symbols cudf#15982
- Move kernel vis over to CUDF_HIDDEN cudf#16165
- Remove CUDA whole compilation ODR violations cudf#16603
I suppose your anonymous namespace suggestion would have the same effect.
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.
Yes, for sure. That will likely be for a later pass. I haven't touched any "detail" headers yet.
cpp/src/aligned.cpp
Outdated
| #include <cstddef> | ||
| #include <cstdint> | ||
|
|
||
| namespace RMM_NAMESPACE { |
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 believe here we should be using namespace rmm since it is the header file which defines our public exported API.
|
/ok to test |
|
I'm going to cut the scope here for the first pass. I'd like to be sure that things work downstream before expanding the precompiled code further. |
|
This is now ready for review. I am going to do some downstream testing with cuDF before I remove the |
Co-authored-by: Robert Maynard <[email protected]>
vyasr
left a comment
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.
Some minor notes, but generally LGTM.
| CXX_STANDARD_REQUIRED ON | ||
| CXX_VISIBILITY_PRESET hidden | ||
| POSITION_INDEPENDENT_CODE ON | ||
| INTERFACE_POSITION_INDEPENDENT_CODE ON) |
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.
We may be able to drop this eventually depending on how much of rmm stops being header-only. Ideally we wouldn't be proscribing this for consumers I think, @robertmaynard any thoughts?
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.
Ideally once RMM is a proper library we can drop INTERFACE_POSITION_INDEPENDENT_CODE but currently having it won't hurt downstream projects
| #include <cstdint> | ||
|
|
||
| namespace RMM_NAMESPACE { | ||
| namespace RMM_EXPORT rmm { |
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.
Is the idea to get rid of RMM_NAMESPACE altogether eventually?
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.
Yes, see: #1896 (comment)
|
What's the ultimate goal here? Convert everything that can be part of a precompiled binary into one? Strictly speaking, the only thing necessary to be part of a DLL is the current device resource machinery. |
|
In my view the ultimate goal should be that if we are making rmm a shared library we should move anything that does not benefit from being header-only (for instance, non-template types that do not need to be inlined into performance-critical code paths) into the shared library. The current device resource machinery obviously needs to move for the uniqueness reasons, but moving other bits will also help us more easily make stability guarantees and reduce recompilation times across RAPIDS (right now a one-line change in the wrong place in rmm can bust sccache for the world, for example). |
Yes -- all of the above here. Memory resources are the most important reason. Moving most code into a precompiled library also gives us stronger control over interfaces. We can shield implementation details behind anonymous namespaces and not need to expose them in |
harrism
left a comment
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'm going to leave this review at one question before I go on, because a lot of my opinions hinge on whether there's something I don't know about the answer to this question.
|
The next step needed for this is to add |
|
I finished adding |
|
I concluded my testing in rapidsai/cudf#18586 through a combination of CI jobs and local CI reproductions (I hadn't set up wheel artifact downloads properly in CI but all seems fine locally when installing RMM wheel artifacts from this PR). I also dealt with a fair bit of friction from the new GitHub Artifacts work. rapidsai/gha-tools#172 will fix those points of friction, making it easier to do future testing. I am planning to merge this over the weekend so that I can avoid the possibility of Friday/weekend breakage, and help deal with any problems it may cause on Monday. |
|
/merge |
After rapidsai#1896 the librmm wheel contains a compiled library, which means it is no longer accurate to tag the wheel as supported on any platform. We must tag it according to the suitable architecture tags to ensure that we do not get arm binaries on x86 and vice versa. We must also add a manylinux tag to indicate glibc compatibility. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Kyle Edwards (https://github.com/KyleFromNVIDIA) URL: rapidsai#1913
Continues from #1896. Contributes to #1779. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Lawrence Mitchell (https://github.com/wence-) - Rong Ou (https://github.com/rongou) - Robert Maynard (https://github.com/robertmaynard) URL: #1980
Description
This PR is a starting point for #1779.
It converts RMM to a precompiled shared library, and moves some implementations into
src/files.Checklist