fix(visibility): restrict RAFT_EXPORT to core/ and raft_runtime/ only#3019
Merged
Conversation
d4d6a90 to
8febe8b
Compare
8febe8b to
0190094
Compare
vyasr
added a commit
to vyasr/cuvs
that referenced
this pull request
May 16, 2026
Temporarily points cuvs at vyasr/raft@fix/detail_symbol_export so CI exercises the fix that removes RAFT_EXPORT from detail namespace declarations in raft headers. Changes: - cpp/cmake/thirdparty/get_raft.cmake: RAFT_FORK=vyasr, RAFT_PINNED_TAG=fix/detail_symbol_export - ci/use_conda_packages_from_prs.sh: downloads libraft conda artifacts from NVIDIA/raft#3019 via rapids-get-pr-artifact - ci/use_wheels_from_prs.sh: downloads libraft wheel artifacts from NVIDIA/raft#3019 - All conda CI scripts (build_cpp, build_python, build_docs, build_go, build_java, build_rust, test_cpp, test_python): source use_conda_packages_from_prs.sh after conda strict channel priority - build_wheel_libcuvs.sh: source use_wheels_from_prs.sh after rapids-init-pip Revert these changes once NVIDIA/raft#3019 is merged and picked up by the nightly.
vyasr
added a commit
to vyasr/cuvs
that referenced
this pull request
May 16, 2026
Temporarily points cuvs at vyasr/raft@fix/detail_symbol_export so CI exercises the fix that removes RAFT_EXPORT from detail namespace declarations in raft headers. Changes: - cpp/cmake/thirdparty/get_raft.cmake: RAFT_FORK=vyasr, RAFT_PINNED_TAG=fix/detail_symbol_export - ci/use_conda_packages_from_prs.sh: downloads libraft conda artifacts from NVIDIA/raft#3019 via rapids-get-pr-artifact - ci/use_wheels_from_prs.sh: downloads libraft wheel artifacts from NVIDIA/raft#3019 - All conda CI scripts (build_cpp, build_python, build_docs, build_go, build_java, build_rust, test_cpp, test_python): source use_conda_packages_from_prs.sh after conda strict channel priority - build_wheel_libcuvs.sh: source use_wheels_from_prs.sh after rapids-init-pip Revert these changes once NVIDIA/raft#3019 is merged and picked up by the nightly.
0190094 to
88c309e
Compare
vyasr
added a commit
to vyasr/cuvs
that referenced
this pull request
May 16, 2026
Temporarily points cuvs at vyasr/raft@fix/detail_symbol_export so CI exercises the fix that removes RAFT_EXPORT from detail namespace declarations in raft headers. Changes: - cpp/cmake/thirdparty/get_raft.cmake: RAFT_FORK=vyasr, RAFT_PINNED_TAG=fix/detail_symbol_export - ci/use_conda_packages_from_prs.sh: downloads libraft conda artifacts from NVIDIA/raft#3019 via rapids-get-pr-artifact - ci/use_wheels_from_prs.sh: downloads libraft wheel artifacts from NVIDIA/raft#3019 - All conda CI scripts (build_cpp, build_python, build_docs, build_go, build_java, build_rust, test_cpp, test_python): source use_conda_packages_from_prs.sh after conda strict channel priority - build_wheel_libcuvs.sh: source use_wheels_from_prs.sh after rapids-init-pip Revert these changes once NVIDIA/raft#3019 is merged and picked up by the nightly.
Contributor
|
So we are reverting some of the changes from an earlier PR right? #3006 |
Contributor
Author
Sort of. The core change in #3006 is hiding symbols by default. That behavior has not changed. However, in that first PR I was more conservative in what APIs were actually hidden by exporting lots of symbols. This PR is effectively going further by removing a lot of the explicit exports, which means that we'll be hiding even more symbols. In particular, we have removed export from all header-only parts of raft except for the core/ directory, which contains the types that are part of public APIs in other libraries and therefore need public visibility. |
vyasr
added a commit
to vyasr/cuml
that referenced
this pull request
May 19, 2026
…isibility) Temporarily points cuml at the symbol visibility branches for both raft and cuvs so CI exercises the combined changes: - NVIDIA/raft#3019: restrict RAFT_EXPORT to core/ and raft_runtime/ - NVIDIA/cuvs#2101: add symbol visibility controls to cuvs Changes: - cpp/cmake/thirdparty/get_raft.cmake: FORK=vyasr, PINNED_TAG=fix/detail_symbol_export - cpp/cmake/thirdparty/get_cuvs.cmake: FORK=vyasr, PINNED_TAG=test/raft-detail-visibility - ci/use_conda_packages_from_prs.sh: downloads libraft + libcuvs conda artifacts from the respective PRs via rapids-get-pr-artifact - ci/use_wheels_from_prs.sh: downloads libraft + libcuvs wheel artifacts - All conda CI scripts (build_cpp, build_python, build_docs, test_cpp, test_python_common, test_notebooks): source use_conda_packages_from_prs.sh - build_wheel_libcuml.sh: source use_wheels_from_prs.sh Revert these changes once both PRs are merged and picked up by nightly.
14edb3a to
ec6b596
Compare
Prevent symbol interposition between libcuml.so and libcuvs.so by removing RAFT_EXPORT attribute from all detail namespace blocks so internal symbols get hidden visibility (matching CMake's CXX_VISIBILITY_PRESET hidden on raft_objs).
Remove RAFT_EXPORT from namespace declarations in all non-core directories (linalg, matrix, random, sparse, spectral, stats, util, label, solver, comms, mr, pmr). With CXX_VISIBILITY_PRESET hidden on raft_objs, only symbols in core/ (the public API surface) and raft_runtime/ (the compiled library entry points) are now exported from libraft.so. This prevents symbol interposition between libcuml.so and libcuvs.so for internal raft implementation details outside core/.
…libraft.so) select_k is declared in raft_runtime but has no corresponding .cu source in src/ — it's an inl-style header instantiated by consumers (cuvs), not by libraft itself. The RAFT_EXPORT annotation was a no-op.
ec6b596 to
d91b7d6
Compare
rapids-bot Bot
pushed a commit
to NVIDIA/cuvs
that referenced
this pull request
May 21, 2026
Add proper symbol visibility controls to libcuvs.so, compatible with the raft visibility restrictions in NVIDIA/raft#3019. ### Motivation With raft restricting exports to only `core/` and `raft_runtime/`, cuvs needs its own visibility controls to: 1. Prevent symbol interposition between libcuml.so and libcuvs.so 2. Export only the intended public API from libcuvs.so 3. Keep internal implementation details hidden ### Changes - **Add `CUDA_VISIBILITY_PRESET hidden` to `cuvs_objs`** — all symbols hidden by default - **Add `CUVS_EXPORT` to public API symbols** — mark symbols that must be visible in libcuvs.so - **Fix NVCC compatibility** — use `struct CUVS_EXPORT` on definitions (not instantiations) for NVCC - **Fix `__half` type visibility** — add cuda_fp16.hpp wrapper to handle type visibility across TUs - **Fix brute_force, cagra, resize_list exports** — ensure all needed symbols are exported - **Fix remaining linker errors** — 4 additional hidden symbols that needed export - **Fix CI rattler-build** — restore `rapids-rattler-channel-string` in both build_cpp.sh and build_python.sh ### CI note The `test(ci): build against vyasr/raft#3019` commit that pins raft to the visibility branch will be reverted before merge (once raft#3019 is merged to release/26.06). Depends on NVIDIA/raft#3019 Contributes to rapidsai/build-infra#53 Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Divye Gala (https://github.com/divyegala) URL: #2101
divyegala
approved these changes
May 21, 2026
Contributor
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restrict symbol exports from libraft.so to only the public API surface:
include/raft/core/(non-detail): exported vianamespace RAFT_EXPORT raftinclude/raft_runtime/: exported viaRAFT_EXPORTon function declarations (lanczos_solver, rmat_rectangular_gen)With
CXX_VISIBILITY_PRESET hiddenonraft_objs, this ensures only the intended public symbols are visible in the shared library, preventing symbol interposition between libcuml.so and libcuvs.so for internal raft implementation details.Changes
RAFT_EXPORTfrom detail namespaces — prevents internal detail symbols from being exportedRAFT_EXPORTfrom all non-core directories — linalg, matrix, random, sparse, spectral, stats, util, label, solver, comms, mr, pmr no longer export symbolsRAFT_EXPORTfromraft_runtime::matrix::select_k— this function has no.cusource insrc/and is not compiled into libraft.so (it's instantiated by downstream consumers like cuvs)Verification
Contributes to https://github.com/rapidsai/build-infra/issues/53