Skip to content
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

Inline get_cache_idx #1492

Merged

Conversation

ahendriksen
Copy link
Contributor

Related to issue #1490.

The get_cache_idx kernel is currently defined in an anonymous namespace. In #1490, it was reported that this could lead to linker errors in CUDA 11.4 in combination with (presumably?) clang.

I tried to reproduce the linker error in commit 01cf409 but could not, as described in the commit message.

This PR attempts to fix the linker errors by marking get_cache_idx as inline and by removing the anonymous namespace.

I cannot reproduce the linker error. Building with clang 11.1 and nvcc
11.8. Both test files have raft::cache::(anonymous
namespace)::get_cache_idx defined though..

$ nm -g -C cpp/build/CMakeFiles/UTILS_TEST.dir/test/util/get_cache_idx_1.cu.o | grep get_cache_idx
                 U __cudaRegisterLinkedBinary_667dac6a_18_get_cache_idx_1_cu_eeb3336e_3832672
0000000000000000 D __fatbinwrap_667dac6a_18_get_cache_idx_1_cu_eeb3336e_3832672
0000000000000010 T __device_stub__ZN4raft5cache59_GLOBAL__N__667dac6a_18_get_cache_idx_1_cu_eeb3336e_383267213get_cache_idxEPiiS2_iiS2_S2_Pbi(int*, int, int*, int, int, int*, int*, bool*, int)
0000000000000000 T raft::cache::(anonymous namespace)::get_cache_idx(int*, int, int*, int, int, int*, int*, bool*, int)

$ nm -g -C cpp/build/CMakeFiles/UTILS_TEST.dir/test/util/get_cache_idx_2.cu.o | grep get_cache_idx
                 U __cudaRegisterLinkedBinary_74c80384_18_get_cache_idx_2_cu_a658dc80
0000000000000000 D __fatbinwrap_74c80384_18_get_cache_idx_2_cu_a658dc80
0000000000000010 T __device_stub__ZN4raft5cache51_GLOBAL__N__74c80384_18_get_cache_idx_2_cu_a658dc8013get_cache_idxEPiiS2_iiS2_S2_Pbi(int*, int, int*, int, int, int*, int*, bool*, int)
0000000000000000 T raft::cache::(anonymous namespace)::get_cache_idx(int*, int, int*, int, int, int*, int*, bool*, int)
Now we do get linker errors
@ahendriksen ahendriksen requested a review from a team as a code owner May 5, 2023 10:34
@github-actions github-actions bot added the cpp label May 5, 2023
@cjnolet cjnolet added bug Something isn't working non-breaking Non-breaking change labels May 5, 2023
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending verification from Meta side.

@alexanderguzhva
Copy link
Contributor

It seems to be working! Thanks.

@cjnolet
Copy link
Member

cjnolet commented May 5, 2023

/merge

@rapids-bot rapids-bot bot merged commit 576b22f into rapidsai:branch-23.06 May 5, 2023
rapids-bot bot pushed a commit that referenced this pull request Aug 11, 2023
Fixes issue #1511. Make get_cache_idx a weak symbol (to allow linking multiple symbols) without marking it inline (to avoid compilation warnings that are promoted to errors in nvcc 12). 

Related issues:
- #1490 
- #1722 

Related PRs:
- #1732 
- #1492

Authors:
  - Allard Hendriksen (https://github.com/ahendriksen)
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Artem M. Chirkin (https://github.com/achirkin)
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #1733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp non-breaking Non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

3 participants