summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/rocprofiler')
-rw-r--r--dev-util/rocprofiler/Manifest2
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-4.3.0-no-aqlprofile.patch35
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-4.3.0-nostrip.patch13
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch59
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-5.1.3-remove-Werror.patch12
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-5.3.3-fix-python3.12-warning.patch88
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-5.3.3-gentoo-location.patch102
-rw-r--r--dev-util/rocprofiler/files/rocprofiler-5.3.3-remove-aql-in-cmake.patch13
-rw-r--r--dev-util/rocprofiler/metadata.xml15
-rw-r--r--dev-util/rocprofiler/rocprofiler-5.1.3-r1.ebuild60
-rw-r--r--dev-util/rocprofiler/rocprofiler-5.3.3-r1.ebuild57
11 files changed, 456 insertions, 0 deletions
diff --git a/dev-util/rocprofiler/Manifest b/dev-util/rocprofiler/Manifest
new file mode 100644
index 000000000000..b2cbc7154ef5
--- /dev/null
+++ b/dev-util/rocprofiler/Manifest
@@ -0,0 +1,2 @@
+DIST rocprofiler-5.1.3.tar.gz 1402172 BLAKE2B 16e9b127ede94a3f96056e84a2942b6c9f3aec90579fb12796ab8ba385160aa020e3dc77f7a475dadbc0a813a823ae733ca9560f6a09e55c4c82b13dd792dfa4 SHA512 6e9932a425eaaa2a1e1741280d7525c6360700f85edb3bcf4967fe9be4fed662bae0d2ba609701f0d9733769c340e93e32076024b27bab3303449c1d68d9e1ce
+DIST rocprofiler-5.3.3.tar.gz 1412740 BLAKE2B 29a63fc9df589787d18a28664002d35ec1b61e6b36f61cc1f2dc2dc14270d0aee4da594f735fceba71a7e29225bd0739b923a05bd36ec2a09a36e1ba95d8d971 SHA512 92b22272229c2c9a91983ded640a1b20f80538800f8e996dbf4e33e9f1f64a286a933f73b975e61c5b321883a11574c71ce91fd6ed7ddac32cd32da3bbea577c
diff --git a/dev-util/rocprofiler/files/rocprofiler-4.3.0-no-aqlprofile.patch b/dev-util/rocprofiler/files/rocprofiler-4.3.0-no-aqlprofile.patch
new file mode 100644
index 000000000000..12480d0baa0a
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-4.3.0-no-aqlprofile.patch
@@ -0,0 +1,35 @@
+Skip loading proprietary AQLProfile lib
+--- a/src/util/hsa_rsrc_factory.cpp 2021-06-28 23:09:44.000000000 +0800
++++ b/src/util/hsa_rsrc_factory.cpp 2022-05-11 10:48:23.431989766 +0800
+@@ -138,14 +138,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool init
+ if (cpu_pool_ == NULL) CHECK_STATUS("CPU memory pool is not found", HSA_STATUS_ERROR);
+ if (kern_arg_pool_ == NULL) CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR);
+
+- // Get AqlProfile API table
+- aqlprofile_api_ = {0};
+-#ifdef ROCP_LD_AQLPROFILE
+- status = LoadAqlProfileLib(&aqlprofile_api_);
+-#else
+- status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE, hsa_ven_amd_aqlprofile_VERSION_MAJOR, sizeof(aqlprofile_api_), &aqlprofile_api_);
+-#endif
+- CHECK_STATUS("aqlprofile API table load failed", status);
+
+ // Get Loader API table
+ loader_api_ = {0};
+--- a/test/util/hsa_rsrc_factory.cpp 2021-06-28 23:09:44.000000000 +0800
++++ b/test/util/hsa_rsrc_factory.cpp 2022-05-11 10:50:44.571990702 +0800
+@@ -135,14 +135,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool init
+ if (cpu_pool_ == NULL) CHECK_STATUS("CPU memory pool is not found", HSA_STATUS_ERROR);
+ if (kern_arg_pool_ == NULL) CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR);
+
+- // Get AqlProfile API table
+- aqlprofile_api_ = {0};
+-#ifdef ROCP_LD_AQLPROFILE
+- status = LoadAqlProfileLib(&aqlprofile_api_);
+-#else
+- status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE, hsa_ven_amd_aqlprofile_VERSION_MAJOR, sizeof(aqlprofile_api_), &aqlprofile_api_);
+-#endif
+- CHECK_STATUS("aqlprofile API table load failed", status);
+
+ // Get Loader API table
+ loader_api_ = {0};
diff --git a/dev-util/rocprofiler/files/rocprofiler-4.3.0-nostrip.patch b/dev-util/rocprofiler/files/rocprofiler-4.3.0-nostrip.patch
new file mode 100644
index 000000000000..3da3d99357f7
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-4.3.0-nostrip.patch
@@ -0,0 +1,13 @@
+Index: rocprofiler-rocm-5.0.2/cmake_modules/env.cmake
+===================================================================
+--- rocprofiler-rocm-5.0.2.orig/cmake_modules/env.cmake
++++ rocprofiler-rocm-5.0.2/cmake_modules/env.cmake
+@@ -92,8 +92,6 @@ string ( TOLOWER "${CMAKE_BUILD_TYPE}" C
+ if ( "${CMAKE_BUILD_TYPE}" STREQUAL debug )
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb" )
+ set ( CMAKE_BUILD_TYPE "debug" )
+-else ()
+- set ( CMAKE_BUILD_TYPE "release" )
+ endif ()
+
+ ## Extend Compiler flags based on Processor architecture
diff --git a/dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch b/dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch
new file mode 100644
index 000000000000..56cc79211ff0
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch
@@ -0,0 +1,59 @@
+Index: rocprofiler-rocm-5.0.2/bin/rpl_run.sh
+===================================================================
+--- rocprofiler-rocm-5.0.2.orig/bin/rpl_run.sh
++++ rocprofiler-rocm-5.0.2/bin/rpl_run.sh
+@@ -25,16 +25,16 @@
+ time_stamp=`date +%y%m%d_%H%M%S`
+ BIN_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
+ PKG_DIR=$(dirname $BIN_DIR)
+-ROOT_DIR=$(dirname $PKG_DIR)
+-TT_DIR=$ROOT_DIR/roctracer
++ROOT_DIR=$PKG_DIR
++TT_DIR=$ROOT_DIR
+ RUN_DIR=`pwd`
+ TMP_DIR="/tmp"
+ DATA_DIR="rpl_data_${time_stamp}_$$"
+
+-RPL_PATH=$PKG_DIR/lib
+-TLIB_PATH=$PKG_DIR/tool
+-TTLIB_PATH=$TT_DIR/tool
+-ROCM_LIB_PATH=$ROOT_DIR/lib
++RPL_PATH=$PKG_DIR/@LIB_DIR@
++TLIB_PATH=$PKG_DIR/@LIB_DIR@
++TTLIB_PATH=$TT_DIR/@LIB_DIR@
++ROCM_LIB_PATH=$ROOT_DIR/@LIB_DIR@
+
+ if [ -z "$ROCP_PYTHON_VERSION" ] ; then
+ ROCP_PYTHON_VERSION=python3
+@@ -70,7 +70,7 @@ export ROCP_HSA_INTERCEPT=1
+ # Disabling internal ROC Profiler proxy queue (simple version supported for testing purposes)
+ unset ROCP_PROXY_QUEUE
+ # ROC Profiler metrics definition
+-export ROCP_METRICS=$PKG_DIR/lib/metrics.xml
++export ROCP_METRICS=$PKG_DIR/share/rocprofiler/metrics.xml
+ # Disable AQL-profile read API
+ export AQLPROFILE_READ_API=0
+ # ROC Profiler package path
+@@ -104,7 +104,7 @@ usage() {
+ bin_name=`basename $0`
+ echo "ROCm Profiling Library (RPL) run script, a part of ROCprofiler library package."
+ echo "Full path: $BIN_DIR/$bin_name"
+- echo "Metrics definition: $PKG_DIR/lib/metrics.xml"
++ echo "Metrics definition: $PKG_DIR/share/rocprofiler/metrics.xml"
+ echo ""
+ echo "Usage:"
+ echo " $bin_name [-h] [--list-basic] [--list-derived] [-i <input .txt/.xml file>] [-o <output CSV file>] <app command line>"
+@@ -374,11 +374,11 @@ while [ 1 ] ; do
+ export ROCP_METRICS="$2"
+ elif [ "$1" = "--list-basic" ] ; then
+ export ROCP_INFO=b
+- HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PKG_DIR/tool/ctrl"
++ HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PKG_DIR/bin/ctrl"
+ exit 1
+ elif [ "$1" = "--list-derived" ] ; then
+ export ROCP_INFO=d
+- HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PKG_DIR/tool/ctrl"
++ HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PKG_DIR/bin/ctrl"
+ exit 1
+ elif [ "$1" = "--basenames" ] ; then
+ if [ "$2" = "on" ] ; then
diff --git a/dev-util/rocprofiler/files/rocprofiler-5.1.3-remove-Werror.patch b/dev-util/rocprofiler/files/rocprofiler-5.1.3-remove-Werror.patch
new file mode 100644
index 000000000000..a30d6d6d00a7
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-5.1.3-remove-Werror.patch
@@ -0,0 +1,12 @@
+Index: rocprofiler-rocm-5.1.3/cmake_modules/env.cmake
+===================================================================
+--- rocprofiler-rocm-5.1.3.orig/cmake_modules/env.cmake
++++ rocprofiler-rocm-5.1.3/cmake_modules/env.cmake
+@@ -38,7 +38,6 @@ add_definitions ( -DHSA_DEPRECATED= )
+ ## Linux Compiler options
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
+-set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type" )
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
diff --git a/dev-util/rocprofiler/files/rocprofiler-5.3.3-fix-python3.12-warning.patch b/dev-util/rocprofiler/files/rocprofiler-5.3.3-fix-python3.12-warning.patch
new file mode 100644
index 000000000000..315ae6b880d9
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-5.3.3-fix-python3.12-warning.patch
@@ -0,0 +1,88 @@
+From c503cea17d6619d95c026fcf661333b3a587936b Mon Sep 17 00:00:00 2001
+From: Yiyang Wu <xgreenlandforwyy@gmail.com>
+Date: Sat, 18 May 2024 16:14:43 +0800
+Subject: [PATCH] Fix python3.12 SyntaxWarning: invalid escape sequence
+
+---
+ bin/mem_manager.py | 4 ++--
+ bin/tblextr.py | 18 +++++++++---------
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/bin/mem_manager.py b/bin/mem_manager.py
+index b5bed79..10ca971 100755
+--- a/bin/mem_manager.py
++++ b/bin/mem_manager.py
+@@ -91,7 +91,7 @@ class MemManager:
+ event = rec_vals[2] # 'Name'
+ procid = rec_vals[3] # 'pid'
+ recordid = rec_vals[5] # 'Index'
+- size_ptrn = re.compile(DELIM + 'Size=(\d+)' + DELIM)
++ size_ptrn = re.compile(DELIM + r'Size=(\d+)' + DELIM)
+ filled_ptrn = re.compile('BW=')
+ # query syncronous memcopy API record
+ key = (recordid, procid, 0)
+@@ -129,7 +129,7 @@ class MemManager:
+ event = rec_vals[4] # 'Name'
+ procid = rec_vals[5] # 'pid'
+ recordid = rec_vals[7] # 'Index'
+- size_ptrn = re.compile(DELIM + 'Size=(\d+)' + DELIM)
++ size_ptrn = re.compile(DELIM + r'Size=(\d+)' + DELIM)
+
+ # query syncronous memcopy API record
+ key = (recordid, procid, 0)
+diff --git a/bin/tblextr.py b/bin/tblextr.py
+index 9f4abb4..81d0851 100755
+--- a/bin/tblextr.py
++++ b/bin/tblextr.py
+@@ -112,14 +112,14 @@ def parse_res(infile):
+ if not os.path.isfile(infile): return
+ inp = open(infile, 'r')
+
+- beg_pattern = re.compile("^dispatch\[(\d*)\], (.*) kernel-name\(\"([^\"]*)\"\)")
+- prop_pattern = re.compile("([\w-]+)\((\w+)\)");
+- ts_pattern = re.compile(", time\((\d*),(\d*),(\d*),(\d*)\)")
++ beg_pattern = re.compile(r"^dispatch\[(\d*)\], (.*) kernel-name\(\"([^\"]*)\"\)")
++ prop_pattern = re.compile(r"([\w-]+)\((\w+)\)");
++ ts_pattern = re.compile(r", time\((\d*),(\d*),(\d*),(\d*)\)")
+ # var pattern below matches a variable name and a variable value from a one
+ # line text in the format of for example "WRITE_SIZE (0.2500000000)" or
+ # "GRBM_GUI_ACTIVE (27867)" or "TA_TA_BUSY[0]"
+- var_pattern = re.compile("^\s*([a-zA-Z0-9_]+(?:\[\d+\])?)\s+\((\d+(?:\.\d+)?)\)")
+- pid_pattern = re.compile("pid\((\d*)\)")
++ var_pattern = re.compile(r"^\s*([a-zA-Z0-9_]+(?:\[\d+\])?)\s+\((\d+(?:\.\d+)?)\)")
++ pid_pattern = re.compile(r"pid\((\d*)\)")
+
+ dispatch_number = 0
+ var_table_pid = 0
+@@ -340,7 +340,7 @@ def fill_ext_db(table_name, db, indir, trace_name, api_pid):
+ #############################################################
+ # arguments manipulation routines
+ def get_field(args, field):
+- ptrn1_field = re.compile(r'^.* ' + field + '\(');
++ ptrn1_field = re.compile(r'^.* ' + field + r'\(');
+ ptrn2_field = re.compile(r'\) .*$');
+ ptrn3_field = re.compile(r'\)\)$');
+ (field_name, n) = ptrn1_field.subn('', args, count=1);
+@@ -351,7 +351,7 @@ def get_field(args, field):
+ return (field_name, n)
+
+ def set_field(args, field, val):
+- return re.subn(field + '\(\w+\)([ \)])', field + '(' + str(val) + ')\\1', args, count=1)
++ return re.subn(field + r'\(\w+\)([ \)])', field + '(' + str(val) + ')\\1', args, count=1)
+
+ hsa_patch_data = {}
+ ops_patch_data = {}
+@@ -384,8 +384,8 @@ def fill_api_db(table_name, db, indir, api_name, api_pid, dep_pid, dep_list, dep
+ hip_sync_dev_event_ptrn = re.compile(r'hipDeviceSynchronize')
+ wait_event_ptrn = re.compile(r'WaitEvent|hipStreamSynchronize|hipDeviceSynchronize')
+ hip_stream_wait_write_ptrn = re.compile(r'hipStreamWaitValue64|hipStreamWriteValue64|hipStreamWaitValue32|hipStreamWriteValue32')
+- prop_pattern = re.compile("([\w-]+)\((\w+)\)");
+- beg_pattern = re.compile("^dispatch\[(\d*)\], (.*) kernel-name\(\"([^\"]*)\"\)")
++ prop_pattern = re.compile(r"([\w-]+)\((\w+)\)");
++ beg_pattern = re.compile(r"^dispatch\[(\d*)\], (.*) kernel-name\(\"([^\"]*)\"\)")
+ hip_strm_cr_event_ptrn = re.compile(r'hipStreamCreate')
+ hsa_mcopy_ptrn = re.compile(r'hsa_amd_memory_async_copy')
+ ptrn_fixformat = re.compile(r'(\d+:\d+ \d+:\d+ \w+)\(\s*(.*)\)$')
+--
+2.44.0
+
diff --git a/dev-util/rocprofiler/files/rocprofiler-5.3.3-gentoo-location.patch b/dev-util/rocprofiler/files/rocprofiler-5.3.3-gentoo-location.patch
new file mode 100644
index 000000000000..48e6f6973ac8
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-5.3.3-gentoo-location.patch
@@ -0,0 +1,102 @@
+Index: rocprofiler-rocm-5.3.3/bin/rpl_run.sh
+===================================================================
+--- rocprofiler-rocm-5.3.3.orig/bin/rpl_run.sh
++++ rocprofiler-rocm-5.3.3/bin/rpl_run.sh
+@@ -29,11 +29,12 @@ RUN_DIR=`pwd`
+ TMP_DIR="/tmp"
+ DATA_DIR="rpl_data_${time_stamp}_$$"
+
+-RPL_PATH=$ROOT_DIR/lib
+-TLIB_PATH=$RPL_PATH/rocprofiler
+-TTLIB_PATH=$ROOT_DIR/lib/roctracer
+-ROCM_LIB_PATH=$ROOT_DIR/lib
+-PROF_BIN_DIR=$ROOT_DIR/libexec/rocprofiler
++RPL_PATH=$ROOT_DIR/@LIB_DIR@
++TLIB_PATH=$RPL_PATH
++TTLIB_PATH=$ROOT_DIR/@LIB_DIR@
++ROCM_LIB_PATH=$ROOT_DIR/@LIB_DIR@
++PROF_BIN_DIR=$ROOT_DIR/bin
++PROF_LIBEXEC_DIR=$ROOT_DIR/libexec/rocprofiler
+
+ if [ -z "$ROCP_PYTHON_VERSION" ] ; then
+ ROCP_PYTHON_VERSION=python3
+@@ -69,7 +70,7 @@ export ROCP_HSA_INTERCEPT=1
+ # Disabling internal ROC Profiler proxy queue (simple version supported for testing purposes)
+ unset ROCP_PROXY_QUEUE
+ # ROC Profiler metrics definition
+-export ROCP_METRICS=$TLIB_PATH/metrics.xml
++export ROCP_METRICS=$ROOT_DIR/share/rocprofiler/metrics.xml
+ # Disable AQL-profile read API
+ export AQLPROFILE_READ_API=0
+ # ROC Profiler package path
+@@ -103,7 +104,7 @@ usage() {
+ bin_name=`basename $0`
+ echo "ROCm Profiling Library (RPL) run script, a part of ROCprofiler library package."
+ echo "Full path: $BIN_DIR/$bin_name"
+- echo "Metrics definition: $TLIB_PATH/metrics.xml"
++ echo "Metrics definition: $ROOT_DIR/share/rocprofiler/metrics.xml"
+ echo ""
+ echo "Usage:"
+ echo " $bin_name [-h] [--list-basic] [--list-derived] [-i <input .txt/.xml file>] [-o <output CSV file>] <app command line>"
+@@ -211,7 +212,7 @@ fi
+ # setting ROCM_LIB_PATH
+ set_rocm_lib_path() {
+
+- for ROCM_LIB_PATH in "$ROOT_DIR/lib" "$ROOT_DIR/lib64" ; do
++ for ROCM_LIB_PATH in $TLIB_PATH ; do
+ if [ -d "$ROCM_LIB_PATH" ]; then
+ return 0
+ fi
+@@ -385,11 +386,11 @@ while [ 1 ] ; do
+ export ROCP_METRICS="$2"
+ elif [ "$1" = "--list-basic" ] ; then
+ export ROCP_INFO=b
+- HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$TLIB_PATH/rocprof-ctrl"
++ HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PROF_BIN_DIR/rocprof-ctrl"
+ exit 1
+ elif [ "$1" = "--list-derived" ] ; then
+ export ROCP_INFO=d
+- HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$TLIB_PATH/rocprof-ctrl"
++ HSA_TOOLS_LIB="$MY_HSA_TOOLS_LIB" eval "$PROF_BIN_DIR/rocprof-ctrl"
+ exit 1
+ elif [ "$1" = "--basenames" ] ; then
+ if [ "$2" = "on" ] ; then
+@@ -550,7 +551,7 @@ elif [ "$input_type" = "txt" -o "$input_
+ mkdir -p $RES_DIR
+ echo "RPL: output dir '$RES_DIR'"
+ if [ "$input_type" = "txt" ] ; then
+- $PROF_BIN_DIR/txt2xml.sh $INPUT_FILE $RES_DIR
++ $PROF_LIBEXEC_DIR/txt2xml.sh $INPUT_FILE $RES_DIR
+ else
+ echo "<metric></metric>" > $RES_DIR/input.xml
+ fi
+@@ -582,9 +583,9 @@ if [ -n "$csv_output" ] ; then
+ merge_output $OUTPUT_LIST
+ if [ "$GEN_STATS" = "1" ] ; then
+ db_output=$(echo $csv_output | sed "s/\.csv/.db/")
+- $ROCP_PYTHON_VERSION $PROF_BIN_DIR/tblextr.py $db_output $OUTPUT_LIST
++ $ROCP_PYTHON_VERSION $PROF_LIBEXEC_DIR/tblextr.py $db_output $OUTPUT_LIST
+ else
+- $ROCP_PYTHON_VERSION $PROF_BIN_DIR/tblextr.py $csv_output $OUTPUT_LIST
++ $ROCP_PYTHON_VERSION $PROF_LIBEXEC_DIR/tblextr.py $csv_output $OUTPUT_LIST
+ fi
+ if [ "$?" -ne 0 ] ; then
+ echo "Profiling data corrupted: '$OUTPUT_LIST'" | tee "$ROCPROFILER_SESS/error"
+Index: rocprofiler-rocm-5.3.3/CMakeLists.txt
+===================================================================
+--- rocprofiler-rocm-5.3.3.orig/CMakeLists.txt
++++ rocprofiler-rocm-5.3.3/CMakeLists.txt
+@@ -159,10 +159,10 @@ install ( FILES
+ install ( FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/test/tool/metrics.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/test/tool/gfx_metrics.xml
+- DESTINATION ${CMAKE_INSTALL_LIBDIR}/${DEST_NAME} )
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/${DEST_NAME} )
+ # librocprof-tool.so
+-install ( FILES ${PROJECT_BINARY_DIR}/test/librocprof-tool.so DESTINATION ${CMAKE_INSTALL_LIBDIR}/${DEST_NAME} )
+-install ( FILES ${PROJECT_BINARY_DIR}/test/rocprof-ctrl DESTINATION ${CMAKE_INSTALL_LIBDIR}/${DEST_NAME}
++install ( FILES ${PROJECT_BINARY_DIR}/test/librocprof-tool.so DESTINATION ${CMAKE_INSTALL_LIBDIR} )
++install ( FILES ${PROJECT_BINARY_DIR}/test/rocprof-ctrl DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+
+ # File reorg Backward compatibility
diff --git a/dev-util/rocprofiler/files/rocprofiler-5.3.3-remove-aql-in-cmake.patch b/dev-util/rocprofiler/files/rocprofiler-5.3.3-remove-aql-in-cmake.patch
new file mode 100644
index 000000000000..19619f9606f5
--- /dev/null
+++ b/dev-util/rocprofiler/files/rocprofiler-5.3.3-remove-aql-in-cmake.patch
@@ -0,0 +1,13 @@
+Index: rocprofiler-rocm-5.3.3/cmake_modules/env.cmake
+===================================================================
+--- rocprofiler-rocm-5.3.3.orig/cmake_modules/env.cmake
++++ rocprofiler-rocm-5.3.3/cmake_modules/env.cmake
+@@ -119,8 +119,3 @@ message ( "---------GPU_TARGETS: ${GPU_T
+ if ( "${ROCM_ROOT_DIR}" STREQUAL "" )
+ message ( FATAL_ERROR "ROCM_ROOT_DIR is not found." )
+ endif ()
+-
+-find_library ( FIND_AQL_PROFILE_LIB "libhsa-amd-aqlprofile64.so" HINTS ${CMAKE_INSTALL_PREFIX} PATHS ${ROCM_ROOT_DIR})
+-if ( NOT FIND_AQL_PROFILE_LIB )
+- message ( FATAL_ERROR "AQL_PROFILE not installed. Please install AQL_PROFILE" )
+-endif()
diff --git a/dev-util/rocprofiler/metadata.xml b/dev-util/rocprofiler/metadata.xml
new file mode 100644
index 000000000000..4742f26158a4
--- /dev/null
+++ b/dev-util/rocprofiler/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci@gentoo.org</email>
+ <name>Gentoo Science Project</name>
+ </maintainer>
+ <maintainer type="person" proxied="yes">
+ <email>xgreenlandforwyy@gmail.com</email>
+ <name>Yiyang Wu</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">ROCm/rocprofiler</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-util/rocprofiler/rocprofiler-5.1.3-r1.ebuild b/dev-util/rocprofiler/rocprofiler-5.1.3-r1.ebuild
new file mode 100644
index 000000000000..e63978351e11
--- /dev/null
+++ b/dev-util/rocprofiler/rocprofiler-5.1.3-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..10} )
+
+inherit cmake python-any-r1
+
+DESCRIPTION="Callback/Activity Library for Performance tracing AMD GPU's"
+HOMEPAGE="https://github.com/ROCm-Developer-Tools/roctracer.git"
+SRC_URI="https://github.com/ROCm-Developer-Tools/${PN}/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-rocm-${PV}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+RDEPEND="dev-libs/rocr-runtime:${SLOT}
+ >=dev-util/roctracer-${PV}-r1:${SLOT}
+ "
+DEPEND="${RDEPEND}"
+BDEPEND="
+ $(python_gen_any_dep '
+ dev-python/CppHeaderParser[${PYTHON_USEDEP}]
+ ')
+"
+
+PATCHES=( "${FILESDIR}/${PN}-4.3.0-nostrip.patch"
+ "${FILESDIR}/${PN}-4.3.0-no-aqlprofile.patch"
+ "${FILESDIR}/${PN}-5.0.2-gentoo-location.patch"
+ "${FILESDIR}/${PN}-5.1.3-remove-Werror.patch" )
+
+python_check_deps() {
+ python_has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+ sed -e "s,\${DEST_NAME}/lib,$(get_libdir),g" \
+ -e "s,\${DEST_NAME}/include,include/\${DEST_NAME},g" \
+ -e "s,\${DEST_NAME}/bin,bin,g" \
+ -e "/ctrl DESTINATION/s,\${DEST_NAME}/tool,bin,g" \
+ -e "/CPACK_RESOURCE_FILE_LICENSE/d" \
+ -e "/libtool.so DESTINATION/s,\${DEST_NAME}/tool,$(get_libdir),g" -i CMakeLists.txt || die
+
+ cmake_src_prepare
+
+ sed -e "s,@LIB_DIR@,$(get_libdir),g" -i bin/rpl_run.sh || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DCMAKE_PREFIX_PATH="${EPREFIX}/usr/include/hsa"
+ -DPROF_API_HEADER_PATH="${EPREFIX}"/usr/include/roctracer/ext
+ -DUSE_PROF_API=1
+ )
+
+ cmake_src_configure
+}
diff --git a/dev-util/rocprofiler/rocprofiler-5.3.3-r1.ebuild b/dev-util/rocprofiler/rocprofiler-5.3.3-r1.ebuild
new file mode 100644
index 000000000000..428554f757ab
--- /dev/null
+++ b/dev-util/rocprofiler/rocprofiler-5.3.3-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit cmake python-any-r1
+
+DESCRIPTION="Callback/Activity Library for Performance tracing AMD GPU's"
+HOMEPAGE="https://github.com/ROCm/rocprofiler"
+SRC_URI="https://github.com/ROCm/${PN}/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-rocm-${PV}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+RDEPEND="dev-libs/rocr-runtime
+ dev-util/roctracer
+ "
+DEPEND="${RDEPEND}"
+BDEPEND="
+ $(python_gen_any_dep '
+ dev-python/CppHeaderParser[${PYTHON_USEDEP}]
+ ')
+"
+
+PATCHES=( "${FILESDIR}/${PN}-4.3.0-nostrip.patch"
+ "${FILESDIR}/${PN}-4.3.0-no-aqlprofile.patch"
+ "${FILESDIR}/${PN}-5.1.3-remove-Werror.patch"
+ "${FILESDIR}/${PN}-5.3.3-gentoo-location.patch"
+ "${FILESDIR}/${PN}-5.3.3-fix-python3.12-warning.patch"
+ "${FILESDIR}/${PN}-5.3.3-remove-aql-in-cmake.patch" )
+
+python_check_deps() {
+ python_has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed -e "s,@LIB_DIR@,$(get_libdir),g" -i bin/rpl_run.sh || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_SKIP_RPATH=On
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DCMAKE_PREFIX_PATH="${EPREFIX}/usr/include/hsa"
+ -DPROF_API_HEADER_PATH="${EPREFIX}"/usr/include/roctracer/ext
+ -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ -DUSE_PROF_API=1
+ )
+
+ cmake_src_configure
+}