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]
This commit is contained in:
Ammar ELWazir
2023-04-20 22:04:46 +00:00
committed by Ammar Elwazir
parent 6b53186f13
commit 7647f6988f
62 changed files with 2220 additions and 737 deletions
@@ -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 -1
View File
@@ -1,5 +1,5 @@
#include <hsa/hsa.h>
#include <rocprofiler.h>
#include "rocprofiler.h"
#include <cstdio>
+3 -7
View File
@@ -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) {