summaryrefslogtreecommitdiff
path: root/sysutils/roct
diff options
context:
space:
mode:
authorJohannes M Dieterich <jmd@FreeBSD.org>2018-11-19 04:05:31 +0000
committerJohannes M Dieterich <jmd@FreeBSD.org>2018-11-19 04:05:31 +0000
commit0b9475cf6cff779d91ce7f79b6a58070281b798f (patch)
tree2fcc2d66066ff0b6fde96c217f18204fec2656cb /sysutils/roct
parent- Update to 1.1-19 (diff)
new ports: sysutils/rocr and sysutils/roct
roct is the ROC thunk interface and rocr is the ROCm platform runtime. Together these form the userspace partners to the amdkfd compute driver. Hence, in the current absence of a working amdkfd on FreeBSD, these ports do not function yet. They are integrated to facilitate integration of amdkfd and test it as part of the LinuxKPI-based DRM. Note that these ports are for the time being based off my forks with FreeBSD bringup bits, I'll work with the corresponding upstream teams to get patches reviewed and integrated. Limit these ports to amd64, as even our upstream does not support anything but that for the time being. Version numbers correspond to the overall ROCm release, currently 1.9.1.
Diffstat (limited to 'sysutils/roct')
-rw-r--r--sysutils/roct/Makefile33
-rw-r--r--sysutils/roct/distinfo3
-rw-r--r--sysutils/roct/files/patch-CMakeLists.txt30
-rw-r--r--sysutils/roct/files/patch-src_fmm.c45
-rw-r--r--sysutils/roct/pkg-descr7
-rw-r--r--sysutils/roct/pkg-plist10
6 files changed, 128 insertions, 0 deletions
diff --git a/sysutils/roct/Makefile b/sysutils/roct/Makefile
new file mode 100644
index 000000000000..7e39e8435b98
--- /dev/null
+++ b/sysutils/roct/Makefile
@@ -0,0 +1,33 @@
+# Created by: Johannes Dieterich <jmd@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= roct
+PORTVERSION= 1.9.1
+CATEGORIES= sysutils
+
+MAINTAINER= jmd@FreeBSD.org
+COMMENT= Radeon Open Compute Thunk Interface
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE.md
+
+ONLY_FOR_ARCHS= amd64
+
+LIB_DEPENDS= libpci.so:devel/libpci
+
+USES= cmake:outsource pkgconfig
+USE_LDCONFIG= yes
+
+USE_GITHUB= yes
+GH_ACCOUNT= iotamudelta
+GH_PROJECT= ROCT-Thunk-Interface
+GH_TAGNAME= 9d1fb76
+
+post-install:
+ ${MKDIR} ${STAGEDIR}/${PREFIX}/include/roct
+ ${MKDIR} ${STAGEDIR}/${PREFIX}/include/roct/linux
+ ${INSTALL_DATA} ${WRKSRC}/include/hsakmt.h ${STAGEDIR}/${PREFIX}/include/roct/.
+ ${INSTALL_DATA} ${WRKSRC}/include/hsakmttypes.h ${STAGEDIR}/${PREFIX}/include/roct/.
+ ${INSTALL_DATA} ${WRKSRC}/include/linux/kfd_ioctl.h ${STAGEDIR}/${PREFIX}/include/roct/linux/.
+
+.include <bsd.port.mk>
diff --git a/sysutils/roct/distinfo b/sysutils/roct/distinfo
new file mode 100644
index 000000000000..b89b7037626e
--- /dev/null
+++ b/sysutils/roct/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1542312742
+SHA256 (iotamudelta-ROCT-Thunk-Interface-1.9.1-9d1fb76_GH0.tar.gz) = abe1c2a8375ce93fd840a64b9b5d66a79e112dd350be15c25b641dbf3b256ab7
+SIZE (iotamudelta-ROCT-Thunk-Interface-1.9.1-9d1fb76_GH0.tar.gz) = 1932817
diff --git a/sysutils/roct/files/patch-CMakeLists.txt b/sysutils/roct/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..e0e31bddc0ad
--- /dev/null
+++ b/sysutils/roct/files/patch-CMakeLists.txt
@@ -0,0 +1,30 @@
+--- CMakeLists.txt.orig 2018-11-15 20:11:47 UTC
++++ CMakeLists.txt
+@@ -59,9 +59,9 @@ set ( BUILD_VERSION_STRING "${BUILD_VERSION_MAJOR}.${B
+ #set ( CMAKE_VERBOSE_MAKEFILE on )
+
+ ## Compiler flags
+-set ( CMAKE_C_FLAGS "-fPIC -W -Wall -Wextra -Wno-unused-parameter -Wformat-security -Wswitch-default -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wlogical-op -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wunreachable-code -std=gnu99 -fvisibility=hidden" )
++set ( CMAKE_C_FLAGS "-fPIC -W -Wall -Wextra -Wno-unused-parameter -Wformat-security -Wswitch-default -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wunreachable-code -std=gnu99 -fvisibility=hidden" )
+ if ( "${CMAKE_C_COMPILER_VERSION}" STRGREATER "4.8.0")
+- set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror" )
++ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} " )
+ endif ()
+
+ if ( "${CMAKE_BUILD_TYPE}" STREQUAL Release )
+@@ -102,10 +102,14 @@ set_property ( TARGET ${HSAKMT_TARGET} PROPERTY VERSIO
+ set_property ( TARGET ${HSAKMT_TARGET} PROPERTY SOVERSION "${BUILD_VERSION_MAJOR}" )
+
+ find_package(PkgConfig)
++find_library(PCI_LIBRARIES NAMES pci REQUIRED)
+ pkg_check_modules(PC_LIBPCI REQUIRED libpci)
+ include_directories ( ${PC_LIBPCI_INCLUDEDIR} )
++#target_link_directories( ${HSAKMT_TARGET}
++# PUBLIC "/usr/local/lib"
++#)
+ target_link_libraries ( ${HSAKMT_TARGET}
+- pthread rt numa ${PC_LIBPCI_LIBRARIES}
++ pthread rt ${PCI_LIBRARIES}
+ )
+
+ ## If the library is a release, strip the target library
diff --git a/sysutils/roct/files/patch-src_fmm.c b/sysutils/roct/files/patch-src_fmm.c
new file mode 100644
index 000000000000..93484d9f4da4
--- /dev/null
+++ b/sysutils/roct/files/patch-src_fmm.c
@@ -0,0 +1,45 @@
+--- src/fmm.c.orig 2018-11-19 01:35:23 UTC
++++ src/fmm.c
+@@ -37,7 +37,9 @@
+ #include <sys/time.h>
+ #include <errno.h>
+ #include <pci/pci.h>
++#ifdef __linux__
+ #include <numaif.h>
++#endif
+ #ifndef MPOL_F_STATIC_NODES
+ /* Bug in numaif.h, this should be defined in there. Definition copied
+ * from linux/mempolicy.h.
+@@ -1207,7 +1209,9 @@ static void *fmm_allocate_host_gpu(uint32_t node_id, u
+ if (!flags.ui32.NonPaged && svm.userptr_for_paged_mem) {
+ const unsigned int bits_per_long = sizeof(unsigned long) * 8;
+ unsigned long node_mask[node_id / bits_per_long + 1];
++#ifdef __linux__
+ int mode = MPOL_F_STATIC_NODES;
++#endif
+
+ /* Allocate address space */
+ pthread_mutex_lock(&aperture->fmm_mutex);
+@@ -1219,10 +1223,12 @@ static void *fmm_allocate_host_gpu(uint32_t node_id, u
+ /* Bind to NUMA node */
+ memset(node_mask, 0, sizeof(node_mask));
+ node_mask[node_id / bits_per_long] = 1UL << (node_id % bits_per_long);
++#ifdef __linux__
+ mode |= flags.ui32.NoSubstitute ? MPOL_BIND : MPOL_PREFERRED;
+ if (mbind(mem, MemorySizeInBytes, mode, node_mask, node_id+1, 0))
+ pr_warn("Failed to set NUMA policy for %lu pages at %p\n",
+ MemorySizeInBytes >> 12, mem);
++#endif
+
+ /* Map anonymous pages */
+ if (mmap(mem, MemorySizeInBytes, PROT_READ | PROT_WRITE,
+@@ -1334,7 +1340,9 @@ static void __fmm_release(void *address, manageable_ap
+ if (address >= dgpu_shared_aperture_base &&
+ address <= dgpu_shared_aperture_limit) {
+ /* Reset NUMA policy */
++#ifdef __linux__
+ mbind(address, object->size, MPOL_DEFAULT, NULL, 0, 0);
++#endif
+ munmap_and_reserve_address(address, object->size);
+ }
+
diff --git a/sysutils/roct/pkg-descr b/sysutils/roct/pkg-descr
new file mode 100644
index 000000000000..2b74767ce4e5
--- /dev/null
+++ b/sysutils/roct/pkg-descr
@@ -0,0 +1,7 @@
+roct
+
+Radeon Open Compute Thunk Interface
+
+The user-mode API interfaces used to interact with the ROCk driver.
+
+WWW: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface
diff --git a/sysutils/roct/pkg-plist b/sysutils/roct/pkg-plist
new file mode 100644
index 000000000000..0d725c30c2aa
--- /dev/null
+++ b/sysutils/roct/pkg-plist
@@ -0,0 +1,10 @@
+include/roct/hsakmt.h
+include/roct/hsakmttypes.h
+include/roct/linux/kfd_ioctl.h
+lib/libhsakmt.so
+lib/libhsakmt.so.1
+lib/libhsakmt.so.1.0.0
+libhsakmt/LICENSE.md
+@dir include/roct/linux
+@dir include/roct
+@dir include