From 80329e8364983e3b2265f355f9111c4d436aa41a Mon Sep 17 00:00:00 2001 From: Ammar ELWazir Date: Tue, 7 Nov 2023 20:55:35 +0000 Subject: [PATCH] Fixing ROCProfilerV2 to match versioning changes in HIP Runtime Change-Id: Ifb0f98356acebcb7cf5372340b36178de000405d [ROCm/rocprofiler commit: a59d56f9bcfd4b1c632e3c6fed239810aaa96893] --- projects/rocprofiler/plugin/ctf/CMakeLists.txt | 4 ++-- projects/rocprofiler/script/gen_ostream_ops.py | 9 +++++++++ projects/rocprofiler/src/api/CMakeLists.txt | 2 +- .../src/core/session/tracer/src/hip_full_api.h | 2 ++ .../rocprofiler/src/core/session/tracer/src/roctracer.h | 1 + .../rocprofiler/tests-v2/unittests/core/CMakeLists.txt | 4 ++-- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 projects/rocprofiler/src/core/session/tracer/src/hip_full_api.h diff --git a/projects/rocprofiler/plugin/ctf/CMakeLists.txt b/projects/rocprofiler/plugin/ctf/CMakeLists.txt index 2ed5c287d3..f501e97ff9 100644 --- a/projects/rocprofiler/plugin/ctf/CMakeLists.txt +++ b/projects/rocprofiler/plugin/ctf/CMakeLists.txt @@ -128,13 +128,13 @@ find_file( list(TRANSFORM HIP_INCLUDE_DIRS PREPEND -I) add_custom_command( OUTPUT hip_erts.yaml hip_begin.cpp.i hip_end.cpp.i - COMMAND ${CMAKE_C_COMPILER} ${HIP_INCLUDE_DIRS} -E "${HIP_RUNTIME_API_H}" + COMMAND ${CMAKE_C_COMPILER} ${HIP_INCLUDE_DIRS} -E "${PROJECT_SOURCE_DIR}/src/core/session/tracer/src/hip_full_api.h" -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -o hip_runtime_api.h.i COMMAND cat hip_runtime_api.h.i "${HIP_PROF_STR_H}" > hip_input.h BYPRODUCTS hip_runtime_api.h.i hip_input.h COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_api_files.py" hip hip_input.h - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/gen_api_files.py" "${HIP_RUNTIME_API_H}" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/gen_api_files.py" "${PROJECT_SOURCE_DIR}/src/core/session/tracer/src/hip_full_api.h" "${HIP_PROF_STR_H}" COMMENT "Generating HIP API files for the `ctf` plugin...") diff --git a/projects/rocprofiler/script/gen_ostream_ops.py b/projects/rocprofiler/script/gen_ostream_ops.py index 9084d73ff6..d101e99c48 100755 --- a/projects/rocprofiler/script/gen_ostream_ops.py +++ b/projects/rocprofiler/script/gen_ostream_ops.py @@ -212,6 +212,15 @@ def gen_cppheader(infilepath, outfilepath, rank): + apiname + "_OSTREAM_OPS_H_\n" + "\n" + ) + if apiname.upper() == 'HIP': + header_s = ( + header_s + + "#include \n" + + "#include \n" + ) + header_s = ( + header_s + '#include "src/core/session/tracer/src/roctracer.h"\n' + "\n" + "#ifdef __cplusplus\n" diff --git a/projects/rocprofiler/src/api/CMakeLists.txt b/projects/rocprofiler/src/api/CMakeLists.txt index 72db79591c..a27789c8fe 100644 --- a/projects/rocprofiler/src/api/CMakeLists.txt +++ b/projects/rocprofiler/src/api/CMakeLists.txt @@ -142,7 +142,7 @@ add_custom_command( COMMAND ${CMAKE_C_COMPILER} "$<$:-I$-I>>" - -E "${HIP_RUNTIME_API_H}" -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -o + -E "${PROJECT_SOURCE_DIR}/src/core/session/tracer/src/hip_full_api.h" -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -o hip_runtime_api.h.i BYPRODUCTS hip_runtime_api.h.i COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/script/gen_ostream_ops.py -in diff --git a/projects/rocprofiler/src/core/session/tracer/src/hip_full_api.h b/projects/rocprofiler/src/core/session/tracer/src/hip_full_api.h new file mode 100644 index 0000000000..ebbd68d5c4 --- /dev/null +++ b/projects/rocprofiler/src/core/session/tracer/src/hip_full_api.h @@ -0,0 +1,2 @@ +#include +#include \ No newline at end of file diff --git a/projects/rocprofiler/src/core/session/tracer/src/roctracer.h b/projects/rocprofiler/src/core/session/tracer/src/roctracer.h index 90a9585edd..c185a214fd 100644 --- a/projects/rocprofiler/src/core/session/tracer/src/roctracer.h +++ b/projects/rocprofiler/src/core/session/tracer/src/roctracer.h @@ -22,6 +22,7 @@ #define SRC_TOOLS_TRACER_SRC_ROCTRACER_H_ #include +#include #include #include #include diff --git a/projects/rocprofiler/tests-v2/unittests/core/CMakeLists.txt b/projects/rocprofiler/tests-v2/unittests/core/CMakeLists.txt index c9c02a5cd6..a4c9a2884e 100644 --- a/projects/rocprofiler/tests-v2/unittests/core/CMakeLists.txt +++ b/projects/rocprofiler/tests-v2/unittests/core/CMakeLists.txt @@ -174,12 +174,12 @@ add_custom_command( COMMAND ${CMAKE_C_COMPILER} "$<$:-I$-I>>" - -E "${HIP_RUNTIME_API_H}" -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -o + -E "${PROJECT_SOURCE_DIR}/src/core/session/tracer/src/hip_full_api.h" -D__HIP_PLATFORM_AMD__=1 -D__HIP_ROCclr__=1 -o hip_runtime_api.h.i BYPRODUCTS hip_runtime_api.h.i COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/script/gen_ostream_ops.py -in hip_runtime_api.h.i -out hip_ostream_ops.h > /dev/null - DEPENDS ${PROJECT_SOURCE_DIR}/script/gen_ostream_ops.py "${HIP_RUNTIME_API_H}" + DEPENDS ${PROJECT_SOURCE_DIR}/script/gen_ostream_ops.py "${PROJECT_SOURCE_DIR}/src/core/session/tracer/src/hip_full_api.h" COMMENT "Generating hip_ostream_ops.h..." COMMAND_EXPAND_LISTS)