-
Notifications
You must be signed in to change notification settings - Fork 203
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
[FEA] make raft sources compilable with clang #424
[FEA] make raft sources compilable with clang #424
Conversation
question to reviewers: what would be the easiest way to bump up versions of tools and dependencies ? With the Rapids cpm system, this seems prohibitively hard. Why? |
@MatthiasKohl, I know you've put this down in the meantime due to some issues w/ dependent versions in RAPIDS. I still see value in merging the c++ code changes and keeping the script in a PR until clang support is ready to go. What do you think? |
Yes I think it makes sense to add these changes to RAFT. But it's hard to test because of these issues in dependencies meaning that for many files, clang doesn't even get to the RAFT part. In fact after I upgraded to clang 13 and updated some of the dependent packages, I still discovered new issues within RAFT sources because they were simply not compiled before. |
@cjnolet I've added a few changes I had in the pipeline which make things compatible with CUDA 11.5, plus a few other RAFT sources which can only be compiled with a newer clang version and updated thrust. Can you review these changes so that we can already merge those? Right now, libcudacxx and cuco cannot be compiled device-side. |
rerun tests |
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.
Since RAFT is still somewhat coupled to cuml's C++ code, can you open a PR in cuml w/ the get_raft.cmake
pinned to this branch just so we can make sure it doesn't break? Overall the changes look good.
@cjnolet sorry I didn't see your comments on this PR (somehow missed the notifications), I'll address them ASAP |
@cjnolet you might have seen this draft PR on cuml, which I'm using to make sure that cuml CI is still passing with these changes: rapidsai/cuml#4571 Note that I had to add some more changes to raft in order to make sure that RAFT sources themselves are compiling with Clang: - cpp/include/raft/cuda_utils.cuh lines 697-728 : I added overloads for the
|
@cjnolet CI on cuml is passing with the latest changes from this PR (see rapidsai/cuml#4571) Apart from that, I'm still awaiting your final review for the latest changes since the compiler-specific stuff might not be what you'd like to do for RAFT in general. |
rerun tests |
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 still thinking through the best way to isolate and document the files that can be safely compiled with a CUDA vs non-CUDA-enabled compiler while keeping the API consistent.
Thanks again for these changes! I really just have a couple minor-ish questions and one small change.
* Ceiling division operation | ||
* Re-declared here from raft/cuda_utils.cuh since we cannot include CUDA files | ||
*/ | ||
template <typename IntType> |
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.
since we cannot include CUDA files
Can you explain what you mean by this? I think I'm misunderstanding only because I notice this file has kernels in it. Is it the __CUDA_ARCH__
that's not allowed?
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.
Thank you for raising this again!
Given the comment, I must have thought that this file was compiled from a .cpp
file (thus with a non-CUDA-enabled compiler). I actually don't think this was the case, and these changes don't make any sense to me anymore, so I reverted them and they don't seem to affect clang compilation at all.
…to use of ld/st CUDA intrinsics with cache hints
@cjnolet @achirkin would it be possible to review the latest changes again? I've made the following changes:
|
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.
This looks good from my end. Thanks for doing this! It will be very useful once we are able to run clang-tidy across the entire codebase.
Also hoping to get final thoughts from @achirkin before merging. |
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 great to me, looking forward to using clang-tidy
in all cuda files!
Thanks guys! I had to fix one final line in kmeans.cuh since my last two merges messed up the includes slightly, but CI in both RAFT and cuml should be passing now. |
@gpucibot merge |
This makes RAFT sources compilable with clang.
It fixes some fragile code (using
static const
instead ofstatic constexpr
or%laneid
in PTX relying on quirks in nvcc which make this happen).RAFT is still not compilable with clang entirely though due to the dependencies:
-Xclang -fcuda-allow-variadic-functions
to clang (wasn't able to verify this yet)EDIT: this is necessary to close #84