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
[ROCm/rocprofiler commit: 9e62e066fe]
Этот коммит содержится в:
коммит произвёл
Ammar Elwazir
родитель
6b53186f13
Коммит
7647f6988f
@@ -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"
|
||||
|
||||
@@ -20,7 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#define ROCP_INTERNAL_BUILD
|
||||
#include "activity.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
#ifndef _SRC_CORE_ACTIVITY_H
|
||||
#define _SRC_CORE_ACTIVITY_H
|
||||
|
||||
#define ROCPROFILER_V1
|
||||
|
||||
#ifdef ROCP_INTERNAL_BUILD
|
||||
#include "inc/rocprofiler.h"
|
||||
#else
|
||||
#include <rocprofiler/rocprofiler.h>
|
||||
#endif
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ THE SOFTWARE.
|
||||
#ifndef SRC_CORE_CONTEXT_H_
|
||||
#define SRC_CORE_CONTEXT_H_
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <hsa/hsa_ext_amd.h>
|
||||
|
||||
@@ -23,7 +23,7 @@ THE SOFTWARE.
|
||||
#ifndef SRC_CORE_CONTEXT_POOL_H_
|
||||
#define SRC_CORE_CONTEXT_POOL_H_
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef SRC_CORE_COUNTERS_PERFMON_H
|
||||
#define SRC_CORE_COUNTERS_PERFMON_H
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "mmio.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef SRC_CORE_HSA_PACKETS_PACKETS_GENERATOR_H_
|
||||
#define SRC_CORE_HSA_PACKETS_PACKETS_GENERATOR_H_
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <hsa/hsa_api_trace.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "rocprofiler.h"
|
||||
#include "src/api/rocmtool.h"
|
||||
#include "src/core/hsa/packets/packets_generator.h"
|
||||
#include "src/core/hsa/hsa_support.h"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef SRC_CORE_HSA_QUEUES_QUEUE_H_
|
||||
#define SRC_CORE_HSA_QUEUES_QUEUE_H_
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <hsa/hsa_api_trace.h>
|
||||
|
||||
@@ -33,7 +33,7 @@ SOFTWARE.
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "util/exception.h"
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||
#include "core/proxy_queue.h"
|
||||
#include "core/tracker.h"
|
||||
#include "core/types.h"
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
|
||||
namespace rocprofiler {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#ifndef SRC_CORE_MEMORY_GENERIC_BUFFER_H_
|
||||
#define SRC_CORE_MEMORY_GENERIC_BUFFER_H_
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
|
||||
@@ -23,7 +23,7 @@ THE SOFTWARE.
|
||||
#ifndef SRC_CORE_PROFILE_H_
|
||||
#define SRC_CORE_PROFILE_H_
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <string.h>
|
||||
@@ -39,8 +39,6 @@ THE SOFTWARE.
|
||||
#include "util/exception.h"
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
#include "util/logger.h"
|
||||
#include "src/core/hsa/hsa_support.h"
|
||||
#include "src/utils/helper.h"
|
||||
|
||||
#define PUBLIC_API __attribute__((visibility("default")))
|
||||
#define CONSTRUCTOR_API __attribute__((constructor))
|
||||
@@ -380,9 +378,6 @@ std::atomic<util::Logger*> util::Logger::instance_{};
|
||||
|
||||
CONTEXT_INSTANTIATE();
|
||||
|
||||
static bool started{false};
|
||||
// #include "src/core/hsa/hsa_support.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public library methods
|
||||
//
|
||||
@@ -398,11 +393,6 @@ ROCPROFILER_EXPORT extern const uint32_t HSA_AMD_TOOL_PRIORITY = 25;
|
||||
PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count,
|
||||
const char* const* failed_tool_names) {
|
||||
ONLOAD_TRACE_BEG();
|
||||
if (started) rocmtools::fatal("HSA Tool started already!");
|
||||
started = true;
|
||||
if (!getenv("ROCP_TOOL_LIB") && !getenv("ROCP_HSA_INTERCEPT")) {
|
||||
rocmtools::hsa_support::Initialize(table);
|
||||
} else {
|
||||
rocprofiler::SaveHsaApi(table);
|
||||
rocprofiler::ProxyQueue::InitFactory();
|
||||
|
||||
@@ -469,20 +459,14 @@ PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t fa
|
||||
ONLOAD_TRACE("end intercept_mode(" << std::hex << intercept_env_value << ")"
|
||||
<< " intercept_mode_mask(" << std::hex << intercept_mode_mask
|
||||
<< ")" << std::dec);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// HSA-runtime tool on-unload method
|
||||
PUBLIC_API void OnUnload() {
|
||||
ONLOAD_TRACE_BEG();
|
||||
if (!started) rocmtools::fatal("HSA Tool hasn't started yet!");
|
||||
if (!getenv("ROCP_TOOL_LIB") && !getenv("ROCP_HSA_INTERCEPT")) {
|
||||
rocmtools::hsa_support::Finalize();
|
||||
} else {
|
||||
rocprofiler::UnloadTool();
|
||||
rocprofiler::RestoreHsaApi();
|
||||
}
|
||||
ONLOAD_TRACE_END();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
namespace rocmtools {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef SRC_CORE_SESSION_DEVICE_PROFILING_H_
|
||||
#define SRC_CORE_SESSION_DEVICE_PROFILING_H_
|
||||
|
||||
#include <rocprofiler.h>
|
||||
#include "rocprofiler.h"
|
||||
#include "src/core/hsa/packets/packets_generator.h"
|
||||
#include <mutex>
|
||||
// #include "src/core/counters/rdc/rdc_metrics.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#define ASSERTM(exp, msg) assert(((void)msg, exp))
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "src/core/counters/basic/basic_counter.h"
|
||||
#include "src/core/counters/metrics/eval_metrics.h"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "src/core/memory/generic_buffer.h"
|
||||
#include "src/core/session/filter.h"
|
||||
#include "profiler/profiler.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "hsa/hsa_ext_amd.h"
|
||||
#include "src/core/hsa/packets/packets_generator.h"
|
||||
#include "src/utils/exception.h"
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
|
||||
namespace rocmtools {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "hip_ostream_ops.h"
|
||||
#include "hsa_ostream_ops.h"
|
||||
#include "hsa_prof_str.h"
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "src/core/memory/generic_buffer.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "src/roctracer.h"
|
||||
|
||||
typedef bool is_filtered_domain_t;
|
||||
|
||||
@@ -33,7 +33,7 @@ THE SOFTWARE.
|
||||
#include <mutex>
|
||||
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
#include "util/exception.h"
|
||||
#include "util/logger.h"
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include "gfxip.h"
|
||||
#include "src/utils/helper.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ set_target_properties(rocprofiler_tool PROPERTIES
|
||||
target_include_directories(rocprofiler_tool
|
||||
PRIVATE
|
||||
${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/inc
|
||||
${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
target_compile_definitions(rocprofiler_tool
|
||||
@@ -26,10 +25,10 @@ target_compile_definitions(rocprofiler_tool
|
||||
|
||||
if(ASAN)
|
||||
target_compile_options(rocprofiler_tool PRIVATE -fsanitize=address)
|
||||
target_link_libraries(rocprofiler_tool ${ROCPROFILER_TARGET} hsa-runtime64::hsa-runtime64 Threads::Threads atomic asan dl rt stdc++fs amd_comgr)
|
||||
target_link_libraries(rocprofiler_tool rocprofiler-v2 hsa-runtime64::hsa-runtime64 Threads::Threads atomic asan dl rt stdc++fs amd_comgr)
|
||||
target_link_options(rocprofiler_tool PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined,-fsanitize=address)
|
||||
else()
|
||||
target_link_libraries(rocprofiler_tool ${ROCPROFILER_TARGET} hsa-runtime64::hsa-runtime64 Threads::Threads atomic dl rt stdc++fs amd_comgr)
|
||||
target_link_libraries(rocprofiler_tool rocprofiler-v2 hsa-runtime64::hsa-runtime64 Threads::Threads atomic dl rt stdc++fs amd_comgr)
|
||||
target_link_options(rocprofiler_tool PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined)
|
||||
endif()
|
||||
|
||||
@@ -44,9 +43,8 @@ add_subdirectory(amdsys)
|
||||
add_subdirectory(rocprofv2)
|
||||
|
||||
add_executable(ctrl ctrl.cpp)
|
||||
target_include_directories(ctrl PRIVATE ${PROJECT_SOURCE_DIR}/inc)
|
||||
target_link_options(rocprofiler_tool PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap -Wl,--no-undefined)
|
||||
target_link_libraries(ctrl PRIVATE ${ROCPROFILER_TARGET} hsa-runtime64::hsa-runtime64)
|
||||
target_link_libraries(ctrl PRIVATE rocprofiler-v2 hsa-runtime64::hsa-runtime64)
|
||||
install(TARGETS ctrl RUNTIME
|
||||
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler
|
||||
COMPONENT runtime)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <hsa/hsa.h>
|
||||
#include <rocprofiler.h>
|
||||
#include "rocprofiler.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
@@ -18,15 +18,12 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#define ROCPROFILER_V2
|
||||
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <hsa/hsa.h>
|
||||
#include <hsa/hsa_api_trace.h>
|
||||
#include <rocprofiler.h>
|
||||
#include <rocprofiler_plugin.h>
|
||||
#include "rocprofiler.h"
|
||||
#include "rocprofiler_plugin.h"
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ipc.h>
|
||||
@@ -54,7 +51,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "rocprofiler.h"
|
||||
#include "utils/helper.h"
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
@@ -415,7 +411,7 @@ ROCPROFILER_EXPORT extern const uint32_t HSA_AMD_TOOL_PRIORITY = 1025;
|
||||
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,
|
||||
ROCPROFILER_EXPORT bool OnLoad(void* table, uint64_t runtime_version,
|
||||
uint64_t failed_tool_count, const char* const* failed_tool_names) {
|
||||
if (rocprofiler_version_major() != ROCPROFILER_VERSION_MAJOR ||
|
||||
rocprofiler_version_minor() < ROCPROFILER_VERSION_MINOR) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "helper.h"
|
||||
#include "inc/rocprofiler.h"
|
||||
#include "rocprofiler.h"
|
||||
|
||||
// TODO(aelwazir): namespace rocmtool
|
||||
namespace rocmtools {
|
||||
|
||||
Ссылка в новой задаче
Block a user