public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Benda XU" <heroxbd@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/roctracer/, dev-util/roctracer/files/
Date: Tue, 31 Jan 2023 14:18:42 +0000 (UTC)	[thread overview]
Message-ID: <1675174705.8d85fce7add919ffa04f44b0e1b148eec6f7c471.heroxbd@gentoo> (raw)

commit:     8d85fce7add919ffa04f44b0e1b148eec6f7c471
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Jan 27 13:57:24 2023 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 14:18:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d85fce7

dev-util/roctracer: add 5.3.3

Add myself as maintainer; use rocm.eclass to enable test.

All tests passed on gfx1031

Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/roctracer/Manifest                        |  1 +
 ...roctracer-5.3.3-do-not-install-test-files.patch | 37 +++++++++++++
 .../files/roctracer-5.3.3-flat-lib-layout.patch    | 34 ++++++++++++
 .../files/roctracer-5.3.3-rocm-path.patch          | 12 ++++
 dev-util/roctracer/metadata.xml                    |  4 ++
 dev-util/roctracer/roctracer-5.3.3.ebuild          | 64 ++++++++++++++++++++++
 6 files changed, 152 insertions(+)

diff --git a/dev-util/roctracer/Manifest b/dev-util/roctracer/Manifest
index 890787a739ee..26b776a9f8a0 100644
--- a/dev-util/roctracer/Manifest
+++ b/dev-util/roctracer/Manifest
@@ -1,5 +1,6 @@
 DIST hsa-class-f8b3870.tar.gz 37432 BLAKE2B c2a09e4a4c3708e8db432378874c63b9cefefb567ad19a9c17181ed2b60f38d0591a618f72b11f606eb44efc5e170adaf72f0ec1b93cde628ca2230a62e2d6de SHA512 f371a955bf59b7e0af07261981a6e68562fad0753d3f39d1e220034c17501abf839ed2fd88fbf376d659970395c8795a82c0560c7ed8d3b87c11c79864f5f612
 DIST rocm-tracer-5.0.2.tar.gz 474669 BLAKE2B b350111590140e1282338e4f134caf6228677c49361ceb9bc7ba0da8709346daa4fd014644c04adff0e903dba6014a84edd2eb3a5c132a8f91b479e4d5b085e5 SHA512 3fc1449cc9c9bf83e5233a7a0e83c0e3fa9da225d5ee4427b7d6fa15e3580497e1b9fbcd63892e4a99df01582aecd3ccfd66d2a19af2d8c25949ee705894ea44
 DIST rocm-tracer-5.1.3.tar.gz 511617 BLAKE2B 4142979b3b7d649798a7ac0b2a04b42aa7fbcbf82f2cf51b0e5363ec0da538046d6e59283d0ce1bfd341317bf24ac2f694d5c8a7d1f132f9b21caea5caf7eda3 SHA512 e73b0c921ffbdcac571d8b0825de39bd8a4fd5f2720ecdd0c189951db85efb607a0b1cd7a9bb02b3dbf329b277cb5e197525216a8e8927eea4e6ce290b7e7c7b
+DIST rocm-tracer-5.3.3.tar.gz 353041 BLAKE2B b7614707ae3af2f5a46d058dacadfb0ef3b980963ac49face66a80c8396e66cf13e0430ab41737ba15e163f5da03697376b13238ea1decfe7ee4a7f31c7664a5 SHA512 95a202f76f6b68a35942750233bd09d372a9be843150d7ec02824da13c6b9a7c8da7a752ac69f66776e7ccfb6176473745dc46a7baadfe77c99c0596fbc2ffeb
 DIST rocprofiler-5.0.2.tar.gz 1401732 BLAKE2B ae870bc50dbd39c11e24f77ccb41773df1107b76cb7a12e1cebc66f8d66ddba6ad3bd6f9fe61657b03b22ef35f88fb608cf6070178f6aab24fe7a1bdcac43a96 SHA512 244e2b827126b7299ec0510daa5e1245a4a5a877394419f8bc9113f443231f67fc935609cbde6eeb26bb138ab4e95e2a88829ffa79ecc8f9881b5a77b5910c02
 DIST rocprofiler-5.1.3.tar.gz 1402172 BLAKE2B 16e9b127ede94a3f96056e84a2942b6c9f3aec90579fb12796ab8ba385160aa020e3dc77f7a475dadbc0a813a823ae733ca9560f6a09e55c4c82b13dd792dfa4 SHA512 6e9932a425eaaa2a1e1741280d7525c6360700f85edb3bcf4967fe9be4fed662bae0d2ba609701f0d9733769c340e93e32076024b27bab3303449c1d68d9e1ce

diff --git a/dev-util/roctracer/files/roctracer-5.3.3-do-not-install-test-files.patch b/dev-util/roctracer/files/roctracer-5.3.3-do-not-install-test-files.patch
new file mode 100644
index 000000000000..ac3e53c1f405
--- /dev/null
+++ b/dev-util/roctracer/files/roctracer-5.3.3-do-not-install-test-files.patch
@@ -0,0 +1,37 @@
+Remove all install commands for test
+===================================================================
+--- roctracer-rocm-5.3.3.orig/test/CMakeLists.txt
++++ roctracer-rocm-5.3.3/test/CMakeLists.txt
+@@ -87,7 +87,6 @@ function(generate_hsaco TARGET_ID INPUT_
+     DEPENDS ${INPUT_FILE} clang
+     COMMENT "Building ${OUTPUT_FILE}..."
+     VERBATIM)
+-  install(FILES ${PROJECT_BINARY_DIR}/${OUTPUT_FILE} DESTINATION test/${PROJECT_NAME} COMPONENT tests)
+   set(HSACO_TARGET_LIST ${HSACO_TARGET_LIST} ${PROJECT_BINARY_DIR}/${OUTPUT_FILE} PARENT_SCOPE)
+ endfunction(generate_hsaco)
+ 
+@@ -150,24 +149,10 @@ add_dependencies(mytest dlopen)
+ ## Copy the golden traces and test scripts
+ configure_file(run.sh ${PROJECT_BINARY_DIR} COPYONLY)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink run.sh ${PROJECT_BINARY_DIR}/run_ci.sh)
+-install(PROGRAMS ${PROJECT_BINARY_DIR}/run.sh DESTINATION test/${PROJECT_NAME} COMPONENT tests)
+ 
+ configure_file(${PROJECT_SOURCE_DIR}/script/check_trace.py ${PROJECT_BINARY_DIR}/test/check_trace.py COPYONLY)
+-install(PROGRAMS ${PROJECT_BINARY_DIR}/test/check_trace.py DESTINATION test/${PROJECT_NAME}/test COMPONENT tests)
+ 
+ file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "golden_traces/tests_trace_cmp_levels.txt" "golden_traces/*_trace.txt")
+ foreach(file ${files})
+   configure_file(${file} ${PROJECT_BINARY_DIR}/test/${file} COPYONLY)
+ endforeach()
+-install(DIRECTORY ${PROJECT_BINARY_DIR}/test/golden_traces DESTINATION test/${PROJECT_NAME}/test COMPONENT tests)
+-
+-# install all executables
+-set(all_executables)
+-get_property(all_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
+-foreach(target IN LISTS all_targets)
+-  get_target_property(target_type ${target} TYPE)
+-  if (target_type STREQUAL "EXECUTABLE")
+-    list(APPEND all_executables ${target})
+-  endif()
+-endforeach()
+-install(TARGETS ${all_executables} DESTINATION test/${PROJECT_NAME}/test COMPONENT tests)

diff --git a/dev-util/roctracer/files/roctracer-5.3.3-flat-lib-layout.patch b/dev-util/roctracer/files/roctracer-5.3.3-flat-lib-layout.patch
new file mode 100644
index 000000000000..46c8d1a168b8
--- /dev/null
+++ b/dev-util/roctracer/files/roctracer-5.3.3-flat-lib-layout.patch
@@ -0,0 +1,34 @@
+Install libs directly into /usr/lib64
+===================================================================
+Index: roctracer-rocm-5.3.3/src/CMakeLists.txt
+===================================================================
+--- roctracer-rocm-5.3.3.orig/src/CMakeLists.txt
++++ roctracer-rocm-5.3.3/src/CMakeLists.txt
+@@ -215,12 +215,12 @@ target_include_directories(roctracer_too
+ target_link_libraries(roctracer_tool util roctracer hsa-runtime64::hsa-runtime64 stdc++fs Threads::Threads atomic dl)
+ target_link_options(roctracer_tool PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/tracer_tool/exportmap -Wl,--no-undefined)
+ 
+-install(TARGETS roctracer_tool LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT runtime)
++install(TARGETS roctracer_tool LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime)
+ 
+ add_library(hip_stats SHARED hip_stats/hip_stats.cpp)
+ target_compile_definitions(hip_stats PRIVATE __HIP_PLATFORM_AMD__)
+ target_link_libraries(hip_stats roctracer stdc++fs)
+-install(TARGETS hip_stats LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} COMPONENT runtime)
++install(TARGETS hip_stats LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime)
+ 
+ endif()
+ 
+Index: roctracer-rocm-5.3.3/plugin/file/CMakeLists.txt
+===================================================================
+--- roctracer-rocm-5.3.3.orig/plugin/file/CMakeLists.txt
++++ roctracer-rocm-5.3.3/plugin/file/CMakeLists.txt
+@@ -38,5 +38,5 @@ target_link_options(file_plugin PRIVATE
+ target_link_libraries(file_plugin PRIVATE util roctracer hsa-runtime64::hsa-runtime64 stdc++fs)
+ 
+ install(TARGETS file_plugin LIBRARY
+-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
+-        COMPONENT runtime)
+\ No newline at end of file
++        DESTINATION ${CMAKE_INSTALL_LIBDIR}
++        COMPONENT runtime)

diff --git a/dev-util/roctracer/files/roctracer-5.3.3-rocm-path.patch b/dev-util/roctracer/files/roctracer-5.3.3-rocm-path.patch
new file mode 100644
index 000000000000..d8cc792b4dbb
--- /dev/null
+++ b/dev-util/roctracer/files/roctracer-5.3.3-rocm-path.patch
@@ -0,0 +1,12 @@
+Append flags for clang to recognize device lib path
+===================================================================
+--- roctracer-rocm-5.3.3.orig/test/CMakeLists.txt
++++ roctracer-rocm-5.3.3/test/CMakeLists.txt
+@@ -80,6 +80,7 @@ add_dependencies(mytest codeobj_test)
+ function(generate_hsaco TARGET_ID INPUT_FILE OUTPUT_FILE)
+   separate_arguments(CLANG_ARG_LIST UNIX_COMMAND
+     "-O2 -x cl -Xclang -finclude-default-header -cl-denorms-are-zero -cl-std=CL2.0 -Wl,--build-id=sha1
++    --rocm-path=@GENTOO_PORTAGE_EPREFIX@/usr --rocm-device-lib-path=@GENTOO_PORTAGE_EPREFIX@/usr/lib/amdgcn/bitcode
+     -target amdgcn-amd-amdhsa -mcpu=${TARGET_ID} -o ${OUTPUT_FILE} ${INPUT_FILE}")
+   add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${OUTPUT_FILE}
+     COMMAND clang ${CLANG_ARG_LIST}

diff --git a/dev-util/roctracer/metadata.xml b/dev-util/roctracer/metadata.xml
index 899809591942..1d728a2f4ec4 100644
--- a/dev-util/roctracer/metadata.xml
+++ b/dev-util/roctracer/metadata.xml
@@ -9,6 +9,10 @@
     <email>candrews@gentoo.org</email>
     <name>Craig Andrews</name>
   </maintainer>
+  <maintainer type="person" proxied="yes">
+    <email>xgreenlandforwyy@gmail.com</email>
+    <name>Yiyang Wu</name>
+  </maintainer>
   <maintainer type="person" proxied="yes">
     <email>gentoo@holzke.net</email>
     <name>Wilfried Holzke</name>

diff --git a/dev-util/roctracer/roctracer-5.3.3.ebuild b/dev-util/roctracer/roctracer-5.3.3.ebuild
new file mode 100644
index 000000000000..a053427379df
--- /dev/null
+++ b/dev-util/roctracer/roctracer-5.3.3.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+
+ROCM_VERSION=${PV}
+
+inherit cmake prefix python-any-r1 rocm
+
+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/roctracer/archive/rocm-${PV}.tar.gz -> rocm-tracer-${PV}.tar.gz"
+S="${WORKDIR}/roctracer-rocm-${PV}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="dev-libs/rocr-runtime:${SLOT}
+	dev-util/hip:${SLOT}"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	$(python_gen_any_dep '
+	dev-python/CppHeaderParser[${PYTHON_USEDEP}]
+	dev-python/ply[${PYTHON_USEDEP}]
+	')
+"
+
+PATCHES=( "${FILESDIR}"/roctracer-5.3.3-flat-lib-layout.patch
+	"${FILESDIR}"/roctracer-5.3.3-do-not-install-test-files.patch )
+
+python_check_deps() {
+	python_has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]" \
+		"dev-python/ply[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+	cmake_src_prepare
+
+	hprefixify script/*.py
+	eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.3.3-rocm-path.patch)
+}
+
+src_configure() {
+	export ROCM_PATH="$(hipconfig -p)"
+	local mycmakeargs=(
+		-DCMAKE_MODULE_PATH="${EPREFIX}/usr/lib64/cmake/hip"
+		-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+		-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
+	)
+
+	cmake_src_configure
+}
+
+src_test() {
+	check_amdgpu
+	cd "${BUILD_DIR}" || die
+	# if LD_LIBRARY_PATH not set, dlopen cannot find correct lib
+	LD_LIBRARY_PATH="${EPREFIX}"/usr/lib64 bash run.sh || die
+}


             reply	other threads:[~2023-01-31 14:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 14:18 Benda XU [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13  8:38 [gentoo-commits] repo/gentoo:master commit in: dev-util/roctracer/, dev-util/roctracer/files/ Sam James
2025-01-05 21:49 Sam James
2023-02-01  9:53 Andreas Sturmlechner
2022-08-08  1:38 Benda XU
2022-05-01 14:43 Benda XU
2021-10-30 16:47 David Seifert
2021-01-24  7:43 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1675174705.8d85fce7add919ffa04f44b0e1b148eec6f7c471.heroxbd@gentoo \
    --to=heroxbd@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox