git: eb3ceff68268 - main - devel/ispc: enable Intel GPU support
Yuri Victorovich
yuri at FreeBSD.org
Thu Sep 9 15:53:11 UTC 2021
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=eb3ceff682682389456e66657eabd66e01fdbca4
commit eb3ceff682682389456e66657eabd66e01fdbca4
Author: Jan Beich <jbeich at FreeBSD.org>
AuthorDate: 2021-08-09 20:28:28 +0000
Commit: Yuri Victorovich <yuri at FreeBSD.org>
CommitDate: 2021-09-09 15:52:04 +0000
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
---
devel/ispc/Makefile | 24 +++++++++++++++++++++
.../ispc/files/patch-cmake_GenerateBuiltins.cmake | 11 ++++++++++
devel/ispc/files/patch-src_ispc.cpp | 25 ++++++++++++++++++++++
devel/ispc/files/patch-src_module.cpp | 20 +++++++++++++++++
4 files changed, 80 insertions(+)
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 at 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 at llvm${LLVM_VERSION}
+GENX_LIB_DEPENDS= libze_loader.so:devel/level-zero \
+ libLLVMSPIRVLib.so.${LLVM_VERSION}:devel/spirv-llvm-translator at 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(
More information about the dev-commits-ports-all
mailing list