All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d
@ 2023-07-25 17:30 Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package Sebastian Weyer
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Sebastian Weyer

This series of patches adds everything necessary to be able to compile
Rusticl inside of mesa3d. It was successfully tested on a Khadas VIM3
board with a Mali-G52 GPU using mesa's Gallium panfrost driver. The
requirements can be found on its documentation website[1].

We need opencl-icd-loader as an additional package since the Rusticl
library will be installed as libRusticlOpenCL.so. The opencl-icd-loader
package will provide a libOpenCL.so file that can capture the OpenCL API
calls and forward them to the correct implementation. The available
OpenCL providers can be configured by creating a file in
/etc/OpenCL/vendors/[2]. In order to build this package we also need the
C language OpenCL headers which are not yet included in Buildroot since
for now we only have the C++ headers (opencl-clhpp).

The package opencl-icd-loader is included as a dependency in mesa3d as
it needs to be present in the sysroot before packages depending on
libopencl are built.

We need to make the Rust compiler known to the meson infrastructure
since it will abort the build of a Rust package if it isn't found. We
also need to add support for cross compilation in the
cross-compilation.conf.in template file and add a regex so that the
compiler and linker are properly inserted.

[1] https://docs.mesa3d.org/rusticl.html
[2] https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds

v2: remove "experimental" from final commit header since rusticl is not
experimental

Romain Naour (7):
  package/rust-bindgen: new host package
  package/llvm-project/llvm: add llvm dump support
  package/pkg-meson.mk: add rust cross-compiler support
  package/spirv-headers: new package
  package/spirv-tools: new package
  package/spirv-llvm-translator: add target variant to provide
    LLVMSPIRVLib
  package/mesa3d: add RustiCL support

Sebastian Weyer (2):
  package/opencl-headers: new package
  package/opencl-icd-loader: new package

 DEVELOPERS                                    |  5 +++
 package/Config.in                             |  5 +++
 package/llvm-project/llvm/Config.in           |  6 +++
 package/llvm-project/llvm/llvm.mk             |  7 ++++
 package/mesa3d/Config.in                      | 19 ++++++++-
 package/mesa3d/mesa3d.mk                      | 20 ++++++++-
 package/opencl-headers/Config.in              |  7 ++++
 package/opencl-headers/opencl-headers.hash    |  3 ++
 package/opencl-headers/opencl-headers.mk      | 42 +++++++++++++++++++
 package/opencl-icd-loader/Config.in           | 12 ++++++
 .../opencl-icd-loader/opencl-icd-loader.hash  |  3 ++
 .../opencl-icd-loader/opencl-icd-loader.mk    | 19 +++++++++
 package/pkg-meson.mk                          | 13 ++++++
 package/rust-bindgen/rust-bindgen.hash        |  3 ++
 package/rust-bindgen/rust-bindgen.mk          | 17 ++++++++
 package/spirv-headers/Config.in               |  6 +++
 package/spirv-headers/spirv-headers.hash      |  2 +
 package/spirv-headers/spirv-headers.mk        | 15 +++++++
 package/spirv-llvm-translator/Config.in       | 22 ++++++++++
 .../spirv-llvm-translator.mk                  | 13 +++++-
 package/spirv-tools/Config.in                 | 12 ++++++
 package/spirv-tools/spirv-tools.hash          |  2 +
 package/spirv-tools/spirv-tools.mk            | 22 ++++++++++
 support/misc/cross-compilation.conf.in        |  2 +
 24 files changed, 274 insertions(+), 3 deletions(-)
 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/rust-bindgen/rust-bindgen.hash
 create mode 100644 package/rust-bindgen/rust-bindgen.mk
 create mode 100644 package/spirv-headers/Config.in
 create mode 100644 package/spirv-headers/spirv-headers.hash
 create mode 100644 package/spirv-headers/spirv-headers.mk
 create mode 100644 package/spirv-llvm-translator/Config.in
 create mode 100644 package/spirv-tools/Config.in
 create mode 100644 package/spirv-tools/spirv-tools.hash
 create mode 100644 package/spirv-tools/spirv-tools.mk

--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-10-01 16:40   ` Thomas Petazzoni via buildroot
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support Sebastian Weyer
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Sebastian Weyer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2722 bytes --]

From: Romain Naour <romain.naour@smile.fr>

host-rust-bindgen will be required to build several different rust-based
packages, including a Linux kernel with rust modules and mesa3d's
rusticl which is the rust-based implementation of OpenCL.

The Cargo.toml file at the project root is a "virtual manifest". Since
we only want to install rust-bindgen, we can specify RUST_BINDGEN_SUBDIR
= bindgen-cli to use the Cargo.toml from this directory.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
v2:
    - remove comment explaining deprecated command line options from
      rust-bindgen.mk
    - Add rust-bindgen under Sebastian WEYER in DEVELOPERS file
---
 DEVELOPERS                             |  3 +++
 package/rust-bindgen/rust-bindgen.hash |  3 +++
 package/rust-bindgen/rust-bindgen.mk   | 17 +++++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/rust-bindgen/rust-bindgen.hash
 create mode 100644 package/rust-bindgen/rust-bindgen.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c690f1dac7..c9ac202de6 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2602,6 +2602,9 @@ F:	support/misc/toolchainfile.cmake.in
 N:	Sam Voss <sam.voss@gmail.com>
 F:	package/ripgrep/
 
+N:	Sebastian Weyer <sebastian.weyer@smile.fr>
+F:	package/rust-bindgen
+
 N:	Sébastien Szymanski <sebastien.szymanski@armadeus.com>
 F:	package/mmc-utils/
 F:	package/python-flask-jsonrpc/
diff --git a/package/rust-bindgen/rust-bindgen.hash b/package/rust-bindgen/rust-bindgen.hash
new file mode 100644
index 0000000000..fe94bbc096
--- /dev/null
+++ b/package/rust-bindgen/rust-bindgen.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  e1cdbaa8e0ed96f647e49807aecfc44d9239d438c2b1c084edb9a3cca0b1f68f  rust-bindgen-0.65.1.tar.gz
+sha256  c23953d9deb0a3312dbeaf6c128a657f3591acee45067612fa68405eaa4525db  LICENSE
diff --git a/package/rust-bindgen/rust-bindgen.mk b/package/rust-bindgen/rust-bindgen.mk
new file mode 100644
index 0000000000..117198f407
--- /dev/null
+++ b/package/rust-bindgen/rust-bindgen.mk
@@ -0,0 +1,17 @@
+################################################################################
+#
+# rust-bindgen
+#
+################################################################################
+
+RUST_BINDGEN_VERSION = 0.65.1
+RUST_BINDGEN_SITE = $(call github,rust-lang,rust-bindgen,v$(RUST_BINDGEN_VERSION))
+RUST_BINDGEN_LICENSE = BSD-3-clause
+RUST_BINDGEN_LICENSE_FILES = LICENSE
+
+# The Cargo.toml at the root directory is an "virtual manifest".
+# Since we only want to build and install bindgen use the Cargo.toml
+# from the bindgen-cli subdirectory.
+RUST_BINDGEN_SUBDIR = bindgen-cli
+
+$(eval $(host-cargo-package))
-- 
2.34.1


[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-07-26 18:56   ` Daniel Lang
  2023-10-01 16:40   ` Thomas Petazzoni via buildroot
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 3/9] package/pkg-meson.mk: add rust cross-compiler support Sebastian Weyer
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Romain Naour, Daniel Lang, Romain Naour,
	Valentin Korenblit

From: Romain Naour <romain.naour@smile.fr>

LLVM_ENABLE_DUMP required by mesa3d rusticl:

https://docs.mesa3d.org/rusticl.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 package/llvm-project/llvm/Config.in | 6 ++++++
 package/llvm-project/llvm/llvm.mk   | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/package/llvm-project/llvm/Config.in b/package/llvm-project/llvm/Config.in
index ebb0fca66a..4ee84b3bcc 100644
--- a/package/llvm-project/llvm/Config.in
+++ b/package/llvm-project/llvm/Config.in
@@ -57,6 +57,12 @@ config BR2_PACKAGE_LLVM_BPF
 	  Build BPF target. Select this option if you are going
 	  to install bcc on the target.
 
+config BR2_PACKAGE_LLVM_DUMP
+	bool "enable dump"
+	help
+	  Build LLVM with dump functions even when assertions are
+	  disabled.
+
 endif
 
 comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk
index 556a2f8c35..6598d8b6c1 100644
--- a/package/llvm-project/llvm/llvm.mk
+++ b/package/llvm-project/llvm/llvm.mk
@@ -228,6 +228,13 @@ HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
 LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
 endif
 
+HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
+ifeq ($(BR2_PACKAGE_LLVM_DUMP),y)
+LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=ON
+else
+LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
+endif
+
 # Compiler-rt not in the source tree.
 # llvm runtime libraries are not in the source tree.
 # Polly is not in the source tree.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 3/9] package/pkg-meson.mk: add rust cross-compiler support
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package Sebastian Weyer
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, 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>
---
 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..25dd4f0d7f 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 = $(notdir $(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 7053df472b..3c5812b131 100644
--- a/support/misc/cross-compilation.conf.in
+++ b/support/misc/cross-compilation.conf.in
@@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
 pkgconfig = '@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] 15+ messages in thread

* [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (2 preceding siblings ...)
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 3/9] package/pkg-meson.mk: add rust cross-compiler support Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-10-01 16:50   ` Thomas Petazzoni via buildroot
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 5/9] package/spirv-tools: " Sebastian Weyer
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Samuel Martin, Sebastian Weyer

From: Romain Naour <romain.naour@smile.fr>

These headers are required to build the pacakge spirv-tools which is
requried by mesa3d for building rusticl:

https://docs.mesa3d.org/rusticl.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
 package/Config.in                        |  1 +
 package/spirv-headers/Config.in          |  6 ++++++
 package/spirv-headers/spirv-headers.hash |  2 ++
 package/spirv-headers/spirv-headers.mk   | 15 +++++++++++++++
 4 files changed, 24 insertions(+)
 create mode 100644 package/spirv-headers/Config.in
 create mode 100644 package/spirv-headers/spirv-headers.hash
 create mode 100644 package/spirv-headers/spirv-headers.mk

diff --git a/package/Config.in b/package/Config.in
index 1e551d17c4..931b0cc21e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -326,6 +326,7 @@ comment "Graphic applications"
 	source "package/pngquant/Config.in"
 	source "package/qt5cinex/Config.in"
 	source "package/rrdtool/Config.in"
+	source "package/spirv-headers/Config.in"
 	source "package/stellarium/Config.in"
 	source "package/sway/Config.in"
 	source "package/tesseract-ocr/Config.in"
diff --git a/package/spirv-headers/Config.in b/package/spirv-headers/Config.in
new file mode 100644
index 0000000000..fd20f301d4
--- /dev/null
+++ b/package/spirv-headers/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_SPIRV_HEADERS
+	bool "spirv-headers"
+	help
+	  Machine-readable files for the SPIR-V Registry
+
+	  https://www.khronos.org/registry/spir-v
diff --git a/package/spirv-headers/spirv-headers.hash b/package/spirv-headers/spirv-headers.hash
new file mode 100644
index 0000000000..b83959f7a4
--- /dev/null
+++ b/package/spirv-headers/spirv-headers.hash
@@ -0,0 +1,2 @@
+sha256  71668e18ef7b318b06f8c466f46abad965b2646eaa322594cd015c2ac87133e6  spirv-headers-1.3.246.1.tar.gz
+sha256  9b243f6f0bf44e295ff411a0f7b7642d1d0dff7cdc42507e9f7206f439e51b5a  LICENSE
diff --git a/package/spirv-headers/spirv-headers.mk b/package/spirv-headers/spirv-headers.mk
new file mode 100644
index 0000000000..11119ac6b2
--- /dev/null
+++ b/package/spirv-headers/spirv-headers.mk
@@ -0,0 +1,15 @@
+################################################################################
+#
+# spirv-headers
+#
+################################################################################
+
+SPIRV_HEADERS_VERSION = 1.3.246.1
+SPIRV_HEADERS_SITE = $(call github,KhronosGroup,SPIRV-Headers,sdk-$(SPIRV_HEADERS_VERSION))
+SPIRV_HEADERS_LICENSE = MIT
+SPIRV_HEADERS_LICENSE_FILES = LICENSE
+
+SPIRV_HEADERS_INSTALL_STAGING = YES
+SPIRV_HEADERS_INSTALL_TARGET = NO
+
+$(eval $(cmake-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 5/9] package/spirv-tools: new package
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (3 preceding siblings ...)
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-10-01 16:53   ` Thomas Petazzoni via buildroot
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 6/9] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Sebastian Weyer
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Samuel Martin, Sebastian Weyer

From: Romain Naour <romain.naour@smile.fr>

This package is required by mesa3d for building rusticl:

https://docs.mesa3d.org/rusticl.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
 package/Config.in                    |  1 +
 package/spirv-tools/Config.in        | 12 ++++++++++++
 package/spirv-tools/spirv-tools.hash |  2 ++
 package/spirv-tools/spirv-tools.mk   | 22 ++++++++++++++++++++++
 4 files changed, 37 insertions(+)
 create mode 100644 package/spirv-tools/Config.in
 create mode 100644 package/spirv-tools/spirv-tools.hash
 create mode 100644 package/spirv-tools/spirv-tools.mk

diff --git a/package/Config.in b/package/Config.in
index 931b0cc21e..aa917264d7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -327,6 +327,7 @@ comment "Graphic applications"
 	source "package/qt5cinex/Config.in"
 	source "package/rrdtool/Config.in"
 	source "package/spirv-headers/Config.in"
+	source "package/spirv-tools/Config.in"
 	source "package/stellarium/Config.in"
 	source "package/sway/Config.in"
 	source "package/tesseract-ocr/Config.in"
diff --git a/package/spirv-tools/Config.in b/package/spirv-tools/Config.in
new file mode 100644
index 0000000000..21b3852779
--- /dev/null
+++ b/package/spirv-tools/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_SPIRV_TOOLS
+	bool "spirv-tools"
+	depends on BR2_USE_WCHAR # python3
+	depends on BR2_USE_MMU # python3
+	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
+	depends on !BR2_STATIC_LIBS # python3
+	select BR2_PACKAGE_PYTHON3
+	help
+	  The SPIR-V Tools project provides an API and commands for
+	  processing SPIR-V modules.
+
+	  https://github.com/KhronosGroup/SPIRV-Tools
diff --git a/package/spirv-tools/spirv-tools.hash b/package/spirv-tools/spirv-tools.hash
new file mode 100644
index 0000000000..6861f543ea
--- /dev/null
+++ b/package/spirv-tools/spirv-tools.hash
@@ -0,0 +1,2 @@
+sha256  645c4585c207cbdfda81a09f8ab180773c18df50fad9644d2d9a53b4464c692b  spirv-tools-1.3.246.1.tar.gz
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
diff --git a/package/spirv-tools/spirv-tools.mk b/package/spirv-tools/spirv-tools.mk
new file mode 100644
index 0000000000..758c01343c
--- /dev/null
+++ b/package/spirv-tools/spirv-tools.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# spirv-tools
+#
+################################################################################
+
+SPIRV_TOOLS_VERSION = 1.3.246.1
+SPIRV_TOOLS_SITE = $(call github,KhronosGroup,SPIRV-Tools,sdk-$(SPIRV_TOOLS_VERSION))
+SPIRV_TOOLS_LICENSE = Apache-2.0
+SPIRV_TOOLS_LICENSE_FILES = LICENSE
+
+SPIRV_TOOLS_DEPENDENCIES = python3 spirv-headers
+
+SPIRV_TOOLS_INSTALL_STAGING = YES
+
+SPIRV_TOOLS_CONF_OPTS = \
+    -DSPIRV-Headers_SOURCE_DIR=${STAGING_DIR}/usr \
+    -DSPIRV_TOOLS_BUILD_STATIC=OFF \
+    -DBUILD_SHARED_LIBS=ON \
+    -DSPIRV_SKIP_TESTS=ON \
+
+$(eval $(cmake-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 6/9] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (4 preceding siblings ...)
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 5/9] package/spirv-tools: " Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 7/9] package/opencl-headers: new package Sebastian Weyer
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Samuel Martin, Sebastian Weyer

From: Romain Naour <romain.naour@smile.fr>

This target version is needed for Rusticl which is an LLVM based OpenCL
framework:

https://docs.mesa3d.org/rusticl.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
 package/Config.in                             |  1 +
 package/spirv-llvm-translator/Config.in       | 22 +++++++++++++++++++
 .../spirv-llvm-translator.mk                  | 13 ++++++++++-
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 package/spirv-llvm-translator/Config.in

diff --git a/package/Config.in b/package/Config.in
index aa917264d7..f7b369b42a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -327,6 +327,7 @@ comment "Graphic applications"
 	source "package/qt5cinex/Config.in"
 	source "package/rrdtool/Config.in"
 	source "package/spirv-headers/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 37db47340e..7a3457a1fa 100644
--- a/package/spirv-llvm-translator/spirv-llvm-translator.mk
+++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
@@ -10,11 +10,22 @@ SPIRV_LLVM_TRANSLATOR_VERSION = v15.0.0-46-ge82ecc2bd7295604fcf1824e47c95fa6a09c
 SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
 SPIRV_LLVM_TRANSLATOR_LICENSE = NCSA
 SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
-HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm
+
+HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm spirv-headers zlib
 HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
 	-DLLVM_BUILD_TOOLS=ON \
 	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
 	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
 	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
 
+SPIRV_LLVM_TRANSLATOR_INSTALL_STAGING = YES
+SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm llvm
+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] 15+ messages in thread

* [Buildroot] [PATCH v2 7/9] package/opencl-headers: new package
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (5 preceding siblings ...)
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 6/9] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Sebastian Weyer
@ 2023-07-25 17:30 ` Sebastian Weyer
  2023-07-25 17:31 ` [Buildroot] [PATCH v2 8/9] package/opencl-icd-loader: " Sebastian Weyer
  2023-07-25 17:31 ` [Buildroot] [PATCH v2 9/9] package/mesa3d: add RustiCL support Sebastian Weyer
  8 siblings, 0 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:30 UTC (permalink / raw)
  To: buildroot; +Cc: Sebastian Weyer, Thomas Petazzoni

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3879 bytes --]

These headers provide the C language API bindings. It is a complement to
the C++ bindings already available in opencl-clhpp. This package is
required to build opencl-icd-loader:

https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/opencl-headers/Config.in           |  7 ++++
 package/opencl-headers/opencl-headers.hash |  3 ++
 package/opencl-headers/opencl-headers.mk   | 42 ++++++++++++++++++++++
 5 files changed, 54 insertions(+)
 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/DEVELOPERS b/DEVELOPERS
index c9ac202de6..38f46b4ac3 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2603,6 +2603,7 @@ N:	Sam Voss <sam.voss@gmail.com>
 F:	package/ripgrep/
 
 N:	Sebastian Weyer <sebastian.weyer@smile.fr>
+F:	package/opencl-headers
 F:	package/rust-bindgen
 
 N:	Sébastien Szymanski <sebastien.szymanski@armadeus.com>
diff --git a/package/Config.in b/package/Config.in
index f7b369b42a..fc73cd1727 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1638,6 +1638,7 @@ menu "Graphics"
 	source "package/libwpe/Config.in"
 	source "package/menu-cache/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"
diff --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
diff --git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
new file mode 100644
index 0000000000..f3d7ef8411
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.hash
@@ -0,0 +1,3 @@
+#Locally generated
+sha256  0ce992f4167f958f68a37918dec6325be18f848dee29a4521c633aae3304915d  OpenCL-Headers-2023.04.17.tar.gz
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
diff --git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
new file mode 100644
index 0000000000..1cad98a3d0
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.mk
@@ -0,0 +1,42 @@
+################################################################################
+#
+# opencl-headers
+#
+################################################################################
+
+OPENCL_HEADERS_VERSION = 2023.04.17
+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
+
+OPENCL_HEADERS_FILES = cl_d3d10.h \
+					   cl_d3d11.h \
+					   cl_dx9_media_sharing.h \
+					   cl_dx9_media_sharing_intel.h \
+					   cl_egl.h \
+					   cl_ext.h \
+					   cl_ext_intel.h \
+					   cl_gl_ext.h \
+					   cl_gl.h \
+					   cl.h \
+					   cl_half.h \
+					   cl_icd.h \
+					   cl_layer.h \
+					   cl_platform.h \
+					   cl_va_api_media_sharing_intel.h \
+					   cl_version.h \
+					   opencl.h
+
+
+define OPENCL_HEADERS_INSTALL_STAGING_CMDS
+	$(foreach header,$(OPENCL_HEADERS_FILES), \
+		$(INSTALL) -D -m 0644 $(@D)/CL/$(header) \
+			$(STAGING_DIR)/usr/include/CL/$(header)
+	)
+endef
+
+$(eval $(generic-package))
-- 
2.34.1


[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 8/9] package/opencl-icd-loader: new package
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (6 preceding siblings ...)
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 7/9] package/opencl-headers: new package Sebastian Weyer
@ 2023-07-25 17:31 ` Sebastian Weyer
  2023-07-25 17:31 ` [Buildroot] [PATCH v2 9/9] package/mesa3d: add RustiCL support Sebastian Weyer
  8 siblings, 0 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:31 UTC (permalink / raw)
  To: buildroot; +Cc: Sebastian Weyer, Samuel Martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4147 bytes --]

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 it 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]

This package is required by certain OpenCL implementations, for example
Mesa3D's implementation if it is not built in standalone mode.

[1] https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/opencl-icd-loader/Config.in           | 12 ++++++++++++
 .../opencl-icd-loader/opencl-icd-loader.hash  |  3 +++
 .../opencl-icd-loader/opencl-icd-loader.mk    | 19 +++++++++++++++++++
 5 files changed, 36 insertions(+)
 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/DEVELOPERS b/DEVELOPERS
index 38f46b4ac3..6af31d447e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2604,6 +2604,7 @@ F:	package/ripgrep/
 
 N:	Sebastian Weyer <sebastian.weyer@smile.fr>
 F:	package/opencl-headers
+F:	package/opencl-icd-loader
 F:	package/rust-bindgen
 
 N:	Sébastien Szymanski <sebastien.szymanski@armadeus.com>
diff --git a/package/Config.in b/package/Config.in
index fc73cd1727..2b7446386b 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1639,6 +1639,7 @@ menu "Graphics"
 	source "package/menu-cache/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/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..d028e3d856
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.hash
@@ -0,0 +1,3 @@
+# locally generated
+sha256  173bdc4f321d550b6578ad2aafc2832f25fbb36041f095e6221025f74134b876  OpenCL-ICD-Loader-2023.04.17.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..d3d94b9cb5
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.mk
@@ -0,0 +1,19 @@
+################################################################################
+#
+# opencl-icd-loader
+#
+################################################################################
+
+OPENCL_ICD_LOADER_VERSION = 2023.04.17
+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


[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 9/9] package/mesa3d: add RustiCL support
  2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
                   ` (7 preceding siblings ...)
  2023-07-25 17:31 ` [Buildroot] [PATCH v2 8/9] package/opencl-icd-loader: " Sebastian Weyer
@ 2023-07-25 17:31 ` Sebastian Weyer
  8 siblings, 0 replies; 15+ messages in thread
From: Sebastian Weyer @ 2023-07-25 17:31 UTC (permalink / raw)
  To: buildroot; +Cc: Bernd Kuhls, Romain Naour, 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

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
v2: change commit header -> RustiCL support is not experimental
---
 package/mesa3d/Config.in | 19 ++++++++++++++++++-
 package/mesa3d/mesa3d.mk | 20 +++++++++++++++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index c7ee2a8db0..4c725709d1 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -56,6 +56,23 @@ config BR2_PACKAGE_MESA3D_OPENCL
 	select BR2_PACKAGE_LIBCLC
 	select BR2_PACKAGE_HAS_LIBOPENCL
 
+# libclc dependencies are satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_RUSTICL
+	bool "RustiCL (OpenCL) support"
+	depends on BR2_PACKAGE_MESA3D_LLVM
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
+	select BR2_PACKAGE_HOST_RUSTC
+	select BR2_PACKAGE_LLVM_RTTI
+	select BR2_PACKAGE_CLANG
+	select BR2_PACKAGE_LLVM_DUMP
+	select BR2_PACKAGE_LIBCLC
+	select BR2_PACKAGE_SPIRV_TOOLS
+	select BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+	select BR2_PACKAGE_HAS_LIBOPENCL
+	select BR2_PACKAGE_OPENCL_ICD_LOADER
+
 # inform the .mk file of gallium, dri, dri3 or vulkan driver selection
 config BR2_PACKAGE_MESA3D_DRI3
 	bool
@@ -387,7 +404,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_OPENCL || BR2_PACKAGE_MESA3D_RUSTICL
 
 endif # BR2_PACKAGE_MESA3D
 
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 6fa5c1c686..3c7d919bb7 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -58,16 +58,34 @@ 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
+ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
+MESA3D_CONF_OPTS += -Dgallium-opencl=icd
+MESA3D_DEPENDENCIES +=  opencl-icd-loader
+# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
+else
 MESA3D_CONF_OPTS += -Dgallium-opencl=standalone
+endif
 else
 MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
 endif
 
+# -Drust_std=2021: known meson bug (https://github.com/mesonbuild/meson/issues/10664)
+#  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
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+MESA3D_PROVIDES += libopencl
+MESA3D_DEPENDENCIES += host-rustc host-rust-bindgen clang libclc opencl-icd-loader spirv-tools spirv-llvm-translator
+MESA3D_CONF_OPTS += -Dgallium-rusticl=true -Drust_std=2021
+else
+MESA3D_CONF_OPTS += -Dgallium-rusticl=false
+endif
+
 ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS),y)
 MESA3D_DEPENDENCIES += elfutils
 endif
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support Sebastian Weyer
@ 2023-07-26 18:56   ` Daniel Lang
  2023-10-01 16:40   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 15+ messages in thread
From: Daniel Lang @ 2023-07-26 18:56 UTC (permalink / raw)
  To: Sebastian Weyer, buildroot
  Cc: Joseph Kogut, Romain Naour, Romain Naour, Valentin Korenblit

On 25.07.23 19:30, Sebastian Weyer wrote:
> From: Romain Naour <romain.naour@smile.fr>
>
> LLVM_ENABLE_DUMP required by mesa3d rusticl:
>
> https://docs.mesa3d.org/rusticl.html
>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Acked-by: Daniel Lang <dalang@gmx.at>

> ---
>  package/llvm-project/llvm/Config.in | 6 ++++++
>  package/llvm-project/llvm/llvm.mk   | 7 +++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/package/llvm-project/llvm/Config.in b/package/llvm-project/llvm/Config.in
> index ebb0fca66a..4ee84b3bcc 100644
> --- a/package/llvm-project/llvm/Config.in
> +++ b/package/llvm-project/llvm/Config.in
> @@ -57,6 +57,12 @@ config BR2_PACKAGE_LLVM_BPF
>  	  Build BPF target. Select this option if you are going
>  	  to install bcc on the target.
>
> +config BR2_PACKAGE_LLVM_DUMP
> +	bool "enable dump"
> +	help
> +	  Build LLVM with dump functions even when assertions are
> +	  disabled.
> +
>  endif
>
>  comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk
> index 556a2f8c35..6598d8b6c1 100644
> --- a/package/llvm-project/llvm/llvm.mk
> +++ b/package/llvm-project/llvm/llvm.mk
> @@ -228,6 +228,13 @@ HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
>  LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
>  endif
>
> +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
> +ifeq ($(BR2_PACKAGE_LLVM_DUMP),y)
> +LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=ON
> +else
> +LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
> +endif
> +
>  # Compiler-rt not in the source tree.
>  # llvm runtime libraries are not in the source tree.
>  # Polly is not in the source tree.

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package Sebastian Weyer
@ 2023-10-01 16:40   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-10-01 16:40 UTC (permalink / raw)
  To: Sebastian Weyer; +Cc: Romain Naour, buildroot

Hello,

On Tue, 25 Jul 2023 19:30:53 +0200
Sebastian Weyer <sebastian.weyer@smile.fr> wrote:

> From: Romain Naour <romain.naour@smile.fr>
> 
> host-rust-bindgen will be required to build several different rust-based
> packages, including a Linux kernel with rust modules and mesa3d's
> rusticl which is the rust-based implementation of OpenCL.
> 
> The Cargo.toml file at the project root is a "virtual manifest". Since
> we only want to install rust-bindgen, we can specify RUST_BINDGEN_SUBDIR
> = bindgen-cli to use the Cargo.toml from this directory.
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>


> diff --git a/DEVELOPERS b/DEVELOPERS
> index c690f1dac7..c9ac202de6 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2602,6 +2602,9 @@ F:	support/misc/toolchainfile.cmake.in
>  N:	Sam Voss <sam.voss@gmail.com>
>  F:	package/ripgrep/
>  
> +N:	Sebastian Weyer <sebastian.weyer@smile.fr>
> +F:	package/rust-bindgen
                            ^^^ missing final slash here

Applied to master with this change. 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] 15+ messages in thread

* Re: [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support Sebastian Weyer
  2023-07-26 18:56   ` Daniel Lang
@ 2023-10-01 16:40   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-10-01 16:40 UTC (permalink / raw)
  To: Sebastian Weyer
  Cc: Joseph Kogut, Daniel Lang, buildroot, Romain Naour, Romain Naour,
	Valentin Korenblit

On Tue, 25 Jul 2023 19:30:54 +0200
Sebastian Weyer <sebastian.weyer@smile.fr> wrote:

> From: Romain Naour <romain.naour@smile.fr>
> 
> LLVM_ENABLE_DUMP required by mesa3d rusticl:
> 
> https://docs.mesa3d.org/rusticl.html
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
>  package/llvm-project/llvm/Config.in | 6 ++++++
>  package/llvm-project/llvm/llvm.mk   | 7 +++++++
>  2 files changed, 13 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package Sebastian Weyer
@ 2023-10-01 16:50   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-10-01 16:50 UTC (permalink / raw)
  To: Sebastian Weyer; +Cc: Romain Naour, Samuel Martin, buildroot

Hello,

On Tue, 25 Jul 2023 19:30:56 +0200
Sebastian Weyer <sebastian.weyer@smile.fr> wrote:

>  package/Config.in                        |  1 +
>  package/spirv-headers/Config.in          |  6 ++++++
>  package/spirv-headers/spirv-headers.hash |  2 ++
>  package/spirv-headers/spirv-headers.mk   | 15 +++++++++++++++
>  4 files changed, 24 insertions(+)

Missing entry in DEVELOPERS file, so I've added that.


> diff --git a/package/spirv-headers/spirv-headers.hash b/package/spirv-headers/spirv-headers.hash
> new file mode 100644
> index 0000000000..b83959f7a4
> --- /dev/null
> +++ b/package/spirv-headers/spirv-headers.hash
> @@ -0,0 +1,2 @@

Missing "Locally calculated" comment.

> +sha256  71668e18ef7b318b06f8c466f46abad965b2646eaa322594cd015c2ac87133e6  spirv-headers-1.3.246.1.tar.gz
> +sha256  9b243f6f0bf44e295ff411a0f7b7642d1d0dff7cdc42507e9f7206f439e51b5a  LICENSE
> diff --git a/package/spirv-headers/spirv-headers.mk b/package/spirv-headers/spirv-headers.mk
> new file mode 100644
> index 0000000000..11119ac6b2
> --- /dev/null
> +++ b/package/spirv-headers/spirv-headers.mk
> @@ -0,0 +1,15 @@
> +################################################################################
> +#
> +# spirv-headers
> +#
> +################################################################################
> +
> +SPIRV_HEADERS_VERSION = 1.3.246.1

I've bumped to the latest version, which fixes a build issue: this
older version was trying to build C++ code for an example/test. With
the newer version, it still tries to build C++ stuff, but mistakenly
with the host C++ compiler, which works because it has no dependencies.
Romain and I didn't bother fixing that as we really don't care about
this silly example being built.

Note: as a follow-up patch, I added a host variant of this package, and
a change to spirv-llvm-translator that makes use of it. Indeed
host-spirv-llvm-translator was downloading its own copy of the
spirv-headers during the build which is very bad (but not your fault,
since you did not introduce host-spirv-llvm-translator).

Anyway: this patch is applied. 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] 15+ messages in thread

* Re: [Buildroot] [PATCH v2 5/9] package/spirv-tools: new package
  2023-07-25 17:30 ` [Buildroot] [PATCH v2 5/9] package/spirv-tools: " Sebastian Weyer
@ 2023-10-01 16:53   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-10-01 16:53 UTC (permalink / raw)
  To: Sebastian Weyer; +Cc: Romain Naour, Samuel Martin, buildroot

On Tue, 25 Jul 2023 19:30:57 +0200
Sebastian Weyer <sebastian.weyer@smile.fr> wrote:

> From: Romain Naour <romain.naour@smile.fr>
> 
> This package is required by mesa3d for building rusticl:
> 
> https://docs.mesa3d.org/rusticl.html
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> ---
>  package/Config.in                    |  1 +
>  package/spirv-tools/Config.in        | 12 ++++++++++++
>  package/spirv-tools/spirv-tools.hash |  2 ++
>  package/spirv-tools/spirv-tools.mk   | 22 ++++++++++++++++++++++
>  4 files changed, 37 insertions(+)

Entry in DEVELOPERS file was missing.

> diff --git a/package/spirv-tools/Config.in b/package/spirv-tools/Config.in
> new file mode 100644
> index 0000000000..21b3852779
> --- /dev/null
> +++ b/package/spirv-tools/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_SPIRV_TOOLS
> +	bool "spirv-tools"
> +	depends on BR2_USE_WCHAR # python3
> +	depends on BR2_USE_MMU # python3
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
> +	depends on !BR2_STATIC_LIBS # python3
> +	select BR2_PACKAGE_PYTHON3

Not sure why you thought python3 was needed on the target. Reading
things a bit about spirv-tools, it doesn't seem like Python is needed,
so I dropped this.

However, it needs spirv-headers, and you had forgotten "select
BR2_PACKAGE_SPIRV_HEADERS" here.


> diff --git a/package/spirv-tools/spirv-tools.hash b/package/spirv-tools/spirv-tools.hash
> new file mode 100644
> index 0000000000..6861f543ea
> --- /dev/null
> +++ b/package/spirv-tools/spirv-tools.hash
> @@ -0,0 +1,2 @@

Missing "Locally calculated" comment here.

> +sha256  645c4585c207cbdfda81a09f8ab180773c18df50fad9644d2d9a53b4464c692b  spirv-tools-1.3.246.1.tar.gz
> +sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
> diff --git a/package/spirv-tools/spirv-tools.mk b/package/spirv-tools/spirv-tools.mk
> new file mode 100644
> index 0000000000..758c01343c
> --- /dev/null
> +++ b/package/spirv-tools/spirv-tools.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# spirv-tools
> +#
> +################################################################################
> +
> +SPIRV_TOOLS_VERSION = 1.3.246.1

I bumped to a newer version to match spirv-headers, as otherwise
spirv-tools would fail to build. I also added a comment in both
spirv-headers and spirv-tools to hint that they should be kept in sync
in terms of version.

> +SPIRV_TOOLS_SITE = $(call github,KhronosGroup,SPIRV-Tools,sdk-$(SPIRV_TOOLS_VERSION))
> +SPIRV_TOOLS_LICENSE = Apache-2.0
> +SPIRV_TOOLS_LICENSE_FILES = LICENSE
> +
> +SPIRV_TOOLS_DEPENDENCIES = python3 spirv-headers

Dropped python3 here.

> +
> +SPIRV_TOOLS_INSTALL_STAGING = YES
> +
> +SPIRV_TOOLS_CONF_OPTS = \
> +    -DSPIRV-Headers_SOURCE_DIR=${STAGING_DIR}/usr \
> +    -DSPIRV_TOOLS_BUILD_STATIC=OFF \
> +    -DBUILD_SHARED_LIBS=ON \
> +    -DSPIRV_SKIP_TESTS=ON \

Indentation here was wrong (spaces used instead of tab), and
${STAGING_DIR} should have been $(STAGING_DIR). Both of these issues
were reported by "make check-package".

Also BUILD_SHARED_LIBS=ON is already passed by the cmake-package
infrastructure as required.

I've added -DSPIRV_WERROR=OFF because it exists, and -Werror is
annoying in the context of Buildroot.

Applied with those various changes. 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] 15+ messages in thread

end of thread, other threads:[~2023-10-01 16:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 17:30 [Buildroot] [PATCH v2 0/9] Add support for Rusticl in mesa3d Sebastian Weyer
2023-07-25 17:30 ` [Buildroot] [PATCH v2 1/9] package/rust-bindgen: new host package Sebastian Weyer
2023-10-01 16:40   ` Thomas Petazzoni via buildroot
2023-07-25 17:30 ` [Buildroot] [PATCH v2 2/9] package/llvm-project/llvm: add llvm dump support Sebastian Weyer
2023-07-26 18:56   ` Daniel Lang
2023-10-01 16:40   ` Thomas Petazzoni via buildroot
2023-07-25 17:30 ` [Buildroot] [PATCH v2 3/9] package/pkg-meson.mk: add rust cross-compiler support Sebastian Weyer
2023-07-25 17:30 ` [Buildroot] [PATCH v2 4/9] package/spirv-headers: new package Sebastian Weyer
2023-10-01 16:50   ` Thomas Petazzoni via buildroot
2023-07-25 17:30 ` [Buildroot] [PATCH v2 5/9] package/spirv-tools: " Sebastian Weyer
2023-10-01 16:53   ` Thomas Petazzoni via buildroot
2023-07-25 17:30 ` [Buildroot] [PATCH v2 6/9] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Sebastian Weyer
2023-07-25 17:30 ` [Buildroot] [PATCH v2 7/9] package/opencl-headers: new package Sebastian Weyer
2023-07-25 17:31 ` [Buildroot] [PATCH v2 8/9] package/opencl-icd-loader: " Sebastian Weyer
2023-07-25 17:31 ` [Buildroot] [PATCH v2 9/9] package/mesa3d: add RustiCL support Sebastian Weyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.