Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New packages: ROCm core and OpenCL
@ 2020-04-19 13:34 ahesford
  2020-04-19 15:24 ` [PR PATCH] [Updated] " ahesford
                   ` (59 more replies)
  0 siblings, 60 replies; 61+ messages in thread
From: ahesford @ 2020-04-19 13:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3503 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages rocm
https://github.com/void-linux/void-packages/pull/21153

New packages: ROCm core and OpenCL
This PR includes several packages designed to bring the OpenCL portion of the
AMD ROCm ecosystem to Void. It addresses Issue #19507. There are many other
packages that AMD provides for GPGPU computing, but these can be added
piecemeal as users demand.

The packages are currently only for `x86_64*`. While at least some of the
packages will compile on other 64-bit architectures, I have no hardware to
test. They are certainly not suitable for 32-bit architectures; some internal
data structures rely on `uint64_t` values that are cast to pointers. At a
minimum, a thorough audit would be necessary to ensure that these casts are
safe (e.g., that the values stored were only ever upcast from 32-bit
pointers). More extensive work may be necessary to support 32-bit
architectures, probably without significant benefit.

The packages successfully identify a Radeon RX 580 on an `x86_64` installation
using both `clinfo` and `rocminfo` as provided. Furthermore, a version of
`pyopencl` linked against these ROCm packages successfully runs a simple
program that validates arithmetic on GPU-bound arrays.

There are caveats with this set of packages, almost all of which revolve
around the incompatibilities between the Void-provided `ocl-icd` and the
[Khronos OpenCL ICD loader](https://github.com/KhronosGroup/OpenCL-ICD-Loader)
required by (and built into) `rocm-opencl-runtime`.
1. All packages install into `/opt/rocm`. This keeps the environment closer to
that officially sanctioned by AMD and helps avoid conflicts between other
packages and those provided here. (For example, `clinfo` and the ICD loader
itself.) Eventually, we may be able to move the files into `/usr`.
2. The Khronos OpenCL ICD loader built into `rocm-opencl-runtime` is an
outdated, pre-release commit. If AMD can update its sources to use the release
version of that loader (which has a backward-incompatible API change), we may
be able to make ROCm compatible with `ocl-icd` or replace `ocl-icd` with the
official Khronos loader.
3. In the meantime, to avoid `shlibs` conflicts, the OpenCL ICD loader is
installed as `/opt/rocm/lib/libOpenCL-ROCm.so` (and an appropriately versioned
shared library), which means that programs wishing to use the ROCm OpenCL must
explicitly link against this library instead of the generic `libOpenCL.so`.
4. I do **not** recommend making any Void packages link against this specific
library, because it will make those packages ROCm-only. For the time being,
ROCm is intended for end-users to specifically link against. This, too,
requires the ICD loader used by ROCm be compatible with `ocl-icd`, or
`ocl-icd` be replaced by the Khronos loader. However, because the Khronos
loader changed its API for the release version, such a change is not yet
appropriate.

Hopefully, if AMD updates its dependence on the Khronos ICD loader, we can resolve some of these caveats in the future and make ROCm a more natural Void component.

Some patches were made to relocate some files in `/opt/rocm` and make everyting build on `x86_64-musl`. Where appropriate, these patches will be pushed upstream to clean up the distribution and packaging.

A patch file from https://github.com/void-linux/void-packages/pull/21153.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rocm-21153.patch --]
[-- Type: text/x-diff, Size: 72717 bytes --]

From 6bc676c5571eb8445510366bd8c8cb3b0ea4b418 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 13:08:09 -0400
Subject: [PATCH 1/7] New package: roct-thunk-interface-3.3.0

---
 common/shlibs                                 |  1 +
 srcpkgs/roct-thunk-interface-devel            |  1 +
 .../patches/cmake-dev-libdir.patch            | 10 ++++++
 .../roct-thunk-interface/patches/musl.patch   | 29 +++++++++++++++
 srcpkgs/roct-thunk-interface/template         | 35 +++++++++++++++++++
 5 files changed, 76 insertions(+)
 create mode 120000 srcpkgs/roct-thunk-interface-devel
 create mode 100644 srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
 create mode 100644 srcpkgs/roct-thunk-interface/patches/musl.patch
 create mode 100644 srcpkgs/roct-thunk-interface/template

diff --git a/common/shlibs b/common/shlibs
index 53a59b7303b..78863e0f7b8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3862,3 +3862,4 @@ libstk-4.6.1.so libstk-4.6.1_1
 libc++utilities.so.5 cpp-utilities-5.2.0_1
 libtagparser.so.9 tagparser-9.1.2_1
 libqtutilities.so.6 qtutilities-6.0.4_1
+libhsakmt.so.1 roct-thunk-interface-3.3.0_1
diff --git a/srcpkgs/roct-thunk-interface-devel b/srcpkgs/roct-thunk-interface-devel
new file mode 120000
index 00000000000..ac3f2cc684c
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface-devel
@@ -0,0 +1 @@
+roct-thunk-interface
\ No newline at end of file
diff --git a/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
new file mode 100644
index 00000000000..98c7f1e459c
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.old	2020-04-18 19:45:17.306081135 -0400
++++ CMakeLists.txt	2020-04-18 19:46:51.300753636 -0400
+@@ -146,6 +146,7 @@
+     COMMAND ${CMAKE_COMMAND}
+         -DSOURCE_DIR="${SOURCE_DIR}"
+         -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
++        -DCMAKE_INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
+         -DCPACK_RPM_PACKAGE_REQUIRES="hsakmt-roct"
+         -DCPACK_PACKAGING_INSTALL_PREFIX="${CPACK_PACKAGING_INSTALL_PREFIX}"
+         -DVERSION="${BUILD_VERSION_STRING}"
diff --git a/srcpkgs/roct-thunk-interface/patches/musl.patch b/srcpkgs/roct-thunk-interface/patches/musl.patch
new file mode 100644
index 00000000000..aeea9832411
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/patches/musl.patch
@@ -0,0 +1,29 @@
+diff -r -u old/src/libhsakmt.h new/src/libhsakmt.h
+--- src/libhsakmt.h	2020-03-04 15:00:47.000000000 -0500
++++ src/libhsakmt.h	2020-04-13 12:58:30.444865992 -0400
+@@ -54,6 +54,10 @@
+ #define CHECK_KFD_OPEN() \
+ 	do { if (kfd_open_count == 0 || hsakmt_forked) return HSAKMT_STATUS_KERNEL_IO_CHANNEL_NOT_OPENED; } while (0)
+ 
++/*On some platforms, a PAGE_SIZE macro eclipses the extern variable*/
++#ifdef PAGE_SIZE
++#undef PAGE_SIZE
++#endif
+ extern int PAGE_SIZE;
+ extern int PAGE_SHIFT;
+ 
+diff -r -u old/src/topology.c new/src/topology.c
+--- src/topology.c	2020-03-04 15:00:47.000000000 -0500
++++ src/topology.c	2020-04-13 13:01:31.209870701 -0400
+@@ -38,6 +38,11 @@
+ #include "libhsakmt.h"
+ #include "fmm.h"
+ 
++/*Needed on MUSL*/
++#ifndef MAXNAMLEN
++#define MAXNAMLEN PATH_MAX
++#endif
++
+ /* Number of memory banks added by thunk on top of topology
+  * This only includes static heaps like LDS, scratch and SVM,
+  * not for MMIO_REMAP heap. MMIO_REMAP memory bank is reported
diff --git a/srcpkgs/roct-thunk-interface/template b/srcpkgs/roct-thunk-interface/template
new file mode 100644
index 00000000000..b3a1e3dc929
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/template
@@ -0,0 +1,35 @@
+# Template file for 'roct-thunk-interface'
+pkgname=roct-thunk-interface
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCT-Thunk-Interface-roc-${version}"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm
+	-DCMAKE_INSTALL_RPATH:PATH='\$ORIGIN:\$ORIGIN/../lib'"
+make_build_target="all build-dev"
+make_install_target="install install-dev"
+hostmakedepends="cmake pkg-config"
+makedepends="pciutils-devel libnuma-devel"
+short_desc="Radeon Open Compute Thunk Interface"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"
+distfiles="${homepage}/archive/roc-${version}.tar.gz"
+checksum=2cabe9d2cfa72031c05d11290837c476182e72d8dec2049298f691143fdd212b
+nocross=yes
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+roct-thunk-interface-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove opt/rocm/include
+		vmove "opt/rocm/lib/*.so"
+		vmove opt/rocm/share/pkgconfig
+		vmove opt/rocm/lib/cmake
+	}
+}

From cae98b4ec2343998783cafd2169b0928c0c69763 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 15:27:27 -0400
Subject: [PATCH 2/7] New package: rocr-runtime-3.3.0

---
 common/shlibs                            |  1 +
 srcpkgs/rocr-runtime-devel               |  1 +
 srcpkgs/rocr-runtime/patches/cmake.patch | 27 +++++++++++++++++++
 srcpkgs/rocr-runtime/template            | 33 ++++++++++++++++++++++++
 4 files changed, 62 insertions(+)
 create mode 120000 srcpkgs/rocr-runtime-devel
 create mode 100644 srcpkgs/rocr-runtime/patches/cmake.patch
 create mode 100644 srcpkgs/rocr-runtime/template

diff --git a/common/shlibs b/common/shlibs
index 78863e0f7b8..ec34c0df9fa 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3863,3 +3863,4 @@ libc++utilities.so.5 cpp-utilities-5.2.0_1
 libtagparser.so.9 tagparser-9.1.2_1
 libqtutilities.so.6 qtutilities-6.0.4_1
 libhsakmt.so.1 roct-thunk-interface-3.3.0_1
+libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
diff --git a/srcpkgs/rocr-runtime-devel b/srcpkgs/rocr-runtime-devel
new file mode 120000
index 00000000000..be838f22d81
--- /dev/null
+++ b/srcpkgs/rocr-runtime-devel
@@ -0,0 +1 @@
+rocr-runtime
\ No newline at end of file
diff --git a/srcpkgs/rocr-runtime/patches/cmake.patch b/srcpkgs/rocr-runtime/patches/cmake.patch
new file mode 100644
index 00000000000..93b74cd2297
--- /dev/null
+++ b/srcpkgs/rocr-runtime/patches/cmake.patch
@@ -0,0 +1,27 @@
+--- src/CMakeLists.txt.old	2020-04-18 20:01:48.549636995 -0400
++++ src/CMakeLists.txt	2020-04-18 20:04:00.177179781 -0400
+@@ -108,8 +108,8 @@
+ ## ROCr build internal versioning
+ add_definitions ( -DROCR_BUILD_ID=${PACKAGE_VERSION_STRING} )
+ 
+-## Set RUNPATH - ../../lib covers use of the legacy symlink in /hsa/lib/
+-set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64")
++## Set RUNPATH
++set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib")
+ 
+ ## ------------------------- Linux Compiler and Linker options -------------------------
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function" )
+@@ -185,11 +185,8 @@
+ add_custom_target ( hsa_lib_link2 ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/lib/${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} )
+ 
+ ## Set install information
+-install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION hsa/lib )
+-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION hsa/include/hsa )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa_include_link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} )
++install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
++install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include/hsa )
+ 
+ ## Packaging directives
+ set ( CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build")
diff --git a/srcpkgs/rocr-runtime/template b/srcpkgs/rocr-runtime/template
new file mode 100644
index 00000000000..3588211584c
--- /dev/null
+++ b/srcpkgs/rocr-runtime/template
@@ -0,0 +1,33 @@
+# Template file for 'rocr-runtime'
+pkgname=rocr-runtime
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCR-Runtime-rocm-${version}"
+build_wrksrc="src"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm
+	-DHSAKMT_INC_PATH:PATH=/opt/rocm/include
+	-DHSAKMT_LIB_PATH:PATH=/opt/rocm/lib"
+hostmakedepends="cmake pkg-config"
+makedepends="roct-thunk-interface-devel elfutils-devel"
+short_desc="Radeon Open Compute HSA Runtime"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/ROCR-Runtime"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=fa2d2d1f8a61d8a6952d377cf288d78c61776c3c2a666f163cafc3aa19ab0b61
+nocross=yes
+
+post_install() {
+	vlicense ../LICENSE.txt
+}
+
+rocr-runtime-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove opt/rocm/include
+		vmove "opt/rocm/lib/*.so"
+	}
+}

From 52f0657ead04c144f6e10a979e035fe929bcaa65 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 18:07:34 -0400
Subject: [PATCH 3/7] New package: rocm-llvm-3.3.0

---
 srcpkgs/rocm-llvm/template | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 srcpkgs/rocm-llvm/template

diff --git a/srcpkgs/rocm-llvm/template b/srcpkgs/rocm-llvm/template
new file mode 100644
index 00000000000..0919e24b514
--- /dev/null
+++ b/srcpkgs/rocm-llvm/template
@@ -0,0 +1,25 @@
+# Template file for 'rocm-llvm'
+pkgname=rocm-llvm
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="llvm-project-rocm-ocl-${version}"
+build_wrksrc=llvm
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm/llvm
+	-DLLVM_ENABLE_PROJECTS='llvm;clang;lld' -DLLVM_TARGETS_TO_BUILD='AMDGPU'
+	-DLLVM_BUILD_DOCS=NO -DLLVM_ENABLE_OCAMLDOC=OFF
+	-DLLVM_ENABLE_SPHINX=NO -DLLVM_ENABLE_DOXYGEN=OFF
+	-DLLVM_INSTALL_UTILS=ON -DLLVM_VERSION_SUFFIX=roc -DOCAMLFIND=NO"
+hostmakedepends="cmake pkg-config python3"
+short_desc="Radeon Open Compute LLVM toolchain"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Custom"
+homepage="https://github.com/RadeonOpenCompute/llvm-project"
+distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz"
+checksum=a2bef7042e8e2f2cd8548cb246b88322e1c77188839983dcac8312d56f544dc8
+nocross=yes
+
+post_install() {
+	vlicense LICENSE.TXT
+}

From a2b682db2d64ece9ed4a24d1ed6cde98c5f65f1c Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 14 Apr 2020 10:25:31 -0400
Subject: [PATCH 4/7] New package: rocm-device-libs-3.3.0

---
 srcpkgs/rocm-device-libs/template | 32 +++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 srcpkgs/rocm-device-libs/template

diff --git a/srcpkgs/rocm-device-libs/template b/srcpkgs/rocm-device-libs/template
new file mode 100644
index 00000000000..94b3be580c0
--- /dev/null
+++ b/srcpkgs/rocm-device-libs/template
@@ -0,0 +1,32 @@
+# Template file for 'rocm-device-libs'
+pkgname=rocm-device-libs
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCm-Device-Libs-rocm-ocl-${version}"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm -DLLVM_DIR:PATH=/opt/rocm/llvm"
+hostmakedepends="cmake rocm-llvm"
+short_desc="Radeon Open Compute device libraries"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/ROCm-Device-Libs"
+distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz"
+checksum=706b08230790e08ca6a7a2fb7687d6131fd39a562148340e00fa37a6c06769c5
+nocross=yes
+
+pre_configure() {
+	# Build the prepare-builtins executable with native compiler
+	mkdir -p utils/build
+	cd utils/build
+	_prepare_builtins="$PWD/prepare-builtins/prepare-builtins"
+	cmake ${configure_args} ..
+	make ${makejobs}
+
+	# Add path to prepare-builtins for cmake
+	configure_args+=" -DPREPARE_BUILTINS='${_prepare_builtins}'"
+}
+
+post_install() {
+	vlicense LICENSE
+}

From c1eaeb4b90fd6947ae4025017c4f31ef38f14b20 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 18:30:00 -0400
Subject: [PATCH 5/7] New package: rocm-comgr-3.3.0

---
 common/shlibs               |  1 +
 srcpkgs/rocm-comgr-devel    |  1 +
 srcpkgs/rocm-comgr/template | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 120000 srcpkgs/rocm-comgr-devel
 create mode 100644 srcpkgs/rocm-comgr/template

diff --git a/common/shlibs b/common/shlibs
index ec34c0df9fa..509755bd8b9 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3864,3 +3864,4 @@ libtagparser.so.9 tagparser-9.1.2_1
 libqtutilities.so.6 qtutilities-6.0.4_1
 libhsakmt.so.1 roct-thunk-interface-3.3.0_1
 libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
+libamd_comgr.so.1 rocm-comgr-3.3.0_1
diff --git a/srcpkgs/rocm-comgr-devel b/srcpkgs/rocm-comgr-devel
new file mode 120000
index 00000000000..3f5ce255e07
--- /dev/null
+++ b/srcpkgs/rocm-comgr-devel
@@ -0,0 +1 @@
+rocm-comgr
\ No newline at end of file
diff --git a/srcpkgs/rocm-comgr/template b/srcpkgs/rocm-comgr/template
new file mode 100644
index 00000000000..fb6580f2f8b
--- /dev/null
+++ b/srcpkgs/rocm-comgr/template
@@ -0,0 +1,34 @@
+# Template file for 'rocm-comgr'
+pkgname=rocm-comgr
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCm-CompilerSupport-rocm-${version}"
+build_wrksrc="lib/comgr"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm
+	-DClang_DIR:PATH=/opt/rocm/llvm/lib/cmake/clang
+	-DCMAKE_INSTALL_RPATH:PATH='\$ORIGIN:\$ORIGIN/../lib'"
+hostmakedepends="cmake pkg-config rocm-llvm"
+makedepends="rocm-device-libs"
+short_desc="Radeon Open Compute Code Object Manager"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="BSD-3-clause"
+homepage="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=01e2524e0f28ecd6f46c9720f279207de935d826b0172158792aa3ec86af9ca7
+nocross=yes
+
+post_install() {
+	vlicense LICENSE.txt
+}
+
+rocm-comgr-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove opt/rocm/include
+		vmove "opt/rocm/lib/*.so"
+		vmove opt/rocm/lib/cmake
+	}
+}

From 5fb6d398f4d4bce91c2df546ed13e3b1dc58a53a Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Fri, 17 Apr 2020 12:11:25 -0400
Subject: [PATCH 6/7] New package: rocminfo-3.3.0

---
 srcpkgs/rocminfo/template | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 srcpkgs/rocminfo/template

diff --git a/srcpkgs/rocminfo/template b/srcpkgs/rocminfo/template
new file mode 100644
index 00000000000..91128a766f3
--- /dev/null
+++ b/srcpkgs/rocminfo/template
@@ -0,0 +1,21 @@
+# Template file for 'rocminfo'
+pkgname=rocminfo
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="rocminfo-rocm-${version}"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm -DROCM_DIR=/opt/rocm"
+hostmakedepends="cmake pkg-config"
+makedepends="rocr-runtime-devel"
+short_desc="Radeon Open Compute system information reporter"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/rocminfo"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=e666f662c9e465aaabbbd0b109d87e017243cdf1a0898fabf5a90947bb3dbcd7
+nocross=yes
+
+post_install() {
+	vlicense License.txt
+}

From 87fa69bae6e6aceda0448914a24af63c02702a4e Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 14 Apr 2020 10:25:54 -0400
Subject: [PATCH 7/7] New package: rocm-opencl-runtime-3.3.0

---
 common/shlibs                                 |   1 +
 srcpkgs/rocm-opencl-runtime-devel             |   1 +
 .../files/libelf-musl.patch                   | 688 ++++++++++++++++++
 .../files/runtime-musl.patch                  |  11 +
 srcpkgs/rocm-opencl-runtime/files/sys_queue.h | 574 +++++++++++++++
 .../rocm-opencl-runtime/patches/cmake.patch   | 123 ++++
 srcpkgs/rocm-opencl-runtime/template          |  78 ++
 7 files changed, 1476 insertions(+)
 create mode 120000 srcpkgs/rocm-opencl-runtime-devel
 create mode 100644 srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
 create mode 100644 srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
 create mode 100644 srcpkgs/rocm-opencl-runtime/files/sys_queue.h
 create mode 100644 srcpkgs/rocm-opencl-runtime/patches/cmake.patch
 create mode 100644 srcpkgs/rocm-opencl-runtime/template

diff --git a/common/shlibs b/common/shlibs
index 509755bd8b9..d087fa3ab4b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3865,3 +3865,4 @@ libqtutilities.so.6 qtutilities-6.0.4_1
 libhsakmt.so.1 roct-thunk-interface-3.3.0_1
 libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
 libamd_comgr.so.1 rocm-comgr-3.3.0_1
+libOpenCL-ROCm.so.1 rocm-opencl-runtime-3.3.0_1
diff --git a/srcpkgs/rocm-opencl-runtime-devel b/srcpkgs/rocm-opencl-runtime-devel
new file mode 120000
index 00000000000..b2cda7e229d
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime-devel
@@ -0,0 +1 @@
+rocm-opencl-runtime
\ No newline at end of file
diff --git a/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
new file mode 100644
index 00000000000..a3705c259a9
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
@@ -0,0 +1,688 @@
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/_libelf.h compiler/lib/loaders/elf/utils/libelf/_libelf.h
+--- compiler/lib/loaders/elf/utils/libelf.orig/_libelf.h	2020-04-19 08:59:34.201386585 -0400
++++ compiler/lib/loaders/elf/utils/libelf/_libelf.h	2020-04-19 09:04:12.950433528 -0400
+@@ -30,7 +30,7 @@
+ #define	__LIBELF_H_
+ 
+ #include <limits.h>
+-#include <sys/queue.h>
++#include "sys_queue.h"
+ 
+ #include "_libelf_config.h"
+ 
+@@ -179,7 +179,9 @@
+  * Function Prototypes.
+  */
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ Elf_Data *_libelf_allocate_data(Elf_Scn *_s);
+ Elf	*_libelf_allocate_elf(Elf_Mem *mem);
+ Elf_Scn	*_libelf_allocate_scn(Elf *_e, size_t _ndx);
+@@ -213,6 +215,8 @@
+ Elf_Data *_libelf_xlate(Elf_Data *_d, const Elf_Data *_s,
+     unsigned int _encoding, int _elfclass, int _direction);
+ int	_libelf_xlate_shtype(uint32_t _sht);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* __LIBELF_H_ */
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_begin.c compiler/lib/loaders/elf/utils/libelf/elf_begin.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_begin.c	2020-04-19 08:59:34.201386585 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_begin.c	2020-04-19 09:01:04.313212042 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <sys/types.h>
+ #if !defined(WIN32)
+ #include <sys/errno.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_end.c compiler/lib/loaders/elf/utils/libelf/elf_end.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_end.c	2020-04-19 08:59:34.201386585 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_end.c	2020-04-19 09:01:14.895204681 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #if !defined(WIN32)
+ #include <sys/mman.h>
+ #endif
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_errmsg.c compiler/lib/loaders/elf/utils/libelf/elf_errmsg.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_errmsg.c	2020-04-19 08:59:34.201386585 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_errmsg.c	2020-04-19 09:01:16.753207065 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ #include <stdio.h>
+ #include <string.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_errno.c compiler/lib/loaders/elf/utils/libelf/elf_errno.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_errno.c	2020-04-19 08:59:34.201386585 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_errno.c	2020-04-19 09:01:18.669209528 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_fill.c compiler/lib/loaders/elf/utils/libelf/elf_fill.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_fill.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_fill.c	2020-04-19 09:01:21.109212667 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_flag.c compiler/lib/loaders/elf/utils/libelf/elf_flag.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_flag.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_flag.c	2020-04-19 09:01:23.376215579 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getarhdr.c compiler/lib/loaders/elf/utils/libelf/elf_getarhdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getarhdr.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_getarhdr.c	2020-04-19 09:01:25.414218197 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getarsym.c compiler/lib/loaders/elf/utils/libelf/elf_getarsym.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getarsym.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_getarsym.c	2020-04-19 09:01:27.575220978 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getbase.c compiler/lib/loaders/elf/utils/libelf/elf_getbase.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getbase.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_getbase.c	2020-04-19 09:01:29.963224043 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getident.c compiler/lib/loaders/elf/utils/libelf/elf_getident.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getident.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_getident.c	2020-04-19 09:01:31.912226551 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <assert.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_hash.c compiler/lib/loaders/elf/utils/libelf/elf_hash.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_hash.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_hash.c	2020-04-19 09:01:33.877229069 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf_config.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_kind.c compiler/lib/loaders/elf/utils/libelf/elf_kind.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_kind.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_kind.c	2020-04-19 09:01:35.940231721 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_memory.c compiler/lib/loaders/elf/utils/libelf/elf_memory.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_memory.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_memory.c	2020-04-19 09:01:38.171234596 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+ #include <string.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_next.c compiler/lib/loaders/elf/utils/libelf/elf_next.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_next.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_next.c	2020-04-19 09:01:40.063237028 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <assert.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_phnum.c compiler/lib/loaders/elf/utils/libelf/elf_phnum.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_phnum.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_phnum.c	2020-04-19 09:01:42.480240134 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_rand.c compiler/lib/loaders/elf/utils/libelf/elf_rand.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_rand.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_rand.c	2020-04-19 09:01:45.061243452 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_rawfile.c compiler/lib/loaders/elf/utils/libelf/elf_rawfile.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_rawfile.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_rawfile.c	2020-04-19 09:01:46.988245928 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_scn.c compiler/lib/loaders/elf/utils/libelf/elf_scn.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_scn.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_scn.c	2020-04-19 09:00:19.724298403 -0400
+@@ -24,8 +24,7 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-#include <sys/queue.h>
++#include "sys_queue.h"
+ 
+ #include <assert.h>
+ #include <errno.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_shnum.c compiler/lib/loaders/elf/utils/libelf/elf_shnum.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_shnum.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_shnum.c	2020-04-19 09:01:51.763252060 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_shstrndx.c compiler/lib/loaders/elf/utils/libelf/elf_shstrndx.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_shstrndx.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_shstrndx.c	2020-04-19 09:01:53.532254340 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_version.c compiler/lib/loaders/elf/utils/libelf/elf_version.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/elf_version.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/elf_version.c	2020-04-19 09:02:01.337264370 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf.h compiler/lib/loaders/elf/utils/libelf/gelf.h
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf.h	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf.h	2020-04-19 09:04:29.669455020 -0400
+@@ -29,8 +29,6 @@
+ #ifndef	_GELF_H_
+ #define	_GELF_H_
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ typedef Elf64_Addr	GElf_Addr;	/* Addresses */
+@@ -72,7 +70,9 @@
+ #define	GELF_ST_TYPE			ELF64_ST_TYPE
+ #define	GELF_ST_VISIBILITY		ELF64_ST_VISIBILITY
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ long		gelf_checksum(Elf *_elf);
+ size_t		gelf_fsize(Elf *_elf, Elf_Type _type, size_t _count,
+ 			unsigned int _version);
+@@ -109,6 +109,8 @@
+ int		gelf_update_move(Elf_Data *_dst, int _index, GElf_Move *_src);
+ int		gelf_update_syminfo(Elf_Data *_dst, int _index, GElf_Syminfo *_src);
+ #endif
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* _GELF_H_ */
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_cap.c compiler/lib/loaders/elf/utils/libelf/gelf_cap.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_cap.c	2020-04-19 08:59:34.202386583 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_cap.c	2020-04-19 09:02:05.429269632 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_checksum.c compiler/lib/loaders/elf/utils/libelf/gelf_checksum.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_checksum.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_checksum.c	2020-04-19 09:02:08.192273183 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_dyn.c compiler/lib/loaders/elf/utils/libelf/gelf_dyn.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_dyn.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_dyn.c	2020-04-19 09:02:10.020275525 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_ehdr.c compiler/lib/loaders/elf/utils/libelf/gelf_ehdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_ehdr.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_ehdr.c	2020-04-19 09:02:11.882277926 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_fsize.c compiler/lib/loaders/elf/utils/libelf/gelf_fsize.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_fsize.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_fsize.c	2020-04-19 09:02:14.139280827 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_getclass.c compiler/lib/loaders/elf/utils/libelf/gelf_getclass.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_getclass.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_getclass.c	2020-04-19 09:02:17.269284848 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_move.c compiler/lib/loaders/elf/utils/libelf/gelf_move.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_move.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_move.c	2020-04-19 09:02:18.974287034 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_phdr.c compiler/lib/loaders/elf/utils/libelf/gelf_phdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_phdr.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_phdr.c	2020-04-19 09:02:20.676289227 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_rel.c compiler/lib/loaders/elf/utils/libelf/gelf_rel.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_rel.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_rel.c	2020-04-19 09:02:23.177292435 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_rela.c compiler/lib/loaders/elf/utils/libelf/gelf_rela.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_rela.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_rela.c	2020-04-19 09:02:25.246295100 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_shdr.c compiler/lib/loaders/elf/utils/libelf/gelf_shdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_shdr.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_shdr.c	2020-04-19 09:02:28.325299060 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_sym.c compiler/lib/loaders/elf/utils/libelf/gelf_sym.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_sym.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_sym.c	2020-04-19 09:02:30.113301356 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_syminfo.c compiler/lib/loaders/elf/utils/libelf/gelf_syminfo.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_syminfo.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_syminfo.c	2020-04-19 09:02:31.906303662 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_symshndx.c compiler/lib/loaders/elf/utils/libelf/gelf_symshndx.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_symshndx.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_symshndx.c	2020-04-19 09:02:33.626305873 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_xlate.c compiler/lib/loaders/elf/utils/libelf/gelf_xlate.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_xlate.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/gelf_xlate.c	2020-04-19 09:02:35.921308822 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ #include <string.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf.h compiler/lib/loaders/elf/utils/libelf/libelf.h
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf.h	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf.h	2020-04-19 09:04:38.760466706 -0400
+@@ -30,7 +30,7 @@
+ #define	_LIBELF_H_
+ 
+ #include <sys/types.h>
+-#include <sys/queue.h>
++#include "sys_queue.h"
+ #include <elfdefinitions.h>
+ #ifndef EM_HSAIL
+ #define EM_HSAIL 0xAF5A
+@@ -187,7 +187,9 @@
+ #define	ELF_F_ARCHIVE	   0x100U /* archive creation */
+ #define	ELF_F_ARCHIVE_SYSV 0x200U /* SYSV style archive */
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ Elf		*elf_begin(int _fd, Elf_Cmd _cmd, Elf *_elf, Elf_Mem *_mem);
+ int		elf_cntl(Elf *_elf, Elf_Cmd _cmd);
+ int		elf_end(Elf *_elf);
+@@ -257,6 +259,8 @@
+ 			unsigned int _enc);
+ Elf_Data	*elf64_xlatetom(Elf_Data *_dst, const Elf_Data *_src,
+ 			unsigned int _enc);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* _LIBELF_H_ */
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_align.c compiler/lib/loaders/elf/utils/libelf/libelf_align.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_align.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_align.c	2020-04-19 09:02:40.660314911 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <sys/types.h>
+ 
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_allocate.c compiler/lib/loaders/elf/utils/libelf/libelf_allocate.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_allocate.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_allocate.c	2020-04-19 09:02:43.079318019 -0400
+@@ -28,8 +28,6 @@
+  * Internal APIs
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #if !defined(WIN32)
+ #include <sys/errno.h>
+ #endif
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar.c compiler/lib/loaders/elf/utils/libelf/libelf_ar.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_ar.c	2020-04-19 09:02:44.763320187 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <ctype.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar_util.c compiler/lib/loaders/elf/utils/libelf/libelf_ar_util.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar_util.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_ar_util.c	2020-04-19 09:02:46.461322369 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <stdlib.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_checksum.c compiler/lib/loaders/elf/utils/libelf/libelf_checksum.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_checksum.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_checksum.c	2020-04-19 09:02:48.645325173 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_convert.c compiler/lib/loaders/elf/utils/libelf/libelf_convert.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_convert.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_convert.c	2020-04-19 09:02:50.883328053 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <string.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_data.c compiler/lib/loaders/elf/utils/libelf/libelf_data.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_data.c	2020-04-19 08:59:34.203386581 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_data.c	2020-04-19 09:02:52.951330708 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ 
+ #include "_libelf.h"
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ehdr.c compiler/lib/loaders/elf/utils/libelf/libelf_ehdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ehdr.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_ehdr.c	2020-04-19 09:02:55.176333563 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_extended.c compiler/lib/loaders/elf/utils/libelf/libelf_extended.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_extended.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_extended.c	2020-04-19 09:02:57.932337110 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_msize.c compiler/lib/loaders/elf/utils/libelf/libelf_msize.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_msize.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_msize.c	2020-04-19 09:03:02.201342598 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <string.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_phdr.c compiler/lib/loaders/elf/utils/libelf/libelf_phdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_phdr.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_phdr.c	2020-04-19 09:03:04.194345160 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_shdr.c compiler/lib/loaders/elf/utils/libelf/libelf_shdr.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_shdr.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_shdr.c	2020-04-19 09:03:05.795347218 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ 
+diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_xlate.c compiler/lib/loaders/elf/utils/libelf/libelf_xlate.c
+--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_xlate.c	2020-04-19 08:59:34.204386579 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf_xlate.c	2020-04-19 09:03:09.472351944 -0400
+@@ -24,8 +24,6 @@
+  * SUCH DAMAGE.
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ 
diff --git a/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
new file mode 100644
index 00000000000..ea18e90e09c
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
@@ -0,0 +1,11 @@
+--- runtime/os/os_posix.cpp.orig	2020-04-19 09:13:51.701982901 -0400
++++ runtime/os/os_posix.cpp	2020-04-19 09:14:04.156947422 -0400
+@@ -44,6 +44,8 @@
+ #include <algorithm>
+ #include <mutex>
+ 
++#include <libgen.h> // for basename
++
+ 
+ namespace amd {
+ 
diff --git a/srcpkgs/rocm-opencl-runtime/files/sys_queue.h b/srcpkgs/rocm-opencl-runtime/files/sys_queue.h
new file mode 100644
index 00000000000..daf4553d33e
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/files/sys_queue.h
@@ -0,0 +1,574 @@
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list.  Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction.  Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * List definitions.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List functions.
+ */
+#define	LIST_INIT(head) do {						\
+	(head)->lh_first = NULL;					\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)	\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev = 			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = ((head)->lh_first);				\
+		(var);							\
+		(var) = ((var)->field.le_next))
+
+/*
+ * List access methods.
+ */
+#define	LIST_EMPTY(head)		((head)->lh_first == NULL)
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+
+/*
+ * Singly-linked List definitions.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) do {						\
+	(head)->slh_first = NULL;					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = (head)->slh_first;		\
+		while(curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)					\
+struct name {								\
+	struct type *stqh_first;	/* first element */			\
+	struct type **stqh_last;	/* addr of last next element */		\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_INIT(head) do {						\
+	(head)->stqh_first = NULL;					\
+	(head)->stqh_last = &(head)->stqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)	\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(head)->stqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.stqe_next = NULL;					\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &(elm)->field.stqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(listelm)->field.stqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+		(head)->stqh_last = &(head)->stqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->stqh_first == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->stqh_first;		\
+		while (curelm->field.stqe_next != (elm))			\
+			curelm = curelm->field.stqe_next;		\
+		if ((curelm->field.stqe_next =				\
+			curelm->field.stqe_next->field.stqe_next) == NULL) \
+			    (head)->stqh_last = &(curelm)->field.stqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->stqh_first);				\
+		(var);							\
+		(var) = ((var)->field.stqe_next))
+
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+
+
+/*
+ * Simple queue definitions.
+ */
+#define	SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define	SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define	SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
+}
+
+/*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->sqh_first == (elm)) {				\
+		SIMPLEQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->sqh_first;		\
+		while (curelm->field.sqe_next != (elm))			\
+			curelm = curelm->field.sqe_next;		\
+		if ((curelm->field.sqe_next =				\
+			curelm->field.sqe_next->field.sqe_next) == NULL) \
+			    (head)->sqh_last = &(curelm)->field.sqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->sqh_first);				\
+		(var);							\
+		(var) = ((var)->field.sqe_next))
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_EMPTY(head)		((head)->sqh_first == NULL)
+#define	SIMPLEQ_FIRST(head)		((head)->sqh_first)
+#define	SIMPLEQ_NEXT(elm, field)	((elm)->field.sqe_next)
+
+
+/*
+ * Tail queue definitions.
+ */
+#define	_TAILQ_HEAD(name, type, qual)					\
+struct name {								\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
+}
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
+
+#define	_TAILQ_ENTRY(type, qual)					\
+struct {								\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
+}
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue functions.
+ */
+#define	TAILQ_INIT(head) do {						\
+	(head)->tqh_first = NULL;					\
+	(head)->tqh_last = &(head)->tqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)	\
+		(head)->tqh_first->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.tqe_next = NULL;					\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	if (((elm)->field.tqe_next) != NULL)				\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = ((head)->tqh_first);				\
+		(var);							\
+		(var) = ((var)->field.tqe_next))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));	\
+		(var);							\
+		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Tail queue access methods.
+ */
+#define	TAILQ_EMPTY(head)		((head)->tqh_first == NULL)
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+
+#define	TAILQ_LAST(head, headname) \
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define	TAILQ_PREV(elm, headname, field) \
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+
+/*
+ * Circular queue definitions.
+ */
+#define	CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ (void *)&head, (void *)&head }
+
+#define	CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) do {						\
+	(head)->cqh_first = (void *)(head);				\
+	(head)->cqh_last = (void *)(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == (void *)(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == (void *)(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = (void *)(head);				\
+	if ((head)->cqh_last == (void *)(head))				\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.cqe_next = (void *)(head);				\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == (void *)(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
+	if ((elm)->field.cqe_next == (void *)(head))			\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == (void *)(head))			\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->cqh_first);				\
+		(var) != (const void *)(head);				\
+		(var) = ((var)->field.cqe_next))
+
+#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for ((var) = ((head)->cqh_last);				\
+		(var) != (const void *)(head);				\
+		(var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define	CIRCLEQ_EMPTY(head)		((head)->cqh_first == (void *)(head))
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field)				\
+	(((elm)->field.cqe_next == (void *)(head))			\
+	    ? ((head)->cqh_first)					\
+	    : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field)				\
+	(((elm)->field.cqe_prev == (void *)(head))			\
+	    ? ((head)->cqh_last)					\
+	    : (elm->field.cqe_prev))
+
+#endif	/* sys/queue.h */
diff --git a/srcpkgs/rocm-opencl-runtime/patches/cmake.patch b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch
new file mode 100644
index 00000000000..2b3354f3eeb
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch
@@ -0,0 +1,123 @@
+diff -u -r ../original/OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt ./OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt
+--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt	2019-09-10 11:53:28.000000000 -0400
++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt	2020-04-16 20:16:13.481180757 -0400
+@@ -73,11 +73,11 @@
+ 
+ set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "Path to OpenCL Headers")
+ 
+-add_library (OpenCL ${OPENCL_ICD_LOADER_SOURCES})
+-set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
++add_library (OpenCL-ROCm ${OPENCL_ICD_LOADER_SOURCES})
++set_target_properties (OpenCL-ROCm PROPERTIES VERSION "1.2" SOVERSION "1")
+ 
+ if (WIN32)
+-    target_link_libraries (OpenCL cfgmgr32.lib)
++    target_link_libraries (OpenCL-ROCm cfgmgr32.lib)
+ 
+     option (OPENCL_ICD_LOADER_REQUIRE_WDK "Build with D3DKMT support, which requires the Windows WDK." ON)
+     if (OPENCL_ICD_LOADER_REQUIRE_WDK)
+@@ -92,10 +92,10 @@
+             get_filename_component(WDK_DIRECTORY ${LATEST_D3DKMT_HEADER} DIRECTORY)
+             get_filename_component(WDK_DIRECTORY ${WDK_DIRECTORY} DIRECTORY)
+             message(STATUS "Found the Windows WDK in: ${WDK_DIRECTORY}")
+-            target_compile_definitions(OpenCL PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK)
+-            target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/um)
+-            target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/km)
+-            target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/shared)
++	    target_compile_definitions(OpenCL-ROCm PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK)
++	    target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/um)
++	    target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/km)
++	    target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/shared)
+         else()
+             message(FATAL_ERROR "The Windows WDK was not found. Consider disabling OPENCL_ICD_LOADER_REQUIRE_WDK. Aborting.")
+         endif()
+@@ -113,25 +113,25 @@
+     endif()
+ else()
+     if (APPLE)
+-        target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
++        target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT})
+     else ()
+-        set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map")
+-        target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
++        set_target_properties (OpenCL-ROCm PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map")
++	target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT})
+     endif ()
+ endif ()
+ 
+ include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR})
+ add_definitions (-DCL_TARGET_OPENCL_VERSION=220)
+ 
+-target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
+-target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
++target_include_directories (OpenCL-ROCm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
++target_link_libraries (OpenCL-ROCm ${CMAKE_DL_LIBS})
+ 
+ include (CTest)
+ if (BUILD_TESTING)
+     add_subdirectory (test)
+ endif()
+ 
+-install (TARGETS OpenCL
++install (TARGETS OpenCL-ROCm
+     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+diff -u -r ../original/OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt ./OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt
+--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt	2019-09-10 11:53:28.000000000 -0400
++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt	2020-04-16 20:16:56.647026589 -0400
+@@ -12,4 +12,4 @@
+     test_clgl.c
+     test_image_objects.c )
+ 
+-target_link_libraries (icd_loader_test OpenCL IcdLog)
++target_link_libraries (icd_loader_test OpenCL-ROCm IcdLog)
+diff -u -r ../original/ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt ./ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt
+--- ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt	2020-04-18 20:16:13.452670818 -0400
++++ ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt	2020-04-18 20:20:09.798862321 -0400
+@@ -102,16 +102,16 @@
+ 
+ # MAIN package
+ install(PROGRAMS $<TARGET_FILE:clinfo>
+-        DESTINATION bin/x86_64
++        DESTINATION bin
+         COMPONENT MAIN)
+ install(PROGRAMS $<TARGET_FILE:amdocl64>
+-        DESTINATION lib/x86_64
++        DESTINATION lib
+         COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_FILE:OpenCL>
+-        DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_FILE:OpenCL-ROCm>
++        DESTINATION lib
+         COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
+-        DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL-ROCm>
++        DESTINATION lib
+         COMPONENT MAIN)
+ 
+ # DEV package
+@@ -123,8 +123,8 @@
+         PATTERN cl_d3d11.h EXCLUDE
+         PATTERN cl_dx9_media_sharing.h EXCLUDE
+         PATTERN cl_egl.h EXCLUDE)
+-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
+-        DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL-ROCm>
++        DESTINATION lib
+         COMPONENT DEV)
+ 
+ # Generic CPACK variables
+diff -u -r ../original/ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt ./ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt
+--- ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt	2020-04-01 13:05:07.000000000 -0400
++++ ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt	2020-04-16 20:17:33.735894123 -0400
+@@ -8,4 +8,7 @@
+ 
+ add_executable(clinfo clinfo.cpp)
+ 
+-target_link_libraries(clinfo OpenCL)
++target_link_libraries(clinfo OpenCL-ROCm)
++
++# Make sure the clinfo rpath does not point to build directory
++set_target_properties(clinfo PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
diff --git a/srcpkgs/rocm-opencl-runtime/template b/srcpkgs/rocm-opencl-runtime/template
new file mode 100644
index 00000000000..832ec7566ff
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/template
@@ -0,0 +1,78 @@
+# Template file for 'rocm-opencl-runtime'
+pkgname=rocm-opencl-runtime
+version=3.3.0
+revision=1
+_ocl_icd_name="OpenCL-ICD-Loader"
+_ocl_icd_ver="6c03f8b58fafd9dd693eaac826749a5cfad515f8"
+archs="x86_64*"
+create_wrksrc=yes
+build_wrksrc="ROCm-OpenCL-Runtime-roc-${version}"
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/opt/rocm
+	-DCMAKE_PREFIX_PATH:PATH=/opt/rocm/lib/cmake
+	-DCMAKE_INSTALL_RPATH:PATH='\$ORIGIN:\$ORIGIN/../lib'
+	-DUSE_COMGR_LIBRARY=yes"
+hostmakedepends="cmake pkg-config"
+makedepends="libglvnd-devel rocm-comgr-devel
+	roct-thunk-interface-devel rocr-runtime-devel"
+depends="rocm-comgr"
+short_desc="Radeon Open Compute OpenCL runtime"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"
+_rocroot="https://github.com/RadeonOpenCompute"
+distfiles="${_rocroot}/ROCm-OpenCL-Runtime/archive/roc-${version}.tar.gz
+	${_rocroot}/rocm-cmake/archive/rocm-${version}.tar.gz
+	https://github.com/KhronosGroup/${_ocl_icd_name}/archive/${_ocl_icd_ver}.tar.gz"
+checksum="ac6999f1a491ab066286c2bd6adf50f08f831286f56e267879f9f7eced22f98e
+	76ed3ee8e56cf3246011cf7723c2abda539e1136e7e7f6909bfa45d268b8644f
+	c94d5bb6dc980c4d41d73e2b81663a19aabe494e923e2d0eec72a4c95b318438"
+nocross=yes
+
+post_patch() {
+	if [ "$XBPS_LIBC" = "musl" ]; then
+		# Copy sys/queue.h locally for MUSL builds
+		libelf_dir="compiler/lib/loaders/elf/utils/libelf"
+		cp "${FILESDIR}/sys_queue.h" "${libelf_dir}"
+
+		# Remove dependence on glibc
+		patch -Np0 < ${FILESDIR}/libelf-musl.patch
+		patch -Np0 < ${FILESDIR}/runtime-musl.patch
+		vsed -e '/glibc_functions.cpp/d' -i api/opencl/amdocl/CMakeLists.txt
+	fi
+}
+
+pre_configure() {
+	# ROCm requires a very specific Khronos ICD loader version in the tree
+	# Keep the ICD loader config in /opt/rocm to avoid conflicts
+	_ocl_icd_dir="${_ocl_icd_name}-${_ocl_icd_ver}"
+	ln -sf "${wrksrc}/${_ocl_icd_dir}" api/opencl/khronos/icd
+	vsed -i "${wrksrc}/${_ocl_icd_dir}/loader/icd_platform.h" \
+		-e 's@/etc/OpenCL/vendors/@/opt/rocm&@g'
+
+	# CMake modules probably not useful anywhere but for this build
+	ln -sf "${wrksrc}/rocm-cmake-rocm-${version}/share/rocm/cmake"/*.cmake cmake
+
+	# Fix the dlopen macro to point to versioned libamd_comgr shared object
+	vsed -i 'runtime/device/comgrctx.cpp' \
+		-e 's/\blibamd_comgr\(32\)\?.so\b/&.1/g'
+}
+
+post_install() {
+	vlicense License
+
+	# Create descriptor to allow the ICD loader to find the driver
+	_ocl_icd_dir="opt/rocm/etc/OpenCL/vendors"
+	vmkdir "${_ocl_icd_dir}"
+	echo "/opt/rocm/lib/libamdocl64.so" \
+		> "${DESTDIR}/${_ocl_icd_dir}/amdocl64.icd"
+}
+
+rocm-opencl-runtime-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove opt/rocm/include
+		vmove opt/rocm/lib/libOpenCL-ROCm.so
+	}
+}

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2021-02-15  5:19 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 13:34 [PR PATCH] New packages: ROCm core and OpenCL ahesford
2020-04-19 15:24 ` [PR PATCH] [Updated] " ahesford
2020-04-19 15:57 ` ahesford
2020-04-19 19:02 ` ahesford
2020-04-20  2:02 ` ahesford
2020-04-28 14:00 ` ahesford
2020-04-28 15:14 ` ahesford
2020-04-28 17:34 ` ahesford
2020-04-28 17:34 ` ahesford
2020-04-28 17:38 ` ahesford
2020-04-28 18:09 ` ahesford
2020-04-28 18:44 ` [PR PATCH] [Updated] " ahesford
2020-04-28 19:59 ` ahesford
2020-04-30 19:05 ` ahesford
2020-04-30 19:12 ` ahesford
2020-04-30 19:22 ` ahesford
2020-04-30 19:32 ` ahesford
2020-04-30 19:35 ` ahesford
2020-04-30 19:38 ` ahesford
2020-05-01  4:57 ` lemmi
2020-05-01  5:10 ` ahesford
2020-05-01  5:12 ` ahesford
2020-05-01 14:04 ` [PR PATCH] [Updated] " ahesford
2020-05-01 19:36 ` ahesford
2020-05-02  1:34 ` ahesford
2020-05-02  3:29 ` ahesford
2020-05-05 14:24 ` ahesford
2020-05-05 14:26 ` ahesford
2020-05-07 14:18 ` ahesford
2020-05-07 16:01 ` ahesford
2020-05-08 14:40 ` ahesford
2020-05-11 18:02 ` ericonr
2020-05-11 18:07 ` ahesford
2020-05-11 18:07 ` ahesford
2020-05-11 18:52 ` [PR PATCH] [Updated] " ahesford
2020-05-11 20:03 ` ahesford
2020-05-14 18:04 ` FiCacador
2020-05-14 18:04 ` FiCacador
2020-05-14 19:13 ` ahesford
2020-05-14 19:14 ` ahesford
2020-05-14 22:51 ` FiCacador
2020-05-15  0:07 ` ahesford
2020-05-15  1:30 ` fosslinux
2020-05-15  3:31 ` FiCacador
2020-05-15  3:32 ` FiCacador
2020-05-15  6:54 ` fosslinux
2020-08-04 17:13 ` [PR PATCH] [Updated] " ahesford
2020-08-04 17:13 ` ahesford
2020-08-04 17:16 ` [PR PATCH] [Closed]: " ahesford
2020-08-04 17:16 ` [PR PATCH] [Updated] " ahesford
2020-08-04 17:19 ` ahesford
2020-08-04 17:24 ` [PR PATCH] [Updated] " ahesford
2020-08-18 18:36 ` aurieh
2020-08-18 18:38 ` aurieh
2020-08-18 18:39 ` aurieh
2020-08-18 19:46 ` ahesford
2020-08-20 18:50 ` [PR PATCH] [Updated] " ahesford
2020-12-21  7:32 ` fosslinux
2020-12-21 11:58 ` ahesford
2021-02-15  5:19 ` ahesford
2021-02-15  5:19 ` [PR PATCH] [Closed]: " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).