Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions projects/rocr-runtime/rocrtst/suites/performance/memory_async_copy_numa.cc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
*
*/

#include "suites/performance/memory_async_copy_numa.h"

#if ENABLE_COPY_NUMA
#include <hwloc.h>
#include <hwloc/linux-libnuma.h>
#include <numa.h>
Expand All @@ -54,7 +57,6 @@
#include "suites/test_common/test_base.h"
#include "hsa/hsa.h"
#include "hsa/hsa_ext_amd.h"
#include "suites/performance/memory_async_copy_numa.h"
#include "common/base_rocr_utils.h"
#include "common/helper_funcs.h"
#include "gtest/gtest.h"
Expand Down Expand Up @@ -124,10 +126,17 @@ void MemoryAsyncCopyNUMA::Run(void) {
hwloc_bitmap_free(cpu_bind_set_chk);

// Bind Memory
#if ENABLE_COPY_NUMA_MEMBIND_NODESET
ret = hwloc_set_membind_nodeset(topology_, cpu_hwl_numa_nodeset_,
HWLOC_MEMBIND_BIND, 0);
ASSERT_TRUE(ret == 0 &&
"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.
<< std::endl;
}
#endif
}
for (Transaction t : tran_) {
RunBenchmarkWithVerification(&t);
Expand Down Expand Up @@ -360,5 +369,5 @@ void MemoryAsyncCopyNUMA::RunBenchmarkWithVerification(Transaction *t) {
t->benchmark_copy_time->push_back(GetMeanTime(&time));
}
}

#undef RET_IF_HSA_ERR
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#ifndef ROCRTST_SUITES_PERFORMANCE_MEMORY_ASYNC_COPY_NUMA_H_
#define ROCRTST_SUITES_PERFORMANCE_MEMORY_ASYNC_COPY_NUMA_H_

#if ENABLE_COPY_NUMA
#include <hwloc.h>

#include <vector>
Expand All @@ -70,5 +71,6 @@ class MemoryAsyncCopyNUMA : public MemoryAsyncCopy {
// @Brief: Run for Benchmark mode with verification
virtual void RunBenchmarkWithVerification(Transaction *t);
};
#endif // ENABLE_COPY_NUMA

#endif // ROCRTST_SUITES_PERFORMANCE_MEMORY_ASYNC_COPY_NUMA_H_
222 changes: 165 additions & 57 deletions projects/rocr-runtime/rocrtst/suites/test_common/CMakeLists.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ aux_source_directory(${ROCRTST_ROOT}/suites/negative negativeSources)
aux_source_directory(${ROCRTST_ROOT}/suites/stress stressSources)
aux_source_directory(${ROCRTST_ROOT}/suites/test_common testCommonSources)

# Optional: enable NUMA async copy test (memory_async_copy_numa.cc)
# 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")

Comment on lines +375 to +381
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.
# Header file include path

include_directories(${ROCRTST_ROOT})
Expand Down Expand Up @@ -480,33 +488,88 @@ set(BITCODE_LIBS "${COMMON_BITCODE_LIBS}")
set(CL_FILE_LIST "${KERNELS_DIR}/cu_mask_kernels.cl")
build_sample_for_devices("cu_mask")

set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# Configure RPATH settings before creating executable target
set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
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.

Why do we need to change the rpath settings?

Copy link
Copy Markdown
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
Copy Markdown
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.

set(CMAKE_SKIP_BUILD_RPATH FALSE)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14")
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Force disable NUMA copy functionality
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.

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?

option(ENABLE_COPY_NUMA "Enable NUMA async copy tests" OFF)

# 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$")
Comment on lines +502 to +504
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


# Check for numa library and headers (same approach as libhsakmt)
# Check for numa library and header
find_package(PkgConfig)
find_package(NUMA)
if(NUMA_FOUND)
set(NUMA_LIBS ${NUMA_LIBRARIES})
message(STATUS "Found NUMA package: ${NUMA_LIBRARIES}")
if(NUMA_INCLUDE_DIRS)
include_directories(${NUMA_INCLUDE_DIRS})
message(STATUS "NUMA include dirs: ${NUMA_INCLUDE_DIRS}")
set(HAVE_NUMA FALSE)
set(NUMA_TARGET "")

if(PKG_CONFIG_FOUND)
pkg_check_modules(NUMA_PC numa)
if(NUMA_PC_FOUND)
# Try to find the actual library file for SHARED IMPORTED target
find_library(NUMA_LIBRARY_FILE
NAMES numa rocm_sysdeps_numa
HINTS ${NUMA_PC_LIBRARY_DIRS}
NO_DEFAULT_PATH
)

if(NUMA_LIBRARY_FILE)
# Create SHARED IMPORTED target for proper RPATH handling
add_library(numa_imported SHARED IMPORTED)
set_target_properties(numa_imported PROPERTIES
IMPORTED_LOCATION "${NUMA_LIBRARY_FILE}"
INTERFACE_INCLUDE_DIRECTORIES "${NUMA_PC_INCLUDE_DIRS}"
)
message(STATUS "Found NUMA via pkg-config (SHARED): ${NUMA_LIBRARY_FILE}")
else()
# Fallback to INTERFACE target if we only have link flags
add_library(numa_imported INTERFACE IMPORTED)
set_target_properties(numa_imported PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${NUMA_PC_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${NUMA_PC_LIBRARIES}"
INTERFACE_LINK_DIRECTORIES "${NUMA_PC_LIBRARY_DIRS}"
)
message(STATUS "Found NUMA via pkg-config (INTERFACE): ${NUMA_PC_LIBRARIES}")
endif()

set(NUMA_TARGET numa_imported)
set(HAVE_NUMA TRUE)
message(STATUS " Include dirs: ${NUMA_PC_INCLUDE_DIRS}")
message(STATUS " Library dirs: ${NUMA_PC_LIBRARY_DIRS}")
endif()
set(HAVE_NUMA TRUE)
else()
# Fallback to manual detection
find_library(NUMA_LIBRARY NAMES numa)
if(NUMA_LIBRARY)
set(NUMA_LIBS ${NUMA_LIBRARY})
message(STATUS "Found numa library (fallback): ${NUMA_LIBRARY}")
endif()

if(NOT HAVE_NUMA)
find_package(NUMA)
if(NUMA_FOUND)
add_library(numa_imported INTERFACE IMPORTED)
set_target_properties(numa_imported PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${NUMA_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${NUMA_LIBRARIES}"
)
set(NUMA_TARGET numa_imported)
set(HAVE_NUMA TRUE)
message(STATUS "Found NUMA package: ${NUMA_LIBRARIES}")
else()
message(WARNING "NUMA library not found. Building without numa support.")
message(WARNING " Install libnuma-dev (Debian/Ubuntu) or numactl-devel (RHEL/CentOS)")
set(NUMA_LIBS "")
set(HAVE_NUMA FALSE)
# Exclude numa-dependent files from build
list(FILTER performanceSources EXCLUDE REGEX ".*memory_async_copy.*\\.cc$")
# Last resort: manual detection
find_library(NUMA_LIBRARY NAMES numa)
if(NUMA_LIBRARY)
add_library(numa_imported INTERFACE IMPORTED)
set_target_properties(numa_imported PROPERTIES
INTERFACE_LINK_LIBRARIES "${NUMA_LIBRARY}"
)
set(NUMA_TARGET numa_imported)
set(HAVE_NUMA TRUE)
message(STATUS "Found numa library (manual): ${NUMA_LIBRARY}")
else()
message(WARNING "NUMA library not found. Building without numa support.")
message(WARNING " Install libnuma-dev (Debian/Ubuntu) or numactl-devel (RHEL/CentOS)")
endif()
Comment on lines +569 to +572
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.
endif()
endif()

Expand All @@ -517,58 +580,103 @@ add_executable(${ROCRTST} ${performanceSources} ${functionalSources} ${negativeS
# Add HAVE_NUMA compile definition so code can conditionally compile NUMA features
target_compile_definitions(${ROCRTST} PRIVATE HAVE_NUMA=$<BOOL:${HAVE_NUMA}>)

# Find hwloc library (optional - only needed for certain performance tests)
# Try pkg-config first (for super-project builds)
if(PKG_CONFIG_FOUND)
pkg_check_modules(HWLOC QUIET hwloc)
if(HWLOC_FOUND)
set(HWLOC_LIBRARY ${HWLOC_LINK_LIBRARIES})
message(STATUS "Found hwloc via pkg-config: ${HWLOC_LIBRARY}")
endif()
# Find hwloc library
set(HAVE_HWLOC FALSE)
set(HWLOC_TARGET "")

# First priority: Try to find hwloc via CMake package (from TheRock sysdeps)
find_package(hwloc QUIET CONFIG)
if(hwloc_FOUND AND TARGET hwloc::hwloc)
set(HWLOC_TARGET hwloc::hwloc)
set(HAVE_HWLOC TRUE)
message(STATUS "Found hwloc via CMake package (TheRock sysdeps)")
endif()

# If not found via pkg-config, check for bundled version (any version)
if(NOT HWLOC_FOUND)
# Use file(GLOB) to find any libhwloc.so* file regardless of version
file(GLOB HWLOC_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/lib/libhwloc.so*")
if(HWLOC_LIBRARY)
list(GET HWLOC_LIBRARY 0 HWLOC_LIBRARY) # Take first match if multiple versions exist
set(HWLOC_FOUND TRUE)
message(STATUS "Found bundled hwloc library: ${HWLOC_LIBRARY}")
else()
# Fall back to system hwloc
find_library(HWLOC_LIBRARY NAMES hwloc)
if(HWLOC_LIBRARY)
set(HWLOC_FOUND TRUE)
message(WARNING "Using system hwloc library: ${HWLOC_LIBRARY}")
message(WARNING " Consider using bundled version to avoid compatibility issues")
# Second priority: Try pkg-config
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
)
Comment on lines +596 to +604
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.

if(HWLOC_LIBRARY_FILE)
# Create SHARED IMPORTED target for proper RPATH handling
add_library(hwloc_imported SHARED IMPORTED)
set_target_properties(hwloc_imported PROPERTIES
IMPORTED_LOCATION "${HWLOC_LIBRARY_FILE}"
INTERFACE_INCLUDE_DIRECTORIES "${HWLOC_PC_INCLUDE_DIRS}"
)
set(HWLOC_TARGET hwloc_imported)
set(HAVE_HWLOC TRUE)
message(STATUS "Found hwloc via pkg-config (SHARED): ${HWLOC_LIBRARY_FILE}")
message(STATUS " Include dirs: ${HWLOC_PC_INCLUDE_DIRS}")
message(STATUS " Library dirs: ${HWLOC_PC_LIBRARY_DIRS}")
endif()
endif()
endif()

# Handle hwloc availability
if(HWLOC_FOUND)
set(HWLOC_LIBS ${HWLOC_LIBRARY})
set(HAVE_HWLOC TRUE)
message(STATUS "hwloc support enabled")
else()
message(FATAL_ERROR "hwloc library not found. Required for rocrtst build. Install libhwloc-dev (Debian/Ubuntu) or hwloc-devel (RHEL/CentOS)")
if(NOT HAVE_HWLOC)
# Fallback: Search in thirdparty (may have symbol version incompatibilities with TheRock's numa)
find_library(HWLOC_LIBRARY
NAMES hwloc
HINTS ${ROCRTST_ROOT}/thirdparty/lib
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH
)

# If not found, try versioned library directly (e.g., libhwloc.so.5)
if(NOT HWLOC_LIBRARY)
find_file(HWLOC_LIBRARY
NAMES libhwloc.so.5 libhwloc.so.15
HINTS ${ROCRTST_ROOT}/thirdparty/lib
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH
)
endif()

if(HWLOC_LIBRARY)
add_library(hwloc_imported SHARED IMPORTED)
set_target_properties(hwloc_imported PROPERTIES
IMPORTED_LOCATION "${HWLOC_LIBRARY}"
)
set(HWLOC_TARGET hwloc_imported)
set(HAVE_HWLOC TRUE)
message(STATUS "Found hwloc library (fallback): ${HWLOC_LIBRARY}")
message(WARNING "Using pre-built hwloc from thirdparty/lib - may have symbol version incompatibilities with TheRock's numa")
else()
message(FATAL_ERROR "hwloc library not found. Install libhwloc-dev (Debian/Ubuntu) or hwloc-devel (RHEL/CentOS) or add hwloc as a TheRock dependency")
endif()
endif()

# Add HAVE_HWLOC compile definition
target_compile_definitions(${ROCRTST} PRIVATE HAVE_HWLOC=$<BOOL:${HAVE_HWLOC}>)

target_link_libraries(${ROCRTST} ${ROCRTST_LIBS} c stdc++ dl pthread rt ${NUMA_LIBS} ${HWLOC_LIBS})
# Link libraries - CMake will automatically handle RPATH for imported targets
target_link_libraries(${ROCRTST} ${ROCRTST_LIBS} c stdc++ dl pthread rt)
if(HAVE_NUMA)
target_link_libraries(${ROCRTST} ${NUMA_TARGET})
endif()
if(HAVE_HWLOC)
target_link_libraries(${ROCRTST} ${HWLOC_TARGET})
endif()

#Build kernels
add_custom_target(rocrtst_kernels ALL DEPENDS ${HSACO_TARG_LIST})

#Build symlinks
add_custom_target(rocrtst_links ALL DEPENDS ${ROCRTST_LINKS_LIST} )

## Set RUNPATH to pickup local copy of hwloc
set_property(TARGET ${ROCRTST} PROPERTY INSTALL_RPATH "$ORIGIN;$ORIGIN/thirdparty/lib;$ORIGIN/../lib/rocrtst/thirdparty/lib" )
set_property(TARGET ${ROCRTST} PROPERTY LINK_FLAGS "-Wl,--enable-new-dtags")
# CMake automatically sets RPATH for linked libraries when CMAKE_INSTALL_RPATH_USE_LINK_PATH is TRUE
# This works for SHARED IMPORTED targets (numa, hwloc) found via pkg-config
set_target_properties(${ROCRTST} PROPERTIES
LINK_FLAGS "-Wl,--enable-new-dtags"
INSTALL_RPATH "$ORIGIN/../lib/rocrtst/lib;$ORIGIN/../lib/rocm_sysdeps/lib"
BUILD_RPATH "$ORIGIN/../../dist/lib/rocm_sysdeps/lib;$ORIGIN/../lib/rocrtst/lib"
Comment on lines +677 to +678
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.
)

install(TARGETS ${ROCRTST}
ARCHIVE DESTINATION lib
Expand All @@ -577,4 +685,4 @@ install(TARGETS ${ROCRTST}

install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/lib DESTINATION lib/rocrtst )

include ( CPack )
include ( CPack )
4 changes: 4 additions & 0 deletions projects/rocr-runtime/rocrtst/suites/test_common/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
#include "suites/functional/svm_memory.h"
#include "suites/performance/dispatch_time.h"
#include "suites/performance/memory_async_copy.h"
#if ENABLE_COPY_NUMA
#include "suites/performance/memory_async_copy_numa.h"
#endif
#include "suites/performance/memory_async_copy_on_engine.h"
#include "suites/performance/enqueueLatency.h"
#include "suites/negative/memory_allocate_negative_tests.h"
Expand Down Expand Up @@ -778,10 +780,12 @@ TEST(rocrtstPerf, ENQUEUE_LATENCY) {
RunGenericTest(&multiPacketequeue);
}

#if ENABLE_COPY_NUMA
TEST(rocrtstPerf, DISABLED_Memory_Async_Copy_NUMA) {
MemoryAsyncCopyNUMA numa;
RunGenericTest(&numa);
}
#endif

TEST(rocrtstPerf, AQL_Dispatch_Time_Single_SpinWait) {
DispatchTime dt(true, true);
Expand Down
Loading