Gentoo Archives: gentoo-commits

From: Craig Andrews <candrews@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocr-runtime/files/, dev-libs/rocr-runtime/
Date: Thu, 03 Oct 2019 15:54:30
Message-Id: 1570118058.ca51ee6c39978cc45987c2d096e588b17f0a5792.candrews@gentoo
1 commit: ca51ee6c39978cc45987c2d096e588b17f0a5792
2 Author: Craig Andrews <candrews <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 3 15:54:04 2019 +0000
4 Commit: Craig Andrews <candrews <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 3 15:54:18 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca51ee6c
7
8 dev-libs/rocr-runtime: Fix SIGSEGV
9
10 Bug: https://github.com/RadeonOpenCompute/ROCR-Runtime/issues/68
11 Closes: https://bugs.gentoo.org/696108
12 Package-Manager: Portage-2.3.76, Repoman-2.3.17
13 Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
14
15 .../rocr-runtime-2.8.0-fix_doorbell_map.patch | 57 ++++++++++++++++++++++
16 dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild | 38 +++++++++++++++
17 2 files changed, 95 insertions(+)
18
19 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
20 new file mode 100644
21 index 00000000000..aef3d297034
22 --- /dev/null
23 +++ b/dev-libs/rocr-runtime/files/rocr-runtime-2.8.0-fix_doorbell_map.patch
24 @@ -0,0 +1,57 @@
25 +https://github.com/RadeonOpenCompute/ROCR-Runtime/pull/71
26 +
27 +From d2a6ad97eb96a28d8f8b658b26ab94e911886cf2 Mon Sep 17 00:00:00 2001
28 +From: Sean Keely <Sean.Keely@×××.com>
29 +Date: Thu, 5 Sep 2019 20:58:57 -0500
30 +Subject: [PATCH] Correct doorbell_queue_map allocation.
31 +
32 +doorbell_queue_map should be allocated unconditionally.
33 +---
34 + core/runtime/amd_gpu_agent.cpp | 22 +++++++++++-----------
35 + 1 file changed, 11 insertions(+), 11 deletions(-)
36 +
37 +diff --git a/core/runtime/amd_gpu_agent.cpp b/core/runtime/amd_gpu_agent.cpp
38 +index 9b79a6b..76df913 100644
39 +--- a/core/runtime/amd_gpu_agent.cpp
40 ++++ b/core/runtime/amd_gpu_agent.cpp
41 +@@ -1182,12 +1182,22 @@ void GpuAgent::SyncClocks() {
42 + }
43 +
44 + void GpuAgent::BindTrapHandler() {
45 ++ // Make an empty map from doorbell index to queue.
46 ++ // The trap handler uses this to retrieve a wave's amd_queue_t*.
47 ++ auto doorbell_queue_map_size = MAX_NUM_DOORBELLS * sizeof(amd_queue_t*);
48 ++
49 ++ doorbell_queue_map_ = (amd_queue_t**)core::Runtime::runtime_singleton_->system_allocator()(
50 ++ doorbell_queue_map_size, 0x1000, 0);
51 ++ assert(doorbell_queue_map_ != NULL && "Doorbell queue map allocation failed");
52 ++
53 ++ memset(doorbell_queue_map_, 0, doorbell_queue_map_size);
54 ++
55 + if (isa_->GetMajorVersion() == 7) {
56 + // No trap handler support on Gfx7, soft error.
57 + return;
58 + }
59 +
60 +- // Disable trap handler on Carrizo until KFD is fixed.
61 ++ // Disable trap handler on APUs until KFD is fixed.
62 + if (profile_ == HSA_PROFILE_FULL) {
63 + return;
64 + }
65 +@@ -1195,16 +1205,6 @@ void GpuAgent::BindTrapHandler() {
66 + // Assemble the trap handler source code.
67 + AssembleShader("TrapHandler", AssembleTarget::ISA, trap_code_buf_, trap_code_buf_size_);
68 +
69 +- // Make an empty map from doorbell index to queue.
70 +- // The trap handler uses this to retrieve a wave's amd_queue_t*.
71 +- auto doorbell_queue_map_size = MAX_NUM_DOORBELLS * sizeof(amd_queue_t*);
72 +-
73 +- doorbell_queue_map_ = (amd_queue_t**)core::Runtime::runtime_singleton_->system_allocator()(
74 +- doorbell_queue_map_size, 0x1000, 0);
75 +- assert(doorbell_queue_map_ != NULL && "Doorbell queue map allocation failed");
76 +-
77 +- memset(doorbell_queue_map_, 0, doorbell_queue_map_size);
78 +-
79 + // Bind the trap handler to this node.
80 + HSAKMT_STATUS err = hsaKmtSetTrapHandler(node_id(), trap_code_buf_, trap_code_buf_size_,
81 + doorbell_queue_map_, doorbell_queue_map_size);
82
83 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
84 new file mode 100644
85 index 00000000000..9a38ed33238
86 --- /dev/null
87 +++ b/dev-libs/rocr-runtime/rocr-runtime-2.8.0-r1.ebuild
88 @@ -0,0 +1,38 @@
89 +# Copyright 1999-2019 Gentoo Authors
90 +# Distributed under the terms of the GNU General Public License v2
91 +
92 +EAPI=7
93 +
94 +inherit cmake-utils
95 +
96 +if [[ ${PV} == *9999 ]] ; then
97 + EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCR-Runtime/"
98 + inherit git-r3
99 + S="${WORKDIR}/${P}/src"
100 +else
101 + SRC_URI="https://github.com/RadeonOpenCompute/ROCR-Runtime/archive/roc-${PV}.tar.gz -> ${P}.tar.gz"
102 + S="${WORKDIR}/ROCR-Runtime-roc-${PV}/src"
103 + KEYWORDS="~amd64"
104 +fi
105 +
106 +DESCRIPTION="Radeon Open Compute Runtime"
107 +HOMEPAGE="https://github.com/RadeonOpenCompute/ROCR-Runtime"
108 +PATCHES=(
109 + "${FILESDIR}/${PN}-2.0.0-cmake-install-paths.patch"
110 + "${FILESDIR}/${P}-fix_doorbell_map.patch"
111 +)
112 +
113 +LICENSE="MIT"
114 +SLOT="0/$(ver_cut 1-2)"
115 +IUSE="nonfree"
116 +
117 +COMMON_DEPEND="sys-process/numactl"
118 +RDEPEND="${COMMON_DEPEND}
119 + nonfree? ( dev-libs/hsa-ext-rocr )"
120 +DEPEND="${COMMON_DEPEND}
121 + >=dev-libs/roct-thunk-interface-${PV}"
122 +
123 +src_prepare() {
124 + sed -e "s:get_version ( \"1.0.0\" ):get_version ( \"${PV}\" ):" -i CMakeLists.txt || die
125 + cmake-utils_src_prepare
126 +}