From 015fdd57022ab7a54e47dafe3e81ffc76e502a90 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 3 Sep 2023 10:18:28 +0100 Subject: gentoo auto-resync : 03:09:2023 - 10:18:27 --- dev-util/rocminfo/Manifest | 3 + .../rocminfo-5.5.1-detect-builtin-amdgpu.patch | 105 +++++++++++++++++++++ dev-util/rocminfo/rocminfo-5.5.1.ebuild | 38 ++++++++ 3 files changed, 146 insertions(+) create mode 100644 dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch create mode 100644 dev-util/rocminfo/rocminfo-5.5.1.ebuild (limited to 'dev-util/rocminfo') diff --git a/dev-util/rocminfo/Manifest b/dev-util/rocminfo/Manifest index f01c852390d4..3101d8b53c21 100644 --- a/dev-util/rocminfo/Manifest +++ b/dev-util/rocminfo/Manifest @@ -1,8 +1,11 @@ AUX rocminfo-5.1.3-detect-builtin-amdgpu.patch 1720 BLAKE2B 990b0bfd101fbe41e7dfda85f88d18763371f7c9cdc46ac10a5c695c45d8e29c08f1444b44524ba0917489b89d4906498c81e9e8d805f5ab9b98e2160a394799 SHA512 c193cc7f72df6cc8d5118f1f55ae184f8d80083aee255efb64762b4f0cc00f2c8973515617630dd8267dc1053cac4d1773683870563c29000eb4fd32a7f54e78 +AUX rocminfo-5.5.1-detect-builtin-amdgpu.patch 3763 BLAKE2B 8d37239cb8e9964bef2e22ea2e1ccfab53cd10247e4a04b4f7ec03c18fa3b1ad2b734169f277fad2cb8d951bee82d71f42ca97c3bd514edd44a65e78a0b82856 SHA512 5b9b4682ac1babe92ce5d86d9a2f2b62a556dbe804da53de2f34af36806b7ba8b53ba1d1eb0b2c446fb834bb91f46d06401f2f79e10f61f7b7b6cc1cf8846d25 DIST rocminfo-5.1.3.tar.gz 16772 BLAKE2B 1b35661f9e6cd8cd5180ef3e4fd3dd8e7d6b282947d25c81b0b8bd347a5bee11cf87d950bbd8adcbd7a8a3053c41622b8e99fc0b56f4a14bdf4acf20992becc7 SHA512 998d499b0ae9a22bde30b2c26e31587a78b5ed63a19649d5b203eb47a044f17d1d4d3e951ec094d5be1ca3ba37efa4b19f5b53047727158170fa90c13a8c7563 DIST rocminfo-5.3.3.tar.gz 16829 BLAKE2B 341908048b9726a22ab5e81317916166d4ba114c5060fd8b7b455e0f4df3857b16a735cfccce2d013cd6632680e29b2e0c9ef91461d46b7e94dc71b0751aa42e SHA512 336a408eb49eb8d40b506f58d62de3fd406d00b0de169bc3f6176c76f1f50366347d212de8783b5c48ae1b6660d307b276ba6b3bac8d8286f5e93cfe739c4dae DIST rocminfo-5.4.3.tar.gz 16832 BLAKE2B 2344b6bd3ffecdfa657559e4d4d8c09de862ebcda287fd67db9864d19aab0a928b071bc43ddd4a24a31037c61500b1bb9697d11b3031c860c5bac77392c664ef SHA512 80221c91f56cd04ba8dcbddd53bb47cb57bb97b74102890a7a43203e9a2fd572762025feb65676774f774a9a5f0d0a1293fc4508fc82d21b6b4042ad92210096 +DIST rocminfo-5.5.1.tar.gz 17020 BLAKE2B 42fdbd32b7092306dc4442910ae922b616c859439511e2acfb17dee32557d77a9731aeb1d7ce25d32ae76f9cafd1e56476ac522545efe516d238d9285fa7b4a3 SHA512 5710979ee885bf35d40b7d07b157226ea4bb84bd14a2c57bdf8c93ca483685a8ce39d01f15b828d015968102457e9a94335a5273524d98eca76d0f8ceed2e8c1 EBUILD rocminfo-5.1.3.ebuild 1008 BLAKE2B 283c059c8c574638ae19d88972d41f7f51b99270c2ba9c8edf5e38e9a546e6e872044ef6685eb51965ccbfcbaad97ea5404e11cc66ed16dd604cde853301dc95 SHA512 f729a8e2c7418e42b96d64294cc6b8b6a1a62f319e4f2e2a67bc9219b698ac47d88b6e95d525c5fba83f9431088011c0ad4b54b859eb08e01d2c2ef5d792c390 EBUILD rocminfo-5.3.3.ebuild 1008 BLAKE2B 283c059c8c574638ae19d88972d41f7f51b99270c2ba9c8edf5e38e9a546e6e872044ef6685eb51965ccbfcbaad97ea5404e11cc66ed16dd604cde853301dc95 SHA512 f729a8e2c7418e42b96d64294cc6b8b6a1a62f319e4f2e2a67bc9219b698ac47d88b6e95d525c5fba83f9431088011c0ad4b54b859eb08e01d2c2ef5d792c390 EBUILD rocminfo-5.4.3.ebuild 1008 BLAKE2B b6762c3b90d65e74c0d770efe37fcf7632c89426b99d174069da219de96a022fae0b5432b9492c93c7921bd2119b7d843d6ad8130ebe596041d209dfea357a2e SHA512 e8aeb732f6331b153cc322a4d554fcaee681c37b1a9386bca280bd8716cf505e14a018274ffae75dc7d74b6d7e92d3774ab35ec3902b84ff19689f7731843a8a +EBUILD rocminfo-5.5.1.ebuild 1014 BLAKE2B 3302e95273bc3c577b14bd977a507e72e3b9ed397517263abfb1b2c23782f54d6ff726387bf798aaf35609c838eeafe18a04f70bb26b20a73cff4bb70138181b SHA512 d2dc4b9810ed7a63d1c04d2751fcfde0192cf85320a71c8187f579dcf90df02369989f6a1cf96b09725c9d79af3d59d39a20760fa5528f8e5b19bf73e277b647 MISC metadata.xml 370 BLAKE2B 25693db5400c16b160c544c9afbf0a093c18cc94164e38fcde05e50cf6cbeef1f4875f59cf83830f8e700a60508b913430208b96518cc9a14c14f036d8152748 SHA512 763bc8e1c7f89ae046514b721ece281146d0b80768f49699ba8f347ff5f8c6a8facb8e6554c0ac0abfb195797acfb51f30f322fe90f6d342320a1d9cb44e1740 diff --git a/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch new file mode 100644 index 000000000000..dd1aefe4df4f --- /dev/null +++ b/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch @@ -0,0 +1,105 @@ +From 3a4d533a1e2a179ad873c480dc4a42ea23681263 Mon Sep 17 00:00:00 2001 +From: Mike Li +Date: Wed, 17 Aug 2022 11:44:09 -0400 +Subject: [PATCH 1/2] Check permission and handle PermissionError exception + +Signed-off-by: Mike Li +Change-Id: If7cb8464d0b761e4be45c85eb7147ceed609da61 +--- + rocm_agent_enumerator | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator +index 6264a5f..ceb9e11 100755 +--- a/rocm_agent_enumerator ++++ b/rocm_agent_enumerator +@@ -195,10 +195,15 @@ def readFromKFD(): + node_path = os.path.join(topology_dir, node) + if os.path.isdir(node_path): + prop_path = node_path + '/properties' +- if os.path.isfile(prop_path): ++ if os.path.isfile(prop_path) and os.access(prop_path, os.R_OK): + target_search_term = re.compile("gfx_target_version.+") + with open(prop_path) as f: +- line = f.readline() ++ try: ++ line = f.readline() ++ except PermissionError: ++ # We may have a subsystem (e.g. scheduler) limiting device visibility which ++ # could cause a permission error. ++ line = '' + while line != '' : + search_result = target_search_term.search(line) + if search_result is not None: + +From 94b4b3f0a66eb70912177ca7076b4267f8b5449b Mon Sep 17 00:00:00 2001 +From: Johannes Dieterich +Date: Mon, 21 Nov 2022 18:09:55 +0000 +Subject: [PATCH 2/2] Fix rocminfo when run within docker environments + +Currently, rocminfo will fail when executed inside a docker container +due to being unable to lsmod inside docker. This has impacts on +rocprofiler use. + +Fix this behavior by querying initstate of the amdgpu module from +/sys/module/amdgpu instead. If initstate is marked "live" everything if +fine - error out with either "not loaded" (initstate file does not +exist) or "not live" (initstate file does not contain "live" string). + +Change-Id: I6f2e9655942fd4cf840fd3f56b7d69e893fa84d7 +--- + rocminfo.cc | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +diff --git a/rocminfo.cc b/rocminfo.cc +index 0842d57..8ed9111 100755 +--- a/rocminfo.cc ++++ b/rocminfo.cc +@@ -51,6 +51,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -1039,16 +1040,33 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { + + int CheckInitialState(void) { + // Check kernel module for ROCk is loaded +- FILE *fd = popen("lsmod | grep amdgpu", "r"); +- char buf[16]; +- if (fread (buf, 1, sizeof (buf), fd) == 0) { ++ ++ std::ifstream amdgpu_initstate("/sys/module/amdgpu/initstate"); ++ if (amdgpu_initstate){ ++ std::stringstream buffer; ++ buffer << amdgpu_initstate.rdbuf(); ++ amdgpu_initstate.close(); ++ ++ std::string line; ++ bool is_live = false; ++ while (std::getline(buffer, line)){ ++ if (line.find( "live" ) != std::string::npos){ ++ is_live = true; ++ break; ++ } ++ } ++ if (is_live){ ++ printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); ++ } else { ++ printf("%sROCk module is NOT live, possibly no GPU devices%s\n", ++ COL_RED, COL_RESET); ++ return -1; ++ } ++ } else { + printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", + COL_RED, COL_RESET); + return -1; +- } else { +- printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); + } +- pclose(fd); + + // Check if user belongs to the group for /dev/kfd (e.g. "video" or + // "render") diff --git a/dev-util/rocminfo/rocminfo-5.5.1.ebuild b/dev-util/rocminfo/rocminfo-5.5.1.ebuild new file mode 100644 index 000000000000..296b859a1fd3 --- /dev/null +++ b/dev-util/rocminfo/rocminfo-5.5.1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +if [[ ${PV} == *9999 ]] ; then + EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocminfo/" + inherit git-r3 +else + SRC_URI="https://github.com/RadeonOpenCompute/rocminfo/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" + S="${WORKDIR}/rocminfo-rocm-${PV}" +fi + +DESCRIPTION="ROCm Application for Reporting System Info" +HOMEPAGE="https://github.com/RadeonOpenCompute/rocminfo" +LICENSE="UoI-NCSA" +SLOT="0/$(ver_cut 1-2)" + +RDEPEND=">=dev-libs/rocr-runtime-${PV}" +DEPEND="${RDEPEND}" + +#PATCHES=( +# "${FILESDIR}/${PN}-5.5.1-detect-builtin-amdgpu.patch" +#) + +src_prepare() { + sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die + sed -e "/num_change_since_prev_pkg(/cset(NUM_COMMITS 0)" -i cmake_modules/utils.cmake || die # Fix QA issue on "git not found" + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( -DROCRTST_BLD_TYPE=Release ) + cmake_src_configure +} -- cgit v1.2.3