diff options
29 files changed, 1372 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile index dfe5922dc24a..8cd7c27b375b 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -1011,6 +1011,7 @@ SUBDIR += iniparser SUBDIR += initutil SUBDIR += injeqt + SUBDIR += intel-graphics-compiler SUBDIR += interactive_rebase_tool SUBDIR += ioncube SUBDIR += ipython @@ -1664,6 +1665,7 @@ SUBDIR += open-beagle SUBDIR += open-usp-tukubai SUBDIR += opencl + SUBDIR += opencl-clang SUBDIR += opencvs SUBDIR += opendht SUBDIR += opengrok @@ -6428,6 +6430,7 @@ SUBDIR += spdlog SUBDIR += spice-protocol SUBDIR += spin + SUBDIR += spirv-llvm-translator SUBDIR += spirv-tools SUBDIR += splint SUBDIR += spread-sheet-widget diff --git a/devel/intel-graphics-compiler/Makefile b/devel/intel-graphics-compiler/Makefile new file mode 100644 index 000000000000..195a94c6634b --- /dev/null +++ b/devel/intel-graphics-compiler/Makefile @@ -0,0 +1,53 @@ +# $FreeBSD$ + +PORTNAME= intel-graphics-compiler +DISTVERSIONPREFIX= igc- +DISTVERSION= 1.0.2990 +CATEGORIES= devel + +PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ +PATCHFILES+= add5ac2f64f3.patch:-p1 + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= Intel Graphics Compiler for OpenCL + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE.md + +ONLY_FOR_ARCHS= amd64 i386 +ONLY_FOR_ARCHS_REASON= Only Intel GPUs on x86 are supported + +LIB_DEPENDS= libopencl-clang.so:devel/opencl-clang + +USES= bison cmake compiler:c++17-lang python:build +USE_GITHUB= yes +USE_LDCONFIG= yes +GH_ACCOUNT= intel +PLIST_SUB= ARCH_SUFX=${ARCH:S/i386/32/:S/amd//:S/x86_//} + +post-patch: +# lang/python* don't install unsuffixed symlinks + @${REINPLACE_CMD} -i .python \ + -e '/EXECUTABLE/s/"python"/"${PYTHON_CMD:T}"/' \ + -e '/IGC_PYTHON/s/"python"/"${PYTHON_CMD:T}"/' \ + ${WRKSRC}/IGC/CMakeLists.txt \ + ${WRKSRC}/IGC/BiFModule/CMakeLists.txt +# devel/llvm* have different naming from upstream under PATH + @${REINPLACE_CMD} -e '/clang-\$$/ { s//clang$$/; \ + s/MAJOR}/&$${LLVM_VERSION_MINOR}/; }' \ + ${WRKSRC}/IGC/BiFModule/CMakeLists.txt +# Silence -Wmacro-redefined to expose __fastcall misuse + @${REINPLACE_CMD} -e '/__fastcall/d' \ + ${WRKSRC}/inc/common/UFO/portable_compiler.h +# No need to abort on every benign warning enabled by default + @${REINPLACE_CMD} -e 's/"-Werror"//; /-Werror/d' \ + ${WRKSRC}/IGC/CMakeLists.txt + +pre-configure: +# Only one libLLVM can be loaded, so use the same version as devel/opencl-clang + @for f in ${LOCALBASE}/lib/libopencl-clang.so.*; do \ + ${REINPLACE_CMD} "/set.*LLVM_VERSION/s/\".*\"/\"$${f##*so.}\"/" \ + ${WRKSRC}/IGC/CMakeLists.txt; \ + done + +.include <bsd.port.mk> diff --git a/devel/intel-graphics-compiler/distinfo b/devel/intel-graphics-compiler/distinfo new file mode 100644 index 000000000000..ed784bba8ae4 --- /dev/null +++ b/devel/intel-graphics-compiler/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1574816720 +SHA256 (intel-intel-graphics-compiler-igc-1.0.2990_GH0.tar.gz) = a4823e365c939254899cead5c9a23ada4d8c0f5ae395eef5f2a46cc82b59315f +SIZE (intel-intel-graphics-compiler-igc-1.0.2990_GH0.tar.gz) = 5930890 +SHA256 (add5ac2f64f3.patch) = 4de0b73bf73d786e3aa6e55bb9bf4a45ac44ee3ef5177a64f50d869bb8e81285 +SIZE (add5ac2f64f3.patch) = 3862 diff --git a/devel/intel-graphics-compiler/files/patch-alloca b/devel/intel-graphics-compiler/files/patch-alloca new file mode 100644 index 000000000000..72d4a319a4b2 --- /dev/null +++ b/devel/intel-graphics-compiler/files/patch-alloca @@ -0,0 +1,34 @@ +<alloca.h> is implicitly included by <stdlib.h> on Linux + +In file included from visa/iga/IGAExe/assemble.cpp:27: +In file included from visa/iga/IGAExe/iga_main.hpp:29: +visa/iga/IGAExe/fatal.hpp:33:10: fatal error: 'alloca.h' file not found +#include <alloca.h> + ^~~~~~~~~~ + +visa/iga/IGALibrary/strings.cpp:41:10: fatal error: 'alloca.h' file not found +#include <alloca.h> /* for alloca */ + ^~~~~~~~~~ + +--- visa/iga/IGAExe/fatal.hpp.orig 2019-11-27 01:05:20 UTC ++++ visa/iga/IGAExe/fatal.hpp +@@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #include <Windows.h> + #include <malloc.h> + #else +-#include <alloca.h> ++#include <stdlib.h> + #endif + #ifdef _MSC_VER + #define VSCPRINTF(PAT,VA) \ +--- visa/iga/IGALibrary/strings.cpp.orig 2019-11-27 01:05:20 UTC ++++ visa/iga/IGALibrary/strings.cpp +@@ -38,7 +38,7 @@ using namespace iga; + #include <Windows.h> + #include <malloc.h> /* for alloca */ + #else +-#include <alloca.h> /* for alloca */ ++#include <stdlib.h> /* for alloca */ + #endif + + std::string iga::format(const char *pat, ...) diff --git a/devel/intel-graphics-compiler/files/patch-limits b/devel/intel-graphics-compiler/files/patch-limits new file mode 100644 index 000000000000..0813904f3aa6 --- /dev/null +++ b/devel/intel-graphics-compiler/files/patch-limits @@ -0,0 +1,16 @@ +<linux/limits.h> is implicitly included via <limits.h> but not required here + +IGC/OCLFE/igd_fcl_mcl/source/LoadBuffer.cpp:40:10: fatal error: 'linux/limits.h' file not found +#include <linux/limits.h> + ^~~~~~~~~~~~~~~~ + +--- IGC/OCLFE/igd_fcl_mcl/source/LoadBuffer.cpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/OCLFE/igd_fcl_mcl/source/LoadBuffer.cpp +@@ -37,7 +37,6 @@ using namespace llvm; + #include <inttypes.h> + #include <libgen.h> + #include <link.h> +-#include <linux/limits.h> + #include <stddef.h> + #include <stdint.h> + #include <unistd.h> diff --git a/devel/intel-graphics-compiler/files/patch-process-name b/devel/intel-graphics-compiler/files/patch-process-name new file mode 100644 index 000000000000..10cf983a039a --- /dev/null +++ b/devel/intel-graphics-compiler/files/patch-process-name @@ -0,0 +1,16 @@ +/proc is gone on DragonFly and OpenBSD but deprecated on FreeBSD and NetBSD + +--- IGC/common/SysUtils.cpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/common/SysUtils.cpp +@@ -82,6 +82,11 @@ namespace IGC + if (!in.good()) + assert(0 && "Error reading from cmdline pseudo file"); + ++#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ ++ defined(__OpenBSD__) || defined(__sun) ++ // KERN_PROC_ARGS returns similar value to /proc/<pid>/cmdline but as ++ // neither invocation path nor arguments are used just ask libc ++ ret = getprogname(); + #elif defined(_WIN64) || defined(_WIN32) + ret.resize(MAX_PATH); + DWORD size = ::GetModuleFileNameA(NULL, &ret[0], ret.size()); diff --git a/devel/intel-graphics-compiler/files/patch-unix b/devel/intel-graphics-compiler/files/patch-unix new file mode 100644 index 000000000000..693bb0a24910 --- /dev/null +++ b/devel/intel-graphics-compiler/files/patch-unix @@ -0,0 +1,309 @@ +Relax recent Linux checks for the code works on any non-Windows platform. + +CMake Error at IGC/CMakeLists.txt:1974 (message): + IGC_OPTION__ARCHITECTURE_TARGET: Target architecture is not specified and + cannot be deduced from context. + + Please specify one, e.g. Windows32, Linux64, Android32, ... + +--- IGC/CMakeLists.txt.orig 2019-11-27 01:05:20 UTC ++++ IGC/CMakeLists.txt +@@ -834,11 +834,11 @@ function(igc_arch_detect targetArchVarName hostArchVar + set(_targetArchitecture "Windows32") + endif() + # Use system processor set by toolchain or CMake. +- elseif(ANDROID OR (CMAKE_SYSTEM_NAME MATCHES "Linux") ++ elseif(ANDROID OR (UNIX AND NOT APPLE) + ) + if(ANDROID) + set(_targetArchOS "Android") +- elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") ++ elseif(UNIX AND NOT APPLE) + set(_targetArchOS "Linux") + endif() + +@@ -865,9 +865,9 @@ function(igc_arch_detect targetArchVarName hostArchVar + set(_hostArchitecture "Windows32") + endif() + # Use 'uname -m' to detect kernel architecture. +- elseif((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") ++ elseif((UNIX AND NOT APPLE) + ) +- if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") ++ if(UNIX AND NOT APPLE) + set(_hostArchOS "Linux") + endif() + +@@ -2171,7 +2171,7 @@ endif() + + # NOTE: LLVM_ON_UNIX is also true for Android (CMAKE_SYSTEM_NAME specified by Android toolchain file is also "Linux", + # but we should make sure so there is no errors in our assumptions). +-if((CMAKE_SYSTEM_NAME MATCHES "Linux") OR ANDROID) ++if((UNIX AND NOT APPLE) OR ANDROID) + set(LLVM_ON_UNIX ON) + else() + set(LLVM_ON_UNIX OFF) +--- 3d/common/iStdLib/File.h.orig 2019-11-27 01:05:20 UTC ++++ 3d/common/iStdLib/File.h +@@ -105,12 +105,9 @@ inline DWORD GetModuleFileName( char* pFileName, DWORD + #elif defined(ISTDLIB_UMD) + #if defined(_WIN32) + return ::GetModuleFileNameA( NULL, pFileName, bufSize ); +- #elif defined(__linux__) ++ #else + //TODO: add Linux implementation. + return 0; +- #else +- // TO DO: replace with non-Windows version +- #error "TODO implement non-Windows equivalent of GetModuleFileName" + #endif + #else + // this compilation path is not intended +--- 3d/common/iStdLib/Object.h.orig 2019-11-27 01:05:20 UTC ++++ 3d/common/iStdLib/Object.h +@@ -150,7 +150,7 @@ inline long CObject<CAllocatorType>::Acquire( void ) + ASSERT( m_RefCount >= 0 ); + ASSERT( m_RefCount < LONG_MAX ); + +-#if defined(ISTDLIB_MT) && defined(__linux__) ++#if defined(ISTDLIB_MT) && defined(__GNUC__) + __sync_fetch_and_add(&m_RefCount, 1); + #elif defined(ISTDLIB_MT) + ::InterlockedIncrement(&m_RefCount); +@@ -182,7 +182,7 @@ inline long CObject<CAllocatorType>::Release( void ) + { + ASSERT( m_RefCount > 0 ); + +-#if defined(ISTDLIB_MT) && defined(__linux__) ++#if defined(ISTDLIB_MT) && defined(__GNUC__) + __sync_sub_and_fetch(&m_RefCount, 1); + #elif defined(ISTDLIB_MT) + ::InterlockedDecrement(&m_RefCount); +--- 3d/common/iStdLib/utility.h.orig 2019-11-27 01:05:20 UTC ++++ 3d/common/iStdLib/utility.h +@@ -431,7 +431,7 @@ __forceinline DWORD bsr64( const unsigned long long in + _BitScanReverse64( &index, static_cast<_int64>( mask ) ); + return static_cast<DWORD>( index ); + +-#elif defined __linux__ ++#elif defined __GNUC__ + return static_cast<unsigned int>( 63 - __builtin_clzll( mask ) ); + + #else +@@ -464,7 +464,7 @@ __forceinline DWORD bsr( const DWORD mask ) + _BitScanReverse( &index, mask ); + return static_cast<DWORD>(index); + +-#elif defined __linux__ ++#elif defined __GNUC__ + return static_cast<unsigned int>( 31 - __builtin_clz( mask ) ); + + #else +@@ -497,7 +497,7 @@ __forceinline DWORD bsf64( const unsigned long long in + _BitScanForward64( &index, static_cast<_int64>( mask ) ); + return static_cast<DWORD>( index ); + +-#elif defined __linux__ ++#elif defined __GNUC__ + return static_cast<unsigned int>( __builtin_ffsll( mask ) - 1 ); + + #else +@@ -529,7 +529,7 @@ __forceinline DWORD bsf( const DWORD mask ) + _BitScanForward( &index, mask ); + return index; + +-#elif defined __linux__ ++#elif defined __GNUC__ + return static_cast<unsigned int>( __builtin_ffsl( mask ) - 1 ); + + #else +--- IGC/AdaptorCommon/customApi.cpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/AdaptorCommon/customApi.cpp +@@ -457,7 +457,7 @@ namespace IGC + return ""; + IGCBaseFolder = "/sdcard/intel/igc/"; + +-#elif defined __linux__ ++#elif !defined __APPLE__ + if (!IGC_IS_FLAG_ENABLED(DumpToCustomDir)) + { + IGCBaseFolder = "/tmp/IntelIGC/"; +@@ -560,7 +560,7 @@ namespace IGC + + g_shaderOutputFolder = ""; + +-#elif defined __linux__ ++#elif !defined __APPLE__ + if (!IGC_IS_FLAG_ENABLED(DumpToCurrentDir) && g_shaderOutputFolder == "" && !IGC_IS_FLAG_ENABLED(DumpToCustomDir)) + { + bool needMkdir = false; +--- IGC/AdaptorOCL/CLElfLib/CLElfTypes.h.orig 2019-11-27 01:05:20 UTC ++++ IGC/AdaptorOCL/CLElfLib/CLElfTypes.h +@@ -30,7 +30,7 @@ Abstract: Defines the types used for ELF headers/sect + \******************************************************************************/ + #pragma once + +-#if defined(__linux__) && defined(OGL) ++#if !defined(__APPLE__) && !defined(_WIN32) && defined(OGL) + #include "os_inc.h" + #endif + +@@ -38,7 +38,7 @@ Abstract: Defines the types used for ELF headers/sect + #include <inttypes.h> + #endif + +-#if defined(__linux__) ++#if !defined(__APPLE__) && !defined(_WIN32) + #include "elf.h" + #endif + +--- IGC/AdaptorOCL/OCL/sp/gtpin_igc_ocl.h.orig 2019-11-27 01:05:20 UTC ++++ IGC/AdaptorOCL/OCL/sp/gtpin_igc_ocl.h +@@ -38,7 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #define MY_CALLINGSTD _fastcall + #define MY_CDECL _cdecl + +-#elif defined(ANDROID) || defined (__linux__) ++#elif defined(__GNUC__) + + // Linux, Android + #define MY_EXTERN_C extern "C" +--- IGC/GenISAIntrinsics/GenIntrinsics.h.orig 2019-11-27 01:05:20 UTC ++++ IGC/GenISAIntrinsics/GenIntrinsics.h +@@ -59,7 +59,7 @@ namespace GenISAIntrinsic { + /// using iAny, fAny, vAny, or iPTRAny). For a declaration of an overloaded + /// intrinsic, Tys must provide exactly one type for each overloaded type in + /// the intrinsic. +-#if defined(ANDROID) || defined(__linux__) ++#if defined(__GNUC__) + __attribute__ ((visibility ("default"))) Function *getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys = None); + #else + Function *getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys = None); +--- IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp +@@ -65,9 +65,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #if defined(_WIN32 )|| defined( _WIN64 ) + #include <direct.h> + #include <process.h> +-#endif +- +-#if defined __linux__ ++#elif !defined(__APPLE__) + #include "iStdLib/File.h" + #endif + +@@ -311,7 +309,7 @@ namespace FCL + + IGCBaseFolder = pathBuf; + } +-#elif defined __linux__ ++#elif !defined(__APPLE__) + if (!FCL_IGC_IS_FLAG_ENABLED(DumpToCustomDir)) + { + IGCBaseFolder = "/tmp/IntelIGC/"; +@@ -387,7 +385,7 @@ namespace FCL + iSTD::CreateAppOutputDir(pathBuf, 256, GetBaseIGCOutputFolder(), false, true, !FCL_IGC_IS_FLAG_ENABLED(ShaderDumpPidDisable)); + g_shaderOutputFolder = pathBuf; + } +-#elif defined __linux__ ++#elif !defined(__APPLE__) + if (!FCL_IGC_IS_FLAG_ENABLED(DumpToCurrentDir) && g_shaderOutputFolder == "" && !FCL_IGC_IS_FLAG_ENABLED(DumpToCustomDir)) + { + bool needMkdir = true; +--- IGC/common/LLVMWarningsPop.hpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/common/LLVMWarningsPop.hpp +@@ -58,6 +58,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + # pragma warning( pop ) + #endif + +-#if defined(__linux__) ++#if defined(__GNUC__) + # pragma GCC diagnostic pop + #endif +--- IGC/common/LLVMWarningsPush.hpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/common/LLVMWarningsPush.hpp +@@ -55,13 +55,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + # pragma warning( push ) + #endif + +-#if defined(__linux__) ++#if defined(__GNUC__) + # pragma GCC diagnostic push + #endif + + #include <llvm/Config/llvm-config.h> + +-#if defined(__linux__) ++#if defined(__GNUC__) + # if __GNUC__ > 8 + # pragma GCC diagnostic ignored "-Winit-list-lifetime" + # endif +--- IGC/common/igc_regkeys.hpp.orig 2019-11-27 01:05:20 UTC ++++ IGC/common/igc_regkeys.hpp +@@ -39,7 +39,7 @@ typedef char debugString[256]; + #define IGC_DEBUG_VARIABLES + #endif + +-#if defined( __linux__ ) ++#if !defined( __APPLE__ ) && !defined( _WIN32 ) + #define IGC_DEBUG_VARIABLES + #endif + +@@ -67,7 +67,7 @@ struct SRegKeyVariableMetaData + } + }; + +-#if defined ( __linux__ ) && !defined( _DEBUG ) && !defined( _INTERNAL ) ++#if !defined ( _WIN32 ) && !defined( _DEBUG ) && !defined( _INTERNAL ) + #define LINUX_RELEASE_MODE + #endif + +--- inc/common/Compiler/API/ShaderInstruction.h.orig 2019-11-27 01:05:20 UTC ++++ inc/common/Compiler/API/ShaderInstruction.h +@@ -39,7 +39,7 @@ namespace USC + class CShaderDebugLocationInfo; + } + +-#if defined _DEBUG && !defined __linux__ ++#if defined _DEBUG && defined _WIN32 + #define USC_OPTIMIZING_COMPILER_TESTS + #endif + +--- visa/BuildCISAIRImpl.cpp.orig 2019-11-27 01:05:20 UTC ++++ visa/BuildCISAIRImpl.cpp +@@ -680,7 +680,6 @@ extern void CISA_delete_buffer(YY_BUFFER_STATE buf); + + int CISA_IR_Builder::ParseVISAText(const std::string& visaHeader, const std::string& visaText, const std::string& visaTextFile) + { +-#if defined(__linux__) || defined(_WIN64) || defined(_WIN32) + // Direct output of parser to null + #if defined(_WIN64) || defined(_WIN32) + CISAout = fopen("nul", "w"); +@@ -740,16 +739,11 @@ int CISA_IR_Builder::ParseVISAText(const std::string& + } + + return CM_SUCCESS; +-#else +- assert(0 && "Asm parsing not supported on this platform"); +- return CM_FAILURE; +-#endif + } + + // Parses inline asm file from ShaderOverride + int CISA_IR_Builder::ParseVISAText(const std::string& visaFile) + { +-#if defined(__linux__) || defined(_WIN64) || defined(_WIN32) + // Direct output of parser to null + #if defined(_WIN64) || defined(_WIN32) + CISAout = fopen("nul", "w"); +@@ -775,10 +769,6 @@ int CISA_IR_Builder::ParseVISAText(const std::string& + fclose(CISAout); + } + return CM_SUCCESS; +-#else +- assert(0 && "Asm parsing not supported on this platform"); +- return CM_FAILURE; +-#endif + } + + // default size of the kernel mem manager in bytes diff --git a/devel/intel-graphics-compiler/pkg-descr b/devel/intel-graphics-compiler/pkg-descr new file mode 100644 index 000000000000..30856bcc3c54 --- /dev/null +++ b/devel/intel-graphics-compiler/pkg-descr @@ -0,0 +1,5 @@ +The Intel(R) Graphics Compiler for OpenCL(TM) is an LLVM-based +compiler for OpenCL(TM) targeting Intel Gen graphics hardware +architecture. + +WWW: https://01.org/compute-runtime diff --git a/devel/intel-graphics-compiler/pkg-plist b/devel/intel-graphics-compiler/pkg-plist new file mode 100644 index 000000000000..cfabfb30c046 --- /dev/null +++ b/devel/intel-graphics-compiler/pkg-plist @@ -0,0 +1,104 @@ +bin/GenX_IR +bin/iga%%ARCH_SUFX%% +include/iga/iga.h +include/iga/iga.hpp +include/iga/igaEncoderWrapper.hpp +include/iga/iga_bxml_enums.hpp +include/iga/iga_bxml_ops.hpp +include/iga/iga_types_ext.hpp +include/iga/iga_types_swsb.hpp +include/iga/igad.h +include/iga/igax.hpp +include/iga/kv.h +include/iga/kv.hpp +include/igc/cif/CMakeLists.txt +include/igc/cif/cif/CMakeLists.txt +include/igc/cif/cif/builtins/builtins_registry.cpp +include/igc/cif/cif/builtins/builtins_registry.h +include/igc/cif/cif/builtins/memory/buffer/buffer.h +include/igc/cif/cif/builtins/memory/buffer/impl/buffer_impl.cpp +include/igc/cif/cif/builtins/memory/buffer/impl/buffer_impl.h +include/igc/cif/cif/common/cif.h +include/igc/cif/cif/common/cif_main.h +include/igc/cif/cif/common/coder.h +include/igc/cif/cif/common/compatibility.h +include/igc/cif/cif/common/id.h +include/igc/cif/cif/common/library_api.h +include/igc/cif/cif/common/library_handle.h +include/igc/cif/cif/export/build/binary_version.h +include/igc/cif/cif/export/cif_impl.h +include/igc/cif/cif/export/cif_main.cpp +include/igc/cif/cif/export/cif_main_impl.h +include/igc/cif/cif/export/interface_creator.h +include/igc/cif/cif/export/library_api.h +include/igc/cif/cif/export/muiltiversion.h +include/igc/cif/cif/export/pimpl_base.h +include/igc/cif/cif/export/registry.cpp +include/igc/cif/cif/export/registry.h +include/igc/cif/cif/helpers/error.cpp +include/igc/cif/cif/helpers/error.h +include/igc/cif/cif/helpers/memory.h +include/igc/cif/cif/import/cif_main.cpp +include/igc/cif/cif/import/cif_main.h +include/igc/cif/cif/import/library_api.h +include/igc/cif/cif/macros/disable.h +include/igc/cif/cif/macros/enable.h +include/igc/cif/cif/os/lin/lin_library_handle.cpp +include/igc/cif/cif/os/lin/lin_library_handle.h +include/igc/cif/cif/os/win/win_library_handle.cpp +include/igc/cif/cif/os/win/win_library_handle.h +include/igc/cif/readme.txt +include/igc/igc.opencl.h +include/igc/ocl_igc_interface/code_type.h +include/igc/ocl_igc_interface/fcl_ocl_device_ctx.h +include/igc/ocl_igc_interface/fcl_ocl_translation_ctx.h +include/igc/ocl_igc_interface/gt_system_info.h +include/igc/ocl_igc_interface/igc_features_and_workarounds.h +include/igc/ocl_igc_interface/igc_ocl_device_ctx.h +include/igc/ocl_igc_interface/igc_ocl_translation_ctx.h +include/igc/ocl_igc_interface/impl/fcl_ocl_device_ctx_impl.cpp +include/igc/ocl_igc_interface/impl/fcl_ocl_device_ctx_impl.h +include/igc/ocl_igc_interface/impl/fcl_ocl_translation_ctx_impl.cpp +include/igc/ocl_igc_interface/impl/fcl_ocl_translation_ctx_impl.h +include/igc/ocl_igc_interface/impl/gt_system_info_impl.cpp +include/igc/ocl_igc_interface/impl/gt_system_info_impl.h +include/igc/ocl_igc_interface/impl/igc_features_and_workarounds_impl.cpp +include/igc/ocl_igc_interface/impl/igc_features_and_workarounds_impl.h +include/igc/ocl_igc_interface/impl/igc_ocl_device_ctx_impl.cpp +include/igc/ocl_igc_interface/impl/igc_ocl_device_ctx_impl.h +include/igc/ocl_igc_interface/impl/igc_ocl_translation_ctx_impl.cpp +include/igc/ocl_igc_interface/impl/igc_ocl_translation_ctx_impl.h +include/igc/ocl_igc_interface/impl/ocl_gen_binary_impl.cpp +include/igc/ocl_igc_interface/impl/ocl_gen_binary_impl.h +include/igc/ocl_igc_interface/impl/ocl_translation_output_impl.cpp +include/igc/ocl_igc_interface/impl/ocl_translation_output_impl.h +include/igc/ocl_igc_interface/impl/platform_impl.cpp +include/igc/ocl_igc_interface/impl/platform_impl.h +include/igc/ocl_igc_interface/ocl_gen_binary.h +include/igc/ocl_igc_interface/ocl_translation_output.h +include/igc/ocl_igc_interface/platform.h +include/igc/ocl_igc_interface/platform_helper.h +include/igc/ocl_igc_shared/device_enqueue/DeviceEnqueueInternalTypes.h +include/igc/ocl_igc_shared/device_enqueue/device_enqueue_internal_types.h +include/igc/ocl_igc_shared/executable_format/patch_g10.h +include/igc/ocl_igc_shared/executable_format/patch_g7.h +include/igc/ocl_igc_shared/executable_format/patch_g75.h +include/igc/ocl_igc_shared/executable_format/patch_g8.h +include/igc/ocl_igc_shared/executable_format/patch_g9.h +include/igc/ocl_igc_shared/executable_format/patch_list.h +include/igc/ocl_igc_shared/executable_format/patch_shared.h +include/igc/ocl_igc_shared/executable_format/program_debug_data.h +include/igc/ocl_igc_shared/gtpin/gtpin_driver_common.h +include/igc/ocl_igc_shared/gtpin/gtpin_driver_common_bti.h +include/igc/ocl_igc_shared/gtpin/gtpin_ocl_interface.h +include/visa/RelocationInfo.h +lib/libiga%%ARCH_SUFX%%.so +lib/libiga%%ARCH_SUFX%%.so.1 +lib/libiga%%ARCH_SUFX%%.so.1.0.1 +lib/libigc.so +lib/libigc.so.1 +lib/libigc.so.1.0.1 +lib/libigdfcl.so +lib/libigdfcl.so.1 +lib/libigdfcl.so.1.0.1 +libdata/pkgconfig/igc-opencl.pc diff --git a/devel/opencl-clang/Makefile b/devel/opencl-clang/Makefile new file mode 100644 index 000000000000..17ec5851863e --- /dev/null +++ b/devel/opencl-clang/Makefile @@ -0,0 +1,42 @@ +# $FreeBSD$ + +PORTNAME= opencl-clang +DISTVERSIONPREFIX= v +DISTVERSION= 9.0.0 +CATEGORIES= devel + +PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ +PATCHFILES+= 29a1f0d9e4e2.patch:-p1 # unbreak on non-x86 +PATCHFILES+= b25df8a90fec.patch:-p1 # don't require Git + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= Clang wrapper to compile OpenCL C kernels to SPIR-V modules + +LICENSE= NCSA +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libLLVM-${DISTVERSION:R:R}.so:devel/llvm${DISTVERSION:R:S/.//g} \ + libLLVMSPIRVLib.so.${DISTVERSION:R:R}:devel/spirv-llvm-translator + +USES= cmake compiler:c++11-lib localbase:ldflags +USE_GITHUB= yes +USE_LDCONFIG= yes +GH_ACCOUNT= intel +CMAKE_OFF= LLVMSPIRV_INCLUDED_IN_LLVM +CMAKE_ARGS= -DSPIRV_TRANSLATOR_DIR:PATH="${PREFIX}/lib" +PLIST_FILES= include/cclang/common_clang.h \ + lib/libopencl-clang.so \ + lib/libopencl-clang.so.${DISTVERSION:R:R} + +pre-configure: +# XXX devel/llvm* only includes DetermineGCCCompatible if OPENMP is enabled + @if [ ! -e ${LOCALBASE}/llvm${DISTVERSION:R:S/.//g}/lib/cmake/llvm/DetermineGCCCompatible.cmake ]; then \ + ${MKDIR} ${WRKSRC}/cmake; \ + ${SED} 's/.*DetermineGCCCompatible.*/set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)/' \ + ${LOCALBASE}/llvm${DISTVERSION:R:S/.//g}/lib/cmake/llvm/AddLLVM.cmake \ + >${WRKSRC}/cmake/AddLLVM.cmake; \ + ${REINPLACE_CMD} $$'1a\\\nlist(APPEND CMAKE_MODULE_PATH $${CMAKE_SOURCE_DIR}/cmake)\n' \ + ${WRKSRC}/CMakeLists.txt; \ + fi + +.include <bsd.port.mk> diff --git a/devel/opencl-clang/distinfo b/devel/opencl-clang/distinfo new file mode 100644 index 000000000000..24ab55bcd956 --- /dev/null +++ b/devel/opencl-clang/distinfo @@ -0,0 +1,7 @@ +TIMESTAMP = 1569325196 +SHA256 (intel-opencl-clang-v9.0.0_GH0.tar.gz) = f98b9122da4066e96853429a3cff9e6c0bfb0fee14fa2be5a22e43546a5cfd93 +SIZE (intel-opencl-clang-v9.0.0_GH0.tar.gz) = 23345 +SHA256 (29a1f0d9e4e2.patch) = 69fdd7b9b669bdd0ff75da22e8f16b0f872475e7865bb42c1358acf3ca9972a6 +SIZE (29a1f0d9e4e2.patch) = 1211 +SHA256 (b25df8a90fec.patch) = 3a52fc0bf93dc4c7accbba2327f4a70b6e5650841876b6a4224210074a6c9462 +SIZE (b25df8a90fec.patch) = 1336 diff --git a/devel/opencl-clang/pkg-descr b/devel/opencl-clang/pkg-descr new file mode 100644 index 000000000000..38d24231f892 --- /dev/null +++ b/devel/opencl-clang/pkg-descr @@ -0,0 +1,5 @@ +Common clang is a thin wrapper library around clang. Common clang has +OpenCL-oriented API and is capable to compile OpenCL C kernels to +SPIR-V modules. + +WWW: https://github.com/intel/opencl-clang diff --git a/devel/spirv-llvm-translator/Makefile b/devel/spirv-llvm-translator/Makefile new file mode 100644 index 000000000000..04be81f90d91 --- /dev/null +++ b/devel/spirv-llvm-translator/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +PORTNAME= spirv-llvm-translator +DISTVERSIONPREFIX= v +DISTVERSION= 9.0.0-1 +CATEGORIES= devel + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= Bi-directional translation between SPIR-V and LLVM IR + +LICENSE= NCSA +LICENSE_FILE= ${WRKSRC}/LICENSE.TXT + +LIB_DEPENDS= libLLVM-${DISTVERSION:R:R}.so:devel/llvm${DISTVERSION:R:S/.//g} + +USES= cmake compiler:c++11-lib +USE_GITHUB= yes +USE_LDCONFIG= yes +GH_ACCOUNT= KhronosGroup +GH_PROJECT= SPIRV-LLVM-Translator +CMAKE_ON= BUILD_SHARED_LIBS +PLIST_FILES= include/LLVMSPIRVLib/LLVMSPIRVExtensions.inc \ + include/LLVMSPIRVLib/LLVMSPIRVLib.h \ + include/LLVMSPIRVLib/LLVMSPIRVOpts.h \ + lib/libLLVMSPIRVLib.so \ + lib/libLLVMSPIRVLib.so.${DISTVERSION:R:R} \ + libdata/pkgconfig/LLVMSPIRVLib.pc + +pre-configure: +# XXX devel/llvm* only includes DetermineGCCCompatible if OPENMP is enabled + @if [ ! -e ${LOCALBASE}/llvm${DISTVERSION:R:S/.//g}/lib/cmake/llvm/DetermineGCCCompatible.cmake ]; then \ + ${MKDIR} ${WRKSRC}/cmake; \ + ${SED} 's/.*DetermineGCCCompatible.*/set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)/' \ + ${LOCALBASE}/llvm${DISTVERSION:R:S/.//g}/lib/cmake/llvm/AddLLVM.cmake \ + >${WRKSRC}/cmake/AddLLVM.cmake; \ + ${REINPLACE_CMD} $$'1a\\\nlist(APPEND CMAKE_MODULE_PATH $${CMAKE_SOURCE_DIR}/cmake)\n' \ + ${WRKSRC}/CMakeLists.txt; \ + fi + +.include <bsd.port.mk> diff --git a/devel/spirv-llvm-translator/distinfo b/devel/spirv-llvm-translator/distinfo new file mode 100644 index 000000000000..eebebd185e35 --- /dev/null +++ b/devel/spirv-llvm-translator/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1569304865 +SHA256 (KhronosGroup-SPIRV-LLVM-Translator-v9.0.0-1_GH0.tar.gz) = 19eff5daedb2c1aac8ab8d64a9f8228976dbaad71b1c1a3d3cd4c17cccdb0e55 +SIZE (KhronosGroup-SPIRV-LLVM-Translator-v9.0.0-1_GH0.tar.gz) = 491089 diff --git a/devel/spirv-llvm-translator/pkg-descr b/devel/spirv-llvm-translator/pkg-descr new file mode 100644 index 000000000000..07b2ac9eb348 --- /dev/null +++ b/devel/spirv-llvm-translator/pkg-descr @@ -0,0 +1,4 @@ +LLVM/SPIR-V Bi-Directional Translator is a library and tool for +translation between LLVM IR and SPIR-V. + +WWW: https://github.com/KhronosGroup/SPIRV-LLVM-Translator 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 |