Date: Mon, 19 Nov 2018 04:05:31 +0000 (UTC) From: Johannes M Dieterich <jmd@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r485302 - in head/sysutils: . rocr rocr/files roct roct/files Message-ID: <201811190405.wAJ45Vnu049894@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmd Date: Mon Nov 19 04:05:31 2018 New Revision: 485302 URL: https://svnweb.freebsd.org/changeset/ports/485302 Log: 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. Added: head/sysutils/rocr/ head/sysutils/rocr/Makefile (contents, props changed) head/sysutils/rocr/distinfo (contents, props changed) head/sysutils/rocr/files/ head/sysutils/rocr/files/patch-src_CMakeLists.txt (contents, props changed) head/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp (contents, props changed) head/sysutils/rocr/pkg-descr (contents, props changed) head/sysutils/rocr/pkg-plist (contents, props changed) head/sysutils/roct/ head/sysutils/roct/Makefile (contents, props changed) head/sysutils/roct/distinfo (contents, props changed) head/sysutils/roct/files/ head/sysutils/roct/files/patch-CMakeLists.txt (contents, props changed) head/sysutils/roct/files/patch-src_fmm.c (contents, props changed) head/sysutils/roct/pkg-descr (contents, props changed) head/sysutils/roct/pkg-plist (contents, props changed) Modified: head/sysutils/Makefile Modified: head/sysutils/Makefile ============================================================================== --- head/sysutils/Makefile Mon Nov 19 03:38:02 2018 (r485301) +++ head/sysutils/Makefile Mon Nov 19 04:05:31 2018 (r485302) @@ -1077,6 +1077,8 @@ SUBDIR += riak-cs SUBDIR += rinse SUBDIR += rmonitor + SUBDIR += rocr + SUBDIR += roct SUBDIR += roottail SUBDIR += rovclock SUBDIR += rpi-firmware Added: head/sysutils/rocr/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/Makefile Mon Nov 19 04:05:31 2018 (r485302) @@ -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> Added: head/sysutils/rocr/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/distinfo Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/rocr/files/patch-src_CMakeLists.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/files/patch-src_CMakeLists.txt Mon Nov 19 04:05:31 2018 (r485302) @@ -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" ) Added: head/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/files/patch-src_core_runtime_amd__loader__context.cpp Mon Nov 19 04:05:31 2018 (r485302) @@ -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; Added: head/sysutils/rocr/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/pkg-descr Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/rocr/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rocr/pkg-plist Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/roct/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/Makefile Mon Nov 19 04:05:31 2018 (r485302) @@ -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> Added: head/sysutils/roct/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/distinfo Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/roct/files/patch-CMakeLists.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/files/patch-CMakeLists.txt Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/roct/files/patch-src_fmm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/files/patch-src_fmm.c Mon Nov 19 04:05:31 2018 (r485302) @@ -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); + } + Added: head/sysutils/roct/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/pkg-descr Mon Nov 19 04:05:31 2018 (r485302) @@ -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 Added: head/sysutils/roct/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/roct/pkg-plist Mon Nov 19 04:05:31 2018 (r485302) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811190405.wAJ45Vnu049894>