Skip to content

Fix missing nvtx stack and host mem resource by exporting the symbols#3083

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
huuanhhuyn:export_symbols
Jul 17, 2026
Merged

Fix missing nvtx stack and host mem resource by exporting the symbols#3083
rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
huuanhhuyn:export_symbols

Conversation

@huuanhhuyn

@huuanhhuyn huuanhhuyn commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This NVIDIA/cuvs#2052 changes default symbol visibility to cuvs from public to hidden. The raft::memory_tracking_resources introduced in raft earlier now has the host memory resource and nvtx stack range symbols switched to hidden (i.e. private within libcuvs.so). This led to empty nvtx stack name and missing host memory allocations in the .csv file produced by raft::memory_tracking_resources, because two DSO's kept two separate symbols.

The current PR explicitly exports those symbols again and fixes the issue.

Analysis

Before the changes, the symbols in the example and in the libcuvs.so are two different entities with different addresses.

default_host_resource_holder_ address (CAGRA_HNSW_ACE_BUILD_EXAMPLE): 0x63a2ff1cfa20
range_name_stack_instance address (CAGRA_HNSW_ACE_BUILD_EXAMPLE): 0x7fabe9d2f030

default_host_resource_holder_ address (libcuvs.so): 0x7fabed9fb7e0
range_name_stack_instance address (libcuvs.so): 0x7fabe9d2d010

$ nm -C /opt/conda/envs/cuvs/lib/libcuvs.so 
00000000036827e0 b raft::mr::detail::default_host_resource_holder_
0000000000001010 b raft::common::nvtx::detail::range_name_stack_instance

After exporting,

default_host_resource_holder_ addr (exe):        0x64a7d9f4ca20
range_name_stack_instance addr (exe, this thread): 0x740c67dfb030

default_host_resource_holder_ addr (libcuvs):        0x64a7d9f4ca20
range_name_stack_instance addr (libcuvs, this thread): 0x740c67dfb030

$ nm -C /opt/conda/envs/cuvs/lib/libcuvs.so 
000000000367f7e0 u raft::mr::detail::default_host_resource_holder_
0000000000001010 u raft::common::nvtx::detail::range_name_stack_instance

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes add RAFT_EXPORT annotations to NVTX range helpers and default host memory resource declarations. SPDX copyright text is also updated; runtime behavior and control flow remain unchanged.

Changes

Export visibility updates

Layer / File(s) Summary
NVTX range exports
cpp/include/raft/core/detail/nvtx_range_stack.hpp
The thread-local NVTX range instance and current-range accessor are marked with RAFT_EXPORT, and the SPDX copyright text is updated.
Host resource exports
cpp/include/raft/mr/host_memory_resource.hpp
The default host resource holder, getter, and setter are marked with RAFT_EXPORT, and the SPDX copyright text is updated without behavior changes.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: exporting NVTX stack and host memory resource symbols.
Description check ✅ Passed The description matches the changeset and explains the symbol visibility fix and its impact.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@huuanhhuyn huuanhhuyn changed the title [WIP] Export nvtx stack and host mem resource symbols Fix missing nvtx stack and host mem resource by explicitly export the symbols Jul 16, 2026
@huuanhhuyn huuanhhuyn changed the title Fix missing nvtx stack and host mem resource by explicitly export the symbols Fix missing nvtx stack and host mem resource by exporting the symbols Jul 16, 2026
@achirkin achirkin added bug Something isn't working non-breaking Non-breaking change labels Jul 17, 2026

@achirkin achirkin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, LGTM!

@achirkin

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit d2bff5d into NVIDIA:main Jul 17, 2026
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants