summaryrefslogtreecommitdiff
path: root/lang/intel-compute-runtime/files
diff options
context:
space:
mode:
Diffstat (limited to 'lang/intel-compute-runtime/files')
-rw-r--r--lang/intel-compute-runtime/files/patch-backtrace37
-rw-r--r--lang/intel-compute-runtime/files/patch-clock_gettime24
-rw-r--r--lang/intel-compute-runtime/files/patch-i38618
-rw-r--r--lang/intel-compute-runtime/files/patch-includes23
-rw-r--r--lang/intel-compute-runtime/files/patch-mmap31
-rw-r--r--lang/intel-compute-runtime/files/patch-rtld18
-rw-r--r--lang/intel-compute-runtime/files/patch-unix26
-rw-r--r--lang/intel-compute-runtime/files/patch-userptr61
8 files changed, 238 insertions, 0 deletions
diff --git a/lang/intel-compute-runtime/files/patch-backtrace b/lang/intel-compute-runtime/files/patch-backtrace
new file mode 100644
index 000000000000..69ce6f62f614
--- /dev/null
+++ b/lang/intel-compute-runtime/files/patch-backtrace
@@ -0,0 +1,37 @@
+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);
+ ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+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*))
+
+--- 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) {
+--- 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)
diff --git a/lang/intel-compute-runtime/files/patch-clock_gettime b/lang/intel-compute-runtime/files/patch-clock_gettime
new file mode 100644
index 000000000000..7a6609f709b7
--- /dev/null
+++ b/lang/intel-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/intel-compute-runtime/files/patch-i386 b/lang/intel-compute-runtime/files/patch-i386
new file mode 100644
index 000000000000..05f80f8ab1c2
--- /dev/null
+++ b/lang/intel-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/intel-compute-runtime/files/patch-includes b/lang/intel-compute-runtime/files/patch-includes
new file mode 100644
index 000000000000..da46c97d99cd
--- /dev/null
+++ b/lang/intel-compute-runtime/files/patch-includes
@@ -0,0 +1,23 @@
+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 {
+ ^
+
+--- 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>
diff --git a/lang/intel-compute-runtime/files/patch-mmap b/lang/intel-compute-runtime/files/patch-mmap
new file mode 100644
index 000000000000..7d40c301a720
--- /dev/null
+++ b/lang/intel-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/intel-compute-runtime/files/patch-rtld b/lang/intel-compute-runtime/files/patch-rtld
new file mode 100644
index 000000000000..661fdbc12333
--- /dev/null
+++ b/lang/intel-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/intel-compute-runtime/files/patch-unix b/lang/intel-compute-runtime/files/patch-unix
new file mode 100644
index 000000000000..16767d7bf70f
--- /dev/null
+++ b/lang/intel-compute-runtime/files/patch-unix
@@ -0,0 +1,26 @@
+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>
diff --git a/lang/intel-compute-runtime/files/patch-userptr b/lang/intel-compute-runtime/files/patch-userptr
new file mode 100644
index 000000000000..9aee9c63e58e
--- /dev/null
+++ b/lang/intel-compute-runtime/files/patch-userptr
@@ -0,0 +1,61 @@
+Try unsynchronized userptr if regular one fails.
+https://github.com/FreeBSDDesktop/kms-drm/issues/197
+
+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, "%s", "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);