summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@gentoo.org>2019-10-03 11:54:04 -0400
committerCraig Andrews <candrews@gentoo.org>2019-10-03 11:54:18 -0400
commitca51ee6c39978cc45987c2d096e588b17f0a5792 (patch)
treeaf98e40d10026d2692e3b3624e05df5327280344 /dev-libs/rocr-runtime
parentprofiles/: Unmask postgres-12 (diff)
downloadgentoo-ca51ee6c39978cc45987c2d096e588b17f0a5792.tar.gz
gentoo-ca51ee6c39978cc45987c2d096e588b17f0a5792.tar.bz2
gentoo-ca51ee6c39978cc45987c2d096e588b17f0a5792.zip
dev-libs/rocr-runtime: Fix SIGSEGV
Bug: https://github.com/RadeonOpenCompute/ROCR-Runtime/issues/68 Closes: https://bugs.gentoo.org/696108 Package-Manager: Portage-2.3.76, Repoman-2.3.17 Signed-off-by: Craig Andrews <candrews@gentoo.org>
Diffstat (limited to 'dev-libs/rocr-runtime')
-rw-r--r--dev-libs/rocr-runtime/files/rocr-runtime-2.8.0-fix_doorbell_map.patch57
-rw-r--r--dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild38
2 files changed, 95 insertions, 0 deletions
diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-2.8.0-fix_doorbell_map.patch b/dev-libs/rocr-runtime/files/rocr-runtime-2.8.0-fix_doorbell_map.patch
new file mode 100644
index 000000000000..aef3d297034e
--- /dev/null
+++ b/dev-libs/rocr-runtime/files/rocr-runtime-2.8.0-fix_doorbell_map.patch
@@ -0,0 +1,57 @@
+https://github.com/RadeonOpenCompute/ROCR-Runtime/pull/71
+
+From d2a6ad97eb96a28d8f8b658b26ab94e911886cf2 Mon Sep 17 00:00:00 2001
+From: Sean Keely <Sean.Keely@amd.com>
+Date: Thu, 5 Sep 2019 20:58:57 -0500
+Subject: [PATCH] Correct doorbell_queue_map allocation.
+
+doorbell_queue_map should be allocated unconditionally.
+---
+ core/runtime/amd_gpu_agent.cpp | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/core/runtime/amd_gpu_agent.cpp b/core/runtime/amd_gpu_agent.cpp
+index 9b79a6b..76df913 100644
+--- a/core/runtime/amd_gpu_agent.cpp
++++ b/core/runtime/amd_gpu_agent.cpp
+@@ -1182,12 +1182,22 @@ void GpuAgent::SyncClocks() {
+ }
+
+ void GpuAgent::BindTrapHandler() {
++ // Make an empty map from doorbell index to queue.
++ // The trap handler uses this to retrieve a wave's amd_queue_t*.
++ auto doorbell_queue_map_size = MAX_NUM_DOORBELLS * sizeof(amd_queue_t*);
++
++ doorbell_queue_map_ = (amd_queue_t**)core::Runtime::runtime_singleton_->system_allocator()(
++ doorbell_queue_map_size, 0x1000, 0);
++ assert(doorbell_queue_map_ != NULL && "Doorbell queue map allocation failed");
++
++ memset(doorbell_queue_map_, 0, doorbell_queue_map_size);
++
+ if (isa_->GetMajorVersion() == 7) {
+ // No trap handler support on Gfx7, soft error.
+ return;
+ }
+
+- // Disable trap handler on Carrizo until KFD is fixed.
++ // Disable trap handler on APUs until KFD is fixed.
+ if (profile_ == HSA_PROFILE_FULL) {
+ return;
+ }
+@@ -1195,16 +1205,6 @@ void GpuAgent::BindTrapHandler() {
+ // Assemble the trap handler source code.
+ AssembleShader("TrapHandler", AssembleTarget::ISA, trap_code_buf_, trap_code_buf_size_);
+
+- // Make an empty map from doorbell index to queue.
+- // The trap handler uses this to retrieve a wave's amd_queue_t*.
+- auto doorbell_queue_map_size = MAX_NUM_DOORBELLS * sizeof(amd_queue_t*);
+-
+- doorbell_queue_map_ = (amd_queue_t**)core::Runtime::runtime_singleton_->system_allocator()(
+- doorbell_queue_map_size, 0x1000, 0);
+- assert(doorbell_queue_map_ != NULL && "Doorbell queue map allocation failed");
+-
+- memset(doorbell_queue_map_, 0, doorbell_queue_map_size);
+-
+ // Bind the trap handler to this node.
+ HSAKMT_STATUS err = hsaKmtSetTrapHandler(node_id(), trap_code_buf_, trap_code_buf_size_,
+ doorbell_queue_map_, doorbell_queue_map_size);
diff --git a/dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild b/dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild
new file mode 100644
index 000000000000..9a38ed332383
--- /dev/null
+++ b/dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-utils
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCR-Runtime/"
+ inherit git-r3
+ S="${WORKDIR}/${P}/src"
+else
+ SRC_URI="https://github.com/RadeonOpenCompute/ROCR-Runtime/archive/roc-${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/ROCR-Runtime-roc-${PV}/src"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Runtime"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCR-Runtime"
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0.0-cmake-install-paths.patch"
+ "${FILESDIR}/${P}-fix_doorbell_map.patch"
+)
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="nonfree"
+
+COMMON_DEPEND="sys-process/numactl"
+RDEPEND="${COMMON_DEPEND}
+ nonfree? ( dev-libs/hsa-ext-rocr )"
+DEPEND="${COMMON_DEPEND}
+ >=dev-libs/roct-thunk-interface-${PV}"
+
+src_prepare() {
+ sed -e "s:get_version ( \"1.0.0\" ):get_version ( \"${PV}\" ):" -i CMakeLists.txt || die
+ cmake-utils_src_prepare
+}