Skip to content

rocrtst: Disabled NUMA async copy build#3044

Merged
jharryma merged 3 commits intodevelopfrom
users/shwetak/Disable_rocrtst_NUMA_async_copy
Feb 6, 2026
Merged

rocrtst: Disabled NUMA async copy build#3044
jharryma merged 3 commits intodevelopfrom
users/shwetak/Disable_rocrtst_NUMA_async_copy

Conversation

@shwetagkhatri
Copy link
Contributor

Forced ENABLE_COPY_NUMA off and excluded memory_async_copy_numa.cc from build

Motivation

Technical Details

JIRA ID

Test Plan

Test Result

Submission Checklist

Copilot AI review requested due to automatic review settings February 3, 2026 19:52
@shwetagkhatri shwetagkhatri requested review from dayatsin-amd and removed request for Copilot February 3, 2026 19:52
@shwetagkhatri
Copy link
Contributor Author

@dayatsin-amd ,
The build errors with the latest hwloc 2.10.0 and above, is coming up due to only this one API - hwloc_set_membind_nodeset.
So guarding this under the #ifdef will resolve TheRock build errors.

We must ofcourse update rocrtst APIs to use latest hwloc APIs "eventually."

Forced ENABLE_COPY_NUMA off and excluded memory_async_copy_numa.cc from build
Copilot AI review requested due to automatic review settings February 4, 2026 17:17
@shwetagkhatri shwetagkhatri force-pushed the users/shwetak/Disable_rocrtst_NUMA_async_copy branch from ecc8499 to 08a1ff2 Compare February 4, 2026 17:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Disables building the NUMA async copy performance test in rocrtst, while also restructuring rocrtst’s CMake logic around NUMA/hwloc discovery and RPATH handling.

Changes:

  • Gated NUMA async copy test registration/includes behind ENABLE_COPY_NUMA.
  • Forced ENABLE_COPY_NUMA OFF and excluded memory_async_copy_numa.cc from the build.
  • Refactored CMake NUMA/hwloc detection and modified build/install RPATH settings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
projects/rocr-runtime/rocrtst/suites/test_common/main.cc Wraps NUMA async copy header include and gtest entry in #if ENABLE_COPY_NUMA.
projects/rocr-runtime/rocrtst/suites/test_common/CMakeLists.txt Forces NUMA test off, filters NUMA source, and refactors NUMA/hwloc detection + RPATH configuration.
projects/rocr-runtime/rocrtst/suites/performance/memory_async_copy_numa.h Wraps the NUMA test class definition behind #if ENABLE_COPY_NUMA.
projects/rocr-runtime/rocrtst/suites/performance/memory_async_copy_numa.cc Wraps NUMA test implementation behind #if ENABLE_COPY_NUMA and gates a membind call behind ENABLE_COPY_NUMA_MEMBIND_NODESET.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +596 to +604
if(NOT HAVE_HWLOC AND PKG_CONFIG_FOUND)
pkg_check_modules(HWLOC_PC hwloc)
if(HWLOC_PC_FOUND)
# Try to find the actual library file for SHARED IMPORTED target
find_library(HWLOC_LIBRARY_FILE
NAMES hwloc
HINTS ${HWLOC_PC_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The hwloc pkg-config path only succeeds if find_library(... NO_DEFAULT_PATH HINTS ${HWLOC_PC_LIBRARY_DIRS}) finds a full .so file. If HWLOC_PC_LIBRARY_DIRS is empty (common when the lib is in a default system path) or the .so symlink isn’t present, HAVE_HWLOC stays FALSE and the later fallback searches only ${ROCRTST_ROOT}/thirdparty/lib (also NO_DEFAULT_PATH), leading to a hard build failure even when system hwloc is installed. Suggest adding an INTERFACE imported target fallback using ${HWLOC_PC_LIBRARIES}/${HWLOC_PC_LIBRARY_DIRS} (like the NUMA logic) and/or dropping NO_DEFAULT_PATH so system paths are searched.

Copilot uses AI. Check for mistakes.
Comment on lines +677 to +678
INSTALL_RPATH "$ORIGIN/../lib/rocrtst/lib;$ORIGIN/../lib/rocm_sysdeps/lib"
BUILD_RPATH "$ORIGIN/../../dist/lib/rocm_sysdeps/lib;$ORIGIN/../lib/rocrtst/lib"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

INSTALL_RPATH/BUILD_RPATH paths look inconsistent with what this CMakeLists installs: install(DIRECTORY .../thirdparty/lib DESTINATION lib/rocrtst) places libhwloc.so.5 under $prefix/lib/rocrtst/, but the new RPATH points to $ORIGIN/../lib/rocrtst/lib (extra /lib). This will prevent the installed binary from finding the bundled hwloc when the fallback is used. Recommend adjusting the RPATH to include $ORIGIN/../lib/rocrtst (and, if needed, $ORIGIN/../lib/rocrtst/thirdparty/lib), or aligning the install destination with the RPATH.

Suggested change
INSTALL_RPATH "$ORIGIN/../lib/rocrtst/lib;$ORIGIN/../lib/rocm_sysdeps/lib"
BUILD_RPATH "$ORIGIN/../../dist/lib/rocm_sysdeps/lib;$ORIGIN/../lib/rocrtst/lib"
INSTALL_RPATH "$ORIGIN/../lib/rocrtst;$ORIGIN/../lib/rocm_sysdeps/lib"
BUILD_RPATH "$ORIGIN/../../dist/lib/rocm_sysdeps/lib;$ORIGIN/../lib/rocrtst"

Copilot uses AI. Check for mistakes.
"hwloc: membind not supported or cannot be enforced. Check errno.");
#else
if (verbosity() >= VERBOSE_STANDARD) {
std::cout << "hwloc: membind nodeset not available in linked libhwloc; skipping."
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The log message in the #else branch is misleading: this branch is selected when ENABLE_COPY_NUMA_MEMBIND_NODESET is disabled at compile time, not necessarily because the linked hwloc lacks nodeset membind support. Recommend rewording to reflect the build-time option (or detect support at runtime and print a message based on the detection result).

Suggested change
std::cout << "hwloc: membind nodeset not available in linked libhwloc; skipping."
std::cout << "hwloc: membind nodeset support disabled at build time "
<< "(ENABLE_COPY_NUMA_MEMBIND_NODESET=0); skipping."

Copilot uses AI. Check for mistakes.
Comment on lines +375 to +381
# Force disabled by default to avoid building the NUMA test source.
set(ENABLE_COPY_NUMA OFF CACHE BOOL "Build Memory_Async_Copy_NUMA test" FORCE)
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")

# Optional: enable hwloc membind nodeset call in NUMA test
set(ENABLE_COPY_NUMA_MEMBIND_NODESET OFF CACHE BOOL "Enable hwloc membind nodeset in NUMA test")

Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

set(ENABLE_COPY_NUMA ... FORCE) makes the option impossible to enable from the command line/GUI, but the surrounding comments call it “Optional”. Also, ENABLE_COPY_NUMA/ENABLE_COPY_NUMA_MEMBIND_NODESET are used in C++ with #if but are never added as compile definitions for the rocrtst target, so turning the CMake option ON would not actually enable the code. Recommend: remove FORCE, keep a single option(), gate source filtering on it, and propagate both options via target_compile_definitions() (e.g., ENABLE_COPY_NUMA=$<BOOL:...>).

Suggested change
# Force disabled by default to avoid building the NUMA test source.
set(ENABLE_COPY_NUMA OFF CACHE BOOL "Build Memory_Async_Copy_NUMA test" FORCE)
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
# Optional: enable hwloc membind nodeset call in NUMA test
set(ENABLE_COPY_NUMA_MEMBIND_NODESET OFF CACHE BOOL "Enable hwloc membind nodeset in NUMA test")
option(ENABLE_COPY_NUMA "Build Memory_Async_Copy_NUMA test" OFF)
if(NOT ENABLE_COPY_NUMA)
# Exclude NUMA test source when NUMA copy tests are disabled.
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
endif()
# Optional: enable hwloc membind nodeset call in NUMA test
option(ENABLE_COPY_NUMA_MEMBIND_NODESET "Enable hwloc membind nodeset in NUMA test" OFF)
# Propagate NUMA options to C++ sources.
if(ENABLE_COPY_NUMA)
add_definitions(-DENABLE_COPY_NUMA=1)
else()
add_definitions(-DENABLE_COPY_NUMA=0)
endif()
if(ENABLE_COPY_NUMA_MEMBIND_NODESET)
add_definitions(-DENABLE_COPY_NUMA_MEMBIND_NODESET=1)
else()
add_definitions(-DENABLE_COPY_NUMA_MEMBIND_NODESET=0)
endif()

Copilot uses AI. Check for mistakes.
Comment on lines +502 to +504
# Always exclude memory_async_copy_numa.cc since ENABLE_COPY_NUMA is forced OFF
message(STATUS "ENABLE_COPY_NUMA is OFF - excluding memory_async_copy_numa.cc from build")
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

This unconditionally excludes memory_async_copy_numa.cc regardless of ENABLE_COPY_NUMA, which makes the option ineffective and can lead to link/compile mismatches if someone tries to enable the test. Recommend: only list(FILTER ...) when NOT ENABLE_COPY_NUMA (and only print the STATUS message in that case).

Suggested change
# Always exclude memory_async_copy_numa.cc since ENABLE_COPY_NUMA is forced OFF
message(STATUS "ENABLE_COPY_NUMA is OFF - excluding memory_async_copy_numa.cc from build")
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
# Exclude memory_async_copy_numa.cc when ENABLE_COPY_NUMA is OFF
if(NOT ENABLE_COPY_NUMA)
message(STATUS "ENABLE_COPY_NUMA is OFF - excluding memory_async_copy_numa.cc from build")
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
endif()

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I concur with copilot's comment--it looks like the source file is unconditionally excluded.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to exclude the .cc file. I would just have
ENABLE_COPY_NUMA_MEMBIND_NODESET and ENABLE_COPY_NUMA set to 0,

But I do not feel strongly about it. Up to you..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you are right.. its already a disabled test. I will work on these review comments in the next PR. I will also clean and eliminate some redundant code in this CMakeFile file as well.

Comment on lines +569 to +572
else()
message(WARNING "NUMA library not found. Building without numa support.")
message(WARNING " Install libnuma-dev (Debian/Ubuntu) or numactl-devel (RHEL/CentOS)")
endif()
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

When NUMA is not found you only emit a warning, but the build still compiles suites/performance/memory_async_copy*.cc, which include <numa.h> and call libnuma APIs. On systems without libnuma headers this will fail at compile time. Either make NUMA a required dependency (FATAL_ERROR with install hint) or keep the previous behavior of filtering out the memory_async_copy*.cc sources when NUMA isn’t available.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@jharryma jharryma left a comment

Choose a reason for hiding this comment

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

@shwetagkhatri
Copy link
Contributor Author

@dayatsin-amd @cfreehill - This patch excludes memory_async_copy_numa.cc from build.
It also includes the other bigger patch from - #2598 - which you have already approved.

This patch has been tested successfully in TheRock's integrated build process by Jessy as confirmed here -ROCm/TheRock#3236
https://github.com/ROCm/TheRock/actions/runs/21723147025/job/62672812484?pr=3236

So instead of PR - #2598 - I would like to submit this PR. Please help provide your approval and complete the review here. Thank you!

endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Force disable NUMA copy functionality
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment (and the one below) correct, and the message()? It looks like it's optional.
Does the message() print out whether ENABLE_COPY_NUMA is on or off?

Comment on lines +502 to +504
# Always exclude memory_async_copy_numa.cc since ENABLE_COPY_NUMA is forced OFF
message(STATUS "ENABLE_COPY_NUMA is OFF - excluding memory_async_copy_numa.cc from build")
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
Copy link
Contributor

Choose a reason for hiding this comment

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

I concur with copilot's comment--it looks like the source file is unconditionally excluded.

@cfreeamd
Copy link
Contributor

cfreeamd commented Feb 6, 2026

I just have minor questions/comments. If rocrtst builds and runs successfully (at least the test in question) in CI and TheRock, then I would approve since it seems to be somewhat urgent. We can address the other issues (like testing the configurability of the tests wrt numa/hwloc), if any, afterwards.


set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# Configure RPATH settings before creating executable target
set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to change the rpath settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With CMAKE_BUILD_WITH_INSTALL_RPATH ON, TheRock build system was complaining about runtime linker failures when testing from the build directory:

./build/rocrtst64: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

  • The binary was looking for libs at build/../lib/rocm_sysdeps/lib (install paths)
  • But in TheRock's build tree, numa/hwloc are actually at dist/lib/rocm_sysdeps/lib
  • Same for bundled thirdparty libs - not at lib/rocrtst yet, they are only copied there during install

With OFF -BUILD_RPATH is pointing to ../../dist/lib/rocm_sysdeps/lib and finds TheRock's libs

Also when they switch to INSTALL_RPATH after make install its able to finds installed libs at /opt/rocm/lib/rocrtst

  • Seemed to have worked in both scenarios without needing to install first.

Let me know if you see any more concerns.. We did a lot of iterations on this PR.. And this seems to be the Goldilocks Cmakefile!

Copy link
Contributor

Choose a reason for hiding this comment

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

@shwetagkhatri

Around 2 years ago, there was a task group that spent a few weeks to research and refine the RPATH settings for all the components in ROCm. I was not part of that discussion, but there were people who were very experienced in packaging/deployment involved. The current RPATH settings were based on the recommendations from that group, so I am hesitant with making RPATH changes.
Given that these changes only apply to rocrtst, which is a executable and not a library, we are probably ok, so we can ignore get back to it if we start seeing problems from this.

Comment on lines +502 to +504
# Always exclude memory_async_copy_numa.cc since ENABLE_COPY_NUMA is forced OFF
message(STATUS "ENABLE_COPY_NUMA is OFF - excluding memory_async_copy_numa.cc from build")
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy_numa\\.cc$")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to exclude the .cc file. I would just have
ENABLE_COPY_NUMA_MEMBIND_NODESET and ENABLE_COPY_NUMA set to 0,

But I do not feel strongly about it. Up to you..

@shwetagkhatri
Copy link
Contributor Author

I just have minor questions/comments. If rocrtst builds and runs successfully (at least the test in question) in CI and TheRock, then I would approve since it seems to be somewhat urgent. We can address the other issues (like testing the configurability of the tests wrt numa/hwloc), if any, afterwards.

Thanks @cfreehill. I would like to see TheRock build get unblocked as Step 1, since rocrtst's hwloc API link errors are blocking it. I will follow up on your review comments in the subsequent PRs. Thank you.

@jharryma jharryma merged commit de8012a into develop Feb 6, 2026
5 of 8 checks passed
@jharryma jharryma deleted the users/shwetak/Disable_rocrtst_NUMA_async_copy branch February 6, 2026 18:48
systems-assistant bot pushed a commit to ROCm/ROCR-Runtime that referenced this pull request Feb 6, 2026
Forced ENABLE_COPY_NUMA off and excluded memory_async_copy_numa.cc from build

Co-authored-by: Shweta Khatri <shweta.khatri@amd.com>
[rocm-systems] ROCm/rocm-systems#3044 (commit de8012a)
amd-josnarlo pushed a commit that referenced this pull request Feb 9, 2026
Forced ENABLE_COPY_NUMA off and excluded memory_async_copy_numa.cc from build

Co-authored-by: Shweta Khatri <shweta.khatri@amd.com>
@chiranjeevipattigidi
Copy link

chiranjeevipattigidi commented Feb 11, 2026

@shwetagkhatri
In rock, CI checks for rocm-systems bump PR ROCm/TheRock#3307 failing with cmake errors.
(added some observations in the comments of above PR)

[rocrtst configure] CMake Error at /__w/TheRock/TheRock/cmake/therock_subproject_dep_provider.cmake:64 (message):
[rocrtst configure]   Project contains find_package(hwloc) for a package availabe in the
[rocrtst configure]   super-project but not declared: Add a BUILD_DEPS or RUNTIME_DEPS
[rocrtst configure]   appropriately
[rocrtst configure] Call Stack (most recent call first):

seems like bug in declaring the dependecies

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants