diff options
author | Yiyang Wu <xgreenlandforwyy@gmail.com> | 2022-05-10 22:45:42 +0800 |
---|---|---|
committer | Benda Xu <heroxbd@gentoo.org> | 2022-06-13 20:00:49 +0800 |
commit | dc49ab61dfce7423b1cd908788a6630aa53b64e3 (patch) | |
tree | 870abe3b46f2b92f577cd986285482f5b60ee3c3 /dev-util | |
parent | dev-util/roctracer: compile tarcer_tool for rocprofiler (diff) | |
download | gentoo-dc49ab61dfce7423b1cd908788a6630aa53b64e3.tar.gz gentoo-dc49ab61dfce7423b1cd908788a6630aa53b64e3.tar.bz2 gentoo-dc49ab61dfce7423b1cd908788a6630aa53b64e3.zip |
dev-util/rocprofiler: initial import
Closes: https://github.com/gentoo/gentoo/pull/25536
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util')
-rw-r--r-- | dev-util/rocprofiler/Manifest | 2 | ||||
-rw-r--r-- | dev-util/rocprofiler/files/rocprofiler-4.3.0-fix-gcc11.patch | 13 | ||||
-rw-r--r-- | dev-util/rocprofiler/files/rocprofiler-4.3.0-gentoo-location.patch | 71 | ||||
-rw-r--r-- | dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch | 59 | ||||
-rw-r--r-- | dev-util/rocprofiler/metadata.xml | 15 | ||||
-rw-r--r-- | dev-util/rocprofiler/rocprofiler-4.3.0.ebuild | 58 | ||||
-rw-r--r-- | dev-util/rocprofiler/rocprofiler-5.0.2.ebuild | 57 |
7 files changed, 275 insertions, 0 deletions
diff --git a/dev-util/rocprofiler/Manifest b/dev-util/rocprofiler/Manifest new file mode 100644 index 000000000000..ad88feaed619 --- /dev/null +++ b/dev-util/rocprofiler/Manifest @@ -0,0 +1,2 @@ +DIST rocprofiler-4.3.0.tar.gz 1402250 BLAKE2B 3826c3b26b0d5838ab3475614c2ecd2265e177fe40b8a90abb491746513bd50841e5ceb34d1fcb4bcb2fbe8a6854b9715d0670d38f08775e5e14cd855f15629b SHA512 e327146604459f2f827ab943a21d0eaa0ee41cf6770ab94dd019d461cf6438e70a48139ce67ec1553d0f450fa5bb233a7ed39438e8bf39b33218d53e2c270d3b +DIST rocprofiler-5.0.2.tar.gz 1401732 BLAKE2B ae870bc50dbd39c11e24f77ccb41773df1107b76cb7a12e1cebc66f8d66ddba6ad3bd6f9fe61657b03b22ef35f88fb608cf6070178f6aab24fe7a1bdcac43a96 SHA512 244e2b827126b7299ec0510daa5e1245a4a5a877394419f8bc9113f443231f67fc935609cbde6eeb26bb138ab4e95e2a88829ffa79ecc8f9881b5a77b5910c02 diff --git a/dev-util/rocprofiler/files/rocprofiler-4.3.0-fix-gcc11.patch b/dev-util/rocprofiler/files/rocprofiler-4.3.0-fix-gcc11.patch new file mode 100644 index 000000000000..0aec99627a4a --- /dev/null +++ b/dev-util/rocprofiler/files/rocprofiler-4.3.0-fix-gcc11.patch @@ -0,0 +1,13 @@ +Index: rocprofiler-rocm-4.3.0/test/ctrl/test_kernel.h +=================================================================== +--- rocprofiler-rocm-4.3.0.orig/test/ctrl/test_kernel.h ++++ rocprofiler-rocm-4.3.0/test/ctrl/test_kernel.h +@@ -23,7 +23,7 @@ THE SOFTWARE. + #ifndef TEST_CTRL_TEST_KERNEL_H_ + #define TEST_CTRL_TEST_KERNEL_H_ + +-#include <string.h> ++#include <string> + #include <stdint.h> + #include <map> + diff --git a/dev-util/rocprofiler/files/rocprofiler-4.3.0-gentoo-location.patch b/dev-util/rocprofiler/files/rocprofiler-4.3.0-gentoo-location.patch new file mode 100644 index 000000000000..b6d8454dfedd --- /dev/null +++ b/dev-util/rocprofiler/files/rocprofiler-4.3.0-gentoo-location.patch @@ -0,0 +1,71 @@ +Index: rocprofiler-rocm-4.3.0/bin/rpl_run.sh +=================================================================== +--- rocprofiler-rocm-4.3.0.orig/bin/rpl_run.sh ++++ rocprofiler-rocm-4.3.0/bin/rpl_run.sh +@@ -25,18 +25,18 @@ + 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@ + +-GFX=`/opt/rocm/bin/rocm_agent_enumerator | tail -1` ++GFX=`rocm_agent_enumerator | tail -1` + + SPM_COUNTERS_FILE="spm_counters.txt" + +@@ -75,7 +75,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 +@@ -109,7 +109,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>" +@@ -270,7 +270,7 @@ run() { + fi + if [ "$KFD_TRACE" = 1 ] ; then + API_TRACE=${API_TRACE}":kfd" +- MY_LD_PRELOAD="$TT_DIR/lib/libkfdwrapper64.so $ROCM_LIB_PATH/libhsakmt.so.1 $MY_LD_PRELOAD" ++ MY_LD_PRELOAD="$TTLIB_PATH/libkfdwrapper64.so $ROCM_LIB_PATH/libhsakmt.so.1 $MY_LD_PRELOAD" + fi + if [ "$HIP_TRACE" = 1 ] ; then + API_TRACE=${API_TRACE}":hip" +@@ -380,11 +380,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.0.2-gentoo-location.patch b/dev-util/rocprofiler/files/rocprofiler-5.0.2-gentoo-location.patch new file mode 100644 index 000000000000..0605675e41c6 --- /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/metadata.xml b/dev-util/rocprofiler/metadata.xml new file mode 100644 index 000000000000..922afe7981b0 --- /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-Developer-Tools/rocprofiler</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-util/rocprofiler/rocprofiler-4.3.0.ebuild b/dev-util/rocprofiler/rocprofiler-4.3.0.ebuild new file mode 100644 index 000000000000..28e57bde66a4 --- /dev/null +++ b/dev-util/rocprofiler/rocprofiler-4.3.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..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:${SLOT} + " +DEPEND="${RDEPEND}" +BDEPEND=" + $(python_gen_any_dep ' + dev-python/CppHeaderParser[${PYTHON_USEDEP}] + ') +" + +PATCHES=( "${FILESDIR}/${P}-fix-gcc11.patch" + "${FILESDIR}/${PN}-4.3.0-gentoo-location.patch" ) + +python_check_deps() { + 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.0.2.ebuild b/dev-util/rocprofiler/rocprofiler-5.0.2.ebuild new file mode 100644 index 000000000000..ff321726622e --- /dev/null +++ b/dev-util/rocprofiler/rocprofiler-5.0.2.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..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:${SLOT} + " +DEPEND="${RDEPEND}" +BDEPEND=" + $(python_gen_any_dep ' + dev-python/CppHeaderParser[${PYTHON_USEDEP}] + ') +" + +PATCHES=( "${FILESDIR}/${PN}-5.0.2-gentoo-location.patch" ) + +python_check_deps() { + 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 +} |