* [Buildroot] [PATCH 1/7] package/pkg-meson.mk: add rust cross-compiler support
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 2/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant via buildroot
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour, Sebastian Weyer
From: Romain Naour <romain.naour@smile.fr>
This change is needed to be able to build target packages requiring
rust. If a package has rust in its project or in an add_language()
call in their meson.build file, meson will try to find a suitable
compiler for this language[1]. If the language is classified as
required but not found, it will abort the build.
It is necessary to specify rust and rust_ld separately in
support/misc/cross-compilation.conf.in. If you specify it in one line
just as "rust", it will generate the following warning:
WARNING: Please do not put -C linker= in your compiler command,
set rust_ld=command in your cross file or use the RUST_LD environment
variable, otherwise meson will override your selection.
[1] https://mesonbuild.com/Reference-manual_functions.html#add_languages
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/pkg-meson.mk | 13 +++++++++++++
support/misc/cross-compilation.conf.in | 2 ++
2 files changed, 15 insertions(+)
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 65cabf23ba..1f2e6394b9 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -82,6 +82,16 @@ else
PKG_MESON_TARGET_FC = /bin/false
endif
+ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
+PKG_MESON_TARGET_RUSTC = $(HOST_DIR)/bin/rustc
+PKG_MESON_TARGET_RUSTC_LINKER = $(TARGET_CROSS)gcc
+PKG_MESON_TARGET_RUSTC_TARGET_NAME = $(RUSTC_TARGET_NAME)
+else
+PKG_MESON_TARGET_RUSTC = /bin/false
+PKG_MESON_TARGET_RUSTC_LINKER = /bin/false
+PKG_MESON_TARGET_RUSTC_TARGET_NAME =
+endif
+
# Generates sed patterns for patching the cross-compilation.conf template,
# since Flags might contain commas the arguments are passed indirectly by
# variable name (stripped to deal with whitespaces).
@@ -91,6 +101,7 @@ define PKG_MESON_CROSSCONFIG_SED
-e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
-e "s%@TARGET_AR@%$(TARGET_AR)%g" \
-e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
+ -e "s%@TARGET_RUSTC@%$(PKG_MESON_TARGET_RUSTC)%g" \
-e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
-e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
-e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
@@ -99,6 +110,8 @@ define PKG_MESON_CROSSCONFIG_SED
-e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
-e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
-e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
+ -e "s%@TARGET_RUSTC_LINKER@%$(PKG_MESON_TARGET_RUSTC_LINKER)%g" \
+ -e "s%@RUSTC_TARGET_NAME@%$(PKG_MESON_TARGET_RUSTC_TARGET_NAME)%g" \
-e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
-e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
-e "s%@HOST_DIR@%$(HOST_DIR)%g" \
diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
index a58ab553d0..21cec10b82 100644
--- a/support/misc/cross-compilation.conf.in
+++ b/support/misc/cross-compilation.conf.in
@@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
pkg-config = '@PKGCONF_HOST_BINARY@'
g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
+rust = ['@TARGET_RUSTC@', '--target', '@RUSTC_TARGET_NAME@' ]
+rust_ld = '@TARGET_RUSTC_LINKER@'
[built-in options]
c_args = [@TARGET_CFLAGS@]
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 2/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 1/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 3/7] package/opencl-headers: new package Antoine Coutant via buildroot
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour, Sebastian Weyer
From: Romain Naour <romain.naour@smile.fr>
This target version is needed for Rusticl which is an LLVM based OpenCL
framework[1]. Rusticl allow programs to compile OpenCL C/C++ code
at runtime with Clang. Clang generates LLVM IR which is translated into
SPIR-V by spirv-llvm-translator. Finally, mesa can use its internal
tools to manage SPIR-V.
[1]: https://docs.mesa3d.org/rusticl.html
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/Config.in | 1 +
package/spirv-llvm-translator/Config.in | 22 +++++++++++++++++++
.../spirv-llvm-translator.mk | 10 +++++++++
3 files changed, 33 insertions(+)
create mode 100644 package/spirv-llvm-translator/Config.in
diff --git a/package/Config.in b/package/Config.in
index 48ef1a6fdc..f7b14c57b9 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -335,6 +335,7 @@ comment "Graphic applications"
source "package/pngquant/Config.in"
source "package/qt5cinex/Config.in"
source "package/rrdtool/Config.in"
+ source "package/spirv-llvm-translator/Config.in"
source "package/spirv-tools/Config.in"
source "package/stellarium/Config.in"
source "package/sway/Config.in"
diff --git a/package/spirv-llvm-translator/Config.in b/package/spirv-llvm-translator/Config.in
new file mode 100644
index 0000000000..73ca787d8a
--- /dev/null
+++ b/package/spirv-llvm-translator/Config.in
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+ bool "spirv-translator"
+ depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on BR2_INSTALL_LIBSTDCPP
+ depends on !BR2_STATIC_LIBS
+ depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
+ select BR2_PACKAGE_LLVM
+ select BR2_PACKAGE_SPIRV_HEADERS
+ select BR2_PACKAGE_ZLIB
+ help
+ LLVM/SPIR-V Bi-Directional Translator is a library and tool
+ for translation between LLVM IR and SPIR-V.
+
+ https://github.com/khronosGroup/SPIRV-LLVM-Translator
+
+comment "spirv-translator needs a toolchain w/ threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
+ depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+ depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
+ !BR2_TOOLCHAIN_GCC_AT_LEAST_7 \
+ || BR2_STATIC_LIBS || !BR2_HOST_GCC_AT_LEAST_7
diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
index 523890a986..ffc8a63b89 100644
--- a/package/spirv-llvm-translator/spirv-llvm-translator.mk
+++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
@@ -19,4 +19,14 @@ HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
-DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(HOST_DIR)/include
+SPIRV_LLVM_TRANSLATOR_INSTALL_STAGING = YES
+SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm llvm spirv-headers
+SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
+ -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(STAGING_DIR)/usr \
+ -DLLVM_BUILD_TOOLS=ON \
+ -DLLVM_DIR=$(STAGING_DIR)/lib/cmake/llvm \
+ -DLLVM_SPIRV_BUILD_EXTERNAL=YES \
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+
+$(eval $(cmake-package))
$(eval $(host-cmake-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 3/7] package/opencl-headers: new package
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 1/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 2/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 4/7] package/opencl-icd-loader: " Antoine Coutant via buildroot
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour, Sebastian Weyer
From: Sebastian Weyer <sebastian.weyer@smile.fr>
These headers provide the C language API headers. It is a complement to
the C++ bindings already available in opencl-clhpp. This package is
required to build opencl-icd-loader [1].
Adding opencl-icd-loader is impossible because mesa OpenCl-header
verison is too old. Indeed, mesa CL headers are not updated often and
not include the last OpenCL specification releases [2][3].
Mesa allow the use of external OpenCL-headers in some cases [4].
The CL headers installed by mesa regroups the opencl api headers [5] and
the opencl api C++ bindings [6]. They are fetched from the official
repositories manualy by mesa maintainers [7]. Those headers must be
backward compatible [8]. Thus it is possible to use them instead of mesa
CL headers to support newer version of OpenCL.
A new patch have been added to prevent the installation of OpenCL
headers by Mesa3d.
Dependencies on OpenCL-headers package have been added when an
implementation of OpenCL is selected.
[1]: https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies
[2]: https://github.com/KhronosGroup/OpenCL-ICD-Loader/releases
[3]: https://gitlab.freedesktop.org/mesa/mesa/-/commits/main/include/CL
[4]: https://gitlab.freedesktop.org/mesa/mesa/-/blob/24.0/include/meson.build#L133
[5]: https://github.com/KhronosGroup/OpenCL-Headers
[6]: https://github.com/KhronosGroup/OpenCL-CLHPP
[7]: https://gitlab.freedesktop.org/mesa/mesa/-/blob/24.0/bin/khronos-update.py
[8]: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#_version_numbers
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/Config.in | 1 +
| 2 +-
| 71 +++++++++++++++++++
| 7 ++
| 3 +
| 22 ++++++
6 files changed, 105 insertions(+), 1 deletion(-)
create mode 100644 package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch
create mode 100644 package/opencl-headers/Config.in
create mode 100644 package/opencl-headers/opencl-headers.hash
create mode 100644 package/opencl-headers/opencl-headers.mk
diff --git a/package/Config.in b/package/Config.in
index f7b14c57b9..7351da5e84 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1710,6 +1710,7 @@ menu "Graphics"
source "package/menu-cache/Config.in"
source "package/onevpl-intel-gpu/Config.in"
source "package/opencl-clhpp/Config.in"
+ source "package/opencl-headers/Config.in"
source "package/opencv3/Config.in"
source "package/opencv4/Config.in"
source "package/opencv4-contrib/Config.in"
--git a/package/mesa3d-headers/mesa3d-headers.mk b/package/mesa3d-headers/mesa3d-headers.mk
index 33c60b285f..def93c3dd3 100644
--- a/package/mesa3d-headers/mesa3d-headers.mk
+++ b/package/mesa3d-headers/mesa3d-headers.mk
@@ -61,7 +61,7 @@ MESA3D_HEADERS_DIRS += GLES GLES2
endif
ifeq ($(BR2_PACKAGE_HAS_LIBOPENCL),y)
-MESA3D_HEADERS_DIRS += CL
+MESA3D_HEADERS_DEPENDENCIES += opencl-headers opencl-clhpp
endif
define MESA3D_HEADERS_BUILD_CMDS
--git a/package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch b/package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch
new file mode 100644
index 0000000000..c0cbce0d12
--- /dev/null
+++ b/package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch
@@ -0,0 +1,71 @@
+From 619f806413c60583ba5e3f88f6ef16a60d1958e4 Mon Sep 17 00:00:00 2001
+From: Antoine Coutant <antoine.coutant@smile.fr>
+Date: Wed, 28 Feb 2024 16:04:21 +0100
+Subject: [PATCH] include: remove the installation of CL headers
+
+The CL headers installed by mesa are old and
+does not support the last versions of OpenCL.
+
+In buildroot, instead of using mesa CL headers
+use official headers from Khronos. Moreover,
+the OpenCL headers are backward compatible.
+See:
+https://github.com/KhronosGroup/OpenCL-Headers#compatibility-notes
+
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
+---
+ include/meson.build | 28 -----------------------
+ src/gallium/frontends/rusticl/meson.build | 1 -
+ 2 files changed, 29 deletions(-)
+
+diff --git a/include/meson.build b/include/meson.build
+index a955ac71073..18f5f2d259e 100644
+--- a/include/meson.build
++++ b/include/meson.build
+@@ -110,31 +110,3 @@ if with_gallium_st_nine
+ )
+ endif
+
+-opencl_headers = files(
+- 'CL/cl.h',
+- 'CL/cl.hpp',
+- 'CL/cl2.hpp',
+- 'CL/cl_d3d10.h',
+- 'CL/cl_d3d11.h',
+- 'CL/cl_dx9_media_sharing.h',
+- 'CL/cl_dx9_media_sharing_intel.h',
+- 'CL/cl_egl.h',
+- 'CL/cl_ext.h',
+- 'CL/cl_ext_intel.h',
+- 'CL/cl_gl.h',
+- 'CL/cl_gl_ext.h',
+- 'CL/cl_icd.h',
+- 'CL/cl_platform.h',
+- 'CL/cl_va_api_media_sharing_intel.h',
+- 'CL/cl_version.h',
+- 'CL/opencl.h',
+- 'CL/opencl.hpp',
+-)
+-# Only install the headers if we are building a stand alone implementation and
+-# not an ICD enabled implementation
+-if with_gallium_opencl and not with_opencl_icd
+- install_headers(
+- opencl_headers,
+- subdir: 'CL'
+- )
+-endif
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index eb87dad2659..e157377404c 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -162,7 +162,6 @@ cl_c_args = [
+ rusticl_opencl_bindings_rs = rust.bindgen(
+ input : [
+ 'rusticl_opencl_bindings.h',
+- opencl_headers,
+ ],
+ output : 'rusticl_opencl_bindings.rs',
+ include_directories : [
+--
+2.34.1
+
--git a/package/opencl-headers/Config.in b/package/opencl-headers/Config.in
new file mode 100644
index 0000000000..092d8a2a4d
--- /dev/null
+++ b/package/opencl-headers/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_OPENCL_HEADERS
+ bool "opencl-headers"
+ depends on BR2_PACKAGE_HAS_LIBOPENCL
+ help
+ C language headers for the OpenCL API
+
+ https://github.com/KhronosGroup/OpenCL-Headers
--git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
new file mode 100644
index 0000000000..928bcfb30b
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.hash
@@ -0,0 +1,3 @@
+#Locally generated
+sha256 3c3dd236d35f4960028f4f58ce8d963fb63f3d50251d1e9854b76f1caab9a309 OpenCL-Headers-2024.05.08.tar.gz
+sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
--git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
new file mode 100644
index 0000000000..fd047f2fad
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# opencl-headers
+#
+################################################################################
+
+OPENCL_HEADERS_VERSION = 2024.05.08
+OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
+OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
+OPENCL_HEADERS_LICENSE = Apache-2.0
+OPENCL_HEADERS_LICENSE_FILES = LICENSE
+OPENCL_HEADERS_INSTALL_STAGING = YES
+
+OPENCL_HEADERS_INSTALL_TARGET = NO
+
+define OPENCL_HEADERS_INSTALL_STAGING_CMDS
+ mkdir -p $(STAGING_DIR)/usr/include/CL
+ $(INSTALL) -D -m 0644 $(@D)/CL/* \
+ $(STAGING_DIR)/usr/include/CL
+endef
+
+$(eval $(generic-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 4/7] package/opencl-icd-loader: new package
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
` (2 preceding siblings ...)
2024-07-13 9:36 ` [Buildroot] [PATCH 3/7] package/opencl-headers: new package Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 5/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant via buildroot
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour, Sebastian Weyer
With this package it is possible to have multiple implementations of
OpenCL at the same time. This package provides a libOpenCL.so file that
captures the OpenCL API calls and forwards them to the correct
implementation of OpenCL. OpenCL implementations can be manually
registered by creating a file containing its full file path in
/etc/OpenCL/vendors/<implementation>.icd[1]
When this package is selected, Clover must be built in icd mode so
it does not override libOpenCL.so installed by this package.
This package and OpenCL-Headers package releases are made at
simultaneously to match OpenCL specifcation releases [2][3].
This is the reason why this package depends on OpenCL-Headers
and not mesa3d CL headers as nothing guarantees that they
supports last version of OpenCL specification.
[1]: https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds
[2]: https://github.com/KhronosGroup/OpenCL-Headers/releases
[3]: https://github.com/KhronosGroup/OpenCL-ICD-Loader/releases
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/Config.in | 1 +
package/mesa3d/mesa3d.mk | 11 +++++++---
| 1 +
package/opencl-icd-loader/Config.in | 12 +++++++++++
.../opencl-icd-loader/opencl-icd-loader.hash | 3 +++
.../opencl-icd-loader/opencl-icd-loader.mk | 20 +++++++++++++++++++
6 files changed, 45 insertions(+), 3 deletions(-)
create mode 100644 package/opencl-icd-loader/Config.in
create mode 100644 package/opencl-icd-loader/opencl-icd-loader.hash
create mode 100644 package/opencl-icd-loader/opencl-icd-loader.mk
diff --git a/package/Config.in b/package/Config.in
index 7351da5e84..b3adfc4db3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1711,6 +1711,7 @@ menu "Graphics"
source "package/onevpl-intel-gpu/Config.in"
source "package/opencl-clhpp/Config.in"
source "package/opencl-headers/Config.in"
+ source "package/opencl-icd-loader/Config.in"
source "package/opencv3/Config.in"
source "package/opencv4/Config.in"
source "package/opencv4-contrib/Config.in"
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index ce460c4475..2cb8f3a2c8 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -50,12 +50,17 @@ else
MESA3D_CONF_OPTS += -Dllvm=disabled
endif
-# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
-# libMesaOpenCL and CL headers are installed
ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
MESA3D_PROVIDES += libopencl
-MESA3D_DEPENDENCIES += clang libclc
+MESA3D_DEPENDENCIES += clang libclc opencl-headers
+ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
+MESA3D_CONF_OPTS += -Dgallium-opencl=icd
+MESA3D_DEPENDENCIES += opencl-icd-loader
+else
+# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
+# libMesaOpenCL and CL headers are installed
MESA3D_CONF_OPTS += -Dgallium-opencl=standalone
+endif
else
MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
endif
--git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
index fd047f2fad..a32ef1b863 100644
--- a/package/opencl-headers/opencl-headers.mk
+++ b/package/opencl-headers/opencl-headers.mk
@@ -4,6 +4,7 @@
#
################################################################################
+# When updating the version, please also update opencl-icd-loader
OPENCL_HEADERS_VERSION = 2024.05.08
OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
diff --git a/package/opencl-icd-loader/Config.in b/package/opencl-icd-loader/Config.in
new file mode 100644
index 0000000000..405dc5401a
--- /dev/null
+++ b/package/opencl-icd-loader/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_OPENCL_ICD_LOADER
+ bool "OpenCL-ICD-Loader"
+ depends on BR2_INSTALL_LIBSTDCPP
+ depends on BR2_PACKAGE_HAS_LIBOPENCL
+ select BR2_PACKAGE_OPENCL_HEADERS
+ help
+ OpenCL defines an Installable Client Driver (ICD) mechanism to
+ allow developers to build applications against an Installable
+ Client Driver loader (ICD loader) rather than linking their
+ applications against a specific OpenCL implementation.
+
+ https://github.com/KhronosGroup/OpenCL-ICD-Loader
diff --git a/package/opencl-icd-loader/opencl-icd-loader.hash b/package/opencl-icd-loader/opencl-icd-loader.hash
new file mode 100644
index 0000000000..1c894f1293
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.hash
@@ -0,0 +1,3 @@
+# locally generated
+sha256 af8df96f1e1030329e8d4892ba3aa761b923838d4c689ef52d97822ab0bd8917 OpenCL-ICD-Loader-2023.12.14.tar.gz
+sha256 c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE
diff --git a/package/opencl-icd-loader/opencl-icd-loader.mk b/package/opencl-icd-loader/opencl-icd-loader.mk
new file mode 100644
index 0000000000..d4fd6cd754
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# opencl-icd-loader
+#
+################################################################################
+
+# When updating the version, please also update opencl-headers
+OPENCL_ICD_LOADER_VERSION = 2023.12.14
+OPENCL_ICD_LOADER_SOURCE = OpenCL-ICD-Loader-$(OPENCL_ICD_LOADER_VERSION).tar.gz
+OPENCL_ICD_LOADER_SITE = $(call github,KhronosGroup,OpenCL-ICD-Loader,v$(OPENCL_ICD_LOADER_VERSION))
+OPENCL_ICD_LOADER_LICENSE = Apache-2.0
+OPENCL_ICD_LOADER_LICENSE_FILES = LICENSE
+OPENCL_ICD_LOADER_INSTALL_STAGING = YES
+
+OPENCL_ICD_LOADER_DEPENDENCIES = opencl-headers
+
+OPENCL_ICD_LOADER_CONF_OPTS += -DOPENCL_ICD_LOADER_HEADERS_DIR=$(STAGING_DIR)/usr/include
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 5/7] package/llvm-project: add opencl-c-base.h on target
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
` (3 preceding siblings ...)
2024-07-13 9:36 ` [Buildroot] [PATCH 4/7] package/opencl-icd-loader: " Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:36 ` [Buildroot] [PATCH 6/7] package/mesa3d: add RustiCL support Antoine Coutant via buildroot
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour
rusticl depends on the mesa clc_compile_to_llvm_module function.
This function requires opencl-c-base.h when LLVM version >= 15.
The header is deleted automatically by CLANG_FILES_TO_REMOVE
post install target hook in llvm-project/clang package.
When rusticl is enabled, after the whole clang directory has
been removed, the header is copied back to
/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/
By default, the mesa3d variable used to retrieve Clang headear's
is set to the staging directory on the host machine. A merge
request on mesa's gitlab solved this problem. See:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568
The patches have been backported to mesa 23.3.4.
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/llvm-project/clang/clang.mk | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk
index 0bafd6461b..09aac7f0ec 100644
--- a/package/llvm-project/clang/clang.mk
+++ b/package/llvm-project/clang/clang.mk
@@ -90,6 +90,15 @@ define HOST_CLANG_INSTALL_CLANG_TBLGEN
endef
HOST_CLANG_POST_INSTALL_HOOKS = HOST_CLANG_INSTALL_CLANG_TBLGEN
+# Rusticl needs opencl-c-base.h to be present on the target.
+define CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
+ mkdir -p $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include
+ $(INSTALL) -D -m 0644 $(@D)/lib/Headers/opencl-c-base.h $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/opencl-c-base.h
+endef
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+CLANG_POST_INSTALL_TARGET_HOOKS += CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
+endif
+
# This option must be enabled to link libclang dynamically against libLLVM.so
HOST_CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 6/7] package/mesa3d: add RustiCL support
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
` (4 preceding siblings ...)
2024-07-13 9:36 ` [Buildroot] [PATCH 5/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant via buildroot
@ 2024-07-13 9:36 ` Antoine Coutant via buildroot
2024-07-13 9:37 ` [Buildroot] [PATCH 7/7] package/mesa3d: remove the dependency on Clover and build it in ICD mode Antoine Coutant via buildroot
2024-07-14 11:10 ` [Buildroot] [PATCH 0/7] Adding RustiCL Romain Naour via buildroot
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:36 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour, Sebastian Weyer
From: Romain Naour <romain.naour@smile.fr>
To build Rusticl you need to satisfy the following build dependencies:
rustc
rustfmt (highly recommended, but only required for CI builds or when authoring patches)
bindgen
LLVM built with libclc and -DLLVM_ENABLE_DUMP=ON.
SPIRV-Tools
SPIRV-LLVM-Translator for a libLLVMSPIRVLib.so matching your version of LLVM, i.e. if you’re using LLVM 15 (libLLVM.so.15), then you need a libLLVMSPIRVLib.so.15.
See:
https://docs.mesa3d.org/rusticl.html
Since rusticl is an implementation of OpenCL, make it a provider of
OpenCL.
We need to use opencl-icd-loader in order to be able to capture API
calls and forward them to the correct implementation of OpenCL (RustiCL
in this case)
opencl-icd-loader needs to be installed in the toolchain's sysroot
as well to be able to compile packages depending on libopencl since
otherwise there's only for example libRustiOpenCL.so and no
libOpenCL.so
Many Gallium drivers are compatible with rusticl. However, tests were
performed with panfrost. Thus only panfrost is actived for the moment.
To activate another driver, make it select
BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER. The list of all
compatible drivers can be found here:
https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/mesa3d/Config.in | 50 ++++++++++++++++++++++++++++++++++++----
package/mesa3d/mesa3d.mk | 9 ++++++++
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index 459051b2db..75504c11da 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -44,17 +44,56 @@ comment "llvm support needs a toolchain not affected by GCC bug 64735"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
-# clang and libclc dependencies are satisfied by
-# BR2_PACKAGE_MESA3D_LLVM
-config BR2_PACKAGE_MESA3D_OPENCL
+menuconfig BR2_PACKAGE_MESA3D_OPENCL
bool "OpenCL support"
+ default n
depends on BR2_PACKAGE_MESA3D_LLVM
depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600 || \
- BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI
+ BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI || \
+ BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS && \
+ BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
select BR2_PACKAGE_LLVM_RTTI
select BR2_PACKAGE_CLANG
select BR2_PACKAGE_LIBCLC
select BR2_PACKAGE_HAS_LIBOPENCL
+ help
+ OpenCL is a standard for parallel programming of heterogeneous
+ systems (CPUs, GPUs, DSPs, FPGAs, etc.)
+
+ http://www.khronos.org/opencl/
+
+if BR2_PACKAGE_MESA3D_OPENCL
+
+# clang and libclc dependencies are satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_CLOVER
+ bool "Clover"
+ depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600 || \
+ BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI
+
+# libclc dependency is satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_RUSTICL
+ bool "RustiCL"
+ depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
+ select BR2_PACKAGE_HOST_RUSTC
+ select BR2_PACKAGE_LLVM_DUMP
+ select BR2_PACKAGE_OPENCL_ICD_LOADER
+ select BR2_PACKAGE_SPIRV_TOOLS
+ select BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+ help
+ RustiCL is an OpenCL implementation written in Rust.
+
+ By default devices are disabled in RustiCL. If you want to enable a device,
+ you need to set the environment variable RUSTICL_ENABLE to the driver you
+ are using.
+ ref: https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE
+
+endif # BR2_PACKAGE_MESA3D_OPENCL
+
+config BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
+ bool
# inform the .mk file of gallium or vulkan driver selection
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
@@ -153,6 +192,7 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
bool "Gallium panfrost driver"
depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
+ select BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
help
Mesa driver for ARM Mali Midgard and Bifrost GPUs.
@@ -385,7 +425,7 @@ config BR2_PACKAGE_PROVIDES_LIBGLES
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES && !BR2_PACKAGE_LIBGLVND
config BR2_PACKAGE_PROVIDES_LIBOPENCL
- default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL
+ default "mesa3d" if BR2_PACKAGE_MESA3D_CLOVER || BR2_PACKAGE_MESA3D_RUSTICL
endif # BR2_PACKAGE_MESA3D
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 2cb8f3a2c8..7b1fc93a26 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -53,6 +53,7 @@ endif
ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
MESA3D_PROVIDES += libopencl
MESA3D_DEPENDENCIES += clang libclc opencl-headers
+ifeq ($(BR2_PACKAGE_MESA3D_CLOVER),y)
ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
MESA3D_CONF_OPTS += -Dgallium-opencl=icd
MESA3D_DEPENDENCIES += opencl-icd-loader
@@ -64,6 +65,14 @@ endif
else
MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
endif
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+MESA3D_DEPENDENCIES += host-rustc host-rust-bindgen opencl-icd-loader spirv-tools spirv-llvm-translator
+# -Drust_std=2021: known meson bug (https://github.com/mesonbuild/meson/issues/10664)
+MESA3D_CONF_OPTS += -Dgallium-rusticl=true -Drust_std=2021
+else
+MESA3D_CONF_OPTS += -Dgallium-rusticl=false
+endif
+endif
ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS),y)
MESA3D_DEPENDENCIES += elfutils
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 7/7] package/mesa3d: remove the dependency on Clover and build it in ICD mode
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
` (5 preceding siblings ...)
2024-07-13 9:36 ` [Buildroot] [PATCH 6/7] package/mesa3d: add RustiCL support Antoine Coutant via buildroot
@ 2024-07-13 9:37 ` Antoine Coutant via buildroot
2024-07-14 11:10 ` [Buildroot] [PATCH 0/7] Adding RustiCL Romain Naour via buildroot
7 siblings, 0 replies; 11+ messages in thread
From: Antoine Coutant via buildroot @ 2024-07-13 9:37 UTC (permalink / raw)
To: buildroot; +Cc: Antoine Coutant, romain.naour
RustiCL can't be built in standalone mode. That shows that we can rely
on icd mode for Clover too.
This change adds more consistency between the two OpenCL
implementations.
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
package/mesa3d/mesa3d.mk | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 7b1fc93a26..22ea19f401 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -54,14 +54,9 @@ ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
MESA3D_PROVIDES += libopencl
MESA3D_DEPENDENCIES += clang libclc opencl-headers
ifeq ($(BR2_PACKAGE_MESA3D_CLOVER),y)
-ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
MESA3D_CONF_OPTS += -Dgallium-opencl=icd
MESA3D_DEPENDENCIES += opencl-icd-loader
-else
-# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
-# libMesaOpenCL and CL headers are installed
-MESA3D_CONF_OPTS += -Dgallium-opencl=standalone
-endif
+# Always build clover in icd as it is done for RustiCL
else
MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
endif
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH 0/7] Adding RustiCL
2024-07-13 9:36 [Buildroot] [PATCH 0/7] Adding RustiCL Antoine Coutant via buildroot
` (6 preceding siblings ...)
2024-07-13 9:37 ` [Buildroot] [PATCH 7/7] package/mesa3d: remove the dependency on Clover and build it in ICD mode Antoine Coutant via buildroot
@ 2024-07-14 11:10 ` Romain Naour via buildroot
2024-07-14 15:49 ` Romain Naour via buildroot
2024-07-22 16:33 ` Thomas Petazzoni via buildroot
7 siblings, 2 replies; 11+ messages in thread
From: Romain Naour via buildroot @ 2024-07-14 11:10 UTC (permalink / raw)
To: Antoine Coutant, buildroot
Hello Antoine, All,
Le 13/07/2024 à 11:36, Antoine Coutant a écrit :
> All,
>
> This series follows the last series I sent at the end of my internship
> [1].
>
> I’m sorry for the long time between those two series, but I do not have
> time to spend on it since the end of my internship.
>
> Compared to the previous one, this series fixes problems raised by
> receivers. Thanks for your review!
> I also made the OpenCL-headers package the default provider of OpenCL
> herders because all OpenCL headers are sourced from the same repo, and
> because they should be backward compatible (mesa OpenCL headers are
> old).
> Finally, I made OpenCL Clover only available in ICD mode to stay
> consistent between OpenCL implementations.
>
> Contrary to the previous series, this one have not been tested on the
> kadhas vim3 board (I don’t have access to it since the end of my
> internship). I tested the build once with qemu_x86_64_defconfig and the
> build was successful. But, an other build with the khadas_vim3_defconfig
> failed:
>
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:34:25: error: '__neon_vector_type__' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:35:25: error: '__neon_vector_type__' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:40:9: error: unknown type name '__SVFloat32_t'
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:41:9: error: unknown type name '__SVFloat64_t'
> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:42:9: error: unknown type name '__SVBool_t'
> clang diag: ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
> panicked at bindgen-cli/main.rs:52:36:
>
> I’m sending this patch series to save the work done, as I don’t know if
> I will have time to work on it.
It seems your patch series only work on top of mesa 23.x. Since mesa 24.0
rusticl include new llvm stuff to build [1].
Somehow it takes the wrong clang or llvm headers/libraries...
It seems such kind of issue has aleady be reported to mesa [2]. I'm not sure if
it's a meson or mesa or rusticl or Buildroot issue yet.
We can't apply your series for now but as soon as this issue is solved, we can
resume the rusticl work.
[1]
https://gitlab.freedesktop.org/mesa/mesa/-/commit/299f9497758ca5d7278e5aafd210aa91d20dfb4d
[2] https://gitlab.freedesktop.org/mesa/mesa/-/issues/11090
>
> (I wish a good buildroot summer camp to everyone who participates !)
Thanks!
Best regards,
Romain
>
> Regards,
> Antoine Coutant
>
> [1]: https://patchwork.ozlabs.org/project/buildroot/list/?series=393298&state=%2A&archive=both
>
>
>
> Antoine Coutant (3):
> package/opencl-icd-loader: new package
> package/llvm-project: add opencl-c-base.h on target
> package/mesa3d: remove the dependency on Clover and build it in ICD
> mode
>
> Romain Naour (3):
> package/pkg-meson.mk: add rust cross-compiler support
> package/spirv-llvm-translator: add target variant to provide
> LLVMSPIRVLib
> package/mesa3d: add RustiCL support
>
> Sebastian Weyer (1):
> package/opencl-headers: new package
>
> package/Config.in | 3 +
> package/llvm-project/clang/clang.mk | 9 +++
> package/mesa3d-headers/mesa3d-headers.mk | 2 +-
> ...emove-the-installation-of-CL-headers.patch | 71 +++++++++++++++++++
> package/mesa3d/Config.in | 50 +++++++++++--
> package/mesa3d/mesa3d.mk | 17 +++--
> package/opencl-headers/Config.in | 7 ++
> package/opencl-headers/opencl-headers.hash | 3 +
> package/opencl-headers/opencl-headers.mk | 23 ++++++
> package/opencl-icd-loader/Config.in | 12 ++++
> .../opencl-icd-loader/opencl-icd-loader.hash | 3 +
> .../opencl-icd-loader/opencl-icd-loader.mk | 20 ++++++
> package/pkg-meson.mk | 13 ++++
> package/spirv-llvm-translator/Config.in | 22 ++++++
> .../spirv-llvm-translator.mk | 10 +++
> support/misc/cross-compilation.conf.in | 2 +
> 16 files changed, 257 insertions(+), 10 deletions(-)
> create mode 100644 package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch
> create mode 100644 package/opencl-headers/Config.in
> create mode 100644 package/opencl-headers/opencl-headers.hash
> create mode 100644 package/opencl-headers/opencl-headers.mk
> create mode 100644 package/opencl-icd-loader/Config.in
> create mode 100644 package/opencl-icd-loader/opencl-icd-loader.hash
> create mode 100644 package/opencl-icd-loader/opencl-icd-loader.mk
> create mode 100644 package/spirv-llvm-translator/Config.in
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH 0/7] Adding RustiCL
2024-07-14 11:10 ` [Buildroot] [PATCH 0/7] Adding RustiCL Romain Naour via buildroot
@ 2024-07-14 15:49 ` Romain Naour via buildroot
2024-07-22 16:33 ` Thomas Petazzoni via buildroot
1 sibling, 0 replies; 11+ messages in thread
From: Romain Naour via buildroot @ 2024-07-14 15:49 UTC (permalink / raw)
To: Antoine Coutant, buildroot
Hello Antoine, All,
Le 14/07/2024 à 13:10, Romain Naour a écrit :
> Hello Antoine, All,
>
> Le 13/07/2024 à 11:36, Antoine Coutant a écrit :
>> All,
>>
>> This series follows the last series I sent at the end of my internship
>> [1].
>>
>> I’m sorry for the long time between those two series, but I do not have
>> time to spend on it since the end of my internship.
>>
>> Compared to the previous one, this series fixes problems raised by
>> receivers. Thanks for your review!
>> I also made the OpenCL-headers package the default provider of OpenCL
>> herders because all OpenCL headers are sourced from the same repo, and
>> because they should be backward compatible (mesa OpenCL headers are
>> old).
>> Finally, I made OpenCL Clover only available in ICD mode to stay
>> consistent between OpenCL implementations.
>>
>> Contrary to the previous series, this one have not been tested on the
>> kadhas vim3 board (I don’t have access to it since the end of my
>> internship). I tested the build once with qemu_x86_64_defconfig and the
>> build was successful. But, an other build with the khadas_vim3_defconfig
>> failed:
>>
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:34:25: error: '__neon_vector_type__' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:35:25: error: '__neon_vector_type__' attribute is not supported on targets missing 'neon' or 'mve'; specify an appropriate -march= or -mcpu=
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:40:9: error: unknown type name '__SVFloat32_t'
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:41:9: error: unknown type name '__SVFloat64_t'
>> ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/math-vector.h:42:9: error: unknown type name '__SVBool_t'
>> clang diag: ./buildroot/test/khadas_vim3_defconfig_rusticl_5/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
>> panicked at bindgen-cli/main.rs:52:36:
>>
>> I’m sending this patch series to save the work done, as I don’t know if
>> I will have time to work on it.
>
> It seems your patch series only work on top of mesa 23.x. Since mesa 24.0
> rusticl include new llvm stuff to build [1].
>
> Somehow it takes the wrong clang or llvm headers/libraries...
>
> It seems such kind of issue has aleady be reported to mesa [2]. I'm not sure if
> it's a meson or mesa or rusticl or Buildroot issue yet.
>
> We can't apply your series for now but as soon as this issue is solved, we can
> resume the rusticl work.
Now that mesa3d 24.0+ use rust-bindgen to build its rusticl_llvm_bindings.rs, we
must provide additional environment variable when executing rust-bindgen [1].
First, we have to define the path to libclang to make sure that rust-bindgen
uses the one installed in HOST_DIR:
LIBCLANG_PATH=$(HOST_DIR)/lib
Then the build now fail due to missing c++ headers (same issue as reported in [1]).
Indeed, only gcc (the cross-compiler) can use "cassert" present in
$(HOST_DIR)/opt/ext-toolchain/aarch64-none-linux-gnu/include/c++/13.2.1/ since
they are part of the GNU toolchain itself.
But rust-bindgen use clang and those c++ headers are not installed in
STAGING_DIR. The llvm-project provide libcxx library but it's not yet supported
in Buildroot! We should add libcxx support in clang package to provide those c++
headers.
Finally, rust-bindgen need to use our clang wrapper installed in HOST_DIR:
CLANG_PATH="$(HOST_DIR)/bin/clang"
With that "fixed", rusticl can build and seems able to run clinfo
# RUSTICL_ENABLE=panfrost clinfo
Number of platforms 1
Platform Name rusticl
Platform Vendor Mesa/X.org
Platform Version OpenCL 3.0
Platform Profile FULL_PROFILE
...
Platform Name rusticl
Number of devices 1
Device Name Mali-G52 (Panfrost)
Device Vendor Arm
Device Vendor ID 0
Device Version OpenCL 3.0
Device Numeric Version 0xc00000 (3.0.0)
Driver Version 24.0.9
Device OpenCL C Version OpenCL C 1.2
...
ICD loader properties
ICD loader Name Khronos OpenCL ICD Loader
ICD loader Vendor Khronos Group
ICD loader Version 3.0.6
ICD loader Profile OpenCL 3.0
[1] https://github.com/KyleMayes/clang-sys#environment-variables
Best regards,
Romain
>
> [1]
> https://gitlab.freedesktop.org/mesa/mesa/-/commit/299f9497758ca5d7278e5aafd210aa91d20dfb4d
> [2] https://gitlab.freedesktop.org/mesa/mesa/-/issues/11090
>
>>
>> (I wish a good buildroot summer camp to everyone who participates !)
>
> Thanks!
>
> Best regards,
> Romain
>
>
>>
>> Regards,
>> Antoine Coutant
>>
>> [1]: https://patchwork.ozlabs.org/project/buildroot/list/?series=393298&state=%2A&archive=both
>>
>>
>>
>> Antoine Coutant (3):
>> package/opencl-icd-loader: new package
>> package/llvm-project: add opencl-c-base.h on target
>> package/mesa3d: remove the dependency on Clover and build it in ICD
>> mode
>>
>> Romain Naour (3):
>> package/pkg-meson.mk: add rust cross-compiler support
>> package/spirv-llvm-translator: add target variant to provide
>> LLVMSPIRVLib
>> package/mesa3d: add RustiCL support
>>
>> Sebastian Weyer (1):
>> package/opencl-headers: new package
>>
>> package/Config.in | 3 +
>> package/llvm-project/clang/clang.mk | 9 +++
>> package/mesa3d-headers/mesa3d-headers.mk | 2 +-
>> ...emove-the-installation-of-CL-headers.patch | 71 +++++++++++++++++++
>> package/mesa3d/Config.in | 50 +++++++++++--
>> package/mesa3d/mesa3d.mk | 17 +++--
>> package/opencl-headers/Config.in | 7 ++
>> package/opencl-headers/opencl-headers.hash | 3 +
>> package/opencl-headers/opencl-headers.mk | 23 ++++++
>> package/opencl-icd-loader/Config.in | 12 ++++
>> .../opencl-icd-loader/opencl-icd-loader.hash | 3 +
>> .../opencl-icd-loader/opencl-icd-loader.mk | 20 ++++++
>> package/pkg-meson.mk | 13 ++++
>> package/spirv-llvm-translator/Config.in | 22 ++++++
>> .../spirv-llvm-translator.mk | 10 +++
>> support/misc/cross-compilation.conf.in | 2 +
>> 16 files changed, 257 insertions(+), 10 deletions(-)
>> create mode 100644 package/mesa3d/0008-include-remove-the-installation-of-CL-headers.patch
>> create mode 100644 package/opencl-headers/Config.in
>> create mode 100644 package/opencl-headers/opencl-headers.hash
>> create mode 100644 package/opencl-headers/opencl-headers.mk
>> create mode 100644 package/opencl-icd-loader/Config.in
>> create mode 100644 package/opencl-icd-loader/opencl-icd-loader.hash
>> create mode 100644 package/opencl-icd-loader/opencl-icd-loader.mk
>> create mode 100644 package/spirv-llvm-translator/Config.in
>>
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 0/7] Adding RustiCL
2024-07-14 11:10 ` [Buildroot] [PATCH 0/7] Adding RustiCL Romain Naour via buildroot
2024-07-14 15:49 ` Romain Naour via buildroot
@ 2024-07-22 16:33 ` Thomas Petazzoni via buildroot
1 sibling, 0 replies; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-22 16:33 UTC (permalink / raw)
To: Romain Naour via buildroot; +Cc: Antoine Coutant, Romain Naour
Hello Antoine, Hello Romain,
On Sun, 14 Jul 2024 13:10:20 +0200
Romain Naour via buildroot <buildroot@buildroot.org> wrote:
> It seems your patch series only work on top of mesa 23.x. Since mesa 24.0
> rusticl include new llvm stuff to build [1].
>
> Somehow it takes the wrong clang or llvm headers/libraries...
Based on this feedback, I have marked the series as "Not Applicable".
Could you address the remaining issues, and send an updated version?
Also, it would be good to have a runtime test for this functionality,
which is quite complex.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread