aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2021-08-09 20:28:28 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2021-09-09 15:52:04 +0000
commiteb3ceff682682389456e66657eabd66e01fdbca4 (patch)
tree5ba7bdb2cb2c1d894f0fc998bf5f1bb07d1e2dc0
parent5d5354ad9410aa99767ea048248e983bc347e9c4 (diff)
downloadports-eb3ceff682682389456e66657eabd66e01fdbca4.tar.gz
ports-eb3ceff682682389456e66657eabd66e01fdbca4.zip
devel/ispc: enable Intel GPU support
https://ispc.github.io/ispc_for_gen.html PR: 257720 Tested by: yuri (testsuite has about the same set of failures as before) Submitted by: jbeich
-rw-r--r--devel/ispc/Makefile24
-rw-r--r--devel/ispc/files/patch-cmake_GenerateBuiltins.cmake11
-rw-r--r--devel/ispc/files/patch-src_ispc.cpp25
-rw-r--r--devel/ispc/files/patch-src_module.cpp20
4 files changed, 80 insertions, 0 deletions
diff --git a/devel/ispc/Makefile b/devel/ispc/Makefile
index 00b0b716254b..8bcfa95a296a 100644
--- a/devel/ispc/Makefile
+++ b/devel/ispc/Makefile
@@ -3,6 +3,7 @@
PORTNAME= ispc
DISTVERSIONPREFIX= v
DISTVERSION= 1.16.1
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
@@ -35,6 +36,29 @@ BINARY_ALIAS= flex=${LOCALBASE}/bin/flex python=${PYTHON_CMD} m4=${LOCALBASE}/bi
PLIST_FILES= bin/ispc \
bin/check_isa
+OPTIONS_DEFINE_amd64= GENX
+OPTIONS_DEFAULT_amd64= GENX
+
+GENX_DESC= Intel GPU 8/16-wide SIMD support
+GENX_BUILD_DEPENDS= ${LOCALBASE}/llvm${LLVM_VERSION}/lib/libLLVMGenXIntrinsics.a:devel/vc-intrinsics@llvm${LLVM_VERSION}
+GENX_LIB_DEPENDS= libze_loader.so:devel/level-zero \
+ libLLVMSPIRVLib.so.${LLVM_VERSION}:devel/spirv-llvm-translator@llvm${LLVM_VERSION}
+GENX_CMAKE_BOOL= GENX_ENABLED
+GENX_CMAKE_BOOL_OFF= ISPCRT_BUILD_TESTS
+GENX_CMAKE_ON= -DGENX_DEPS_DIR:PATH="${LOCALBASE}/llvm${LLVM_VERSION}"
+GENX_PLIST_FILES= include/ispcrt/ispcrt.h \
+ include/ispcrt/ispcrt.hpp \
+ include/ispcrt/ispcrt.isph \
+ lib/cmake/ispcrt-${PORTVERSION}/Findlevel_zero.cmake \
+ lib/cmake/ispcrt-${PORTVERSION}/ispc.cmake \
+ lib/cmake/ispcrt-${PORTVERSION}/ispcrtConfig.cmake \
+ lib/cmake/ispcrt-${PORTVERSION}/ispcrt_Exports-%%CMAKE_BUILD_TYPE%%.cmake \
+ lib/cmake/ispcrt-${PORTVERSION}/ispcrt_Exports.cmake \
+ lib/libispcrt.so \
+ lib/libispcrt.so.1 \
+ lib/libispcrt.so.${PORTVERSION} \
+ lib/libispcrt_static.a
+
do-test: # some tests fail: https://github.com/ispc/ispc/issues/1868
@cd ${WRKSRC} && ISPC_HOME=${BUILD_WRKSRC}/bin ./run_tests.py
diff --git a/devel/ispc/files/patch-cmake_GenerateBuiltins.cmake b/devel/ispc/files/patch-cmake_GenerateBuiltins.cmake
new file mode 100644
index 000000000000..e541332c18f1
--- /dev/null
+++ b/devel/ispc/files/patch-cmake_GenerateBuiltins.cmake
@@ -0,0 +1,11 @@
+--- cmake/GenerateBuiltins.cmake.orig 2021-07-15 23:04:31 UTC
++++ cmake/GenerateBuiltins.cmake
+@@ -289,6 +289,8 @@ function(builtin_genx_to_cpp bit resultFileName)
+ set(os_name "windows")
+ elseif (APPLE)
+ set(SKIP ON)
++ elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
++ set(os_name "freebsd")
+ else ()
+ set(os_name "linux")
+ endif()
diff --git a/devel/ispc/files/patch-src_ispc.cpp b/devel/ispc/files/patch-src_ispc.cpp
new file mode 100644
index 000000000000..e06e096d9b80
--- /dev/null
+++ b/devel/ispc/files/patch-src_ispc.cpp
@@ -0,0 +1,25 @@
+--- src/ispc.cpp.orig 2021-07-15 23:04:31 UTC
++++ src/ispc.cpp
+@@ -1464,10 +1464,22 @@ std::string Target::GetTripleString() const {
+ triple.setArchName("armv7");
+ } else if (m_arch == Arch::aarch64) {
+ triple.setArchName("aarch64");
++ } else if (m_arch == Arch::genx32) {
++ triple.setArchName("spir");
++ } else if (m_arch == Arch::genx64) {
++ triple.setArchName("spir64");
+ } else {
+ Error(SourcePos(), "Unknown arch.");
+ exit(1);
+ }
++#ifdef ISPC_GENX_ENABLED
++ if (m_arch == Arch::genx32 || m_arch == Arch::genx64) {
++ //"spir64-unknown-unknown"
++ triple.setVendor(llvm::Triple::VendorType::UnknownVendor);
++ triple.setOS(llvm::Triple::OSType::UnknownOS);
++ return triple.str();
++ }
++#endif
+ triple.setVendor(llvm::Triple::VendorType::UnknownVendor);
+ triple.setOS(llvm::Triple::OSType::FreeBSD);
+ break;
diff --git a/devel/ispc/files/patch-src_module.cpp b/devel/ispc/files/patch-src_module.cpp
new file mode 100644
index 000000000000..987c2fcb2fd6
--- /dev/null
+++ b/devel/ispc/files/patch-src_module.cpp
@@ -0,0 +1,20 @@
+--- src/module.cpp.orig 2021-07-15 23:04:31 UTC
++++ src/module.cpp
+@@ -102,7 +102,7 @@
+ #define OCLOC_LIBRARY_NAME "ocloc64.dll"
+ #elif defined(_WIN32)
+ #define OCLOC_LIBRARY_NAME "ocloc32.dll"
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(__FreeBSD__)
+ #define OCLOC_LIBRARY_NAME "libocloc.so"
+ #else
+ #error "Unexpected platform"
+@@ -1149,7 +1149,7 @@ bool Module::translateToSPIRV(llvm::Module *module, st
+ llvm::cl::desc("Allow DWARF operations not listed in the OpenCL.DebugInfo.100 "
+ "specification (experimental, may produce incompatible SPIR-V "
+ "module)"));
+-#if ISPC_LLVM_VERSION < ISPC_LLVM_12_0
++#if ISPC_LLVM_VERSION >= ISPC_LLVM_13_0
+ Opts.setSPIRVAllowUnknownIntrinsics({"llvm.genx"});
+ #else
+ llvm::cl::opt<bool> SPIRVAllowUnknownIntrinsics(