Intel(R) Implicit SPMD Program Compiler (Intel(R) ISPC)

ispc is a compiler for a variant of the C programming language, with
extensions for single program, multiple data programming. Under the SPMD
model, the programmer writes a program that generally appears to be a
regular serial program, though the execution model is actually that a
number of program instances execute in parallel on the hardware.

https://ispc.github.io/downloads.html
https://github.com/ispc/ispc

Signed-off-by: Naveen Saini <[email protected]>
Signed-off-by: Anuj Mittal <[email protected]>
---
 ...ink-with-libclang-cpp-library-instea.patch | 28 ++++++++
 ...cmake-don-t-build-for-32-bit-targets.patch | 64 +++++++++++++++++++
 ...0f26916e776bc3664e6a4dc68eff3a198d7a.patch | 38 +++++++++++
 .../recipes-core/ispc/ispc_1.16.0.bb          | 36 +++++++++++
 4 files changed, 166 insertions(+)
 create mode 100644 
dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch
 create mode 100644 
dynamic-layers/clang-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
 create mode 100644 
dynamic-layers/clang-layer/recipes-core/ispc/ispc/8b5d0f26916e776bc3664e6a4dc68eff3a198d7a.patch
 create mode 100644 dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.16.0.bb

diff --git 
a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch
 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch
new file mode 100644
index 00000000..4e25420c
--- /dev/null
+++ 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch
@@ -0,0 +1,28 @@
+From b9bc0df996d1e65fd70d5eb2d40866693f23bb67 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Thu, 24 Jun 2021 17:53:27 +0800
+Subject: [PATCH] CMakeLists.txt: link with libclang-cpp library instead
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ef88317e..7507d6a5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -281,7 +281,7 @@ if (WASM_ENABLED)
+     list(APPEND ISPC_TARGETS wasm-i32x4)
+ endif()
+ 
+-set(CLANG_LIBRARY_LIST clangFrontend clangDriver clangSerialization 
clangParse clangSema clangAnalysis clangAST clangBasic clangEdit clangLex)
++set(CLANG_LIBRARY_LIST clang-cpp)
+ set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker 
option frontendopenmp)
+ 
+ if (X86_ENABLED)
+-- 
+2.17.1
+
diff --git 
a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
new file mode 100644
index 00000000..5f3c7d0b
--- /dev/null
+++ 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
@@ -0,0 +1,64 @@
+From 3f3f81bde7d9d80921515ed0bf7fe36e69319bc4 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Wed, 30 Jun 2021 13:47:41 +0800
+Subject: [PATCH] cmake: don't build for 32-bit targets
+
+Error log:
+| 
tmp/work/corei7-64-poky-linux/ispc/1.16.0-r0/recipe-sysroot/usr/include/bits/long-double.h:23:10:
 fatal error: 'bits/long-double-32.h' file not found
+| #include <bits/long-double-32.h>
+|          ^~~~~~~~~~~~~~~~~~~~~~~
+| 1 error generated.
+
+Remove SYSTEM include search path and set -isysroot dir path
+for root dir for cross compilation.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+---
+ cmake/GenerateBuiltins.cmake | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/cmake/GenerateBuiltins.cmake b/cmake/GenerateBuiltins.cmake
+index 15a74788..db30f809 100644
+--- a/cmake/GenerateBuiltins.cmake
++++ b/cmake/GenerateBuiltins.cmake
+@@ -249,7 +249,7 @@ function(builtin_to_cpp bit os_name arch supported_archs 
supported_oses resultFi
+             #   In this case headers will be installed in 
/usr/arm-linux-gnueabihf/include and will not be picked up
+             #   by clang by default. So the following line adds such path 
explicitly. If this path doesn't exist and
+             #   the headers can be found in other locations, this should not 
be a problem.
+-            set(includePath -isystem/usr/${debian_triple}/include)
++            set(includePath -isysroot${SYSROOT_DIR})
+         endif()
+     endif()
+ 
+@@ -331,7 +331,7 @@ function (generate_target_builtins resultList)
+     set(regular_targets ${ARGN})
+     list(FILTER regular_targets EXCLUDE REGEX wasm)
+     foreach (ispc_target ${regular_targets})
+-        foreach (bit 32 64)
++        foreach (bit 64)
+             foreach (os_name ${TARGET_OS_LIST_FOR_LL})
+                 target_ll_to_cpp(target-${ispc_target} ${bit} ${os_name} 
output${os_name}${bit})
+                 list(APPEND tmpList ${output${os_name}${bit}})
+@@ -392,7 +392,7 @@ function (generate_common_builtins resultList)
+     endif()
+ 
+     message (STATUS "ISPC will be built with support of ${supported_oses} for 
${supported_archs}")
+-    foreach (bit 32 64)
++    foreach (bit 64)
+         foreach (os_name "windows" "linux" "freebsd" "macos" "android" "ios" 
"ps4" "web")
+             foreach (arch "x86" "arm" "wasm32")
+                 builtin_to_cpp(${bit} ${os_name} ${arch} "${supported_archs}" 
"${supported_oses}" res${bit}${os_name}${arch})
+@@ -405,7 +405,7 @@ function (generate_common_builtins resultList)
+         endforeach()
+     endforeach()
+     if (GENX_ENABLED)
+-        foreach (bit 32 64)
++        foreach (bit 64)
+             builtin_genx_to_cpp(${bit} res_genx_${bit})
+             list(APPEND tmpList ${res_genx_${bit}} )
+             if(MSVC)
+-- 
+2.17.1
+
diff --git 
a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/8b5d0f26916e776bc3664e6a4dc68eff3a198d7a.patch
 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/8b5d0f26916e776bc3664e6a4dc68eff3a198d7a.patch
new file mode 100644
index 00000000..1b87af4c
--- /dev/null
+++ 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/8b5d0f26916e776bc3664e6a4dc68eff3a198d7a.patch
@@ -0,0 +1,38 @@
+From 8b5d0f26916e776bc3664e6a4dc68eff3a198d7a Mon Sep 17 00:00:00 2001
+From: Dmitry Babokin <[email protected]>
+Date: Wed, 16 Jun 2021 20:38:44 -0700
+Subject: [PATCH] Do not use depricated file open flags
+
+Upstream-Status: Backport 
[https://github.com/ispc/ispc/commit/8b5d0f26916e776bc3664e6a4dc68eff3a198d7a]
+Signed-off-by: Anuj Mittal <[email protected]>
+---
+ src/module.cpp | 2 +-
+ src/opt.cpp    | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/module.cpp b/src/module.cpp
+index 1e68d30c4..352bcd09e 100644
+--- a/src/module.cpp
++++ b/src/module.cpp
+@@ -1314,7 +1314,7 @@ bool 
Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, llvm:
+     llvm::CodeGenFileType fileType = (outputType == Object) ? 
llvm::CGFT_ObjectFile : llvm::CGFT_AssemblyFile;
+     bool binary = (fileType == llvm::CGFT_ObjectFile);
+ 
+-    llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_None : 
llvm::sys::fs::F_Text;
++    llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::OF_None : 
llvm::sys::fs::OF_Text;
+ 
+     std::error_code error;
+ 
+diff --git a/src/opt.cpp b/src/opt.cpp
+index ae1a11d3d..de1b27e1e 100644
+--- a/src/opt.cpp
++++ b/src/opt.cpp
+@@ -4687,7 +4687,7 @@ void DebugPassFile::run(llvm::Module &module, bool init) 
{
+     std::error_code EC;
+     char fname[100];
+     snprintf(fname, sizeof(fname), "%s_%d_%s.ll", init ? "init" : "ir", pnum, 
sanitize(std::string(pname)).c_str());
+-    llvm::raw_fd_ostream OS(fname, EC, llvm::sys::fs::F_None);
++    llvm::raw_fd_ostream OS(fname, EC, llvm::sys::fs::OF_None);
+     Assert(!EC && "IR dump file creation failed!");
+     module.print(OS, 0);
+ }
diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.16.0.bb 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.16.0.bb
new file mode 100644
index 00000000..5355140b
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.16.0.bb
@@ -0,0 +1,36 @@
+SUMMARY  = "Intel(R) Implicit SPMD Program Compiler"
+DESCRIPTION = "ispc is a compiler for a variant of the C programming language, 
\
+with extensions for single program, multiple data programming."
+HOMEPAGE = "https://github.com/ispc/ispc";
+
+LICENSE  = "BSD-3-Clause & Apache-2.0-with-LLVM-exception"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=da5ecffdd210b3cf776b32b41c182e87 \
+                    
file://third-party-programs.txt;md5=3cd6f8a7c3bd9d2bb898fcb27c75221a"
+
+inherit cmake python3native
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/ispc/ispc.git;protocol=https;branch=main \
+           
file://0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch \
+           file://0002-cmake-don-t-build-for-32-bit-targets.patch \
+           file://8b5d0f26916e776bc3664e6a4dc68eff3a198d7a.patch \
+           "
+SRCREV = "bdd411085d3e398cf7927cb3b94b00af676737ba"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+
+DEPENDS += " clang-native bison-native "
+RDEPENDS_${PN} += " clang-libllvm clang"
+
+EXTRA_OECMAKE += " \
+                  -DISPC_INCLUDE_TESTS=OFF  \
+                  -DISPC_INCLUDE_EXAMPLES=OFF  \
+                  -DISPC_NO_DUMPS=ON  \
+                  -DARM_ENABLED=OFF  \
+                  -DISPC_CROSS=ON  \
+                  -DSYSROOT_DIR=${STAGING_DIR_NATIVE}  \
+                  "
+
+TOOLCHAIN = "clang"
+BBCLASSEXTEND = "native nativesdk"
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7138): 
https://lists.yoctoproject.org/g/meta-intel/message/7138
Mute This Topic: https://lists.yoctoproject.org/mt/83936111/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to