diff options
author | jbeich <jbeich@FreeBSD.org> | 2019-12-08 01:31:44 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2019-12-08 01:31:44 +0800 |
commit | 8071bf3a85a946a23b888245588b1bb9e46f1a09 (patch) | |
tree | 56541d432cd5abb5da9316ac4acef495ab059fd6 /lang | |
parent | eab38a255d1b0bdff7f864676e6f63bb600dda14 (diff) | |
download | freebsd-ports-gnome-8071bf3a85a946a23b888245588b1bb9e46f1a09.tar.gz freebsd-ports-gnome-8071bf3a85a946a23b888245588b1bb9e46f1a09.tar.zst freebsd-ports-gnome-8071bf3a85a946a23b888245588b1bb9e46f1a09.zip |
devel/compute-runtime: add new port
Tested by: clpeak, waifu2x-converter-cpp via drm-v4.9 on Skylake
The Intel(R) Graphics Compute Runtime for OpenCL(TM) is an open source
project to converge Intel's development efforts on OpenCL(TM) compute
stacks supporting the GEN graphics hardware architecture.
https://01.org/compute-runtime
Diffstat (limited to 'lang')
-rw-r--r-- | lang/Makefile | 1 | ||||
-rw-r--r-- | lang/compute-runtime/Makefile | 48 | ||||
-rw-r--r-- | lang/compute-runtime/distinfo | 3 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-backtrace | 140 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-clang9 | 76 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-clock_gettime | 24 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-i386 | 18 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-includes | 45 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-libc++ | 37 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-mmap | 31 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-rtld | 18 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-unix | 219 | ||||
-rw-r--r-- | lang/compute-runtime/files/patch-userptr | 61 | ||||
-rw-r--r-- | lang/compute-runtime/pkg-descr | 5 |
14 files changed, 726 insertions, 0 deletions
diff --git a/lang/Makefile b/lang/Makefile index 92eb28af4925..a89a61784e47 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -45,6 +45,7 @@ SUBDIR += cmucl-extra SUBDIR += cocor SUBDIR += coffeescript + SUBDIR += compute-runtime SUBDIR += cparser SUBDIR += crystal SUBDIR += csharp-mode.el diff --git a/lang/compute-runtime/Makefile b/lang/compute-runtime/Makefile new file mode 100644 index 000000000000..6105ec2ef613 --- /dev/null +++ b/lang/compute-runtime/Makefile @@ -0,0 +1,48 @@ +# $FreeBSD$ + +PORTNAME= compute-runtime +DISTVERSION= 19.48.14977 +CATEGORIES= lang + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= OpenCL library for Intel HD 5000 (Gen8) or newer + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +ONLY_FOR_ARCHS= amd64 i386 +ONLY_FOR_ARCHS_REASON= Only Intel GPUs on x86 are supported + +LIB_DEPENDS= libigc.so:devel/intel-graphics-compiler \ + libigdgmm.so:multimedia/gmmlib + +USES= cmake:noninja compiler:c++14-lang pkgconfig +USE_GITHUB= yes +USE_LDCONFIG= yes +GH_ACCOUNT= intel +CMAKE_ARGS= -DNEO_DRIVER_VERSION:STRING="${DISTVERSIONFULL}" +PLIST_FILES= etc/OpenCL/vendors/intel.icd \ + bin/ocloc \ + lib/intel-opencl/libigdrcl.so + +OPTIONS_DEFINE= TEST + +# XXX Unbundle googletest +TEST_CMAKE_BOOL_OFF= SKIP_ALL_ULT +TEST_BROKEN= many tests fail + +post-patch: + @${REINPLACE_CMD} -e '/-Werror/d' \ + ${WRKSRC}/CMakeLists.txt + @${REINPLACE_CMD} -e '/defaults/!s,/etc",${PREFIX}&,' \ + ${WRKSRC}/package.cmake +# XXX libexecinfo backtraces are incomplete + @${REINPLACE_CMD} -e 's/SegFault/DISABLED_&/' \ + ${WRKSRC}/unit_tests/offline_compiler/segfault_test/main.cpp + +post-install: +# install/strip has no effect on install(FILES), so strip manually + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/* + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/intel-opencl/*.so + +.include <bsd.port.mk> diff --git a/lang/compute-runtime/distinfo b/lang/compute-runtime/distinfo new file mode 100644 index 000000000000..1f5d73e70fd0 --- /dev/null +++ b/lang/compute-runtime/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1575037414 +SHA256 (intel-compute-runtime-19.48.14977_GH0.tar.gz) = 1b3c58260582f1af8934cd23837c9b27326f3968b8a21755dbf7d3feec7ebcd3 +SIZE (intel-compute-runtime-19.48.14977_GH0.tar.gz) = 2633172 diff --git a/lang/compute-runtime/files/patch-backtrace b/lang/compute-runtime/files/patch-backtrace new file mode 100644 index 000000000000..0a45e5688dab --- /dev/null +++ b/lang/compute-runtime/files/patch-backtrace @@ -0,0 +1,140 @@ +Adjust for backtrace(3) on BSDs + +In file included from offline_compiler/utilities/linux/safety_caller_linux.cpp:10: +offline_compiler/utilities/linux/safety_guard_linux.h:36:25: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32] + backtraceSize = backtrace(addresses, callstackDepth); + ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +core/unit_tests/helpers/memory_management.cpp:113:46: error: + implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' + [-Werror,-Wshorten-64-to-32] + ...= logTraces ? backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; + ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +ld: error: undefined symbol: backtrace +>>> referenced by safety_caller_linux.cpp +>>> CMakeFiles/ocloc.dir/utilities/linux/safety_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) +ld: error: undefined symbol: backtrace_symbols +>>> referenced by safety_caller_linux.cpp +>>> CMakeFiles/ocloc.dir/utilities/linux/safety_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) + +ld: error: undefined symbol: backtrace_symbols +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(MemoryManagement::printCallStack(MemoryManagement::AllocationEvent const&)) + +ld: error: undefined symbol: backtrace +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void* MemoryManagement::allocate<(MemoryManagement::AllocationEvent::EventType)1, (MemoryManagement::AllocationEvent::EventType)2>(unsigned long)) +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void* MemoryManagement::allocate<(MemoryManagement::AllocationEvent::EventType)3, (MemoryManagement::AllocationEvent::EventType)4>(unsigned long, std::nothrow_t const&)) +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void* MemoryManagement::allocate<(MemoryManagement::AllocationEvent::EventType)5, (MemoryManagement::AllocationEvent::EventType)6>(unsigned long)) +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void* MemoryManagement::allocate<(MemoryManagement::AllocationEvent::EventType)7, (MemoryManagement::AllocationEvent::EventType)8>(unsigned long, std::nothrow_t const&)) +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void MemoryManagement::deallocate<(MemoryManagement::AllocationEvent::EventType)9>(void*)) +>>> referenced by memory_management.cpp +>>> CMakeFiles/elflib_tests.dir/__/__/core/unit_tests/helpers/memory_management.cpp.o:(void MemoryManagement::deallocate<(MemoryManagement::AllocationEvent::EventType)10>(void*)) + +ld: error: undefined symbol: backtrace +>>> referenced by safety_guard_caller_linux.cpp +>>> CMakeFiles/ocloc_segfault_test.dir/linux/safety_guard_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) + +ld: error: undefined symbol: backtrace_symbols +>>> referenced by safety_guard_caller_linux.cpp +>>> CMakeFiles/ocloc_segfault_test.dir/linux/safety_guard_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) + +ld: error: undefined symbol: backtrace +>>> referenced by safety_caller_linux.cpp +>>> CMakeFiles/ocloc_tests.dir/__/__/offline_compiler/utilities/linux/safety_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) +ld: error: undefined symbol: backtrace_symbols +>>> referenced by safety_caller_linux.cpp +>>> CMakeFiles/ocloc_tests.dir/__/__/offline_compiler/utilities/linux/safety_caller_linux.cpp.o:(SafetyGuardLinux::sigAction(int, __siginfo*, void*)) + +--- offline_compiler/utilities/linux/safety_guard_linux.h.orig 2019-11-22 15:41:47 UTC ++++ offline_compiler/utilities/linux/safety_guard_linux.h +@@ -33,7 +33,7 @@ class SafetyGuardLinux { + char **callstack; + int backtraceSize = 0; + +- backtraceSize = backtrace(addresses, callstackDepth); ++ backtraceSize = (int)backtrace(addresses, callstackDepth); + callstack = backtrace_symbols(addresses, backtraceSize); + + for (int i = 0; i < backtraceSize; ++i) { +--- core/unit_tests/helpers/memory_management.cpp.orig 2019-11-22 15:41:47 UTC ++++ core/unit_tests/helpers/memory_management.cpp +@@ -110,7 +110,7 @@ static void *allocate(size_t size) { + eventAllocation.address = p; + eventAllocation.event = typeValid; + #if defined(__linux__) +- eventAllocation.frames = logTraces ? backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; ++ eventAllocation.frames = logTraces ? (int)backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventAllocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventAllocation.callstack, NULL) : 0; + #else +@@ -162,7 +162,7 @@ static void *allocate(size_t size, const std::nothrow_ + eventAllocation.address = p; + eventAllocation.size = size; + #if defined(__linux__) +- eventAllocation.frames = logTraces ? backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; ++ eventAllocation.frames = logTraces ? (int)backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventAllocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventAllocation.callstack, NULL) : 0; + #else +@@ -207,7 +207,7 @@ static void deallocate(void *p) { + eventDeallocation.address = p; + eventDeallocation.size = -1; + #if defined(__linux__) +- eventDeallocation.frames = logTraces ? backtrace(eventDeallocation.callstack, AllocationEvent::CallStackSize) : 0; ++ eventDeallocation.frames = logTraces ? (int)backtrace(eventDeallocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventDeallocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventDeallocation.callstack, NULL) : 0; + #else +--- offline_compiler/CMakeLists.txt.orig 2019-11-29 14:23:34 UTC ++++ offline_compiler/CMakeLists.txt +@@ -124,6 +124,9 @@ endif() + + if(UNIX) + target_link_libraries(ocloc dl pthread) ++ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") ++ target_link_libraries(ocloc execinfo) ++ endif() + endif() + + target_link_libraries(ocloc elflib) +--- unit_tests/elflib/CMakeLists.txt.orig 2019-11-29 14:23:34 UTC ++++ unit_tests/elflib/CMakeLists.txt +@@ -21,6 +21,9 @@ set_property(TARGET elflib_tests APPEND_STRING PROPERT + + if(UNIX) + target_link_libraries(elflib_tests ${IGDRCL_EXTRA_LIBS}) ++ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") ++ target_link_libraries(elflib_tests execinfo) ++ endif() + endif() + + add_custom_target(run_elflib_tests ALL DEPENDS unit_tests elflib_tests) +--- unit_tests/offline_compiler/segfault_test/CMakeLists.txt.orig 2019-11-29 14:23:34 UTC ++++ unit_tests/offline_compiler/segfault_test/CMakeLists.txt +@@ -39,6 +39,9 @@ if(MSVC) + endif() + if(UNIX) + target_link_libraries(ocloc_segfault_test dl pthread) ++ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") ++ target_link_libraries(ocloc_segfault_test execinfo) ++ endif() + endif() + + set(CLOC_SEGFAULT_TEST_INCLUDES +--- unit_tests/offline_compiler/CMakeLists.txt.orig 2019-11-29 14:23:34 UTC ++++ unit_tests/offline_compiler/CMakeLists.txt +@@ -86,6 +86,9 @@ endif() + + if(UNIX) + target_link_libraries(ocloc_tests dl pthread) ++ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") ++ target_link_libraries(ocloc_tests execinfo) ++ endif() + endif() + + get_property(CLOC_FOLDER TARGET ocloc PROPERTY FOLDER) diff --git a/lang/compute-runtime/files/patch-clang9 b/lang/compute-runtime/files/patch-clang9 new file mode 100644 index 000000000000..c91edd8c5776 --- /dev/null +++ b/lang/compute-runtime/files/patch-clang9 @@ -0,0 +1,76 @@ +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen9.cpp +>>> preamble_gen9.cpp.o:(.rodata+0x0) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen9.cpp +>>> preamble_gen9.cpp.o:(.rodata+0x4) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at command_stream_receiver_hw_gen11.cpp +>>> command_stream_receiver_hw_gen11.cpp.o:(.rodata+0x0) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at command_stream_receiver_hw_gen11.cpp +>>> command_stream_receiver_hw_gen11.cpp.o:(.rodata+0x4) in archive ../lib/libigdrcl_lib_release.a +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen11.cpp +>>> preamble_gen11.cpp.o:(.rodata+0x0) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen11.cpp +>>> preamble_gen11.cpp.o:(.rodata+0x4) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at aub_mem_dump_gen12lp.cpp +>>> aub_mem_dump_gen12lp.cpp.o:(.rodata+0x0) in archive ../lib/libigdrcl_lib_release.a +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at aub_mem_dump_gen12lp.cpp +>>> aub_mem_dump_gen12lp.cpp.o:(.rodata+0x4) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::registerOffset<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen12lp.cpp +>>> preamble_gen12lp.cpp.o:(.rodata+0x0) in archive ../lib/libigdrcl_lib_release.a + +ld: error: duplicate symbol: NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily> +>>> defined at preamble_gen8.cpp +>>> preamble_gen8.cpp.o:(NEO::DebugModeRegisterOffset::debugEnabledValue<NEO::ICLFamily>) in archive ../lib/libigdrcl_lib_release.a +>>> defined at preamble_gen12lp.cpp +>>> preamble_gen12lp.cpp.o:(.rodata+0x4) in archive ../lib/libigdrcl_lib_release.a + +--- runtime/gen11/reg_configs.h.orig 2019-11-29 14:23:34 UTC ++++ runtime/gen11/reg_configs.h +@@ -25,9 +25,15 @@ struct L3CNTLRegisterOffset<ICLFamily> { + + namespace DebugModeRegisterOffset { + template <> ++#ifdef __clang__ ++static ++#endif + constexpr uint32_t registerOffset<ICLFamily> = 0x20d8; + template <> ++#ifdef __clang__ ++static ++#endif + constexpr uint32_t debugEnabledValue<ICLFamily> = (1 << 5) | (1 << 21); + }; // namespace DebugModeRegisterOffset + + namespace gen11HdcModeRegister { diff --git a/lang/compute-runtime/files/patch-clock_gettime b/lang/compute-runtime/files/patch-clock_gettime new file mode 100644 index 000000000000..7a6609f709b7 --- /dev/null +++ b/lang/compute-runtime/files/patch-clock_gettime @@ -0,0 +1,24 @@ +CLOCK_MONOTONIC_RAW doesn't exist on non-Linux systems. + +runtime/os_interface/linux/os_time_linux.cpp:61:21: error: + use of undeclared identifier 'CLOCK_MONOTONIC_RAW' + if (getTimeFunc(CLOCK_MONOTONIC_RAW, &ts)) { + ^ +runtime/os_interface/linux/os_time_linux.cpp:138:24: error: + use of undeclared identifier 'CLOCK_MONOTONIC_RAW' + if (resolutionFunc(CLOCK_MONOTONIC_RAW, &ts)) { + ^ + +--- runtime/os_interface/linux/os_time_linux.cpp.orig 2019-11-22 15:41:47 UTC ++++ runtime/os_interface/linux/os_time_linux.cpp +@@ -14,6 +14,10 @@ + + #include <time.h> + ++#ifndef CLOCK_MONOTONIC_RAW ++#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC ++#endif ++ + namespace NEO { + + OSTimeLinux::OSTimeLinux(OSInterface *osInterface) { diff --git a/lang/compute-runtime/files/patch-i386 b/lang/compute-runtime/files/patch-i386 new file mode 100644 index 000000000000..05f80f8ab1c2 --- /dev/null +++ b/lang/compute-runtime/files/patch-i386 @@ -0,0 +1,18 @@ +SSE2 is not enabled by default on BSDs + +core/utilities/clflush.cpp:16:5: error: '_mm_clflush' needs target feature sse2 + _mm_clflush(ptr); + ^ + +--- core/utilities/clflush.cpp.orig 2019-11-29 14:23:34 UTC ++++ core/utilities/clflush.cpp +@@ -12,6 +12,9 @@ + namespace NEO { + namespace CpuIntrinsics { + ++#ifdef __GNUC__ ++__attribute__((target("sse2"))) ++#endif + void clFlush(void const *ptr) { + _mm_clflush(ptr); + } diff --git a/lang/compute-runtime/files/patch-includes b/lang/compute-runtime/files/patch-includes new file mode 100644 index 000000000000..771a9efb5b51 --- /dev/null +++ b/lang/compute-runtime/files/patch-includes @@ -0,0 +1,45 @@ +Add missing includes in various places. + +runtime/tbx/tbx_sockets_imp.cpp:74:51: error: use of undeclared identifier 'IPPROTO_TCP' + m_socket = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ^ +runtime/tbx/tbx_sockets_imp.cpp:107:9: error: unknown type name 'sockaddr_in'; did you mean 'sockaddr'? + sockaddr_in clientService; + ^~~~~~~~~~~ + sockaddr +/usr/include/sys/socket.h:328:8: note: 'sockaddr' declared here +struct sockaddr { + ^ + +unit_tests/main.cpp:116:18: error: + variable has incomplete type 'struct sigaction' +struct sigaction oldSigAbrt; + ^ +unit_tests/main.cpp:116:8: note: + forward declaration of 'sigaction' +struct sigaction oldSigAbrt; + ^ + +--- runtime/tbx/tbx_sockets_imp.cpp.orig 2019-11-22 15:41:47 UTC ++++ runtime/tbx/tbx_sockets_imp.cpp +@@ -18,6 +18,7 @@ typedef int socklen_t; + #else + #include <arpa/inet.h> + #include <netdb.h> ++#include <netinet/in.h> + #include <stdlib.h> + #include <string.h> + #include <unistd.h> +--- unit_tests/main.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/main.cpp +@@ -32,6 +32,10 @@ + #include <sstream> + #include <thread> + ++#ifndef _WIN32 ++#include <signal.h> ++#endif ++ + #ifdef WIN32 + const char *fSeparator = "\\"; + #else diff --git a/lang/compute-runtime/files/patch-libc++ b/lang/compute-runtime/files/patch-libc++ new file mode 100644 index 000000000000..0fc1e3411542 --- /dev/null +++ b/lang/compute-runtime/files/patch-libc++ @@ -0,0 +1,37 @@ +Don't define OpenCL keywords before including system headers + +In file included from unit_tests/built_ins/built_in_kernels_tests.cpp:10: +In file included from third_party/gtest/gtest/gtest.h:57: +In file included from /usr/include/c++/v1/ostream:138: +In file included from /usr/include/c++/v1/ios:215: +/usr/include/c++/v1/__locale:177:29: error: expected member name or ';' after declaration specifiers + static locale& __global(); + ~~~~~~~~~~~~~ ^ +In file included from unit_tests/built_ins/built_in_kernels_tests.cpp:10: +In file included from third_party/gtest/gtest/gtest.h:57: +In file included from /usr/include/c++/v1/ostream:140: +In file included from /usr/include/c++/v1/locale:197: +In file included from /usr/include/nl_types.h:40: +In file included from /usr/include/sys/types.h:377: +/usr/include/sys/select.h:105:37: error: too many arguments provided to function-like macro invocation +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + ^ +runtime/builtin_kernels_simulation/opencl_c.h:223:9: note: + macro 'select' defined here +#define select(a, b, c) (c ? b : a) + ^ + +--- unit_tests/built_ins/built_in_kernels_tests.cpp.orig 2019-11-29 14:23:34 UTC ++++ unit_tests/built_ins/built_in_kernels_tests.cpp +@@ -5,9 +5,9 @@ + * + */ + +-#include "runtime/builtin_kernels_simulation/opencl_c.h" +- + #include "gtest/gtest.h" ++ ++#include "runtime/builtin_kernels_simulation/opencl_c.h" + + namespace BuiltinKernelsSimulation { + diff --git a/lang/compute-runtime/files/patch-mmap b/lang/compute-runtime/files/patch-mmap new file mode 100644 index 000000000000..7d40c301a720 --- /dev/null +++ b/lang/compute-runtime/files/patch-mmap @@ -0,0 +1,31 @@ +Some mmap(2) flags are Linux-specific but otherwise not required + +core/os_interface/linux/os_memory_linux.cpp:17:83: error: + use of undeclared identifier 'MAP_NORESERVE' + return mmapWrapper(0, sizeToReserve, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_... + ^ +core/os_interface/linux/os_memory_linux.cpp:17:99: error: + use of undeclared identifier 'MAP_HUGETLB' + ...mmapWrapper(0, sizeToReserve, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_HUGETLB, -1... + ^ + +--- core/os_interface/linux/os_memory_linux.cpp.orig 2019-11-22 15:41:47 UTC ++++ core/os_interface/linux/os_memory_linux.cpp +@@ -7,6 +7,17 @@ + + #include "core/os_interface/linux/os_memory_linux.h" + ++#ifdef MAP_ALIGNED_SUPER ++#define MAP_HUGETLB MAP_ALIGNED_SUPER // FreeBSD ++#endif ++ ++#ifndef MAP_NORESERVE ++#define MAP_NORESERVE 0 ++#endif ++#ifndef MAP_HUGETLB ++#define MAP_HUGETLB 0 ++#endif ++ + namespace NEO { + + std::unique_ptr<OSMemory> OSMemory::create() { diff --git a/lang/compute-runtime/files/patch-rtld b/lang/compute-runtime/files/patch-rtld new file mode 100644 index 000000000000..661fdbc12333 --- /dev/null +++ b/lang/compute-runtime/files/patch-rtld @@ -0,0 +1,18 @@ +RTLD_DEEPBIND isn't available on non-Linux + +core/os_interface/linux/os_library_linux.cpp: In constructor 'NEO::Linux::OsLibrary::OsLibrary(const string&)': +core/os_interface/linux/os_library_linux.cpp:35:49: error: 'RTLD_DEEPBIND' was not declared in this scope + 35 | constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND; + | ^~~~~~~~~~~~~ + +--- core/os_interface/linux/os_library_linux.cpp.orig 2019-11-29 14:23:34 UTC ++++ core/os_interface/linux/os_library_linux.cpp +@@ -29,7 +29,7 @@ OsLibrary::OsLibrary(const std::string &name) { + if (name.empty()) { + this->handle = dlopen(0, RTLD_LAZY); + } else { +-#ifdef SANITIZER_BUILD ++#if defined(SANITIZER_BUILD) || !defined(__linux__) + constexpr auto dlopenFlag = RTLD_LAZY; + #else + constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND; diff --git a/lang/compute-runtime/files/patch-unix b/lang/compute-runtime/files/patch-unix new file mode 100644 index 000000000000..32660a0e3c86 --- /dev/null +++ b/lang/compute-runtime/files/patch-unix @@ -0,0 +1,219 @@ +Relax Linux checks for the code works on any non-Windows platform + +core/elf/writer.cpp:54:9: error: + use of undeclared identifier 'memcpy_s' + memcpy_s(data, queueFront.dataSize, queueFront.data.c_str(), queueFront.dataSize); + ^ +core/elf/writer.cpp:59:13: error: + use of undeclared identifier 'memcpy_s' + memcpy_s(curString, queueFront.name.size(), queueFront.name.c_str(), queueFront.name.size()); + ^ +core/elf/writer.cpp:76:5: error: + use of undeclared identifier 'memcpy_s' + memcpy_s(curSectionHeader, sizeof(SElf64SectionHeader), + ^ + +--- core/helpers/string.h.orig 2019-11-22 15:41:47 UTC ++++ core/helpers/string.h +@@ -10,7 +10,7 @@ + #include <memory> + #include <type_traits> + +-#if defined(__linux__) ++#if !defined(_WIN32) + + #include <cstring> + #include <errno.h> +--- core/unit_tests/compiler_interface/compiler_interface_tests.cpp.orig 2019-11-22 15:41:47 UTC ++++ core/unit_tests/compiler_interface/compiler_interface_tests.cpp +@@ -24,7 +24,7 @@ using namespace NEO; + + #if defined(_WIN32) + const char *gBadDompilerDllName = "bad_compiler.dll"; +-#elif defined(__linux__) ++#elif !defined(__APPLE__) + const char *gCBadDompilerDllName = "libbad_compiler.so"; + #else + #error "Unknown OS!" +--- core/unit_tests/helpers/memory_management.cpp.orig 2019-11-22 15:41:47 UTC ++++ core/unit_tests/helpers/memory_management.cpp +@@ -18,7 +18,7 @@ + #include <iostream> + #include <new> + +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + #include <cstdio> + #include <dlfcn.h> + #include <execinfo.h> +@@ -109,7 +109,7 @@ static void *allocate(size_t size) { + + eventAllocation.address = p; + eventAllocation.event = typeValid; +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + eventAllocation.frames = logTraces ? (int)backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventAllocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventAllocation.callstack, NULL) : 0; +@@ -161,7 +161,7 @@ static void *allocate(size_t size, const std::nothrow_ + : typeFail; + eventAllocation.address = p; + eventAllocation.size = size; +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + eventAllocation.frames = logTraces ? (int)backtrace(eventAllocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventAllocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventAllocation.callstack, NULL) : 0; +@@ -206,7 +206,7 @@ static void deallocate(void *p) { + eventDeallocation.event = typeValid; + eventDeallocation.address = p; + eventDeallocation.size = -1; +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + eventDeallocation.frames = logTraces ? (int)backtrace(eventDeallocation.callstack, AllocationEvent::CallStackSize) : 0; + #elif defined(_WIN32) + eventDeallocation.frames = logTraces ? CaptureStackBackTrace(0, AllocationEvent::CallStackSize, eventDeallocation.callstack, NULL) : 0; +@@ -312,7 +312,7 @@ std::string printCallStack(const MemoryManagement::All + printf("for detailed stack information turn on captureCallStacks in memory_management.h\n"); + } + if (event.frames > 0) { +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + char **bt = backtrace_symbols(event.callstack, event.frames); + char *demangled; + int status; +--- core/unit_tests/helpers/string_tests.cpp.orig 2019-11-22 15:41:47 UTC ++++ core/unit_tests/helpers/string_tests.cpp +@@ -10,7 +10,7 @@ + + #include "gtest/gtest.h" + +-#if defined(__linux__) ++#if !defined(_WIN32) + + TEST(StringHelpers, strncpy) { + char dst[1024] = ""; +--- unit_tests/fixtures/memory_management_fixture.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/fixtures/memory_management_fixture.cpp +@@ -12,12 +12,12 @@ + #include "runtime/helpers/options.h" + + #include <cinttypes> +-#if defined(__linux__) ++#if !defined(_WIN32) + #include <cstdio> + #include <cxxabi.h> + #include <dlfcn.h> + #include <execinfo.h> +-#elif defined(_WIN32) ++#else + #include <Windows.h> + #pragma warning(push) // Saves the current warning state. + #pragma warning(disable : 4091) // Temporarily disables warning 4091. +--- unit_tests/main.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/main.cpp +@@ -104,7 +104,7 @@ void applyWorkarounds() { + tempThreadID = t.get_id(); + t.join(); + } +-#ifdef __linux__ ++#ifndef _WIN32 + void handle_SIGALRM(int signal) { + std::cout << "Tests timeout on: " << lastTest << std::endl; + abort(); +@@ -158,7 +158,7 @@ std::string getRunPath(char *argv0) { + res = res.substr(0, pos); + + if (res == "." || pos == std::string::npos) { +-#if defined(__linux__) ++#if !defined(_WIN32) + res = getcwd(nullptr, 0); + #else + res = _getcwd(nullptr, 0); +@@ -176,7 +176,7 @@ int main(int argc, char **argv) { + + applyWorkarounds(); + +-#if defined(__linux__) ++#if !defined(_WIN32) + bool enable_segv = true; + bool enable_abrt = true; + if (getenv("IGDRCL_TEST_SELF_EXEC") == nullptr) { +@@ -373,7 +373,7 @@ int main(int argc, char **argv) { + if (_chdir(executionDirectory.c_str())) { + std::cout << "chdir into " << executionDirectory << " directory failed.\nThis might cause test failures." << std::endl; + } +-#elif defined(__linux__) ++#else + #include <unistd.h> + if (chdir(executionDirectory.c_str()) != 0) { + std::cout << "chdir into " << executionDirectory << " directory failed.\nThis might cause test failures." << std::endl; +@@ -412,7 +412,7 @@ int main(int argc, char **argv) { + gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName); + gEnvironment->setDefaultDebugVars(fclDebugVars, igcDebugVars, device); + +-#if defined(__linux__) ++#if !defined(_WIN32) + //ULTs timeout + if (enable_alarm) { + unsigned int alarmTime = NEO::ultIterationMaxTime * ::testing::GTEST_FLAG(repeat); +--- unit_tests/offline_compiler/main.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/offline_compiler/main.cpp +@@ -14,7 +14,7 @@ + + #ifdef WIN32 + const char *fSeparator = "\\"; +-#elif defined(__linux__) ++#else + const char *fSeparator = "/"; + #endif + +@@ -22,7 +22,7 @@ Environment *gEnvironment; + + std::string getRunPath() { + std::string res; +-#if defined(__linux__) ++#if !defined(_WIN32) + res = getcwd(nullptr, 0); + #else + res = _getcwd(nullptr, 0); +@@ -36,7 +36,7 @@ int main(int argc, char **argv) { + std::string devicePrefix("skl"); + std::string familyNameWithType("Gen9core"); + +-#if defined(__linux__) ++#if !defined(_WIN32) + if (getenv("CLOC_SELFTEST") == nullptr) { + setenv("CLOC_SELFTEST", "YES", 1); + +@@ -88,7 +88,7 @@ int main(int argc, char **argv) { + if (_chdir(familyNameWithType.c_str())) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; + } +-#elif defined(__linux__) ++#else + #include <unistd.h> + if (chdir(familyNameWithType.c_str()) != 0) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; +--- unit_tests/os_interface/linux/options.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/os_interface/linux/options.cpp +@@ -15,7 +15,7 @@ namespace Os { + // These options determine the Linux specific behavior for + // the runtime unit tests + /////////////////////////////////////////////////////////////////////////////// +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + const char *frontEndDllName = "libmock_igdfcl.so"; + const char *igcDllName = "libmock_igc.so"; + const char *libvaDllName = nullptr; +--- unit_tests/os_interface/os_library_tests.cpp.orig 2019-11-22 15:41:47 UTC ++++ unit_tests/os_interface/os_library_tests.cpp +@@ -7,7 +7,7 @@ + + #if defined(_WIN32) + #include "core/os_interface/windows/os_library_win.h" +-#elif defined(__linux__) ++#else + #include "core/os_interface/linux/os_library_linux.h" + #endif + #include "core/os_interface/os_library.h" diff --git a/lang/compute-runtime/files/patch-userptr b/lang/compute-runtime/files/patch-userptr new file mode 100644 index 000000000000..c7c387dd086c --- /dev/null +++ b/lang/compute-runtime/files/patch-userptr @@ -0,0 +1,61 @@ +Try unsynchronized userptr if regular one fails. +https://github.com/FreeBSDDesktop/DEPRECATED-freebsd-base-graphics/issues/132 + +Process 51117 stopped +* thread #1, name = 'clinfo', stop reason = signal SIGABRT + frame #0: 0x000000080044fe7a libc.so.7`__sys_thr_kill at thr_kill.S:4 +(lldb) bt +* thread #1, name = 'clinfo', stop reason = signal SIGABRT + * frame #0: 0x000000080044fe7a libc.so.7`__sys_thr_kill at thr_kill.S:4 + frame #1: 0x000000080044f7e4 libc.so.7`__raise(s=6) at raise.c:52:10 + frame #2: 0x00000008003b3a89 libc.so.7`abort at abort.c:67:8 + frame #3: 0x000000080043a711 libc.so.7`__assert(func=<unavailable>, file=<unavailable>, line=<unavailable>, failedexpr=<unavailable>) at assert.c:51:2 + frame #4: 0x0000000800e255ad libigdrcl.so`NEO::debugBreak(line=58, file="compute-runtime-19.48.14977/runtime/os_interface/linux/drm_memory_manager.cpp") at debug_helpers.cpp:19:9 + frame #5: 0x000000080104b4e5 libigdrcl.so`NEO::DrmMemoryManager::DrmMemoryManager(this=0x00000008018e7300, mode=gemCloseWorkerActive, forcePinAllowed=true, validateHostPtrMemory=true, executionEnvironment=0x00000008018f6180) at drm_memory_manager.cpp:58:9 + frame #6: 0x0000000800f07bb1 libigdrcl.so`std::__1::__unique_if<NEO::DrmMemoryManager>::__unique_single std::__1::make_unique<NEO::DrmMemoryManager, NEO::gemCloseWorkerMode, bool, bool, NEO::ExecutionEnvironment&>(__args=0x00007fffffffda4c, __args=0x00007fffffffda4b, __args=0x00007fffffffda4a, __args=0x00000008018f6180) at memory:3003:32 + frame #7: 0x0000000800f07ad4 libigdrcl.so`NEO::MemoryManager::createMemoryManager(executionEnvironment=0x00000008018f6180) at create_drm_memory_manager.cpp:16:12 + frame #8: 0x0000000800fbce8b libigdrcl.so`NEO::ExecutionEnvironment::initializeMemoryManager(this=0x00000008018f6180) at execution_environment.cpp:63:25 + frame #9: 0x0000000801058c9d libigdrcl.so`NEO::Platform::initialize(this=0x00000008025ea0a0) at platform.cpp:144:27 + frame #10: 0x0000000800e259f2 libigdrcl.so`::clGetPlatformIDs(numEntries=1, platforms=0x0000000800251500, numPlatforms=0x0000000000000000) at api.cpp:82:35 + frame #11: 0x0000000800e25c54 libigdrcl.so`::clIcdGetPlatformIDsKHR(numEntries=1, platforms=0x0000000800251500, numPlatforms=0x0000000000000000) at api.cpp:112:14 + frame #12: 0x000000080025d0e0 libOpenCL.so.1`__initClIcd + 3392 + frame #13: 0x00000008006a61a8 libthr.so.3`_thr_once(once_control=0x000000080026e038, init_routine=(libOpenCL.so.1`__initClIcd)) at thr_once.c:98:2 + frame #14: 0x000000080025b670 libOpenCL.so.1`clGetPlatformIDs_hid + 320 + frame #15: 0x000000000020f9cd clinfo`main(argc=<unavailable>, argv=0x00007fffffffe188) at clinfo.c:2656:10 + frame #16: 0x000000000020713d clinfo`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7 +(lldb) f 5 +frame #5: 0x000000080104b4e5 libigdrcl.so`NEO::DrmMemoryManager::DrmMemoryManager(this=0x00000008018e7300, mode=gemCloseWorkerActive, forcePinAllowed=true, validateHostPtrMemory=true, executionEnvironment=0x00000008018f6180) at drm_memory_manager.cpp:58:9 + 50 + 51 if (forcePinEnabled || validateHostPtrMemory) { + 52 pinBB = allocUserptr(reinterpret_cast<uintptr_t>(memoryForPinBB), MemoryConstants::pageSize, 0, 0); + 53 } + 54 + 55 if (!pinBB) { + 56 alignedFreeWrapper(memoryForPinBB); + 57 memoryForPinBB = nullptr; +-> 58 DEBUG_BREAK_IF(true); + 59 UNRECOVERABLE_IF(validateHostPtrMemory); + 60 } + 61 } + +--- runtime/os_interface/linux/drm_memory_manager.cpp.orig 2019-11-29 14:23:34 UTC ++++ runtime/os_interface/linux/drm_memory_manager.cpp +@@ -141,7 +141,17 @@ NEO::BufferObject *DrmMemoryManager::allocUserptr(uint + userptr.flags = static_cast<uint32_t>(flags); + + if (this->drm->ioctl(DRM_IOCTL_I915_GEM_USERPTR, &userptr) != 0) { +- return nullptr; ++ if (errno == ENODEV && userptr.flags == 0) { ++ userptr.flags = I915_USERPTR_UNSYNCHRONIZED; ++ if (this->drm->ioctl(DRM_IOCTL_I915_GEM_USERPTR, &userptr) != 0) { ++ if (geteuid() != 0) { ++ printDebugString(true, stderr, "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n"); ++ } ++ return nullptr; ++ } ++ } else { ++ return nullptr; ++ } + } + + auto res = new (std::nothrow) BufferObject(this->drm, userptr.handle, rootDeviceIndex); diff --git a/lang/compute-runtime/pkg-descr b/lang/compute-runtime/pkg-descr new file mode 100644 index 000000000000..27eebbbdbad4 --- /dev/null +++ b/lang/compute-runtime/pkg-descr @@ -0,0 +1,5 @@ +The Intel(R) Graphics Compute Runtime for OpenCL(TM) is an open source +project to converge Intel's development efforts on OpenCL(TM) compute +stacks supporting the GEN graphics hardware architecture. + +WWW: https://01.org/compute-runtime |