From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 028D2158041 for ; Fri, 8 Mar 2024 19:22:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9443E29D0; Fri, 8 Mar 2024 19:22:53 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AE0B5E29CA for ; Fri, 8 Mar 2024 19:22:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 95E2D33BE42 for ; Fri, 8 Mar 2024 19:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E6B10119 for ; Fri, 8 Mar 2024 19:22:50 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1709925715.3748b8bb7dae574634a74d7144a4d50be62dc4e3.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocr-runtime/files/, dev-libs/rocr-runtime/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-extend-isa-compatibility-check.patch dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild X-VCS-Directories: dev-libs/rocr-runtime/ dev-libs/rocr-runtime/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3748b8bb7dae574634a74d7144a4d50be62dc4e3 X-VCS-Branch: master Date: Fri, 8 Mar 2024 19:22:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: cc150cb4-f396-4f94-8561-4880b520420f X-Archives-Hash: ff4807becab8b62d16c26e11d3a47c12 commit: 3748b8bb7dae574634a74d7144a4d50be62dc4e3 Author: Sv. Lockal gmail com> AuthorDate: Fri Oct 20 22:01:19 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Mar 8 19:21:55 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3748b8bb dev-libs/rocr-runtime: add extend-isa-compatibility-check patch Signed-off-by: Sv. Lockal gmail.com> Signed-off-by: Sam James gentoo.org> ...time-5.7.1-extend-isa-compatibility-check.patch | 73 ++++++++++++++++++++++ dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild | 1 + 2 files changed, 74 insertions(+) diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-extend-isa-compatibility-check.patch b/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-extend-isa-compatibility-check.patch new file mode 100644 index 000000000000..b12352e40c92 --- /dev/null +++ b/dev-libs/rocr-runtime/files/rocr-runtime-5.7.1-extend-isa-compatibility-check.patch @@ -0,0 +1,73 @@ +Combined with matching changes within hip ebuild, this patch allows +to load compatible kernels whenever possible. +For example if AMDGPU_TARGETS is set to gfx1030 and some application +was started on gfx1036, it loads gfx1030 kernel. + +Author: Cordell Bloor +https://salsa.debian.org/rocm-team/rocr-runtime/-/blob/master/debian/patches/0004-extend-isa-compatibility-check.patch +--- src/core/runtime/isa.cpp ++++ src/core/runtime/isa.cpp +@@ -43,6 +43,7 @@ + #include "core/inc/isa.h" + + #include ++#include + #include + #include + #include +@@ -69,13 +70,53 @@ bool Wavefront::GetInfo( + } + } + ++template ++static bool Contains(const std::array& arr, const T& value) { ++ return std::find(std::begin(arr), std::end(arr), value) != std::end(arr); ++} ++ ++static bool IsVersionCompatible(const Isa &code_object_isa, ++ const Isa &agent_isa) { ++ if (code_object_isa.GetMajorVersion() == agent_isa.GetMajorVersion() && ++ code_object_isa.GetMinorVersion() == agent_isa.GetMinorVersion()) { ++ ++ if (code_object_isa.GetStepping() == agent_isa.GetStepping()) { ++ return true; // exact match ++ } ++ ++ // the processor and code object may sometimes be compatible if ++ // they differ only by stepping version ++ if (code_object_isa.GetMajorVersion() == 9 && ++ code_object_isa.GetMinorVersion() == 0) { ++ const std::array gfx900_equivalent = { 0, 2, 9, 12 }; ++ const std::array gfx900_superset = { 0, 2, 6, 9, 12 }; ++ if (Contains(gfx900_equivalent, code_object_isa.GetStepping()) && ++ Contains(gfx900_superset, agent_isa.GetStepping())) { ++ return true; // gfx900 compatible ++ } ++ } else if (code_object_isa.GetMajorVersion() == 10) { ++ if (code_object_isa.GetMinorVersion() == 1) { ++ const std::array gfx1010_equivalent = { 0, 2 }; ++ const std::array gfx1010_superset = { 0, 1, 2, 3 }; ++ if (Contains(gfx1010_equivalent, code_object_isa.GetStepping()) && ++ Contains(gfx1010_superset, agent_isa.GetStepping())) { ++ return true; // gfx1010 compatible ++ } ++ } else if (code_object_isa.GetMinorVersion() == 3) { ++ return true; // gfx1030 compatible ++ } ++ } ++ } ++ ++ return false; ++} ++ + /* static */ + bool Isa::IsCompatible(const Isa &code_object_isa, + const Isa &agent_isa) { +- if (code_object_isa.GetVersion() != agent_isa.GetVersion()) ++ if (!IsVersionCompatible(code_object_isa, agent_isa)) + return false; + +- assert(code_object_isa.IsSrameccSupported() == agent_isa.IsSrameccSupported() && agent_isa.GetSramecc() != IsaFeature::Any); + if ((code_object_isa.GetSramecc() == IsaFeature::Enabled || + code_object_isa.GetSramecc() == IsaFeature::Disabled) && + code_object_isa.GetSramecc() != agent_isa.GetSramecc()) diff --git a/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild b/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild index 840a1949b160..7cac2db83745 100644 --- a/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild +++ b/dev-libs/rocr-runtime/rocr-runtime-5.7.1-r1.ebuild @@ -21,6 +21,7 @@ DESCRIPTION="Radeon Open Compute Runtime" HOMEPAGE="https://github.com/RadeonOpenCompute/ROCR-Runtime" PATCHES=( "${FILESDIR}/${PN}-4.3.0_no-aqlprofiler.patch" + "${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch" ) LICENSE="MIT"