Removes default visibility in debug mode and updates unit tests for alt_rsmi impl (#2091)
* Update unit tests for alt_rsmi impl
- Create distinct test executable for alt_rsmi testing
- Updated alt_rsmi tests to use public methods
- Compiles alt_rsmi.cc with ARSMI_TEST_BUILD
- Enables external linkage of internal variables
- Only for AltRsmiTests.cpp that manipulates internals
- Clean separation for test behavior
* Address review comments
* restore hidden symbol visibility
[ROCm/rccl commit: 74690ea705]
This commit is contained in:
committad av
GitHub
förälder
4f7698c27e
incheckning
c64c23fbee
@@ -1095,6 +1095,7 @@ target_compile_options(rccl PRIVATE -Werror=deprecated-copy-with-user-provided-c
|
||||
target_compile_options(rccl PRIVATE -Wno-format-nonliteral)
|
||||
target_compile_options(rccl PRIVATE -Wno-unused-function)
|
||||
target_compile_options(rccl PRIVATE -fgpu-rdc)
|
||||
target_compile_options(rccl PRIVATE -fvisibility=hidden)
|
||||
|
||||
if(QUIET_WARNINGS)
|
||||
target_compile_options(rccl PRIVATE -Wno-invalid-offsetof)
|
||||
@@ -1118,8 +1119,7 @@ if(ENABLE_CODE_COVERAGE)
|
||||
message(STATUS "Code coverage is enabled with build type '${CMAKE_BUILD_TYPE}'.")
|
||||
|
||||
target_compile_options(rccl PRIVATE
|
||||
-fvisibility=default -Xarch_host -fprofile-instr-generate
|
||||
-Xarch_host -fcoverage-mapping)
|
||||
-Xarch_host -fprofile-instr-generate -Xarch_host -fcoverage-mapping)
|
||||
|
||||
set(COVERAGE_SHARED_LINKER_FLAGS
|
||||
-fprofile-generate
|
||||
@@ -1133,14 +1133,6 @@ if(ENABLE_CODE_COVERAGE)
|
||||
|
||||
target_link_options(rccl PRIVATE ${COVERAGE_SHARED_LINKER_FLAGS})
|
||||
target_link_options(rccl PRIVATE ${COVERAGE_EXE_LINKER_FLAGS})
|
||||
elseif(BUILD_TESTS) # Enable default/hidden visibility based on build type and ROCM_VERSION
|
||||
if (ROCM_VERSION VERSION_GREATER_EQUAL "60400" AND CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
target_compile_options(rccl PRIVATE -fvisibility=default)
|
||||
else()
|
||||
target_compile_options(rccl PRIVATE -fvisibility=hidden)
|
||||
endif()
|
||||
else() # Enable hidden visibility for library without tests/code coverage enabled
|
||||
target_compile_options(rccl PRIVATE -fvisibility=hidden)
|
||||
endif()
|
||||
|
||||
if (HAVE_KERNARG_PRELOAD)
|
||||
|
||||
@@ -48,18 +48,29 @@ struct ARSMI_systemNode {
|
||||
std::string s_card;
|
||||
};
|
||||
|
||||
static const char *kKFDNodesPathRoot = "/sys/class/kfd/kfd/topology/nodes";
|
||||
// Internal implementation details
|
||||
// When compiled into the test binary (ARSMI_TEST_BUILD defined), these have external linkage
|
||||
// so AltRsmiTestUtils.cpp can access them via extern declarations.
|
||||
// When compiled into the production library (ARSMI_TEST_BUILD not defined), these are static.
|
||||
#ifdef ARSMI_TEST_BUILD
|
||||
// Test build: external linkage for cross-TU access
|
||||
#define ARSMI_LOCAL thread_local
|
||||
#else
|
||||
// Production build: static/internal linkage
|
||||
#define ARSMI_LOCAL static thread_local
|
||||
#endif
|
||||
|
||||
ARSMI_LOCAL const char *kKFDNodesPathRoot = "/sys/class/kfd/kfd/topology/nodes";
|
||||
static const uint32_t kAmdGpuId = 0x1002;
|
||||
|
||||
// Vector containing data about each node, ordered by bdf ID
|
||||
static thread_local std::vector<ARSMI_systemNode> ARSMI_orderedNodes;
|
||||
ARSMI_LOCAL std::vector<ARSMI_systemNode> ARSMI_orderedNodes;
|
||||
|
||||
// 2-D matrix with link information between each pair of nodes.
|
||||
static thread_local std::vector<std::vector<ARSMI_linkInfo>> ARSMI_orderedLinks;
|
||||
ARSMI_LOCAL std::vector<std::vector<ARSMI_linkInfo>> ARSMI_orderedLinks;
|
||||
|
||||
// Number of devices recognized
|
||||
static thread_local int ARSMI_num_devices=-1;
|
||||
|
||||
ARSMI_LOCAL int ARSMI_num_devices=-1;
|
||||
|
||||
// Public API functions
|
||||
int ARSMI_init(void)
|
||||
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -236,6 +236,25 @@ if(BUILD_TESTS)
|
||||
list(APPEND RCCL_TEST_EXECUTABLES rccl-UnitTestsMPI)
|
||||
|
||||
endif()
|
||||
|
||||
# rccl-UnitTestsAltRsmi: Uses TEST BUILD alt_rsmi.cc (ARSMI_TEST_BUILD)
|
||||
# This separate executable compiles alt_rsmi.cc with ARSMI_TEST_BUILD,
|
||||
# enabling external linkage of internal variables so that
|
||||
# tests can access and manipulate them for testing.
|
||||
list(APPEND RCCL_TEST_EXECUTABLES rccl-UnitTestsAltRsmi)
|
||||
|
||||
set(TEST_ALTRSMI_SOURCE_FILES
|
||||
AltRsmiTests.cpp
|
||||
../src/misc/alt_rsmi.cc
|
||||
common/main_fixtures.cpp
|
||||
common/EnvVars.cpp
|
||||
common/ProcessIsolatedTestRunner.cpp
|
||||
)
|
||||
|
||||
add_executable(rccl-UnitTestsAltRsmi ${TEST_ALTRSMI_SOURCE_FILES})
|
||||
|
||||
# Define ARSMI_TEST_BUILD specifically for rccl-UnitTestsAltRsmi
|
||||
target_compile_definitions(rccl-UnitTestsAltRsmi PRIVATE ARSMI_TEST_BUILD)
|
||||
endif()
|
||||
|
||||
foreach(test_executable IN LISTS RCCL_TEST_EXECUTABLES)
|
||||
|
||||
Referens i nytt ärende
Block a user