Skip to content

Enable stricter compiler warnings (-Wnon-virtual-dtor, -Woverloaded-virtual)#2327

Open
maxwbuckley wants to merge 5 commits into
rapidsai:mainfrom
maxwbuckley:enable-strict-compiler-warnings
Open

Enable stricter compiler warnings (-Wnon-virtual-dtor, -Woverloaded-virtual)#2327
maxwbuckley wants to merge 5 commits into
rapidsai:mainfrom
maxwbuckley:enable-strict-compiler-warnings

Conversation

@maxwbuckley

@maxwbuckley maxwbuckley commented Mar 22, 2026

Copy link
Copy Markdown

Summary

Add -Wnon-virtual-dtor and -Woverloaded-virtual to the compiler warning flags for the library, tests, and benchmarks, enforced as errors via the existing -Werror. Both flags compile cleanly against the current codebase — this PR is CMake-only, no source changes required.

Why

Some downstream organizations (e.g. Google's internal build) enforce strict warning policies by default, which makes importing RMM into those builds harder. More importantly, the codebase as it stands today is already clean against these two flags; enabling them in CI locks that in as a regression gate, so future contributors can't accidentally introduce:

  • Classes with virtual functions but a non-virtual destructor (-Wnon-virtual-dtor) — a well-known source of undefined-behavior when deleting via a base pointer.
  • Derived-class member functions that hide a base virtual function instead of overriding it (-Woverloaded-virtual) — typically a silent bug where the override never gets called.

CI will now catch either of these at the warning-as-error stage rather than at runtime.

Scope note

This PR originally also added -Wshadow, but that flag triggers a much larger set of source-level renames and was split off into a separate PR so the naming convention can be reviewed independently.

Follow-up: -Wshadow is being addressed in #2417 using the Google C++ style convention (size for params/locals, trailing-underscore size_ for private members) suggested by @bdice. With #2417 landed, RMM will enforce all three stricter warning flags discussed in this thread.

Test plan

  • Full build passes at 100% (library + tests + benchmarks) with -Werror and the two new flags — zero warnings.
  • ctest passes (failures observed locally are pre-existing runtime SEGVs in CUDA_ASYNC_MR_SHARED_CUDART_TEST, unrelated to compile-flag changes).
  • cmake-format and cmake-lint clean.

🤖 Generated with Claude Code

…erloaded-virtual)

Add `-Wshadow`, `-Wnon-virtual-dtor`, and `-Woverloaded-virtual` to the
compiler warning flags for the library, tests, and benchmarks. These are
enforced as errors via the existing `-Werror`. Third-party includes
(rapids_logger, spdlog) are marked as SYSTEM to suppress upstream warnings.

Fix all violations:
- Rename variables/parameters that shadow outer-scope names, class members,
  type aliases, or inherited members across headers, sources, tests, and
  benchmarks
- Add explicit virtual destructor to owning_wrapper
- Replace C-style (void)0 cast with static_cast<void>(0)
- Rename GTest INSTANTIATE_TEST_SUITE_P lambda params to avoid macro-internal
  shadow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Mar 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6a840eae-99a4-497f-894b-4ab8e00b94d3

📥 Commits

Reviewing files that changed from the base of the PR and between b444650 and 4feac3e.

📒 Files selected for processing (1)
  • cpp/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/CMakeLists.txt

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced compiler warning checks across the codebase to improve code quality and detect potential issues during compilation.

Walkthrough

RMM's build CMake files are updated to add -Wnon-virtual-dtor and -Woverloaded-virtual to C++ flags and to the CUDA host-compiler (-Xcompiler) warning lists for the main library, benchmarks, and tests, preserving existing warning and suppression settings.

Changes

Compiler Warning Configuration

Layer / File(s) Summary
Enable non-virtual destructor and virtual function warnings
cpp/CMakeLists.txt, cpp/benchmarks/CMakeLists.txt, cpp/tests/CMakeLists.txt
RMM_CXX_FLAGS, RMM_BENCHMARKS_CXX_FLAGS, and RMM_TESTS_CXX_FLAGS are extended to include -Wnon-virtual-dtor and -Woverloaded-virtual. Corresponding RMM_CUDA_FLAGS/RMM_BENCHMARKS_CUDA_FLAGS/RMM_TESTS_CUDA_FLAGS continue to pass host warnings via -Xcompiler=... and now include the same additional warnings while retaining existing -Wall -Werror -Wextra, -Wsign-conversion, and prior suppression flags.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • rapidsai/rmm#2308: Both PRs modify the same CMake warning-flag variables across the three main CMakeLists files.

Suggested labels

non-breaking

Suggested reviewers

  • ttnghia
  • bdice
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.46% 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
Title check ✅ Passed The title clearly and specifically summarizes the main change: enabling two new compiler warning flags (-Wnon-virtual-dtor and -Woverloaded-virtual) across the CMake configuration. It directly corresponds to the primary objective of the changeset.
Description check ✅ Passed The description is directly related to the changeset, providing clear rationale for adding the two compiler warnings, explaining the scope (CMake-only, no source changes for these flags), and detailing the test plan and downstream impact of these additions.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cpp/include/rmm/cuda_stream.hpp (1)

60-63: ⚠️ Potential issue | 🟡 Minor

Update Doxygen param name to match the signature.

After renaming to stream_flags, the doc comment still uses @param flags, which makes API docs inconsistent.

📝 Proposed fix
-   * `@param` flags Stream creation flags.
+   * `@param` stream_flags Stream creation flags.

As per coding guidelines, "cpp/include/rmm/**/*.{h,hpp}: C++ public APIs must include Doxygen comments using /** ... */ format."

Also applies to: 66-66

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cpp/include/rmm/cuda_stream.hpp` around lines 60 - 63, The constructor
Doxygen uses an out-of-date param tag (`@param` flags); update the comment for the
CUDA stream constructor to use the correct parameter name (`@param` stream_flags)
to match the function signature (constructor for class cuda_stream / function
name cuda_stream::cuda_stream or similar) and ensure the comment uses the
required /** ... */ Doxygen style; also apply the same fix to the other
occurrence mentioned (the doc at the second occurrence).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cpp/benchmarks/synchronization/synchronization.hpp`:
- Around line 69-71: Update the Doxygen `@param` for the cuda_event_timer
constructor to use the renamed parameter name "strm" instead of "stream"; locate
the declaration/definition of cuda_event_timer(benchmark::State& state, bool
flush_l2_cache, rmm::cuda_stream_view strm = rmm::cuda_stream_default) and
change the `@param` tag to `@param` strm (or rename the parameter back and make docs
consistent) so the documentation matches the actual argument name.

In `@cpp/include/rmm/exec_policy.hpp`:
- Around line 48-49: Update the Doxygen param names to match the constructor
signatures: change any "@param stream" to "@param strm" for the exec_policy
constructors (the explicit exec_policy(cuda_stream_view strm = ...,
device_async_resource_ref mr = ...) overload and the other constructor overload
referenced around the same area) so the public API docs match the actual
parameter name `strm` and avoid stale documentation.

---

Outside diff comments:
In `@cpp/include/rmm/cuda_stream.hpp`:
- Around line 60-63: The constructor Doxygen uses an out-of-date param tag
(`@param` flags); update the comment for the CUDA stream constructor to use the
correct parameter name (`@param` stream_flags) to match the function signature
(constructor for class cuda_stream / function name cuda_stream::cuda_stream or
similar) and ensure the comment uses the required /** ... */ Doxygen style; also
apply the same fix to the other occurrence mentioned (the doc at the second
occurrence).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3def1fde-be46-4e74-b628-073ded4c98c6

📥 Commits

Reviewing files that changed from the base of the PR and between 1bef459 and 0059816.

📒 Files selected for processing (47)
  • cpp/CMakeLists.txt
  • cpp/benchmarks/CMakeLists.txt
  • cpp/benchmarks/random_allocations/random_allocations.cpp
  • cpp/benchmarks/replay/replay.cpp
  • cpp/benchmarks/synchronization/synchronization.cpp
  • cpp/benchmarks/synchronization/synchronization.hpp
  • cpp/benchmarks/utilities/log_parser.hpp
  • cpp/include/rmm/cuda_stream.hpp
  • cpp/include/rmm/detail/logging_assert.hpp
  • cpp/include/rmm/detail/runtime_capabilities.hpp
  • cpp/include/rmm/exec_policy.hpp
  • cpp/include/rmm/mr/arena_memory_resource.hpp
  • cpp/include/rmm/mr/detail/coalescing_free_list.hpp
  • cpp/include/rmm/mr/detail/free_list.hpp
  • cpp/include/rmm/mr/owning_wrapper.hpp
  • cpp/include/rmm/mr/pinned_host_memory_resource.hpp
  • cpp/include/rmm/mr/system_memory_resource.hpp
  • cpp/src/cuda_stream.cpp
  • cpp/src/exec_policy.cpp
  • cpp/src/logger.cpp
  • cpp/tests/CMakeLists.txt
  • cpp/tests/cuda_stream_pool_tests.cpp
  • cpp/tests/device_buffer_tests.cu
  • cpp/tests/mr/aligned_mr_tests.cpp
  • cpp/tests/mr/arena_mr_tests.cpp
  • cpp/tests/mr/callback_mr_tests.cpp
  • cpp/tests/mr/host_mr_ref_tests.cpp
  • cpp/tests/mr/hwdecompress_tests.cpp
  • cpp/tests/mr/mr_ref_arena_tests.cpp
  • cpp/tests/mr/mr_ref_binning_tests.cpp
  • cpp/tests/mr/mr_ref_cuda_async_tests.cpp
  • cpp/tests/mr/mr_ref_cuda_tests.cpp
  • cpp/tests/mr/mr_ref_fixed_size_tests.cpp
  • cpp/tests/mr/mr_ref_managed_tests.cpp
  • cpp/tests/mr/mr_ref_pinned_pool_tests.cpp
  • cpp/tests/mr/mr_ref_pinned_tests.cpp
  • cpp/tests/mr/mr_ref_pool_tests.cpp
  • cpp/tests/mr/mr_ref_system_tests.cpp
  • cpp/tests/mr/mr_ref_test.hpp
  • cpp/tests/mr/mr_ref_test_basic.hpp
  • cpp/tests/mr/pool_mr_tests.cpp
  • cpp/tests/mr/prefetch_resource_adaptor_tests.cpp
  • cpp/tests/mr/resource_ref_conversion_tests.cpp
  • cpp/tests/mr/statistics_mr_tests.cpp
  • cpp/tests/mr/thrust_allocator_tests.cu
  • cpp/tests/mr/tracking_mr_tests.cpp
  • cpp/tests/prefetch_tests.cpp

Comment thread cpp/benchmarks/synchronization/synchronization.hpp Outdated
Comment thread cpp/include/rmm/exec_policy.hpp Outdated
Update @param tags in exec_policy.hpp (stream → strm),
cuda_stream.hpp (flags → stream_flags), synchronization.hpp
(stream → strm), and replay.cpp (args → simulated_size/events)
so documentation matches the actual parameter names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maxwbuckley

Copy link
Copy Markdown
Author

All CodeRabbit review comments have been addressed in commit b9091a9:

  • exec_policy.hpp: @param stream@param strm (both constructors)
  • cuda_stream.hpp: @param flags@param stream_flags
  • synchronization.hpp: @param stream@param strm
  • replay.cpp: stale @param args replaced with @param simulated_size + @param events

Comment thread cpp/CMakeLists.txt Outdated
-Wall
-Werror
-Wextra
-Wshadow

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi, thanks for the PR.

  1. Is there a specific environment where you’re observing these warnings?
  2. How did you select this set of warnings?
  3. Some seems fine to enable but I am unsure about -Wshadow. Can you justify this one in particular? We generally avoid the abbreviated names introduced here like strm for a stream or p for a pointer in favor of full words.

RMM typically requires issues that motivate all pull requests so we have an archive of the library design decisions, could you file an issue containing that motivational information including what environments you observed these? I want to be sure RMM can meet requirements of the libraries depending on it, and I am not aware of any libraries requiring these flags that use RMM.

This PR has a large diff. I am currently refactoring a large part of the library and this will be hard to rebase into the staging branch. Once we settle on what changes we want to make, we can work on a PR based on the staging branch, but I may ask you to wait until some large open PRs land to avoid churn. Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Also some companies (Google which I recently left) enforce strict compiler settings by default. So all of these issues make it harder to import RMM into third party.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the detailed feedback, Bradley!

Filed #2338 with the motivation. The short version: some organizations (Google, which I recently left) enforce strict compiler settings by default, so these warnings make it harder to import RMM into third-party projects using -Werror.

To answer your questions:

  1. I observed these warnings building with GCC 13 and Clang 18 using -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Woverloaded-virtual -Werror.
  2. I selected these specific flags because they catch real bug classes (shadowing, missing virtual destructors, accidentally hidden overloads) and are commonly enforced in projects with strict warning policies.
  3. On -Wshadow specifically — I understand the preference for full names over abbreviations like strm/p. Happy to rework those renames to use more descriptive alternatives that still avoid the shadowing (e.g. cuda_stream instead of strm). Let me know what naming you'd prefer and I'll update.

Also happy to wait on the staging branch and rebase once your refactor lands — just let me know when it's a good time. Thanks again!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome. Yes, I think a lot of this will change on the staging branch (it's a near-total rewrite). The staging branch should stabilize in about a week or two. The last major change I need for that branch is #2325 and I'm currently working on splitting that PR up into smaller pieces and working out some design issues with CCCL upstream. I'll follow up on this thread once it's ready.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would expect this PR would cause some sort of breaking builds for downstream libraries. Can we switch this to draft mode, test it against downstream libraries first, apply the same set of compiler directive to them first if needed, then merge this one last?

@bdice bdice May 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Following up from earlier: the major library changes are now complete, so I'm ready to start thinking about this PR again. We'll likely need to rebase or merge main -- maybe have an agent help you since the conflicts are large. You might also want to start fresh and apply these changes one flag at a time (maybe start with an easier one and we'll work up from there, -Wshadow is likely to be the largest one).

On -Wshadow specifically — I understand the preference for full names over abbreviations [...]. Let me know what naming you'd prefer and I'll update.

@maxwbuckley I think what I want to propose here is something like the Google C++ Style Guide:

  • size is a normal variable or parameter
  • size_ with a trailing underscore is used for (private) members

That should help with most cases as a starting point.

@bdice bdice May 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would expect this PR would cause some sort of breaking builds for downstream libraries.

@ttnghia Compiling RMM with additional compiler warnings will only enforce them for RMM, we won't propagate these flags to consumers of RMM:

target_compile_options(rmm PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${RMM_CXX_FLAGS}>"
                                   "$<$<COMPILE_LANGUAGE:CUDA>:${RMM_CUDA_FLAGS}>")

@maxwbuckley

Copy link
Copy Markdown
Author

Why -Wshadow?

Variable shadowing is a well-documented source of subtle bugs in C++ codebases. When a local variable or parameter shares a name with an outer-scope variable, class member, or inherited member, the programmer may accidentally read or write the wrong one — and the compiler will silently accept it.

Concrete example from this PR: In arena_memory_resource.hpp, a local variable arena shadowed the type alias using arena = rmm::mr::detail::arena::arena. In exec_policy.cpp, the constructor parameter stream shadowed the inherited cudaStream_t stream member from Thrust's execution_policy base class. Both compiled fine before this change, but either could silently break if future code in those scopes referenced the wrong name.

What -Wshadow catches:

  • Constructor parameters shadowing class members (e.g., block_base(void* ptr) : ptr{ptr} where ptr is both the param and the member)
  • Lambda parameters shadowing enclosing-scope variables (e.g., do_deallocate(void* ptr, ...) { ... [](void* ptr) { ... } })
  • Local variables shadowing inherited members from base classes (e.g., Thrust's stream member)
  • Variables shadowing type aliases or nested type names

Why now? RMM already enforces -Wall -Werror -Wextra -Wsign-conversion. Adding -Wshadow is the natural next step — it's widely adopted in production C++ codebases (LLVM, Chromium, Qt) and catches a class of bugs that the existing flags miss entirely. The fixes required were all straightforward renames with no behavioral changes.

maxwbuckley and others added 2 commits May 23, 2026 12:06
…r-warnings

# Conflicts:
#	cpp/include/rmm/mr/owning_wrapper.hpp
Add `-Wnon-virtual-dtor` and `-Woverloaded-virtual` to the compiler
warning flags for the library, tests, and benchmarks, enforced as errors
via the existing `-Werror`. Some downstream projects (e.g. Google
internal builds) enable these warnings as errors by default, so adding
them here makes importing RMM into those builds easier.

`-Wshadow` is intentionally not included in this PR; it will be a
follow-up so we can settle on a Google-style naming convention
(trailing-underscore members) for the shadow fixes separately.

No source changes are required: both flags compile cleanly against the
current codebase.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maxwbuckley

Copy link
Copy Markdown
Author

Thanks @bdice — I've rebased this against main (via merge to preserve the review-diff view) and narrowed the scope.

Current state:

  • Merged main into the branch (96-commit gap closed). The merge commit is f9cde49a.
  • Dropped -Wshadow from this PR per your suggestion to land flags one at a time, easier-first. This PR now only adds -Wnon-virtual-dtor and -Woverloaded-virtual.
  • Both flags compile cleanly against the post-rewrite codebase — no source changes required. The cumulative diff vs main is now exactly 3 CMakeLists.txt files (+14/-8 lines).
  • Built locally with both flags + -Werror at 100% with zero warnings (lib + tests + benchmarks).
  • clang-format/cmake-format/cmake-lint clean.

-Wshadow follow-up: I'll open a separate PR for that one, using the Google C++ style you proposed (size for params/locals, trailing-underscore size_ for private members) so the shadow fixes are reviewable on their own.

@ttnghia — to address your earlier concern about downstream impact: as Bradley noted, target_compile_options(rmm PRIVATE ...) keeps these flags scoped to RMM's own compilation; consumers of RMM aren't affected.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cpp/tests/CMakeLists.txt (1)

255-266: ⚡ Quick win

Apply RMM_TESTS_CXX_FLAGS to the standalone shutdown test target.

PROCESS_IS_EXITING_SHUTDOWN_TEST bypasses ConfigureTestInternal, so it currently misses the stricter warning set enabled in this PR for tests.

Suggested patch
 add_executable(PROCESS_IS_EXITING_SHUTDOWN_TEST process_is_exiting_shutdown_test.cpp)
 target_include_directories(PROCESS_IS_EXITING_SHUTDOWN_TEST
                            PRIVATE "$<BUILD_INTERFACE:${RMM_SOURCE_DIR}>")
 target_link_libraries(PROCESS_IS_EXITING_SHUTDOWN_TEST PRIVATE rmm
                                                                $<TARGET_NAME_IF_EXISTS:conda_env>)
+target_compile_options(
+  PROCESS_IS_EXITING_SHUTDOWN_TEST
+  PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${RMM_TESTS_CXX_FLAGS}>"
+          "$<$<COMPILE_LANGUAGE:CUDA>:${RMM_TESTS_CUDA_FLAGS}>")
 set_target_properties(
   PROCESS_IS_EXITING_SHUTDOWN_TEST
   PROPERTIES POSITION_INDEPENDENT_CODE ON
              RUNTIME_OUTPUT_DIRECTORY "$<BUILD_INTERFACE:${RMM_BINARY_DIR}/gtests>"
              INSTALL_RPATH "\$ORIGIN/../../../lib"
              CXX_STANDARD 20
              CXX_STANDARD_REQUIRED ON)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/CMakeLists.txt` around lines 255 - 266, The standalone test target
PROCESS_IS_EXITING_SHUTDOWN_TEST bypasses ConfigureTestInternal and therefore
doesn't inherit the stricter warning/compile flags; add the RMM_TESTS_CXX_FLAGS
to that target (e.g., call
target_compile_options(PROCESS_IS_EXITING_SHUTDOWN_TEST PRIVATE
${RMM_TESTS_CXX_FLAGS}) or equivalent) after the target is created/linked so the
test uses the same C++ warning and compile options as other tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/tests/CMakeLists.txt`:
- Around line 255-266: The standalone test target
PROCESS_IS_EXITING_SHUTDOWN_TEST bypasses ConfigureTestInternal and therefore
doesn't inherit the stricter warning/compile flags; add the RMM_TESTS_CXX_FLAGS
to that target (e.g., call
target_compile_options(PROCESS_IS_EXITING_SHUTDOWN_TEST PRIVATE
${RMM_TESTS_CXX_FLAGS}) or equivalent) after the target is created/linked so the
test uses the same C++ warning and compile options as other tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 496006d0-ad55-490b-8b77-49a16d7e7942

📥 Commits

Reviewing files that changed from the base of the PR and between b9091a9 and b444650.

📒 Files selected for processing (3)
  • cpp/CMakeLists.txt
  • cpp/benchmarks/CMakeLists.txt
  • cpp/tests/CMakeLists.txt

@maxwbuckley maxwbuckley mentioned this pull request May 23, 2026
3 tasks
@maxwbuckley

Copy link
Copy Markdown
Author

Follow-up: opened #2417 for the -Wshadow part, using the Google C++ style trailing-underscore convention you suggested. With both this PR and #2417 landed, RMM enforces all three stricter warning flags from this discussion.

@bdice bdice added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels May 23, 2026
@bdice bdice changed the title Enable stricter compiler warnings (-Wshadow, -Wnon-virtual-dtor, -Woverloaded-virtual) Enable stricter compiler warnings (-Wnon-virtual-dtor, -Woverloaded-virtual) May 23, 2026

@bdice bdice left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see your testing plan mentioned some existing segfaults. Can you file an issue with more information on how to reproduce?

@bdice

bdice commented May 23, 2026

Copy link
Copy Markdown
Collaborator

/ok to test b444650

@maxwbuckley

Copy link
Copy Markdown
Author

Followed up on the segfault question — turns out it's environmental on my WSL2 dev box, not an RMM bug, so I don't think it warrants an upstream issue. Quick writeup in case it saves the next person the same dig:

Symptom. CUDA_ASYNC_MR_SHARED_CUDART_TEST SEGVs (exit 139) inside the first test, AsyncMRTest.ExplicitInitialPoolSize, during cuda_async_memory_resource construction. CUDA_ASYNC_MR_STATIC_CUDART_TEST — same source file, only difference is cudart linkage — passes cleanly.

Stack (cuda-gdb, then resolving against /proc/.../maps):

  • IP in libc.so.6 at an unexported helper past __nss_database_lookup
  • Caller in libnvidia-ptxjitcompiler.so.535.309.01

Root cause. Two libnvidia-ptxjitcompiler.so.1 are installed on the box:

Path Version Owner
/usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.535.309.01 535 (stale) Ubuntu libnvidia-compute-535:amd64
/usr/lib/wsl/drivers/nvddi.inf_amd64_…/libnvidia-ptxjitcompiler.so.1 matches driver 596.x / CUDA 13.2 WSL-mounted modern driver

ldconfig resolves libnvidia-ptxjitcompiler.so.1 to the stale 535 one, but libcuda.so.1.1 and libcudart.so.13.2.51 are the modern CUDA-13.2 path. The shared-cudart init path dlopens libnvidia-ptxjitcompiler.so.1 and gets the wrong-version shim → SEGV. The static-cudart variant doesn't reach that dlopen during the test (confirmed via LD_DEBUG=files).

Workaround:

LD_LIBRARY_PATH=/usr/lib/wsl/drivers/nvddi.inf_amd64_<id>:/usr/lib/wsl/lib \
  cpp/build/gtests/CUDA_ASYNC_MR_SHARED_CUDART_TEST

All 5 tests pass; the Fabric handles test skips.

Permanent fix on my side: apt purge libnvidia-compute-535 (and sibling 535 packages).

Implication for this PR. Confirmed the crashing files (cuda_async_mr_tests.cpp, cuda_async_memory_resource.hpp, the impl .cpp) are byte-identical to main on this branch, and the crash is entirely in dynamically loaded driver libs — so the segfault is not introduced or exposed by the warning-flag changes here (or by -Wshadow in #2417). CI builders on RAPIDS infra don't have the conflicting 535 package, which is why this never showed up there.

I'll skip filing an upstream issue unless you'd prefer one for searchability — happy to do that if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

3 participants