commit:     794758cd9e9393bccfddf89d160810220a5913df
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Feb 10 03:53:33 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 10 04:25:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=794758cd

dev-libs/rocm-opencl-runtime: fix rocclr compile issue

Due to bbff88f734f62381b0a0624b4b2d182a8d4b8589, /usr/include/hsa.h is
gone, so backport patch for rocclr to fix compile error.

Also remove the unused prefix.eclass inherit

Closes: https://bugs.gentoo.org/893602
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/rocclr-5.3.3-fix-include.patch           | 218 +++++++++++++++++++++
 .../rocm-opencl-runtime-5.3.3-r1.ebuild            |   3 +-
 .../rocm-opencl-runtime-5.3.3.ebuild               | 122 ------------
 3 files changed, 220 insertions(+), 123 deletions(-)

diff --git a/dev-libs/rocm-opencl-runtime/files/rocclr-5.3.3-fix-include.patch 
b/dev-libs/rocm-opencl-runtime/files/rocclr-5.3.3-fix-include.patch
new file mode 100644
index 000000000000..e014fe374bec
--- /dev/null
+++ b/dev-libs/rocm-opencl-runtime/files/rocclr-5.3.3-fix-include.patch
@@ -0,0 +1,218 @@
+For https://bugs.gentoo.org/893602
+==================================
+From 197ea6f76f34e0b3c8ab46d96c2fa5014e467e37 Mon Sep 17 00:00:00 2001
+From: Maneesh Gupta <maneesh.gu...@amd.com>
+Date: Fri, 5 Aug 2022 05:42:39 +0000
+Subject: [PATCH] SWDEV-350289 - Fix build warnings due to file re-org
+
+Change-Id: I0066fa163b9f25fdde4c5b3baed1ef0654390c06
+---
+ device/comgrctx.hpp           | 2 +-
+ device/devkernel.hpp          | 2 +-
+ device/devprogram.hpp         | 2 +-
+ device/rocm/pro/prodevice.cpp | 2 +-
+ device/rocm/pro/prodriver.hpp | 2 +-
+ device/rocm/roccounters.hpp   | 2 +-
+ device/rocm/rocdevice.hpp     | 8 ++++----
+ device/rocm/rocglinterop.hpp  | 2 +-
+ device/rocm/rockernel.cpp     | 2 +-
+ device/rocm/rocprogram.cpp    | 2 +-
+ device/rocm/rocsignal.hpp     | 4 ++--
+ device/rocm/rocvirtual.cpp    | 4 ++--
+ device/rocm/rocvirtual.hpp    | 8 ++++----
+ 13 files changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/device/comgrctx.hpp b/device/comgrctx.hpp
+index d69506e2..31ee24e1 100644
+--- a/device/comgrctx.hpp
++++ b/device/comgrctx.hpp
+@@ -23,7 +23,7 @@
+ #include <mutex>
+ #if defined(USE_COMGR_LIBRARY)
+ #include "top.hpp"
+-#include "amd_comgr.h"
++#include "amd_comgr/amd_comgr.h"
+ 
+ namespace amd {
+ typedef void (*t_amd_comgr_get_version)(size_t *major, size_t *minor);
+diff --git a/device/devkernel.hpp b/device/devkernel.hpp
+index 19b3212d..b256abf3 100644
+--- a/device/devkernel.hpp
++++ b/device/devkernel.hpp
+@@ -105,7 +105,7 @@ struct RuntimeHandle {
+   uint32_t group_segment_size;        //!< From GROUP_SEGMENT_FIXED_SIZE
+ };
+ 
+-#include "amd_comgr.h"
++#include "amd_comgr/amd_comgr.h"
+ 
+ //  for Code Object V3
+ enum class ArgField : uint8_t {
+diff --git a/device/devprogram.hpp b/device/devprogram.hpp
+index 099d6a37..741d81b0 100644
+--- a/device/devprogram.hpp
++++ b/device/devprogram.hpp
+@@ -29,7 +29,7 @@
+ #include "devwavelimiter.hpp"
+ 
+ #if defined(USE_COMGR_LIBRARY)
+-#include "amd_comgr.h"
++#include "amd_comgr/amd_comgr.h"
+ #endif  // defined(USE_COMGR_LIBRARY)
+ 
+ namespace amd {
+diff --git a/device/rocm/pro/prodevice.cpp b/device/rocm/pro/prodevice.cpp
+index a0e49461..1e366cd2 100644
+--- a/device/rocm/pro/prodevice.cpp
++++ b/device/rocm/pro/prodevice.cpp
+@@ -20,7 +20,7 @@
+ 
+ #ifndef WITHOUT_HSA_BACKEND
+ 
+-#include "hsa_ext_amd.h"
++#include "hsa/hsa_ext_amd.h"
+ #include "lnxheaders.h"
+ #include "prodevice.hpp"
+ #include "amdgpu_drm.h"
+diff --git a/device/rocm/pro/prodriver.hpp b/device/rocm/pro/prodriver.hpp
+index bc420697..819ade27 100644
+--- a/device/rocm/pro/prodriver.hpp
++++ b/device/rocm/pro/prodriver.hpp
+@@ -23,7 +23,7 @@
+ #ifndef WITHOUT_HSA_BACKEND
+ 
+ #include "top.hpp"
+-#include "hsa.h"
++#include "hsa/hsa.h"
+ 
+ /*! \addtogroup HSA
+  *  @{
+diff --git a/device/rocm/roccounters.hpp b/device/rocm/roccounters.hpp
+index ffc9fad0..45ebbe66 100644
+--- a/device/rocm/roccounters.hpp
++++ b/device/rocm/roccounters.hpp
+@@ -24,7 +24,7 @@
+ #include "top.hpp"
+ #include "device/device.hpp"
+ #include "device/rocm/rocdevice.hpp"
+-#include "hsa_ven_amd_aqlprofile.h"
++#include "hsa/hsa_ven_amd_aqlprofile.h"
+ 
+ namespace roc {
+ 
+diff --git a/device/rocm/rocdevice.hpp b/device/rocm/rocdevice.hpp
+index d8cb4c6c..44339bb9 100644
+--- a/device/rocm/rocdevice.hpp
++++ b/device/rocm/rocdevice.hpp
+@@ -40,10 +40,10 @@
+ #include "device/rocm/rocprintf.hpp"
+ #include "device/rocm/rocglinterop.hpp"
+ 
+-#include "hsa.h"
+-#include "hsa_ext_image.h"
+-#include "hsa_ext_amd.h"
+-#include "hsa_ven_amd_loader.h"
++#include "hsa/hsa.h"
++#include "hsa/hsa_ext_image.h"
++#include "hsa/hsa_ext_amd.h"
++#include "hsa/hsa_ven_amd_loader.h"
+ 
+ #include <atomic>
+ #include <iostream>
+diff --git a/device/rocm/rocglinterop.hpp b/device/rocm/rocglinterop.hpp
+index a539cc6f..588d8a6f 100644
+--- a/device/rocm/rocglinterop.hpp
++++ b/device/rocm/rocglinterop.hpp
+@@ -34,7 +34,7 @@ typedef __GLXcontextRec* GLXContext;
+ 
+ #include "device/rocm/mesa_glinterop.h"
+ #include "device/rocm/rocregisters.hpp"
+-#include "hsa_ext_amd.h"
++#include "hsa/hsa_ext_amd.h"
+ 
+ namespace roc {
+ 
+diff --git a/device/rocm/rockernel.cpp b/device/rocm/rockernel.cpp
+index 76ab76ad..5624c877 100644
+--- a/device/rocm/rockernel.cpp
++++ b/device/rocm/rockernel.cpp
+@@ -19,7 +19,7 @@
+  THE SOFTWARE. */
+ 
+ #include "rockernel.hpp"
+-#include "amd_hsa_kernel_code.h"
++#include "hsa/amd_hsa_kernel_code.h"
+ 
+ #include <algorithm>
+ 
+diff --git a/device/rocm/rocprogram.cpp b/device/rocm/rocprogram.cpp
+index e4559645..4f77026d 100644
+--- a/device/rocm/rocprogram.cpp
++++ b/device/rocm/rocprogram.cpp
+@@ -25,7 +25,7 @@
+ #include "utils/options.hpp"
+ #include "rockernel.hpp"
+ 
+-#include "amd_hsa_kernel_code.h"
++#include "hsa/amd_hsa_kernel_code.h"
+ 
+ #include <string>
+ #include <vector>
+diff --git a/device/rocm/rocsignal.hpp b/device/rocm/rocsignal.hpp
+index 3e8c1e6e..fff310d5 100644
+--- a/device/rocm/rocsignal.hpp
++++ b/device/rocm/rocsignal.hpp
+@@ -22,7 +22,7 @@
+ 
+ #include "device/devsignal.hpp"
+ 
+-#include <hsa.h>
++#include "hsa/hsa.h"
+ 
+ namespace roc {
+ 
+@@ -44,4 +44,4 @@ public:
+   }
+ };
+ 
+-};
+\ No newline at end of file
++};
+diff --git a/device/rocm/rocvirtual.cpp b/device/rocm/rocvirtual.cpp
+index 63b96378..1b6287e9 100644
+--- a/device/rocm/rocvirtual.cpp
++++ b/device/rocm/rocvirtual.cpp
+@@ -33,8 +33,8 @@
+ #include "platform/sampler.hpp"
+ #include "utils/debug.hpp"
+ #include "os/os.hpp"
+-#include "amd_hsa_kernel_code.h"
+-#include "amd_hsa_queue.h"
++#include "hsa/amd_hsa_kernel_code.h"
++#include "hsa/amd_hsa_queue.h"
+ 
+ #include <fstream>
+ #include <limits>
+diff --git a/device/rocm/rocvirtual.hpp b/device/rocm/rocvirtual.hpp
+index 6c738776..1bb0868c 100644
+--- a/device/rocm/rocvirtual.hpp
++++ b/device/rocm/rocvirtual.hpp
+@@ -24,11 +24,11 @@
+ #include "rocdefs.hpp"
+ #include "rocdevice.hpp"
+ #include "utils/util.hpp"
+-#include "hsa.h"
+-#include "hsa_ext_image.h"
+-#include "hsa_ext_amd.h"
++#include "hsa/hsa.h"
++#include "hsa/hsa_ext_image.h"
++#include "hsa/hsa_ext_amd.h"
+ #include "rocprintf.hpp"
+-#include "hsa_ven_amd_aqlprofile.h"
++#include "hsa/hsa_ven_amd_aqlprofile.h"
+ #include "rocsched.hpp"
+ 
+ namespace roc {
+-- 
+2.39.1
+

diff --git a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3-r1.ebuild 
b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3-r1.ebuild
index 88142c6e203e..169deaf37b79 100644
--- a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3-r1.ebuild
+++ b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit cmake edo flag-o-matic prefix
+inherit cmake edo flag-o-matic
 
 DESCRIPTION="Radeon Open Compute OpenCL Compatible Runtime"
 HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";
@@ -37,6 +37,7 @@ src_prepare() {
        # Bug #753377
        # patch re-enables accidentally disabled gfx800 family
        eapply "${FILESDIR}/${PN}-5.0.2-enable-gfx800.patch"
+       eapply "${FILESDIR}/rocclr-${PV}-fix-include.patch"
        popd || die
 }
 

diff --git a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3.ebuild 
b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3.ebuild
deleted file mode 100644
index 1dc7f3cf3345..000000000000
--- a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-5.3.3.ebuild
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit cmake edo flag-o-matic prefix
-
-DESCRIPTION="Radeon Open Compute OpenCL Compatible Runtime"
-HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";
-SRC_URI="https://github.com/ROCm-Developer-Tools/ROCclr/archive/rocm-${PV}.tar.gz
 -> rocclr-${PV}.tar.gz
-       
https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/rocm-${PV}.tar.gz
 -> rocm-opencl-runtime-${PV}.tar.gz"
-
-LICENSE="Apache-2.0 MIT"
-SLOT="0/$(ver_cut 1-2)"
-IUSE="debug test"
-RESTRICT="!test? ( test )"
-KEYWORDS="~amd64"
-
-RDEPEND=">=dev-libs/rocr-runtime-${PV}
-       >=dev-libs/rocm-comgr-${PV}
-       >=dev-libs/rocm-device-libs-${PV}
-       >=virtual/opencl-3
-       media-libs/mesa"
-DEPEND="${RDEPEND}"
-BDEPEND=">=dev-util/rocm-cmake-${PV}
-       media-libs/glew
-       test? ( >=x11-apps/mesa-progs-8.5.0[X] )
-       "
-
-PATCHES=(
-       "${FILESDIR}/${PN}-3.5.0-do-not-install-libopencl.patch"
-)
-
-S="${WORKDIR}/ROCm-OpenCL-Runtime-rocm-${PV}"
-S1="${WORKDIR}/ROCclr-rocm-${PV}"
-
-src_prepare() {
-       # Remove "clinfo" - use "dev-util/clinfo" instead
-       #[ -d tools/clinfo ] && rm -rf tools/clinfo || die
-
-       cmake_src_prepare
-
-       hprefixify amdocl/CMakeLists.txt
-
-       sed -e "s/DESTINATION lib/DESTINATION ${CMAKE_INSTALL_LIBDIR}/g" -i 
packaging/CMakeLists.txt || die
-       # remove trailing CR or it won't work
-       sed -e "s/\r$//g" -i tests/ocltst/module/perf/oclperf.exclude || die
-
-       pushd ${S1} || die
-       # Bug #753377
-       # patch re-enables accidentally disabled gfx800 family
-       eapply "${FILESDIR}/${PN}-5.0.2-enable-gfx800.patch"
-       popd || die
-}
-
-src_configure() {
-       # Reported upstream: 
https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/120
-       append-cflags -fcommon
-
-       local mycmakeargs=(
-               -Wno-dev
-               -DROCCLR_PATH="${S1}"
-               -DAMD_OPENCL_PATH="${S}"
-               -DROCM_PATH="${EPREFIX}/usr"
-               -DBUILD_TESTS=$(usex test ON OFF)
-               -DEMU_ENV=ON
-               # -DCMAKE_STRIP=""
-       )
-       cmake_src_configure
-}
-
-src_install() {
-       insinto /etc/OpenCL/vendors
-       doins config/amdocl64.icd
-
-       cd "${BUILD_DIR}" || die
-       insinto /usr/lib64
-       doins amdocl/libamdocl64.so
-       doins tools/cltrace/libcltrace.so
-}
-
-# Copied from rocm.eclass. This ebuild does not need amdgpu_targets
-# USE_EXPANDS, so it should not inherit rocm.eclass; it only uses the
-# check_amdgpu function in src_test. Rename it to check-amdgpu to avoid
-# pkgcheck warning.
-check-amdgpu() {
-       for device in /dev/kfd /dev/dri/render*; do
-               addwrite ${device}
-               if [[ ! -r ${device} || ! -w ${device} ]]; then
-                       eerror "Cannot read or write ${device}!"
-                       eerror "Make sure it is present and check the 
permission."
-                       ewarn "By default render group have access to it. Check 
if portage user is in render group."
-                       die "${device} inaccessible"
-               fi
-       done
-}
-
-src_test() {
-       check-amdgpu
-       cd "${BUILD_DIR}"/tests/ocltst || die
-       export OCL_ICD_FILENAMES="${BUILD_DIR}"/amdocl/libamdocl64.so
-       local instruction1="Please start an X server using amdgpu driver (not 
Xvfb!),"
-       local instruction2="and export OCLGL_DISPLAY=\${DISPLAY} 
OCLGL_XAUTHORITY=\${XAUTHORITY} before reruning the test."
-       if [[ -n ${OCLGL_DISPLAY+x} ]]; then
-               export DISPLAY=${OCLGL_DISPLAY}
-               export XAUTHORITY=${OCLGL_XAUTHORITY}
-               ebegin "Running oclgl test under DISPLAY ${OCLGL_DISPLAY}"
-               if ! glxinfo | grep "OpenGL vendor string: AMD"; then
-                       ewarn "${instruction1}"
-                       ewarn "${instruction2}"
-                       die "This display does not have AMD OpenGL vendor!"
-               fi
-               ./ocltst -m liboclgl.so -A ogl.exclude
-               eend $? || die "oclgl test failed"
-       else
-               ewarn "${instruction1}"
-               ewarn "${instruction2}"
-               die "\${OCLGL_DISPLAY} not set."
-       fi
-       edob ./ocltst -m liboclruntime.so -A oclruntime.exclude
-       edob ./ocltst -m liboclperf.so -A oclperf.exclude
-}

Reply via email to