V1/V2 API Library Separation
V1 library will be supported as librocprofiler64.so and V2 will be supported as librocprofiler64v2.so and headers will be rocprofiler.h for V1 and v2/rocprofiler.h for v2 Change-Id: Ibe5bdbf2f79f0175342c648e917ae77918186604
Этот коммит содержится в:
коммит произвёл
Ammar Elwazir
родитель
9dd1a12468
Коммит
9e62e066fe
@@ -134,16 +134,18 @@ set(GENERATED_SOURCES
|
||||
find_path(PCIACCESS_INCLUDE_DIR pciaccess.h REQUIRED)
|
||||
find_library(PCIACCESS_LIBRARIES pciaccess REQUIRED)
|
||||
|
||||
set(PUBLIC_HEADERS
|
||||
rocprofiler_plugin.h
|
||||
rocprofiler.h)
|
||||
set(PUBLIC_HEADERS rocprofiler.h)
|
||||
|
||||
foreach(header ${PUBLIC_HEADERS})
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/inc/${header}
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/include/rocprofiler/${header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
||||
COMPONENT dev)
|
||||
endforeach()
|
||||
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/rocprofiler/v2
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
||||
COMPONENT dev)
|
||||
|
||||
# Getting Source files for ROCProfiler, Hardware, HSA, Memory, Session, Counters, Utils
|
||||
file(GLOB ROCPROFILER_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
|
||||
@@ -187,8 +189,31 @@ file(GLOB CORE_UTILS_SRC_FILES ${CORE_UTILS_DIR}/*.cpp)
|
||||
set(CORE_PC_SAMPLING_DIR ${PROJECT_SOURCE_DIR}/src/pcsampler)
|
||||
file(GLOB CORE_PC_SAMPLING_FILES ${CORE_PC_SAMPLING_DIR}/core/*.cpp ${CORE_PC_SAMPLING_DIR}/gfxip/*.cpp ${CORE_PC_SAMPLING_DIR}/session/*.cpp)
|
||||
|
||||
|
||||
#### V1 Library
|
||||
# Compiling/Installing ROCProfiler API V1
|
||||
add_library(${ROCPROFILER_TARGET} SHARED ${OLD_LIB_SRC})
|
||||
set_target_properties(${ROCPROFILER_TARGET} PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VERSION 1.0.0
|
||||
SOVERSION 1)
|
||||
# As ROCR hsa_api_trace header file is not usable unless AMD_INTERNAL_BUILD is defined
|
||||
target_compile_definitions(${ROCPROFILER_TARGET} PUBLIC AMD_INTERNAL_BUILD)
|
||||
target_include_directories(${ROCPROFILER_TARGET}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/rocprofiler>
|
||||
PRIVATE
|
||||
${LIB_DIR} ${ROOT_DIR}
|
||||
${PROJECT_SOURCE_DIR}/include/rocprofiler)
|
||||
target_link_libraries(${ROCPROFILER_TARGET} PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 c stdc++)
|
||||
## Install libraries: Non versioned lib file in dev package
|
||||
# install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev NAMELINK_COMPONENT runtime)
|
||||
install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP)
|
||||
# install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT asan)
|
||||
|
||||
#### V2 Library
|
||||
# Compiling/Installing ROCProfiler API
|
||||
add_library(${ROCPROFILER_TARGET} SHARED
|
||||
add_library(rocprofiler-v2 SHARED
|
||||
${ROCPROFILER_SRC_FILES}
|
||||
${ROCPROFILER_CLASS_SRC_FILES}
|
||||
${ROCPROFILER_PROFILER_SRC_FILES}
|
||||
@@ -211,47 +236,54 @@ add_library(${ROCPROFILER_TARGET} SHARED
|
||||
${ROCPROFILER_ROCTRACER_SRC_FILES}
|
||||
${GENERATED_SOURCES}
|
||||
${CORE_COUNTERS_SRC_FILES}
|
||||
${CORE_PC_SAMPLING_FILES}
|
||||
${OLD_LIB_SRC})
|
||||
|
||||
set_target_properties(${ROCPROFILER_TARGET} PROPERTIES
|
||||
${CORE_PC_SAMPLING_FILES})
|
||||
set_target_properties(rocprofiler-v2 PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
DEFINE_SYMBOL "ROCPROFILER_EXPORTS"
|
||||
LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/exportmap
|
||||
OUTPUT_NAME rocprofiler64
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/v2
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
target_compile_definitions(${ROCPROFILER_TARGET}
|
||||
PUBLIC AMD_INTERNAL_BUILD
|
||||
PRIVATE PROF_API_IMPL HIP_PROF_HIP_API_STRING=1 __HIP_PLATFORM_AMD__=1)
|
||||
|
||||
target_include_directories(${ROCPROFILER_TARGET}
|
||||
target_compile_definitions(rocprofiler-v2
|
||||
# As ROCR hsa_api_trace header file is not usable unless AMD_INTERNAL_BUILD is defined
|
||||
PRIVATE AMD_INTERNAL_BUILD
|
||||
PROF_API_IMPL HIP_PROF_HIP_API_STRING=1 __HIP_PLATFORM_AMD__=1)
|
||||
target_include_directories(rocprofiler-v2
|
||||
PUBLIC
|
||||
${ROCM_PATH}/include
|
||||
${HIP_INCLUDE_DIRECTORIES} ${HSA_RUNTIME_INCLUDE_DIRECTORIES}
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/tools>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/inc>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/rocprofiler/v2>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
PRIVATE
|
||||
${LIB_DIR} ${ROOT_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/tools
|
||||
${PROJECT_SOURCE_DIR}/inc)
|
||||
|
||||
${PROJECT_SOURCE_DIR}/tools)
|
||||
if(ASAN)
|
||||
target_compile_options(${ROCPROFILER_TARGET} PRIVATE -fsanitize=address)
|
||||
target_link_options(${ROCPROFILER_TARGET} PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined,-fsanitize=address)
|
||||
target_link_libraries(${ROCPROFILER_TARGET} PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 Threads::Threads atomic asan dl c stdc++ stdc++fs amd_comgr ${PCIACCESS_LIBRARIES})
|
||||
target_compile_options(rocprofiler-v2 PRIVATE -fsanitize=address)
|
||||
target_link_options(rocprofiler-v2 PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined,-fsanitize=address)
|
||||
target_link_libraries(rocprofiler-v2 PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 Threads::Threads atomic asan dl c stdc++ stdc++fs amd_comgr ${PCIACCESS_LIBRARIES})
|
||||
else()
|
||||
target_link_options(${ROCPROFILER_TARGET} PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined)
|
||||
target_link_libraries(${ROCPROFILER_TARGET} PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 Threads::Threads atomic dl c stdc++ stdc++fs amd_comgr ${PCIACCESS_LIBRARIES})
|
||||
target_link_options(rocprofiler-v2 PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined)
|
||||
target_link_libraries(rocprofiler-v2 PRIVATE ${AQLPROFILE_LIB} hsa-runtime64::hsa-runtime64 Threads::Threads atomic dl c stdc++ stdc++fs amd_comgr ${PCIACCESS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
## Install libraries: Non versioned lib file in dev package
|
||||
install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev NAMELINK_ONLY )
|
||||
install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP )
|
||||
install ( TARGETS ${ROCPROFILER_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT asan )
|
||||
# install(TARGETS rocprofiler-v2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev)
|
||||
install(TARGETS rocprofiler-v2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP)
|
||||
# install(TARGETS rocprofiler-v2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT asan)
|
||||
|
||||
file(CONFIGURE OUTPUT ${CMAKE_BINARY_DIR}/librocprofiler64.so
|
||||
CONTENT "OUTPUT_FORMAT(elf64-x86-64)\nINPUT(librocprofiler64.so.1)")
|
||||
install(FILES ${CMAKE_BINARY_DIR}/librocprofiler64.so DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
COMPONENT runtime)
|
||||
|
||||
file(CONFIGURE OUTPUT ${CMAKE_BINARY_DIR}/librocprofiler64v2.so
|
||||
CONTENT "OUTPUT_FORMAT(elf64-x86-64)\nINPUT(librocprofiler64.so.${PROJECT_VERSION_MAJOR})")
|
||||
install(FILES ${CMAKE_BINARY_DIR}/librocprofiler64v2.so DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
COMPONENT runtime)
|
||||
|
||||
configure_file(${PROJECT_SOURCE_DIR}/src/core/counters/metrics/basic_counters.xml ${PROJECT_BINARY_DIR}/counters/basic_counters.xml COPYONLY)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/src/core/counters/metrics/derived_counters.xml ${PROJECT_BINARY_DIR}/counters/derived_counters.xml COPYONLY)
|
||||
|
||||
@@ -1,48 +1,9 @@
|
||||
ROCPROFILER_8.0 {
|
||||
ROCPROFILER_9.0 {
|
||||
global: OnLoad;
|
||||
OnUnload;
|
||||
rocprofiler_version_major;
|
||||
rocprofiler_version_minor;
|
||||
rocprofiler_error_string;
|
||||
rocprofiler_open;
|
||||
rocprofiler_add_feature;
|
||||
rocprofiler_features_set_open;
|
||||
rocprofiler_close;
|
||||
rocprofiler_reset;
|
||||
rocprofiler_get_agent;
|
||||
rocprofiler_get_time;
|
||||
rocprofiler_set_queue_callbacks;
|
||||
rocprofiler_remove_queue_callbacks;
|
||||
rocprofiler_start_queue_callbacks;
|
||||
rocprofiler_stop_queue_callbacks;
|
||||
rocprofiler_start;
|
||||
rocprofiler_stop;
|
||||
rocprofiler_read;
|
||||
rocprofiler_get_data;
|
||||
rocprofiler_group_count;
|
||||
rocprofiler_get_group;
|
||||
rocprofiler_group_start;
|
||||
rocprofiler_group_stop;
|
||||
rocprofiler_group_read;
|
||||
rocprofiler_group_get_data;
|
||||
rocprofiler_get_metrics;
|
||||
rocprofiler_iterate_trace_data;
|
||||
rocprofiler_get_info;
|
||||
rocprofiler_iterate_info;
|
||||
rocprofiler_query_info;
|
||||
rocprofiler_queue_create_profiled;
|
||||
rocprofiler_pool_open;
|
||||
rocprofiler_pool_close;
|
||||
rocprofiler_pool_fetch;
|
||||
rocprofiler_pool_release;
|
||||
rocprofiler_pool_iterate;
|
||||
rocprofiler_pool_flush;
|
||||
rocprofiler_set_hsa_callbacks;
|
||||
local: *;
|
||||
};
|
||||
|
||||
ROCPROFILER_9.0 {
|
||||
global: HSA_AMD_TOOL_PRIORITY;
|
||||
HSA_AMD_TOOL_PRIORITY;
|
||||
rocprofiler_error_str;
|
||||
rocprofiler_initialize;
|
||||
rocprofiler_finalize;
|
||||
@@ -85,4 +46,5 @@ global: HSA_AMD_TOOL_PRIORITY;
|
||||
rocprofiler_device_profiling_session_poll;
|
||||
rocprofiler_device_profiling_session_stop;
|
||||
rocprofiler_device_profiling_session_destroy;
|
||||
} ROCPROFILER_8.0;
|
||||
local: *;
|
||||
};
|
||||
@@ -720,7 +720,7 @@ rocprofiler_device_profiling_session_destroy(rocprofiler_session_id_t session_id
|
||||
}
|
||||
|
||||
|
||||
// static bool started{false};
|
||||
static bool started{false};
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -729,27 +729,28 @@ extern "C" {
|
||||
// The HSA_AMD_TOOL_PRIORITY variable must be a constant value type
|
||||
// initialized by the loader itself, not by code during _init. 'extern const'
|
||||
// seems do that although that is not a guarantee.
|
||||
// ROCPROFILER_EXPORT extern const uint32_t HSA_AMD_TOOL_PRIORITY = 25;
|
||||
ROCPROFILER_EXPORT extern const uint32_t HSA_AMD_TOOL_PRIORITY = 25;
|
||||
|
||||
/**
|
||||
* @brief Callback function called upon loading the HSA.
|
||||
* The function updates the core api table function pointers to point to the
|
||||
* interceptor functions in this file.
|
||||
*/
|
||||
// ROCPROFILER_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
|
||||
// uint64_t failed_tool_count, const char* const* failed_tool_names) {
|
||||
// if (started) rocmtools::fatal("HSA Tool started already!");
|
||||
// started = true;
|
||||
// rocmtools::hsa_support::Initialize(table);
|
||||
// return true;
|
||||
// }
|
||||
ROCPROFILER_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
|
||||
uint64_t failed_tool_count, const char* const* failed_tool_names) {
|
||||
if (started) rocmtools::fatal("HSA Tool started already!");
|
||||
started = true;
|
||||
rocmtools::hsa_support::Initialize(table);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback function upon unloading the HSA.
|
||||
*/
|
||||
// ROCPROFILER_EXPORT void OnUnload() {
|
||||
// if (!started) rocmtools::fatal("HSA Tool hasn't started yet!");
|
||||
// rocmtools::hsa_support::Finalize();
|
||||
// }
|
||||
ROCPROFILER_EXPORT void OnUnload() {
|
||||
if (!started) rocmtools::fatal("HSA Tool hasn't started yet!");
|
||||
rocmtools::hsa_support::Finalize();
|
||||
started=false;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Ссылка в новой задаче
Block a user