Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: intel-compute-runtime-20.18.16699
@ 2020-05-11 23:48 st3r4g
  2020-05-12  6:21 ` [PR PATCH] [Updated] " st3r4g
                   ` (44 more replies)
  0 siblings, 45 replies; 46+ messages in thread
From: st3r4g @ 2020-05-11 23:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

There is a new pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 6879 bytes --]

From e5d0fa78a7751e3792a5b41d0c9d928f4b6ac81e Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index 7693053e46b..3449b1caf3b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
@ 2020-05-12  6:21 ` st3r4g
  2020-05-12  7:18 ` st3r4g
                   ` (43 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12  6:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 9757 bytes --]

From e5d0fa78a7751e3792a5b41d0c9d928f4b6ac81e Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/2] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index 7693053e46b..3449b1caf3b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From b57759d5fdde339859d492ff9a97848c7ababe47 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/2] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
  2020-05-12  6:21 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-12  7:18 ` st3r4g
  2020-05-12  7:26 ` st3r4g
                   ` (42 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12  7:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 10778 bytes --]

From e5d0fa78a7751e3792a5b41d0c9d928f4b6ac81e Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/3] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index 7693053e46b..3449b1caf3b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From b57759d5fdde339859d492ff9a97848c7ababe47 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/3] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From 40e167985dc6ce3b385cfcf23342dce54a4c3023 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 3/3] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
  2020-05-12  6:21 ` [PR PATCH] [Updated] " st3r4g
  2020-05-12  7:18 ` st3r4g
@ 2020-05-12  7:26 ` st3r4g
  2020-05-12  8:13 ` ericonr
                   ` (41 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12  7:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627164455

Comment:
@ahesford this should now build on `x86-64`, feel free to test.

As for musl, not sure what is the correct way to fix this:
```
/builddir/compute-runtime-20.18.16699/shared/source/os_interface/linux/os_library_linux.cpp: In constructor 'NEO::Linux::OsLibrary::OsLibrary(const string&)':
/builddir/compute-runtime-20.18.16699/shared/source/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;
      |                                                 ^~~~~~~~~~~~~
```

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (2 preceding siblings ...)
  2020-05-12  7:26 ` st3r4g
@ 2020-05-12  8:13 ` ericonr
  2020-05-12 18:02 ` ericonr
                   ` (40 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-12  8:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627186530

Comment:
It should come from `dlfcn.h`, which, on musl, doesn't seem to define that type. `/usr/include/python3.8/pyconfig.h` seems to have some tricks for dealing with that, so I guess we can try to think of a patch based on that.

The intel use case for that option is mentioned here as well https://stackoverflow.com/questions/34073051/when-we-are-supposed-to-use-rtld-deepbind#34074587

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (3 preceding siblings ...)
  2020-05-12  8:13 ` ericonr
@ 2020-05-12 18:02 ` ericonr
  2020-05-12 19:17 ` st3r4g
                   ` (39 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-12 18:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627502114

Comment:
https://github.com/intel/compute-runtime/issues/266 suggests passing a `SANITIZER_BUILD` define to the `CXXFLAGS`. Makes sense, this is the only place where deepbind is used: https://github.com/intel/compute-runtime/blob/ee5ebde417716c8cacfbc42c0c7cd840339188d9/shared/source/os_interface/linux/os_library_linux.cpp#L32

As a more correct fix, however, https://github.com/intel/compute-runtime/issues/265#issuecomment-594581483 recommends using RTLD_GLOBAL instead of DEEPBIND. Upstream seems quite responsive, we could look into communicating with them if any more issues appear.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (4 preceding siblings ...)
  2020-05-12 18:02 ` ericonr
@ 2020-05-12 19:17 ` st3r4g
  2020-05-12 20:15 ` [PR PATCH] [Updated] " st3r4g
                   ` (38 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12 19:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627540217

Comment:
@ericonr thanks! didn't see there has been some work from alpine since last time I tried.
Indeed the combination of `SANITIZER_BUILD` + `RTLD_GLOBAL` fixes the error I was hitting soon after with the generation of the kernels

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (5 preceding siblings ...)
  2020-05-12 19:17 ` st3r4g
@ 2020-05-12 20:15 ` st3r4g
  2020-05-12 21:36 ` st3r4g
                   ` (37 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12 20:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 13092 bytes --]

From e5d0fa78a7751e3792a5b41d0c9d928f4b6ac81e Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/4] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index 7693053e46b..3449b1caf3b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From b57759d5fdde339859d492ff9a97848c7ababe47 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/4] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From 40e167985dc6ce3b385cfcf23342dce54a4c3023 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 3/4] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 81051bdc24ec20817060b51e908ba4e8ab7fd5e1 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 4/4] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (6 preceding siblings ...)
  2020-05-12 20:15 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-12 21:36 ` st3r4g
  2020-05-12 22:22 ` st3r4g
                   ` (36 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12 21:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 16426 bytes --]

From e5d0fa78a7751e3792a5b41d0c9d928f4b6ac81e Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/5] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index 7693053e46b..3449b1caf3b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From b57759d5fdde339859d492ff9a97848c7ababe47 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/5] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From 40e167985dc6ce3b385cfcf23342dce54a4c3023 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 3/5] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 81051bdc24ec20817060b51e908ba4e8ab7fd5e1 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 4/5] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

From 9f5b8df52411e17450cbd6a0caed4db9b795ee59 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 23:36:20 +0200
Subject: [PATCH 5/5] neo: more musl patches

[skip ci]
---
 .../patches/musl-ioctl.patch                  | 14 +++++++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++++++++
 .../patches/musl-select.patch                 | 13 ++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (7 preceding siblings ...)
  2020-05-12 21:36 ` st3r4g
@ 2020-05-12 22:22 ` st3r4g
  2020-05-12 22:38 ` st3r4g
                   ` (35 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12 22:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627630163

Comment:
Some tests are failing:
```
[ 93%] Built target run_kbl_unit_tests
running tests for linux dynamic library - .so in /builddir/compute-runtime-20.18.16699/build/bin
```
In this stage a lot of checks fail and there is even a segfault. Other stages seem ok

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (8 preceding siblings ...)
  2020-05-12 22:22 ` st3r4g
@ 2020-05-12 22:38 ` st3r4g
  2020-05-13  9:54 ` [PR PATCH] [Updated] " st3r4g
                   ` (34 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-12 22:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627630163

Comment:
Some tests are failing:
```
[ 93%] Built target run_kbl_unit_tests
running tests for linux dynamic library - .so in /builddir/compute-runtime-20.18.16699/build/bin
```
In this stage a lot of checks fail and there is even a segfault. Other stages seem ok.
Will post more detailed error log later

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (9 preceding siblings ...)
  2020-05-12 22:38 ` st3r4g
@ 2020-05-13  9:54 ` st3r4g
  2020-05-13 10:04 ` st3r4g
                   ` (33 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-13  9:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 23386 bytes --]

From 91015aa0646267f2168cf1768b551c7923141d3b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/7] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index d7ef5f18ee9..436261ca498 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From 20eb9ba6bff9562c43f6c3d2b52c4c9b9157971b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/7] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From a761c3d198346b7467899ab75b468caa8f527770 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 3/7] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 8394a7e76746261a107a511246098a00019f4769 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 4/7] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

From 409e0173f5e0da3199164e7c3589afe403573746 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 23:36:20 +0200
Subject: [PATCH 5/7] neo: more musl patches

[skip ci]
---
 .../patches/musl-ioctl.patch                  | 14 +++++++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++++++++
 .../patches/musl-select.patch                 | 13 ++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);

From 28ea7fe571373a32020e4b7280ea4d6ef7fe4594 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 10:18:26 +0200
Subject: [PATCH 6/7] neo: disable tests by default, fix style

[skip ci]
---
 srcpkgs/intel-compute-runtime/template | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index f1e34b3bed4..4de974b9d4a 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,18 +2,12 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-wrksrc=compute-runtime-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=compute-runtime-${version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
-depends="intel-gmmlib intel-graphics-compiler"
+depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
@@ -21,6 +15,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" libexecinfo-devel"
 	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"

From ac162bda0a65d189bc9e48f4f2c0f88318513f9c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 11:55:26 +0200
Subject: [PATCH 7/7] fix style, some other changes

---
 srcpkgs/SPIRV-LLVM-Translator/template        | 13 ++-------
 .../patches/musl.patch                        | 12 ++++----
 srcpkgs/intel-graphics-compiler/template      | 12 ++------
 srcpkgs/intel-opencl-clang/template           | 28 +++++++++++--------
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 1be0ff4278c..cef0a2adc3c 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,18 +3,11 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#create_wrksrc=yes
 #archs="i686 x86_64"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-#hostmakedepends="llvm10"
-makedepends="clang-tools-extra llvm10"
-depends=""
-short_desc="library and tool for translation between LLVM IR and SPIR-V"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
@@ -26,7 +19,7 @@ post_install() {
 }
 
 SPIRV-LLVM-Translator-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index c42794f3738..7c802631ec6 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -1,8 +1,6 @@
-diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
-index 8177776..5e3dabf 100644
---- inc/common/UFO/portable_compiler.h
-+++ inc/common/UFO/portable_compiler.h
-@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
  /* compile-time ASSERT */
  
  #ifndef C_ASSERT
@@ -11,8 +9,8 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
---- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
-+++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
 @@ -25,6 +25,7 @@
  ======================= end_copyright_notice ==================================*/
  
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 573d61e6c8a..30c3262e45e 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,18 +2,12 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-wrksrc=intel-graphics-compiler-igc-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
-configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
 hostmakedepends="bison flex"
-makedepends="clang-tools-extra llvm10 intel-opencl-clang"
-depends=""
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
 short_desc="Intel Graphics Compiler for OpenCL"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index fc4a7cfd5fd..55c478def2e 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -1,22 +1,28 @@
 # Template file for 'intel-opencl-clang'
 pkgname=intel-opencl-clang
 version=10.0.0.1
-_version=10.0.0-1
 revision=1
-wrksrc=opencl-clang-${_version}
-#create_wrksrc=yes
+_version=10.0.0-1
 archs="i686* x86_64*"
+wrksrc=opencl-clang-${_version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-makedepends="llvm10 SPIRV-LLVM-Translator-devel"
-depends=""
-short_desc="wrapper library around clang"
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/intel/opencl-clang"
 distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
 checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (10 preceding siblings ...)
  2020-05-13  9:54 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-13 10:04 ` st3r4g
  2020-05-13 12:25 ` st3r4g
                   ` (32 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-13 10:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 23955 bytes --]

From 91015aa0646267f2168cf1768b551c7923141d3b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 1/8] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index d7ef5f18ee9..436261ca498 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From 20eb9ba6bff9562c43f6c3d2b52c4c9b9157971b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 2/8] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From a761c3d198346b7467899ab75b468caa8f527770 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 3/8] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 8394a7e76746261a107a511246098a00019f4769 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 4/8] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

From 409e0173f5e0da3199164e7c3589afe403573746 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 23:36:20 +0200
Subject: [PATCH 5/8] neo: more musl patches

[skip ci]
---
 .../patches/musl-ioctl.patch                  | 14 +++++++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++++++++
 .../patches/musl-select.patch                 | 13 ++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);

From 28ea7fe571373a32020e4b7280ea4d6ef7fe4594 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 10:18:26 +0200
Subject: [PATCH 6/8] neo: disable tests by default, fix style

[skip ci]
---
 srcpkgs/intel-compute-runtime/template | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index f1e34b3bed4..4de974b9d4a 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,18 +2,12 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-wrksrc=compute-runtime-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=compute-runtime-${version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
-depends="intel-gmmlib intel-graphics-compiler"
+depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
@@ -21,6 +15,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" libexecinfo-devel"
 	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"

From ac162bda0a65d189bc9e48f4f2c0f88318513f9c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 11:55:26 +0200
Subject: [PATCH 7/8] fix style, some other changes

---
 srcpkgs/SPIRV-LLVM-Translator/template        | 13 ++-------
 .../patches/musl.patch                        | 12 ++++----
 srcpkgs/intel-graphics-compiler/template      | 12 ++------
 srcpkgs/intel-opencl-clang/template           | 28 +++++++++++--------
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 1be0ff4278c..cef0a2adc3c 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,18 +3,11 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#create_wrksrc=yes
 #archs="i686 x86_64"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-#hostmakedepends="llvm10"
-makedepends="clang-tools-extra llvm10"
-depends=""
-short_desc="library and tool for translation between LLVM IR and SPIR-V"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
@@ -26,7 +19,7 @@ post_install() {
 }
 
 SPIRV-LLVM-Translator-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index c42794f3738..7c802631ec6 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -1,8 +1,6 @@
-diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
-index 8177776..5e3dabf 100644
---- inc/common/UFO/portable_compiler.h
-+++ inc/common/UFO/portable_compiler.h
-@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
  /* compile-time ASSERT */
  
  #ifndef C_ASSERT
@@ -11,8 +9,8 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
---- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
-+++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
 @@ -25,6 +25,7 @@
  ======================= end_copyright_notice ==================================*/
  
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 573d61e6c8a..30c3262e45e 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,18 +2,12 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-wrksrc=intel-graphics-compiler-igc-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
-configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
 hostmakedepends="bison flex"
-makedepends="clang-tools-extra llvm10 intel-opencl-clang"
-depends=""
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
 short_desc="Intel Graphics Compiler for OpenCL"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index fc4a7cfd5fd..55c478def2e 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -1,22 +1,28 @@
 # Template file for 'intel-opencl-clang'
 pkgname=intel-opencl-clang
 version=10.0.0.1
-_version=10.0.0-1
 revision=1
-wrksrc=opencl-clang-${_version}
-#create_wrksrc=yes
+_version=10.0.0-1
 archs="i686* x86_64*"
+wrksrc=opencl-clang-${_version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-makedepends="llvm10 SPIRV-LLVM-Translator-devel"
-depends=""
-short_desc="wrapper library around clang"
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/intel/opencl-clang"
 distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
 checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 6c9284bf8c750a920d0aa26d371bc47868d5de19 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 12:04:37 +0200
Subject: [PATCH 8/8] forgot symlink

---
 srcpkgs/intel-opencl-clang-devel | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (11 preceding siblings ...)
  2020-05-13 10:04 ` st3r4g
@ 2020-05-13 12:25 ` st3r4g
  2020-05-14 19:11 ` [PR PATCH] [Updated] " st3r4g
                   ` (31 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-13 12:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2681 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-627630163

Comment:
Some tests are failing on musl:
```
[ 93%] Built target run_kbl_unit_tests
Scanning dependencies of target run_unit_tests
running tests for linux dynamic library - .so in /builddir/compute-runtime-20.18.16699/build/bin
Iteration: 1
Iteration: 1. random_seed: 0

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/drm_null_device_tests.cpp:28: Failure
Expected: (drmNullDevice) != (nullptr), actual: NULL vs (nullptr)
[  FAILED  ][ --- ][ 0 ] DrmNullDeviceTests.GIVENdrmNullDeviceWHENcallGetDeviceIdTHENreturnProperDeviceId

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/drm_null_device_tests.cpp:28: Failure
Expected: (drmNullDevice) != (nullptr), actual: NULL vs (nullptr)
[  FAILED  ][ --- ][ 0 ] DrmNullDeviceTests.GIVENdrmNullDeviceWHENcallIoctlTHENalwaysSuccess

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/drm_null_device_tests.cpp:28: Failure
Expected: (drmNullDevice) != (nullptr), actual: NULL vs (nullptr)
[  FAILED  ][ --- ][ 0 ] DrmNullDeviceTests.GIVENdrmNullDeviceWHENregReadOtherThenTimestampReadTHENalwaysSuccess

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/drm_null_device_tests.cpp:28: Failure
Expected: (drmNullDevice) != (nullptr), actual: NULL vs (nullptr)
[  FAILED  ][ --- ][ 0 ] DrmNullDeviceTests.GIVENdrmNullDeviceWHENgetGpuTimestamp32bOr64bTHENerror

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/drm_null_device_tests.cpp:28: Failure
Expected: (drmNullDevice) != (nullptr), actual: NULL vs (nullptr)
[  FAILED  ][ --- ][ 0 ] DrmNullDeviceTests.GIVENdrmNullDeviceWHENgetGpuTimestamp36bTHENproperValues

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/main_linux_dll.cpp:81: Failure
Expected equality of these values:
  2u
    Which is: 2
  hwDeviceIds.size()
    Which is: 0
[  FAILED  ][ --- ][ 0 ] DrmTest.GivenTwoOpenableDevicesWhenDiscoverDevicesThenCreateTwoHwDeviceIds

/builddir/compute-runtime-20.18.16699/opencl/test/unit_test/linux/main_linux_dll.cpp:103: Failure
Expected equality of these values:
  1u
    Which is: 1
  hwDeviceIds.size()
    Which is: 0
make[2]: *** [opencl/test/unit_test/CMakeFiles/run_unit_tests.dir/build.make:78: run_unit_tests] Segmentation fault
make[1]: *** [CMakeFiles/Makefile2:8180: opencl/test/unit_test/CMakeFiles/run_unit_tests.dir/all] Error 2
make: *** [Makefile:172: all] Error 2
```
also note that it ends with a segfault. We have to find out if really the compute-runtime is broken or just these tests.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (12 preceding siblings ...)
  2020-05-13 12:25 ` st3r4g
@ 2020-05-14 19:11 ` st3r4g
  2020-05-14 21:09 ` st3r4g
                   ` (30 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-14 19:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 28253 bytes --]

From 91015aa0646267f2168cf1768b551c7923141d3b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 01/10] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index d7ef5f18ee9..436261ca498 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From 20eb9ba6bff9562c43f6c3d2b52c4c9b9157971b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 02/10] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From a761c3d198346b7467899ab75b468caa8f527770 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 03/10] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 8394a7e76746261a107a511246098a00019f4769 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 04/10] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

From 409e0173f5e0da3199164e7c3589afe403573746 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 23:36:20 +0200
Subject: [PATCH 05/10] neo: more musl patches

[skip ci]
---
 .../patches/musl-ioctl.patch                  | 14 +++++++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++++++++
 .../patches/musl-select.patch                 | 13 ++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);

From 28ea7fe571373a32020e4b7280ea4d6ef7fe4594 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 10:18:26 +0200
Subject: [PATCH 06/10] neo: disable tests by default, fix style

[skip ci]
---
 srcpkgs/intel-compute-runtime/template | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index f1e34b3bed4..4de974b9d4a 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,18 +2,12 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-wrksrc=compute-runtime-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=compute-runtime-${version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
-depends="intel-gmmlib intel-graphics-compiler"
+depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
@@ -21,6 +15,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" libexecinfo-devel"
 	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"

From ac162bda0a65d189bc9e48f4f2c0f88318513f9c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 11:55:26 +0200
Subject: [PATCH 07/10] fix style, some other changes

---
 srcpkgs/SPIRV-LLVM-Translator/template        | 13 ++-------
 .../patches/musl.patch                        | 12 ++++----
 srcpkgs/intel-graphics-compiler/template      | 12 ++------
 srcpkgs/intel-opencl-clang/template           | 28 +++++++++++--------
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 1be0ff4278c..cef0a2adc3c 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,18 +3,11 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#create_wrksrc=yes
 #archs="i686 x86_64"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-#hostmakedepends="llvm10"
-makedepends="clang-tools-extra llvm10"
-depends=""
-short_desc="library and tool for translation between LLVM IR and SPIR-V"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
@@ -26,7 +19,7 @@ post_install() {
 }
 
 SPIRV-LLVM-Translator-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index c42794f3738..7c802631ec6 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -1,8 +1,6 @@
-diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
-index 8177776..5e3dabf 100644
---- inc/common/UFO/portable_compiler.h
-+++ inc/common/UFO/portable_compiler.h
-@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
  /* compile-time ASSERT */
  
  #ifndef C_ASSERT
@@ -11,8 +9,8 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
---- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
-+++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
 @@ -25,6 +25,7 @@
  ======================= end_copyright_notice ==================================*/
  
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 573d61e6c8a..30c3262e45e 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,18 +2,12 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-wrksrc=intel-graphics-compiler-igc-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
-configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
 hostmakedepends="bison flex"
-makedepends="clang-tools-extra llvm10 intel-opencl-clang"
-depends=""
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
 short_desc="Intel Graphics Compiler for OpenCL"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index fc4a7cfd5fd..55c478def2e 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -1,22 +1,28 @@
 # Template file for 'intel-opencl-clang'
 pkgname=intel-opencl-clang
 version=10.0.0.1
-_version=10.0.0-1
 revision=1
-wrksrc=opencl-clang-${_version}
-#create_wrksrc=yes
+_version=10.0.0-1
 archs="i686* x86_64*"
+wrksrc=opencl-clang-${_version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-makedepends="llvm10 SPIRV-LLVM-Translator-devel"
-depends=""
-short_desc="wrapper library around clang"
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/intel/opencl-clang"
 distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
 checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 6c9284bf8c750a920d0aa26d371bc47868d5de19 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 12:04:37 +0200
Subject: [PATCH 08/10] forgot symlink

---
 srcpkgs/intel-opencl-clang-devel | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file

From 7d8853781096be01faec22da5b2494378d8043d0 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Thu, 14 May 2020 21:03:37 +0200
Subject: [PATCH 09/10] restrict everything to x86_64{,-musl}

compile-runtime doesn't build on i686
---
 srcpkgs/SPIRV-LLVM-Translator/template   | 2 +-
 srcpkgs/intel-compute-runtime/template   | 2 +-
 srcpkgs/intel-graphics-compiler/template | 2 +-
 srcpkgs/intel-opencl-clang/template      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index cef0a2adc3c..02beb58bd0e 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,7 +3,7 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#archs="i686 x86_64"
+archs="x86_64*"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
 makedepends="clang-tools-extra llvm"
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 4de974b9d4a..23f2f5e406b 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,7 +2,7 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=compute-runtime-${version}
 build_style=cmake
 hostmakedepends="pkg-config"
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 30c3262e45e..89a198568d7 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,7 +2,7 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
 configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index 55c478def2e..5d03529a48b 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -3,7 +3,7 @@ pkgname=intel-opencl-clang
 version=10.0.0.1
 revision=1
 _version=10.0.0-1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=opencl-clang-${_version}
 build_style=cmake
 makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"

From 7bbf5e7e8ed7f79ed34832f6f5f8bd3d4b6f8c62 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Thu, 14 May 2020 21:10:50 +0200
Subject: [PATCH 10/10] igc: split -devel

---
 srcpkgs/intel-compute-runtime/template   |  2 +-
 srcpkgs/intel-graphics-compiler-devel    |  1 +
 srcpkgs/intel-graphics-compiler/template | 10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 23f2f5e406b..94db8685f4e 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -6,7 +6,7 @@ archs="x86_64*"
 wrksrc=compute-runtime-${version}
 build_style=cmake
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
 depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 89a198568d7..11260f87362 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -18,3 +18,13 @@ checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
 post_install() {
 	vlicense LICENSE.md
 }
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (13 preceding siblings ...)
  2020-05-14 19:11 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-14 21:09 ` st3r4g
  2020-05-16 14:19 ` st3r4g
                   ` (29 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-14 21:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 30336 bytes --]

From 91015aa0646267f2168cf1768b551c7923141d3b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 01:35:04 +0200
Subject: [PATCH 01/11] WIP

---
 common/shlibs                                 |  2 ++
 srcpkgs/SPIRV-LLVM-Translator-devel           |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template        | 36 +++++++++++++++++++
 srcpkgs/intel-compute-runtime/template        | 28 +++++++++++++++
 .../patches/musl.patch                        | 13 +++++++
 srcpkgs/intel-graphics-compiler/template      | 26 ++++++++++++++
 srcpkgs/intel-opencl-clang/template           | 22 ++++++++++++
 7 files changed, 128 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template
 create mode 100644 srcpkgs/intel-compute-runtime/template
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/common/shlibs b/common/shlibs
index d7ef5f18ee9..436261ca498 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3876,3 +3876,5 @@ libhidrd_opt.so.0 hidrd-0.2.0_1
 libhidrd_strm.so.0 hidrd-0.2.0_1
 libhidrd_fmt.so.0 hidrd-0.2.0_1
 libjcat.so.1 libjcat-0.1.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..1be0ff4278c
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,36 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+wrksrc=SPIRV-LLVM-Translator-${version}
+#create_wrksrc=yes
+#archs="i686 x86_64"
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+#hostmakedepends="llvm10"
+makedepends="clang-tools-extra llvm10"
+depends=""
+short_desc="library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..6d31353efd6
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,28 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+wrksrc=compute-runtime-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+depends="intel-gmmlib intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+CXXFLAGS+=" -lexecinfo"
+
+post_install() {
+	vlicense LICENSE
+}
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..f8f50294678
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,13 @@
+diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
+index 8177776..5e3dabf 100644
+--- inc/common/UFO/portable_compiler.h
++++ inc/common/UFO/portable_compiler.h
+@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..573d61e6c8a
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,26 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+wrksrc=intel-graphics-compiler-igc-${version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm10 intel-opencl-clang"
+depends=""
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..fc4a7cfd5fd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,22 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+_version=10.0.0-1
+revision=1
+wrksrc=opencl-clang-${_version}
+#create_wrksrc=yes
+archs="i686* x86_64*"
+build_style=cmake
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+makedepends="llvm10 SPIRV-LLVM-Translator-devel"
+depends=""
+short_desc="wrapper library around clang"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="custom:LLVM"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507

From 20eb9ba6bff9562c43f6c3d2b52c4c9b9157971b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 08:20:13 +0200
Subject: [PATCH 02/11] igc: tmp libpath patch, neo: rm execinfo for now

[skip ci]
---
 srcpkgs/intel-compute-runtime/template        |  5 +++--
 .../patches/fix-LLVM-library-path.patch       | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 6d31353efd6..780d2401488 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,8 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel"
+#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
+makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
@@ -21,7 +22,7 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-CXXFLAGS+=" -lexecinfo"
+#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
 
 post_install() {
 	vlicense LICENSE
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")

From a761c3d198346b7467899ab75b468caa8f527770 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 09:18:22 +0200
Subject: [PATCH 03/11] igt: finish musl patch

[skip ci]
---
 srcpkgs/intel-graphics-compiler/patches/musl.patch | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index f8f50294678..c42794f3738 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -11,3 +11,13 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
+--- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
++++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>

From 8394a7e76746261a107a511246098a00019f4769 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 22:16:22 +0200
Subject: [PATCH 04/11] neo: execinfo & RTLD_GLOBAL

---
 .../patches/musl-rtld-global.patch                    | 11 +++++++++++
 srcpkgs/intel-compute-runtime/template                |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 780d2401488..f1e34b3bed4 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -12,7 +12,6 @@ build_style=cmake
 #conf_files=""
 #make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
-#makedepends="intel-gmmlib-devel intel-graphics-compiler libexecinfo-devel" TODO
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
 depends="intel-gmmlib intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
@@ -22,7 +21,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
-#CXXFLAGS+=" -lexecinfo" TODO: see if it helps on musl
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
 
 post_install() {
 	vlicense LICENSE

From 409e0173f5e0da3199164e7c3589afe403573746 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Tue, 12 May 2020 23:36:20 +0200
Subject: [PATCH 05/11] neo: more musl patches

[skip ci]
---
 .../patches/musl-ioctl.patch                  | 14 +++++++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++++++++
 .../patches/musl-select.patch                 | 13 ++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);

From 28ea7fe571373a32020e4b7280ea4d6ef7fe4594 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 10:18:26 +0200
Subject: [PATCH 06/11] neo: disable tests by default, fix style

[skip ci]
---
 srcpkgs/intel-compute-runtime/template | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index f1e34b3bed4..4de974b9d4a 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,18 +2,12 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-wrksrc=compute-runtime-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=compute-runtime-${version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
 hostmakedepends="pkg-config"
 makedepends="intel-gmmlib-devel intel-graphics-compiler"
-depends="intel-gmmlib intel-graphics-compiler"
+depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
@@ -21,6 +15,10 @@ homepage="https://github.com/intel/compute-runtime"
 distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
 checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
 
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" libexecinfo-devel"
 	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"

From ac162bda0a65d189bc9e48f4f2c0f88318513f9c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 11:55:26 +0200
Subject: [PATCH 07/11] fix style, some other changes

---
 srcpkgs/SPIRV-LLVM-Translator/template        | 13 ++-------
 .../patches/musl.patch                        | 12 ++++----
 srcpkgs/intel-graphics-compiler/template      | 12 ++------
 srcpkgs/intel-opencl-clang/template           | 28 +++++++++++--------
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 1be0ff4278c..cef0a2adc3c 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,18 +3,11 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#create_wrksrc=yes
 #archs="i686 x86_64"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-#hostmakedepends="llvm10"
-makedepends="clang-tools-extra llvm10"
-depends=""
-short_desc="library and tool for translation between LLVM IR and SPIR-V"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
@@ -26,7 +19,7 @@ post_install() {
 }
 
 SPIRV-LLVM-Translator-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
index c42794f3738..7c802631ec6 100644
--- a/srcpkgs/intel-graphics-compiler/patches/musl.patch
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -1,8 +1,6 @@
-diff --git inc/common/UFO/portable_compiler.h inc/common/UFO/portable_compiler.h
-index 8177776..5e3dabf 100644
---- inc/common/UFO/portable_compiler.h
-+++ inc/common/UFO/portable_compiler.h
-@@ -125,7 +125,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
  /* compile-time ASSERT */
  
  #ifndef C_ASSERT
@@ -11,8 +9,8 @@ index 8177776..5e3dabf 100644
      #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
  
  
---- visa/CISA.y.orig	2020-05-12 08:57:46.820979512 +0200
-+++ visa/CISA.y	2020-05-12 08:58:14.689978585 +0200
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
 @@ -25,6 +25,7 @@
  ======================= end_copyright_notice ==================================*/
  
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 573d61e6c8a..30c3262e45e 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,18 +2,12 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-wrksrc=intel-graphics-compiler-igc-${version}
-#create_wrksrc=yes
 archs="i686* x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
-configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0'"
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
 hostmakedepends="bison flex"
-makedepends="clang-tools-extra llvm10 intel-opencl-clang"
-depends=""
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
 short_desc="Intel Graphics Compiler for OpenCL"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="MIT"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index fc4a7cfd5fd..55c478def2e 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -1,22 +1,28 @@
 # Template file for 'intel-opencl-clang'
 pkgname=intel-opencl-clang
 version=10.0.0.1
-_version=10.0.0-1
 revision=1
-wrksrc=opencl-clang-${_version}
-#create_wrksrc=yes
+_version=10.0.0-1
 archs="i686* x86_64*"
+wrksrc=opencl-clang-${_version}
 build_style=cmake
-#configure_args=""
-#make_build_args=""
-#make_install_args=""
-#conf_files=""
-#make_dirs="/var/log/dir 0755 root root"
-makedepends="llvm10 SPIRV-LLVM-Translator-devel"
-depends=""
-short_desc="wrapper library around clang"
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
 license="custom:LLVM"
 homepage="https://github.com/intel/opencl-clang"
 distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
 checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 6c9284bf8c750a920d0aa26d371bc47868d5de19 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Wed, 13 May 2020 12:04:37 +0200
Subject: [PATCH 08/11] forgot symlink

---
 srcpkgs/intel-opencl-clang-devel | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file

From 7d8853781096be01faec22da5b2494378d8043d0 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Thu, 14 May 2020 21:03:37 +0200
Subject: [PATCH 09/11] restrict everything to x86_64{,-musl}

compile-runtime doesn't build on i686
---
 srcpkgs/SPIRV-LLVM-Translator/template   | 2 +-
 srcpkgs/intel-compute-runtime/template   | 2 +-
 srcpkgs/intel-graphics-compiler/template | 2 +-
 srcpkgs/intel-opencl-clang/template      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index cef0a2adc3c..02beb58bd0e 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -3,7 +3,7 @@ pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
 wrksrc=SPIRV-LLVM-Translator-${version}
-#archs="i686 x86_64"
+archs="x86_64*"
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
 makedepends="clang-tools-extra llvm"
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 4de974b9d4a..23f2f5e406b 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -2,7 +2,7 @@
 pkgname=intel-compute-runtime
 version=20.18.16699
 revision=1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=compute-runtime-${version}
 build_style=cmake
 hostmakedepends="pkg-config"
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 30c3262e45e..89a198568d7 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -2,7 +2,7 @@
 pkgname=intel-graphics-compiler
 version=1.0.3899
 revision=1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=intel-graphics-compiler-igc-${version}
 build_style=cmake
 configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index 55c478def2e..5d03529a48b 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -3,7 +3,7 @@ pkgname=intel-opencl-clang
 version=10.0.0.1
 revision=1
 _version=10.0.0-1
-archs="i686* x86_64*"
+archs="x86_64*"
 wrksrc=opencl-clang-${_version}
 build_style=cmake
 makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"

From 7bbf5e7e8ed7f79ed34832f6f5f8bd3d4b6f8c62 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Thu, 14 May 2020 21:10:50 +0200
Subject: [PATCH 10/11] igc: split -devel

---
 srcpkgs/intel-compute-runtime/template   |  2 +-
 srcpkgs/intel-graphics-compiler-devel    |  1 +
 srcpkgs/intel-graphics-compiler/template | 10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel

diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
index 23f2f5e406b..94db8685f4e 100644
--- a/srcpkgs/intel-compute-runtime/template
+++ b/srcpkgs/intel-compute-runtime/template
@@ -6,7 +6,7 @@ archs="x86_64*"
 wrksrc=compute-runtime-${version}
 build_style=cmake
 hostmakedepends="pkg-config"
-makedepends="intel-gmmlib-devel intel-graphics-compiler"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
 depends="intel-graphics-compiler"
 short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
index 89a198568d7..11260f87362 100644
--- a/srcpkgs/intel-graphics-compiler/template
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -18,3 +18,13 @@ checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
 post_install() {
 	vlicense LICENSE.md
 }
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 578224d71066c4f04ea2db85ef403d9c7fbe44a8 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Thu, 14 May 2020 23:09:52 +0200
Subject: [PATCH 11/11] fix license, mark opencl-clang nocross

[skip ci]
---
 srcpkgs/SPIRV-LLVM-Translator/template | 4 ++--
 srcpkgs/intel-opencl-clang/template    | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 02beb58bd0e..89befc40dd0 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -2,14 +2,14 @@
 pkgname=SPIRV-LLVM-Translator
 version=10.0.0
 revision=1
-wrksrc=SPIRV-LLVM-Translator-${version}
 archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
 build_style=cmake
 configure_args="-DBUILD_SHARED_LIBS=ON"
 makedepends="clang-tools-extra llvm"
 short_desc="Library and tool for translation between LLVM IR and SPIR-V"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
-license="custom:LLVM"
+license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
 checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
index 5d03529a48b..e23f2e72ba9 100644
--- a/srcpkgs/intel-opencl-clang/template
+++ b/srcpkgs/intel-opencl-clang/template
@@ -9,11 +9,13 @@ build_style=cmake
 makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
 short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
 maintainer="Stefano Ragni <st3r4g@protonmail.com>"
-license="custom:LLVM"
+license="NCSA"
 homepage="https://github.com/intel/opencl-clang"
 distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
 checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
 
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
 post_install() {
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (14 preceding siblings ...)
  2020-05-14 21:09 ` st3r4g
@ 2020-05-16 14:19 ` st3r4g
  2020-05-16 14:23 ` st3r4g
                   ` (28 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-16 14:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 14449 bytes --]

From 7b88cf981ec5dc7f1e5436ffe1e8b3116adcc42d Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:12:58 +0200
Subject: [PATCH 1/5] common/shlibs: add libLLVMSPIRVLib,libopencl-clang

---
 common/shlibs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/shlibs b/common/shlibs
index 22e35e26882..9c74e614d0c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3880,3 +3880,5 @@ libjcat.so.1 libjcat-0.1.2_1
 libmatio.so.9 matio-1.5.17_2
 libvips.so.42 libvips-8.9.2_1
 libvips-cpp.so.42 libvips-8.9.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1

From ae05946b0cd4b1a9adc754a705b299bffdefcf2a Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:15:13 +0200
Subject: [PATCH 2/5] New package: SPIRV-LLVM-Translator-10.0.0

---
 srcpkgs/SPIRV-LLVM-Translator-devel    |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template

diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..89befc40dd0
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,29 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From dffa723c1188e2632866173f5ef0265661055d34 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:16:36 +0200
Subject: [PATCH 3/5] New package: intel-opencl-clang-10.0.0.1

---
 srcpkgs/intel-opencl-clang-devel    |  1 +
 srcpkgs/intel-opencl-clang/template | 30 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..e23f2e72ba9
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+revision=1
+_version=10.0.0-1
+archs="x86_64*"
+wrksrc=opencl-clang-${_version}
+build_style=cmake
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 7b41ed947267835f6a23da8a93161d2a798f0059 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:17:54 +0200
Subject: [PATCH 4/5] New package: intel-graphics-compiler-1.0.3899

---
 srcpkgs/intel-graphics-compiler-devel         |  1 +
 .../patches/fix-LLVM-library-path.patch       | 19 ++++++++++++
 .../patches/musl.patch                        | 21 +++++++++++++
 srcpkgs/intel-graphics-compiler/template      | 30 +++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template

diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..7c802631ec6
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,21 @@
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..11260f87362
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+archs="x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From e5a6edc8c52822e850b9bdcd72606365e1e56642 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:18:46 +0200
Subject: [PATCH 5/5] New package: intel-compute-runtime-20.18.16699

---
 .../patches/musl-ioctl.patch                  | 14 +++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++
 .../patches/musl-rtld-global.patch            | 11 +++++++
 .../patches/musl-select.patch                 | 13 +++++++++
 srcpkgs/intel-compute-runtime/template        | 29 +++++++++++++++++++
 5 files changed, 87 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch
 create mode 100644 srcpkgs/intel-compute-runtime/template

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..94db8685f4e
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,29 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+archs="x86_64*"
+wrksrc=compute-runtime-${version}
+build_style=cmake
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
+depends="intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (15 preceding siblings ...)
  2020-05-16 14:19 ` st3r4g
@ 2020-05-16 14:23 ` st3r4g
  2020-05-18  1:58 ` ericonr
                   ` (27 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-16 14:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629653770

Comment:
Needs to be tested with real world CL programs, especially on `musl`

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (16 preceding siblings ...)
  2020-05-16 14:23 ` st3r4g
@ 2020-05-18  1:58 ` ericonr
  2020-05-18  2:04 ` ericonr
                   ` (26 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  1:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629905111

Comment:
I'm doing some quick testing on Darktable (on musl), seems to be working fine. I will try to test darktable CLI on musl afterwards.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (17 preceding siblings ...)
  2020-05-18  1:58 ` ericonr
@ 2020-05-18  2:04 ` ericonr
  2020-05-18  2:08 ` ericonr
                   ` (25 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629905111

Comment:
I'm doing some quick testing on Darktable (on glibc), seems to be working fine. I will try to test darktable CLI on musl afterwards.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (18 preceding siblings ...)
  2020-05-18  2:04 ` ericonr
@ 2020-05-18  2:08 ` ericonr
  2020-05-18  2:27 ` ericonr
                   ` (24 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629907613

Comment:
Btw, I believe you're missing some additions from common/shlibs (at least xbps-src complained about that here). I can get them for you if you want.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (19 preceding siblings ...)
  2020-05-18  2:08 ` ericonr
@ 2020-05-18  2:27 ` ericonr
  2020-05-18  2:40 ` ericonr
                   ` (23 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629905111

Comment:
I'm doing some quick testing on Darktable (on glibc), seems to be working fine. I will try to test darktable CLI on musl afterwards.

EDIT: darktable simple image worked!

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (20 preceding siblings ...)
  2020-05-18  2:27 ` ericonr
@ 2020-05-18  2:40 ` ericonr
  2020-05-18  2:42 ` ericonr
                   ` (22 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:40 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629905111

Comment:
I'm doing some quick testing on Darktable (on glibc), seems to be working fine. I will try to test darktable CLI on musl afterwards.

EDIT: darktable simple image worked! Both on glibc and musl, I tested an image with all effects enabled, and `intel_gpu_top` showed high usage in  the Render line, sometimes at 100% even. No crashes or segfaults.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (21 preceding siblings ...)
  2020-05-18  2:40 ` ericonr
@ 2020-05-18  2:42 ` ericonr
  2020-05-18  2:42 ` ericonr
                   ` (21 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629915067

Comment:
The patches that you're using, do they come from upstream? At least the main repo seemed open to solving musl problems, so we can probably get all that upstreamed in the future c:

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (22 preceding siblings ...)
  2020-05-18  2:42 ` ericonr
@ 2020-05-18  2:42 ` ericonr
  2020-05-18  8:27 ` st3r4g
                   ` (20 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-18  2:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-629915067

Comment:
The patches that you're using, do they come from upstream? At least the main repo seemed open to solving musl problems, so we can probably get all that upstreamed in the future c:

Great work btw, thanks!

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (23 preceding siblings ...)
  2020-05-18  2:42 ` ericonr
@ 2020-05-18  8:27 ` st3r4g
  2020-05-18 21:55 ` [PR PATCH] [Updated] " st3r4g
                   ` (19 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-18  8:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-630027581

Comment:
> Btw, I believe you're missing some additions from common/shlibs (at least xbps-src complained about that here). I can get them for you if you want.

I think the usual policy is to only add those actually required by other packages

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (24 preceding siblings ...)
  2020-05-18  8:27 ` st3r4g
@ 2020-05-18 21:55 ` st3r4g
  2020-05-22 20:09 ` ericonr
                   ` (18 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-18 21:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 14469 bytes --]

From 506c6c11bc7dfced9bac5baf7f4caf94f3da42bf Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:12:58 +0200
Subject: [PATCH 1/5] common/shlibs: add libLLVMSPIRVLib,libopencl-clang

---
 common/shlibs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/shlibs b/common/shlibs
index e2b782e80e8..2c4243ecd01 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3889,3 +3889,5 @@ libjcat.so.1 libjcat-0.1.2_1
 libmatio.so.9 matio-1.5.17_2
 libvips.so.42 libvips-8.9.2_1
 libvips-cpp.so.42 libvips-8.9.2_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1

From a2479abdef6b35f9d0ba05cf73f6b98199ed9a17 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:15:13 +0200
Subject: [PATCH 2/5] New package: SPIRV-LLVM-Translator-10.0.0

---
 srcpkgs/SPIRV-LLVM-Translator-devel    |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template

diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..89befc40dd0
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,29 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From eebc381f01998e949742daf552bcef0f54b4de02 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:16:36 +0200
Subject: [PATCH 3/5] New package: intel-opencl-clang-10.0.0.1

---
 srcpkgs/intel-opencl-clang-devel    |  1 +
 srcpkgs/intel-opencl-clang/template | 30 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..9cc8889cedd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+revision=1
+_version=${version%.*}-${version##*.}
+archs="x86_64*"
+wrksrc=opencl-clang-${_version}
+build_style=cmake
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From d20e69c59832891f11245fbf2f87003b01007bef Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:17:54 +0200
Subject: [PATCH 4/5] New package: intel-graphics-compiler-1.0.3899

---
 srcpkgs/intel-graphics-compiler-devel         |  1 +
 .../patches/fix-LLVM-library-path.patch       | 19 ++++++++++++
 .../patches/musl.patch                        | 21 +++++++++++++
 srcpkgs/intel-graphics-compiler/template      | 30 +++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template

diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..7c802631ec6
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,21 @@
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..11260f87362
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3899
+revision=1
+archs="x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=fcb721a40a88e1c9bbd45281ba003cf519eaf648435896071bc1e8a80ef05e71
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 9fe797188aea9fe6be9c338868e553ffe70d09fa Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:18:46 +0200
Subject: [PATCH 5/5] New package: intel-compute-runtime-20.18.16699

---
 .../patches/musl-ioctl.patch                  | 14 +++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++
 .../patches/musl-rtld-global.patch            | 11 +++++++
 .../patches/musl-select.patch                 | 13 +++++++++
 srcpkgs/intel-compute-runtime/template        | 29 +++++++++++++++++++
 5 files changed, 87 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch
 create mode 100644 srcpkgs/intel-compute-runtime/template

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..94db8685f4e
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,29 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.18.16699
+revision=1
+archs="x86_64*"
+wrksrc=compute-runtime-${version}
+build_style=cmake
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
+depends="intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=04576130cbb72af19ef6c79092105af7c06df95d7b17769d8fd815fe81c42b12
+
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (25 preceding siblings ...)
  2020-05-18 21:55 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-22 20:09 ` ericonr
  2020-05-22 21:05 ` [PR PATCH] [Updated] " st3r4g
                   ` (17 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-22 20:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-632892395

Comment:
https://github.com/intel/intel-graphics-compiler/releases we have a new release!

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (26 preceding siblings ...)
  2020-05-22 20:09 ` ericonr
@ 2020-05-22 21:05 ` st3r4g
  2020-05-22 21:07 ` st3r4g
                   ` (16 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-22 21:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 13032 bytes --]

From 1cab26fc42c23fd2ceb4cc5da8f03358e683bb41 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:12:58 +0200
Subject: [PATCH 1/5] common/shlibs: add libLLVMSPIRVLib,libopencl-clang

---
 common/shlibs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/shlibs b/common/shlibs
index 477ce5f2d3f..1fa133816c4 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3892,3 +3892,5 @@ libvips.so.42 libvips-8.9.2_1
 libvips-cpp.so.42 libvips-8.9.2_1
 libselinux.so.1 libselinux-3.0_1
 libsepol.so.1 libsepol-3.0_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1

From 876a6d9e6ad45c1a3d7269be9050d9edab822a0c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:15:13 +0200
Subject: [PATCH 2/5] New package: SPIRV-LLVM-Translator-10.0.0

---
 srcpkgs/SPIRV-LLVM-Translator-devel    |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template

diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..89befc40dd0
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,29 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 0cccdd475c084979365a55c5e644ad699f0d8c84 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:16:36 +0200
Subject: [PATCH 3/5] New package: intel-opencl-clang-10.0.0.1

---
 srcpkgs/intel-opencl-clang-devel    |  1 +
 srcpkgs/intel-opencl-clang/template | 30 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..9cc8889cedd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+revision=1
+_version=${version%.*}-${version##*.}
+archs="x86_64*"
+wrksrc=opencl-clang-${_version}
+build_style=cmake
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From eba0e7fc8473db7600ffef1c5b9b0c3feb7f04a0 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:17:54 +0200
Subject: [PATCH 4/5] New package: intel-graphics-compiler-1.0.3977

---
 srcpkgs/intel-graphics-compiler-devel         |  1 +
 .../patches/musl.patch                        | 21 +++++++++++++
 srcpkgs/intel-graphics-compiler/template      | 30 +++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template

diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..7c802631ec6
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,21 @@
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..9f17c2d5361
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3977
+revision=1
+archs="x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=60641b21c01f97f4b2a1881f7562449c733fdde9108b7e4ad5be2b4db38ceae6
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From d27437f0d2cbb80fbf52417a57f4e4f48267f412 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:18:46 +0200
Subject: [PATCH 5/5] New package: intel-compute-runtime-20.20.16837

---
 .../patches/musl-ioctl.patch                  | 14 +++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++
 .../patches/musl-rtld-global.patch            | 11 +++++++
 .../patches/musl-select.patch                 | 13 +++++++++
 srcpkgs/intel-compute-runtime/template        | 29 +++++++++++++++++++
 5 files changed, 87 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch
 create mode 100644 srcpkgs/intel-compute-runtime/template

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..9ba842ba5ef
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,29 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.20.16837
+revision=1
+archs="x86_64*"
+wrksrc=compute-runtime-${version}
+build_style=cmake
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
+depends="intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=975787ced1800ea52ece2ca40c23c4cac9267a358957c4a7f5255d22dc6a6d5f
+
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (27 preceding siblings ...)
  2020-05-22 21:05 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-22 21:07 ` st3r4g
  2020-05-22 21:08 ` ericonr
                   ` (15 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-22 21:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-632909022

Comment:
Updated

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (28 preceding siblings ...)
  2020-05-22 21:07 ` st3r4g
@ 2020-05-22 21:08 ` ericonr
  2020-05-22 21:18 ` st3r4g
                   ` (14 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-22 21:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-632909525

Comment:
They didn't include the CMake patch in the release :c 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (29 preceding siblings ...)
  2020-05-22 21:08 ` ericonr
@ 2020-05-22 21:18 ` st3r4g
  2020-05-22 21:21 ` [PR PATCH] [Updated] " st3r4g
                   ` (13 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-22 21:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-632912355

Comment:
Oof I thought they did. I have to readd it back.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.18.16699
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (30 preceding siblings ...)
  2020-05-22 21:18 ` st3r4g
@ 2020-05-22 21:21 ` st3r4g
  2020-05-29 17:55 ` New package: intel-compute-runtime-20.20.16837 ericonr
                   ` (12 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-22 21:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.18.16699
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 14473 bytes --]

From 1cab26fc42c23fd2ceb4cc5da8f03358e683bb41 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:12:58 +0200
Subject: [PATCH 1/5] common/shlibs: add libLLVMSPIRVLib,libopencl-clang

---
 common/shlibs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/shlibs b/common/shlibs
index 477ce5f2d3f..1fa133816c4 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3892,3 +3892,5 @@ libvips.so.42 libvips-8.9.2_1
 libvips-cpp.so.42 libvips-8.9.2_1
 libselinux.so.1 libselinux-3.0_1
 libsepol.so.1 libsepol-3.0_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1

From 876a6d9e6ad45c1a3d7269be9050d9edab822a0c Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:15:13 +0200
Subject: [PATCH 2/5] New package: SPIRV-LLVM-Translator-10.0.0

---
 srcpkgs/SPIRV-LLVM-Translator-devel    |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template

diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..89befc40dd0
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,29 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 0cccdd475c084979365a55c5e644ad699f0d8c84 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:16:36 +0200
Subject: [PATCH 3/5] New package: intel-opencl-clang-10.0.0.1

---
 srcpkgs/intel-opencl-clang-devel    |  1 +
 srcpkgs/intel-opencl-clang/template | 30 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..9cc8889cedd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+revision=1
+_version=${version%.*}-${version##*.}
+archs="x86_64*"
+wrksrc=opencl-clang-${_version}
+build_style=cmake
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 0cdc0b5eefc2ae71845db3b861a63f5a28b923cc Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:17:54 +0200
Subject: [PATCH 4/5] New package: intel-graphics-compiler-1.0.3977

---
 srcpkgs/intel-graphics-compiler-devel         |  1 +
 .../patches/fix-LLVM-library-path.patch       | 19 ++++++++++++
 .../patches/musl.patch                        | 21 +++++++++++++
 srcpkgs/intel-graphics-compiler/template      | 30 +++++++++++++++++++
 4 files changed, 71 insertions(+)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template

diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
new file mode 100644
index 00000000000..b379245dfee
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/fix-LLVM-library-path.patch
@@ -0,0 +1,19 @@
+diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt
+index 8c9a5fcc..3b5e88cf 100644
+--- IGC/CMakeLists.txt
++++ IGC/CMakeLists.txt
+@@ -3271,8 +3271,12 @@ endif()
+ if(LLVM_LINK_LLVM_DYLIB)
+     # LLVM was built and configured in a way that tools (in our case IGC) should be linked
+     # against single LLVM dynamic library.
+-    set(IGC_BUILD__LLVM_LIBS_TO_LINK "/usr/local/lib/libLLVM-${LLVM_VERSION_MAJOR}.so")
+-    message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    find_library(IGC_BUILD__LLVM_LIBS_TO_LINK "libLLVM-${LLVM_VERSION_MAJOR}.so")
++    if(IGC_BUILD__LLVM_LIBS_TO_LINK)
++      message(STATUS "[IGC] Link against LLVM dylib ${IGC_BUILD__LLVM_LIBS_TO_LINK}")
++    else()
++      message(FATAL_ERROR "[IGC] Could not find the LLVM dylib. Aborting.")
++    endif()
+ else()
+     # LLVM was built into multiple libraries (static or shared).
+     message(STATUS "[IGC] Link against LLVM static or shared component libs")
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..7c802631ec6
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,21 @@
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..9f17c2d5361
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.3977
+revision=1
+archs="x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=60641b21c01f97f4b2a1881f7562449c733fdde9108b7e4ad5be2b4db38ceae6
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 33a741c42809880621f258673ca11b4087a6deda Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:18:46 +0200
Subject: [PATCH 5/5] New package: intel-compute-runtime-20.20.16837

---
 .../patches/musl-ioctl.patch                  | 14 +++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++
 .../patches/musl-rtld-global.patch            | 11 +++++++
 .../patches/musl-select.patch                 | 13 +++++++++
 srcpkgs/intel-compute-runtime/template        | 29 +++++++++++++++++++
 5 files changed, 87 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch
 create mode 100644 srcpkgs/intel-compute-runtime/template

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..9ba842ba5ef
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,29 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.20.16837
+revision=1
+archs="x86_64*"
+wrksrc=compute-runtime-${version}
+build_style=cmake
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
+depends="intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=975787ced1800ea52ece2ca40c23c4cac9267a358957c4a7f5255d22dc6a6d5f
+
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (31 preceding siblings ...)
  2020-05-22 21:21 ` [PR PATCH] [Updated] " st3r4g
@ 2020-05-29 17:55 ` ericonr
  2020-05-29 18:03 ` ericonr
                   ` (11 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-29 17:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-636105095

Comment:
https://github.com/intel/compute-runtime/releases/tag/20.21.16886

https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.4053

https://github.com/intel/opencl-clang/releases/tag/v10.0.0-2

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (32 preceding siblings ...)
  2020-05-29 17:55 ` New package: intel-compute-runtime-20.20.16837 ericonr
@ 2020-05-29 18:03 ` ericonr
  2020-05-29 18:07 ` ericonr
                   ` (10 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-29 18:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-636105095

Comment:
https://github.com/intel/compute-runtime/releases/tag/20.21.16886

https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.4053

https://github.com/intel/opencl-clang/releases/tag/v10.0.0-2 <- failing, might have to file upstream bug

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (33 preceding siblings ...)
  2020-05-29 18:03 ` ericonr
@ 2020-05-29 18:07 ` ericonr
  2020-05-29 20:22 ` ericonr
                   ` (9 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-29 18:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-636105095

Comment:
https://github.com/intel/compute-runtime/releases/tag/20.21.16886

https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.4053 <- can remove the CMake patch

https://github.com/intel/opencl-clang/releases/tag/v10.0.0-2 <- failing, might have to file upstream bug

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (34 preceding siblings ...)
  2020-05-29 18:07 ` ericonr
@ 2020-05-29 20:22 ` ericonr
  2020-05-29 20:23 ` ericonr
                   ` (8 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-29 20:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-636175334

Comment:
Working for darktable on glibc and musl.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (35 preceding siblings ...)
  2020-05-29 20:22 ` ericonr
@ 2020-05-29 20:23 ` ericonr
  2020-05-29 20:27 ` [PR PATCH] [Updated] " st3r4g
                   ` (7 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-05-29 20:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-636175334

Comment:
Working for darktable on glibc and musl. Updated runtime and compiler, but not opencl-clang.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Updated] New package: intel-compute-runtime-20.20.16837
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (36 preceding siblings ...)
  2020-05-29 20:23 ` ericonr
@ 2020-05-29 20:27 ` st3r4g
  2020-11-22  5:17 ` New package: intel-compute-runtime-20.21.16886 the-maldridge
                   ` (6 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-05-29 20:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by st3r4g against master on the void-packages repository

https://github.com/st3r4g/void-packages intel-compute-runtime
https://github.com/void-linux/void-packages/pull/21855

New package: intel-compute-runtime-20.20.16837
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

A patch file from https://github.com/void-linux/void-packages/pull/21855.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-intel-compute-runtime-21855.patch --]
[-- Type: text/x-diff, Size: 13032 bytes --]

From 9c19000ca8c9930c11509bccebffd04c0e3a83c8 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:12:58 +0200
Subject: [PATCH 1/5] common/shlibs: add libLLVMSPIRVLib,libopencl-clang

---
 common/shlibs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/shlibs b/common/shlibs
index f5c5bed6b93..43662db0d8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3956,3 +3956,5 @@ libvips.so.42 libvips-8.9.2_1
 libvips-cpp.so.42 libvips-8.9.2_1
 libselinux.so.1 libselinux-3.0_1
 libsepol.so.1 libsepol-3.0_1
+libLLVMSPIRVLib.so.10 SPIRV-LLVM-Translator-10.0.0_1
+libopencl-clang.so.10 intel-opencl-clang-10.0.0.1_1

From 8d8d2e2d3584b94e56ae5a56a3f5cbffed6a54e5 Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:15:13 +0200
Subject: [PATCH 2/5] New package: SPIRV-LLVM-Translator-10.0.0

---
 srcpkgs/SPIRV-LLVM-Translator-devel    |  1 +
 srcpkgs/SPIRV-LLVM-Translator/template | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator-devel
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/template

diff --git a/srcpkgs/SPIRV-LLVM-Translator-devel b/srcpkgs/SPIRV-LLVM-Translator-devel
new file mode 120000
index 00000000000..170ae65aeda
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator-devel
@@ -0,0 +1 @@
+SPIRV-LLVM-Translator
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
new file mode 100644
index 00000000000..89befc40dd0
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -0,0 +1,29 @@
+# Template file for 'SPIRV-LLVM-Translator'
+pkgname=SPIRV-LLVM-Translator
+version=10.0.0
+revision=1
+archs="x86_64*"
+wrksrc=SPIRV-LLVM-Translator-${version}
+build_style=cmake
+configure_args="-DBUILD_SHARED_LIBS=ON"
+makedepends="clang-tools-extra llvm"
+short_desc="Library and tool for translation between LLVM IR and SPIR-V"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${version}.tar.gz"
+checksum=7ccde52bac4c9ad967a362a3c5ec7261aa5b7b34d28cef0f3dec38d77c923049
+
+post_install() {
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 0ebc4e79356d9f26b900705c8227d4dde604e0ff Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:16:36 +0200
Subject: [PATCH 3/5] New package: intel-opencl-clang-10.0.0.1

---
 srcpkgs/intel-opencl-clang-devel    |  1 +
 srcpkgs/intel-opencl-clang/template | 30 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 120000 srcpkgs/intel-opencl-clang-devel
 create mode 100644 srcpkgs/intel-opencl-clang/template

diff --git a/srcpkgs/intel-opencl-clang-devel b/srcpkgs/intel-opencl-clang-devel
new file mode 120000
index 00000000000..9840099b161
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang-devel
@@ -0,0 +1 @@
+intel-opencl-clang
\ No newline at end of file
diff --git a/srcpkgs/intel-opencl-clang/template b/srcpkgs/intel-opencl-clang/template
new file mode 100644
index 00000000000..9cc8889cedd
--- /dev/null
+++ b/srcpkgs/intel-opencl-clang/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-opencl-clang'
+pkgname=intel-opencl-clang
+version=10.0.0.1
+revision=1
+_version=${version%.*}-${version##*.}
+archs="x86_64*"
+wrksrc=opencl-clang-${_version}
+build_style=cmake
+makedepends="clang-tools-extra llvm SPIRV-LLVM-Translator-devel"
+short_desc="Wrapper library to compile OpenCL C kernels to SPIR-V modules"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="NCSA"
+homepage="https://github.com/intel/opencl-clang"
+distfiles="https://github.com/intel/opencl-clang/archive/v${_version}.tar.gz"
+checksum=815005b6fb7fd8fd2f08b9036035d3aa9543f5ce8464e41ef2f2ed08a816f507
+
+nocross="https://travis-ci.org/github/st3r4g/void-packages/jobs/686510849#L4390"
+
+post_install() {
+	vlicense LICENSE
+}
+
+intel-opencl-clang-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.so"
+	}
+}

From 78172f23d3c329b24000abf5d674df78564ff78b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:17:54 +0200
Subject: [PATCH 4/5] New package: intel-graphics-compiler-1.0.4053

---
 srcpkgs/intel-graphics-compiler-devel         |  1 +
 .../patches/musl.patch                        | 21 +++++++++++++
 srcpkgs/intel-graphics-compiler/template      | 30 +++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 120000 srcpkgs/intel-graphics-compiler-devel
 create mode 100644 srcpkgs/intel-graphics-compiler/patches/musl.patch
 create mode 100644 srcpkgs/intel-graphics-compiler/template

diff --git a/srcpkgs/intel-graphics-compiler-devel b/srcpkgs/intel-graphics-compiler-devel
new file mode 120000
index 00000000000..3b09034b520
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler-devel
@@ -0,0 +1 @@
+intel-graphics-compiler
\ No newline at end of file
diff --git a/srcpkgs/intel-graphics-compiler/patches/musl.patch b/srcpkgs/intel-graphics-compiler/patches/musl.patch
new file mode 100644
index 00000000000..7c802631ec6
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/patches/musl.patch
@@ -0,0 +1,21 @@
+--- inc/common/UFO/portable_compiler.h.orig	2020-05-13 11:41:37.725900359 +0200
++++ inc/common/UFO/portable_compiler.h	2020-05-13 11:42:26.407898739 +0200
+@@ -125,7 +125,7 @@
+ /* compile-time ASSERT */
+ 
+ #ifndef C_ASSERT
+-    #define __UNIQUENAME( a1, a2 )  __CONCAT( a1, a2 )
++    #define __UNIQUENAME( a1, a2 )  a1 ## a2
+     #define UNIQUENAME( __text )    __UNIQUENAME( __text, __COUNTER__ )
+ 
+ 
+--- visa/CISA.y.orig	2020-05-13 11:42:12.245899211 +0200
++++ visa/CISA.y	2020-05-13 11:42:26.410898739 +0200
+@@ -25,6 +25,7 @@
+ ======================= end_copyright_notice ==================================*/
+ 
+ %{
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <math.h>
+ #include <string>
diff --git a/srcpkgs/intel-graphics-compiler/template b/srcpkgs/intel-graphics-compiler/template
new file mode 100644
index 00000000000..6d07b597f61
--- /dev/null
+++ b/srcpkgs/intel-graphics-compiler/template
@@ -0,0 +1,30 @@
+# Template file for 'intel-graphics-compiler'
+pkgname=intel-graphics-compiler
+version=1.0.4053
+revision=1
+archs="x86_64*"
+wrksrc=intel-graphics-compiler-igc-${version}
+build_style=cmake
+configure_args="-DIGC_PREFERRED_LLVM_VERSION='10.0.0' -Wno-dev"
+hostmakedepends="bison flex"
+makedepends="clang-tools-extra llvm intel-opencl-clang-devel"
+short_desc="Intel Graphics Compiler for OpenCL"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/intel-graphics-compiler"
+distfiles="https://github.com/intel/intel-graphics-compiler/archive/igc-${version}.tar.gz"
+checksum=9117399688b02f7cee51fccbd0f140921377c8250563f65ae92a1e9ed1abd717
+
+post_install() {
+	vlicense LICENSE.md
+}
+
+intel-graphics-compiler-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 818f530ccbaee5c3a2bbd82e45a381e225a34d5b Mon Sep 17 00:00:00 2001
From: Stefano Ragni <st3r4g@protonmail.com>
Date: Sat, 16 May 2020 16:18:46 +0200
Subject: [PATCH 5/5] New package: intel-compute-runtime-20.21.16886

---
 .../patches/musl-ioctl.patch                  | 14 +++++++++
 .../patches/musl-pthread_yield.patch          | 20 +++++++++++++
 .../patches/musl-rtld-global.patch            | 11 +++++++
 .../patches/musl-select.patch                 | 13 +++++++++
 srcpkgs/intel-compute-runtime/template        | 29 +++++++++++++++++++
 5 files changed, 87 insertions(+)
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
 create mode 100644 srcpkgs/intel-compute-runtime/patches/musl-select.patch
 create mode 100644 srcpkgs/intel-compute-runtime/template

diff --git a/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
new file mode 100644
index 00000000000..2accb14d9d2
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-ioctl.patch
@@ -0,0 +1,14 @@
+--- opencl/test/unit_test/linux/mock_os_layer.h.orig	2020-05-12 23:23:47.438463587 +0200
++++ opencl/test/unit_test/linux/mock_os_layer.h	2020-05-12 23:26:38.282470463 +0200
+@@ -20,7 +20,11 @@
+ 
+ extern "C" {
+ int open(const char *pathname, int flags, ...);
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long int request, ...) throw();
++#else
++int ioctl(int fd, int request, ...) throw();
++#endif
+ }
+ 
+ extern int (*c_open)(const char *pathname, int flags, ...);
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
new file mode 100644
index 00000000000..2f609838418
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-pthread_yield.patch
@@ -0,0 +1,20 @@
+--- opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp.orig	2020-05-12 23:05:41.057419864 +0200
++++ opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp	2020-05-12 23:06:01.992420706 +0200
+@@ -121,7 +121,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     worker->close(false);
+ 
+@@ -142,7 +142,7 @@
+ 
+     //wait for worker to complete or deadCnt drops
+     while (!worker->isEmpty() && (deadCnt-- > 0))
+-        pthread_yield(); //yield to another threads
++        sched_yield(); //yield to another threads
+ 
+     //and check if GEM was closed
+     EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
new file mode 100644
index 00000000000..745d04d0a26
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-rtld-global.patch
@@ -0,0 +1,11 @@
+--- shared/source/os_interface/linux/os_library_linux.cpp.orig	2020-05-12 21:02:19.995121993 +0200
++++ shared/source/os_interface/linux/os_library_linux.cpp	2020-05-12 21:03:20.426124425 +0200
+@@ -30,7 +30,7 @@
+         this->handle = dlopen(0, RTLD_LAZY);
+     } else {
+ #ifdef SANITIZER_BUILD
+-        constexpr auto dlopenFlag = RTLD_LAZY;
++        constexpr auto dlopenFlag = RTLD_LAZY | RTLD_GLOBAL;
+ #else
+         constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
+ #endif
diff --git a/srcpkgs/intel-compute-runtime/patches/musl-select.patch b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
new file mode 100644
index 00000000000..ce64516df04
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/patches/musl-select.patch
@@ -0,0 +1,13 @@
+This macro conflicts with the select syscall. Since it isn't actually used, we
+just remove it.
+--- opencl/source/builtin_kernels_simulation/opencl_c.h.orig	2020-04-30 12:24:42.000000000 +0200
++++ opencl/source/builtin_kernels_simulation/opencl_c.h	2020-05-12 22:31:37.166337603 +0200
+@@ -220,8 +220,6 @@
+     (                               \
+         (type)var)
+ 
+-#define select(a, b, c) (c ? b : a)
+-
+ uint get_local_id(int dim);
+ uint get_global_id(int dim);
+ uint get_local_size(int dim);
diff --git a/srcpkgs/intel-compute-runtime/template b/srcpkgs/intel-compute-runtime/template
new file mode 100644
index 00000000000..538c862d5f5
--- /dev/null
+++ b/srcpkgs/intel-compute-runtime/template
@@ -0,0 +1,29 @@
+# Template file for 'intel-compute-runtime'
+pkgname=intel-compute-runtime
+version=20.21.16886
+revision=1
+archs="x86_64*"
+wrksrc=compute-runtime-${version}
+build_style=cmake
+hostmakedepends="pkg-config"
+makedepends="intel-gmmlib-devel intel-graphics-compiler-devel"
+depends="intel-graphics-compiler"
+short_desc="Intel Graphics Compute Runtime for OpenCL (Broadwell+)"
+maintainer="Stefano Ragni <st3r4g@protonmail.com>"
+license="MIT"
+homepage="https://github.com/intel/compute-runtime"
+distfiles="https://github.com/intel/compute-runtime/archive/${version}.tar.gz"
+checksum=7be4f46fb7e78e16ff37ba45035a20f4e8e492eece0d3d754bad173c4857a2a0
+
+if [ -z "${XBPS_CHECK_PKGS}" ]; then
+	configure_args+=" -DSKIP_UNIT_TESTS=1"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" libexecinfo-devel"
+	CXXFLAGS+=" -lexecinfo -DSANITIZER_BUILD"
+fi
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (37 preceding siblings ...)
  2020-05-29 20:27 ` [PR PATCH] [Updated] " st3r4g
@ 2020-11-22  5:17 ` the-maldridge
  2020-11-22 15:02 ` ericonr
                   ` (5 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: the-maldridge @ 2020-11-22  5:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

New comment by the-maldridge on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-731699919

Comment:
@ericonr what is the status of this PR?

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (38 preceding siblings ...)
  2020-11-22  5:17 ` New package: intel-compute-runtime-20.21.16886 the-maldridge
@ 2020-11-22 15:02 ` ericonr
  2020-11-22 15:02 ` ericonr
                   ` (4 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-11-22 15:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-731761303

Comment:
On my to-do list to update and merge.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (39 preceding siblings ...)
  2020-11-22 15:02 ` ericonr
@ 2020-11-22 15:02 ` ericonr
  2020-11-22 17:45 ` st3r4g
                   ` (3 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2020-11-22 15:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-731761303

Comment:
On my to-do list to update and merge.

If @st3r4g is up to updating, that'd be great as well.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (40 preceding siblings ...)
  2020-11-22 15:02 ` ericonr
@ 2020-11-22 17:45 ` st3r4g
  2021-05-19  3:51 ` ericonr
                   ` (2 subsequent siblings)
  44 siblings, 0 replies; 46+ messages in thread
From: st3r4g @ 2020-11-22 17:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

New comment by st3r4g on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-731783394

Comment:
Lost interest a bit since I'm not actually using it atm, but I might resume it some day, if ericonr doesn't do it before.
The status was: apparently working on musl, but some tests were failing.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (41 preceding siblings ...)
  2020-11-22 17:45 ` st3r4g
@ 2021-05-19  3:51 ` ericonr
  2022-04-16  2:02 ` github-actions
  2022-05-01  2:13 ` [PR PATCH] [Closed]: " github-actions
  44 siblings, 0 replies; 46+ messages in thread
From: ericonr @ 2021-05-19  3:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-843725307

Comment:
Not surprised this is weirdly broken, even *with* patches for llvm12 compat.

Branch: https://github.com/ericonr/void-packages/tree/intel-comp

Build failure: https://gist.github.com/033f9a3d0279de04c7a1db7a9b1fd70a

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (42 preceding siblings ...)
  2021-05-19  3:51 ` ericonr
@ 2022-04-16  2:02 ` github-actions
  2022-05-01  2:13 ` [PR PATCH] [Closed]: " github-actions
  44 siblings, 0 replies; 46+ messages in thread
From: github-actions @ 2022-04-16  2:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/21855#issuecomment-1100506713

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PR PATCH] [Closed]: New package: intel-compute-runtime-20.21.16886
  2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
                   ` (43 preceding siblings ...)
  2022-04-16  2:02 ` github-actions
@ 2022-05-01  2:13 ` github-actions
  44 siblings, 0 replies; 46+ messages in thread
From: github-actions @ 2022-05-01  2:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

There's a closed pull request on the void-packages repository

New package: intel-compute-runtime-20.21.16886
https://github.com/void-linux/void-packages/pull/21855

Description:
Closes #11364

Resumed the work I did some time ago, mainly updated the templates to use `llvm10`. Opening this as a draft for now because I remember musl requiring to be patched (I gave up back then), any help is welcome.

@ericonr 

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2022-05-01  2:13 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 23:48 [PR PATCH] New package: intel-compute-runtime-20.18.16699 st3r4g
2020-05-12  6:21 ` [PR PATCH] [Updated] " st3r4g
2020-05-12  7:18 ` st3r4g
2020-05-12  7:26 ` st3r4g
2020-05-12  8:13 ` ericonr
2020-05-12 18:02 ` ericonr
2020-05-12 19:17 ` st3r4g
2020-05-12 20:15 ` [PR PATCH] [Updated] " st3r4g
2020-05-12 21:36 ` st3r4g
2020-05-12 22:22 ` st3r4g
2020-05-12 22:38 ` st3r4g
2020-05-13  9:54 ` [PR PATCH] [Updated] " st3r4g
2020-05-13 10:04 ` st3r4g
2020-05-13 12:25 ` st3r4g
2020-05-14 19:11 ` [PR PATCH] [Updated] " st3r4g
2020-05-14 21:09 ` st3r4g
2020-05-16 14:19 ` st3r4g
2020-05-16 14:23 ` st3r4g
2020-05-18  1:58 ` ericonr
2020-05-18  2:04 ` ericonr
2020-05-18  2:08 ` ericonr
2020-05-18  2:27 ` ericonr
2020-05-18  2:40 ` ericonr
2020-05-18  2:42 ` ericonr
2020-05-18  2:42 ` ericonr
2020-05-18  8:27 ` st3r4g
2020-05-18 21:55 ` [PR PATCH] [Updated] " st3r4g
2020-05-22 20:09 ` ericonr
2020-05-22 21:05 ` [PR PATCH] [Updated] " st3r4g
2020-05-22 21:07 ` st3r4g
2020-05-22 21:08 ` ericonr
2020-05-22 21:18 ` st3r4g
2020-05-22 21:21 ` [PR PATCH] [Updated] " st3r4g
2020-05-29 17:55 ` New package: intel-compute-runtime-20.20.16837 ericonr
2020-05-29 18:03 ` ericonr
2020-05-29 18:07 ` ericonr
2020-05-29 20:22 ` ericonr
2020-05-29 20:23 ` ericonr
2020-05-29 20:27 ` [PR PATCH] [Updated] " st3r4g
2020-11-22  5:17 ` New package: intel-compute-runtime-20.21.16886 the-maldridge
2020-11-22 15:02 ` ericonr
2020-11-22 15:02 ` ericonr
2020-11-22 17:45 ` st3r4g
2021-05-19  3:51 ` ericonr
2022-04-16  2:02 ` github-actions
2022-05-01  2:13 ` [PR PATCH] [Closed]: " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).