Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/rocminfo/, dev-util/rocminfo/files/
Date: Sat, 06 Aug 2022 14:23:18
Message-Id: 1659795615.976187a0664388a0f03b3c2ef8b5434bc594c8ad.heroxbd@gentoo
1 commit: 976187a0664388a0f03b3c2ef8b5434bc594c8ad
2 Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Sat Jun 25 10:56:55 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 6 14:20:15 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=976187a0
7
8 dev-util/rocminfo: add 5.1.3
9
10 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
11 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
12
13 dev-util/rocminfo/Manifest | 1 +
14 .../rocminfo-5.1.3-detect-builtin-amdgpu.patch | 50 ++++++++++++++++++++++
15 dev-util/rocminfo/rocminfo-5.1.3.ebuild | 31 ++++++++++++++
16 3 files changed, 82 insertions(+)
17
18 diff --git a/dev-util/rocminfo/Manifest b/dev-util/rocminfo/Manifest
19 index 6c5dce60e7f1..6c2df6b0a95e 100644
20 --- a/dev-util/rocminfo/Manifest
21 +++ b/dev-util/rocminfo/Manifest
22 @@ -7,3 +7,4 @@ DIST rocminfo-4.1.0.tar.gz 15379 BLAKE2B dcf7a663792538dbe5c02fbc9e5874d1e716f29
23 DIST rocminfo-4.2.0.tar.gz 15379 BLAKE2B a76dd3f0d550d5b8a8c39454ef44d5f0a76ad24e4a3b75a9fd2a1b0d4d983a02a877c0eb4d2e4158f9c8c97602b52a2de9a1f535fad609a52e8cad48c4c8a833 SHA512 801c29ae88878b9448ad2f2c9faaa7ffba3a46c77887bebf2fa8d3db7e9258fb4678cf2b898ddfc88a34fcc0fdcc91c9aa2f4a1509eeb05db6a7b085ae28f3dc
24 DIST rocminfo-4.3.0.tar.gz 15379 BLAKE2B 86683d8e88d26a8730cf84b3a1d4f69231ff7158186ca6b867b5a029ae485978cf0d67db2b07c05c046bb300b55b6e80e280b9429cef903e3077dc1da0945b8d SHA512 88b7f1ad86e76ede270d12fc3065eba192fcf3938d749b8345dac3b71be0985071dc5139a801ff46015369cd09b3eefcd8ff9ea71ab297476dda195f57792849
25 DIST rocminfo-5.0.2.tar.gz 15767 BLAKE2B 4617e4df51cc0b02d1743e655491600510e4f9fc22ef47612aa69bc311e7dc3979b0063c650d9a4fee0124be404b92c110dc9db056a554ee25ba3d4bfd12f618 SHA512 dd02837e621a414b54ef50b52ca816509ffa8b613e7de5f8b09449c5fc543dee054860a2245462008f687683af48203b6d2080fe71bf6e3654981d6bfd56e254
26 +DIST rocminfo-5.1.3.tar.gz 16772 BLAKE2B 1b35661f9e6cd8cd5180ef3e4fd3dd8e7d6b282947d25c81b0b8bd347a5bee11cf87d950bbd8adcbd7a8a3053c41622b8e99fc0b56f4a14bdf4acf20992becc7 SHA512 998d499b0ae9a22bde30b2c26e31587a78b5ed63a19649d5b203eb47a044f17d1d4d3e951ec094d5be1ca3ba37efa4b19f5b53047727158170fa90c13a8c7563
27
28 diff --git a/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch
29 new file mode 100644
30 index 000000000000..5d0b2ed284bd
31 --- /dev/null
32 +++ b/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch
33 @@ -0,0 +1,50 @@
34 +/sys/module/amdgpu instead of lsmod for builtin amdgpu kernel module
35 +
36 +https://github.com/RadeonOpenCompute/rocminfo/pull/43
37 +https://github.com/RadeonOpenCompute/rocminfo/issues/42
38 +From ea4f017ed035928b1970e2589b02ec9b348c863e Mon Sep 17 00:00:00 2001
39 +From: YiyangWu <xgreenlandforwyy@×××××.com>
40 +Date: Wed, 18 Aug 2021 21:05:20 +0800
41 +Subject: [PATCH] Check /sys/module/amdgpu for ROCk instead of lsmod
42 +
43 +Closes: #42
44 +
45 +Signed-off-by: YiyangWu <xgreenlandforwyy@×××××.com>
46 +---
47 + rocminfo.cc | 10 ++++++----
48 + 1 file changed, 6 insertions(+), 4 deletions(-)
49 +
50 +diff --git a/rocminfo.cc b/rocminfo.cc
51 +index 871f406..58c847d 100755
52 +--- a/rocminfo.cc
53 ++++ b/rocminfo.cc
54 +@@ -995,6 +995,8 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) {
55 + err = AcquireAgentInfo(agent, &agent_i);
56 + RET_IF_HSA_ERR(err);
57 +
58 ++ std::string ind(kIndentSize, ' ');
59 ++
60 + printLabel("*******", true);
61 + std::string agent_ind("Agent ");
62 + agent_ind += std::to_string(*agent_number).c_str();
63 +@@ -1031,16 +1033,16 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) {
64 +
65 + int CheckInitialState(void) {
66 + // Check kernel module for ROCk is loaded
67 +- FILE *fd = popen("lsmod | grep amdgpu", "r");
68 +- char buf[16];
69 +- if (fread (buf, 1, sizeof (buf), fd) == 0) {
70 ++ int module_dir;
71 ++ module_dir = open("/sys/module/amdgpu", O_DIRECTORY);
72 ++ if (module_dir < 0) {
73 + printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
74 + COL_RED, COL_RESET);
75 + return -1;
76 + } else {
77 + printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET);
78 ++ close(module_dir);
79 + }
80 +- pclose(fd);
81 +
82 + // Check if user belongs to the group for /dev/kfd (e.g. "video" or
83 + // "render")
84
85 diff --git a/dev-util/rocminfo/rocminfo-5.1.3.ebuild b/dev-util/rocminfo/rocminfo-5.1.3.ebuild
86 new file mode 100644
87 index 000000000000..c090c863e060
88 --- /dev/null
89 +++ b/dev-util/rocminfo/rocminfo-5.1.3.ebuild
90 @@ -0,0 +1,31 @@
91 +# Copyright 1999-2022 Gentoo Authors
92 +# Distributed under the terms of the GNU General Public License v2
93 +
94 +EAPI=8
95 +
96 +inherit cmake
97 +
98 +if [[ ${PV} == *9999 ]] ; then
99 + EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocminfo/"
100 + inherit git-r3
101 +else
102 + SRC_URI="https://github.com/RadeonOpenCompute/rocminfo/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
103 + KEYWORDS="~amd64"
104 + S="${WORKDIR}/rocminfo-rocm-${PV}"
105 +fi
106 +
107 +DESCRIPTION="ROCm Application for Reporting System Info"
108 +HOMEPAGE="https://github.com/RadeonOpenCompute/rocminfo"
109 +LICENSE="UoI-NCSA"
110 +SLOT="0/$(ver_cut 1-2)"
111 +
112 +RDEPEND=">=dev-libs/rocr-runtime-${PV}"
113 +DEPEND="${RDEPEND}"
114 +
115 +PATCHES=("${FILESDIR}/${PN}-5.1.3-detect-builtin-amdgpu.patch")
116 +
117 +src_prepare() {
118 + sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die
119 + sed -e "/num_change_since_prev_pkg(/cset(NUM_COMMITS 0)" -i cmake_modules/utils.cmake || die # Fix QA issue on "git not found"
120 + cmake_src_prepare
121 +}