aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/Makefile2
-rw-r--r--sysutils/rocr/Makefile28
-rw-r--r--sysutils/rocr/distinfo3
-rw-r--r--sysutils/rocr/files/patch-src_CMakeLists.txt39
-rw-r--r--sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp11
-rw-r--r--sysutils/rocr/pkg-descr8
-rw-r--r--sysutils/rocr/pkg-plist16
-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
13 files changed, 235 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 71821e01bff1..a9565a52afc1 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -1077,6 +1077,8 @@
SUBDIR += riak-cs
SUBDIR += rinse
SUBDIR += rmonitor
+ SUBDIR += rocr
+ SUBDIR += roct
SUBDIR += roottail
SUBDIR += rovclock
SUBDIR += rpi-firmware
diff --git a/sysutils/rocr/Makefile b/sysutils/rocr/Makefile
new file mode 100644
index 000000000000..78bc5969449d
--- /dev/null
+++ b/sysutils/rocr/Makefile
@@ -0,0 +1,28 @@
+# Created by: Johannes Dieterich <jmd@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= rocr
+PORTVERSION= 1.9.1
+CATEGORIES= sysutils
+
+MAINTAINER= jmd@FreeBSD.org
+COMMENT= HPC market enhanced HSA based runtime
+
+LICENSE= NCSA
+LICENSE_FILE= ${WRKSRC}/src/LICENSE.md
+
+ONLY_FOR_ARCHS= amd64
+
+LIB_DEPENDS= libhsakmt.so:sysutils/roct
+
+USES= cmake:outsource
+USE_LDCONFIG= yes
+
+USE_GITHUB= yes
+GH_ACCOUNT= iotamudelta
+GH_PROJECT= ROCR-Runtime
+GH_TAGNAME= 5ab09ee
+
+CMAKE_SOURCE_PATH= ${WRKSRC}/src
+
+.include <bsd.port.mk>
diff --git a/sysutils/rocr/distinfo b/sysutils/rocr/distinfo
new file mode 100644
index 000000000000..f36bb87ea63d
--- /dev/null
+++ b/sysutils/rocr/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1542596496
+SHA256 (iotamudelta-ROCR-Runtime-1.9.1-5ab09ee_GH0.tar.gz) = d26d854207b32c6cc1dfe24aacf0f6c454aae7b52caffb8fa66e9499a0a8955c
+SIZE (iotamudelta-ROCR-Runtime-1.9.1-5ab09ee_GH0.tar.gz) = 305552
diff --git a/sysutils/rocr/files/patch-src_CMakeLists.txt b/sysutils/rocr/files/patch-src_CMakeLists.txt
new file mode 100644
index 000000000000..b702a2d79e74
--- /dev/null
+++ b/sysutils/rocr/files/patch-src_CMakeLists.txt
@@ -0,0 +1,39 @@
+--- src/CMakeLists.txt.orig 2018-11-19 03:01:00 UTC
++++ src/CMakeLists.txt
+@@ -63,7 +63,6 @@ include(CheckSymbolExists)
+ CHECK_SYMBOL_EXISTS ( "__NR_memfd_create" "sys/syscall.h" HAVE_MEMFD_CREATE )
+
+ ## Compiler preproc definitions.
+-add_definitions ( -D__linux__ )
+ add_definitions ( -DHSA_EXPORT=1 )
+ add_definitions ( -DHSA_EXPORT_FINALIZER=1 )
+ add_definitions ( -DHSA_EXPORT_IMAGES=1 )
+@@ -93,6 +92,7 @@ unset( HSAKMT_INC CACHE )
+ unset( HSAKMT_LIB CACHE )
+
+ ## Set include and link directories for libhsakmt
++include_directories ( "/usr/local/include/roct" )
+ include_directories ( ${HSAKMT_INC_PATH} )
+ link_directories ( ${HSAKMT_LIB_PATH} )
+
+@@ -177,14 +176,14 @@ if ( "${CMAKE_BUILD_TYPE}" STREQUAL Release )
+ endif ()
+
+ ## Create symlinks for packaging and install
+-add_custom_target ( hsa-link ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/include/hsa hsa-link )
+-add_custom_target ( ${CORE_RUNTIME_TARGET}.so-link ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/lib/${CORE_RUNTIME_LIBRARY}.so ${CORE_RUNTIME_LIBRARY}.so-link )
++#add_custom_target ( hsa-link ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../include/hsa hsa-link )
++#add_custom_target ( ${CORE_RUNTIME_TARGET}.so-link ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../lib/${CORE_RUNTIME_LIBRARY}.so ${CORE_RUNTIME_LIBRARY}.so-link )
+
+ ## 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-link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}.so-link DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so )
++install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION lib )
++install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include/hsa )
++#install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa-link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa )
++#install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}.so-link DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so )
+
+ ## Packaging directives
+ set ( CPACK_PACKAGE_NAME "hsa-rocr-dev" )
diff --git a/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp b/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp
new file mode 100644
index 000000000000..8af5ac4ec8b6
--- /dev/null
+++ b/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp
@@ -0,0 +1,11 @@
+--- src/core/runtime/amd_loader_context.cpp.orig 2018-11-19 02:58:50 UTC
++++ src/core/runtime/amd_loader_context.cpp
+@@ -207,7 +207,7 @@ bool MappedMemory::Allocate(size_t size, size_t align,
+ #else
+ ptr_ = is_kv_ ?
+ mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0) :
+- mmap(nullptr, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0);
++ mmap(nullptr, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ #endif // _WIN32 || _WIN64
+ if (nullptr == ptr_) {
+ return false;
diff --git a/sysutils/rocr/pkg-descr b/sysutils/rocr/pkg-descr
new file mode 100644
index 000000000000..6f92ad676994
--- /dev/null
+++ b/sysutils/rocr/pkg-descr
@@ -0,0 +1,8 @@
+rocr
+
+HPC market enhanced HSA based runtime
+
+The user-mode API interfaces and libraries necessary for host applications to
+launch compute kernels to available HSA ROCm kernel agents.
+
+WWW: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface
diff --git a/sysutils/rocr/pkg-plist b/sysutils/rocr/pkg-plist
new file mode 100644
index 000000000000..6f8b9fae156b
--- /dev/null
+++ b/sysutils/rocr/pkg-plist
@@ -0,0 +1,16 @@
+include/hsa/Brig.h
+include/hsa/amd_hsa_common.h
+include/hsa/amd_hsa_elf.h
+include/hsa/amd_hsa_kernel_code.h
+include/hsa/amd_hsa_queue.h
+include/hsa/amd_hsa_signal.h
+include/hsa/hsa.h
+include/hsa/hsa_api_trace.h
+include/hsa/hsa_ext_amd.h
+include/hsa/hsa_ext_finalize.h
+include/hsa/hsa_ext_image.h
+include/hsa/hsa_ven_amd_aqlprofile.h
+include/hsa/hsa_ven_amd_loader.h
+lib/libhsa-runtime64.so
+lib/libhsa-runtime64.so.1
+lib/libhsa-runtime64.so.1.0.0
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