Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion projects/clr/rocclr/device/hotswap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace amd {
namespace hotswap {

// On when this tool is loaded via HSA_TOOLS_LIB (name must match ROCR LoadTools).
inline constexpr const char* kHotswapToolLib = "libamd_comgr_hotswap_tool.so";
inline constexpr const char* kHotswapToolLib = "libhsa-hotswap.so";

inline bool Enabled() {
const char* tools_lib = std::getenv("HSA_TOOLS_LIB");
Expand Down
13 changes: 12 additions & 1 deletion projects/hotswap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.16)
project(hotswap LANGUAGES CXX)

include(GNUInstallDirs)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -10,6 +12,7 @@ set(HSA_RUNTIME_INC "${CMAKE_CURRENT_SOURCE_DIR}/../rocr-runtime/runtime/hsa-run

# COMGR is required — provides amd_comgr_hotswap_rewrite.
find_package(amd_comgr CONFIG REQUIRED)
find_package(hsa-runtime64 CONFIG REQUIRED)

find_path(HSA_INCLUDE_DIR hsa.h PATHS ${HSA_RUNTIME_INC} NO_DEFAULT_PATH REQUIRED)

Expand All @@ -36,10 +39,18 @@ target_include_directories(hsa-hotswap PRIVATE
${HSA_RUNTIME_INC}/..
)

target_link_libraries(hsa-hotswap PRIVATE amd_comgr)
target_link_libraries(hsa-hotswap PRIVATE
amd_comgr
hsa-runtime64::hsa-runtime64
Comment thread
nirmie marked this conversation as resolved.
)
set_target_properties(hsa-hotswap PROPERTIES
POSITION_INDEPENDENT_CODE ON)

install(TARGETS hsa-hotswap
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

# Test executable
add_executable(hotswap_test tests/hotswap_test.cpp hotswap.cpp)
target_include_directories(hotswap_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion projects/hotswap/hotswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//===----------------------------------------------------------------------===//

#include "hotswap.hpp"
#include <amd_comgr.h>
#include "amd_comgr/amd_comgr.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2793,12 +2793,12 @@ void Runtime::LoadTools() {
getpid(), rocp_reg_status, rocprofiler_register_error_string(rocp_reg_status));
}

// rocprofiler-register (v3) provides tracing only; the comgr hotswap tool must
// rocprofiler-register (v3) provides tracing only; the hotswap tool must
// intercept and modify HSA calls (it wraps hsa_code_object_reader_create_from_memory),
// which requires the v1 HSA_TOOLS_LIB path. Allow v1 registration specifically for
// that first-party tool so it loads via HSA_TOOLS_LIB alone, without re-enabling v1
// for other tools. General v1 behavior is otherwise unchanged.
static constexpr const char* kHotswapToolLib = "libamd_comgr_hotswap_tool.so";
static constexpr const char* kHotswapToolLib = "libhsa-hotswap.so";
bool allow_v1_registration =
flag().tools_lib_names().find(kHotswapToolLib) != std::string::npos;
if (os::IsEnvVarSet("HSA_TOOLS_ROCPROFILER_V1_TOOLS")) {
Expand Down
Loading