El Mehdi YOUNES fc7c7d74aa package/mesa3d: add RustiCL support
RustiCL is an OpenCL implementation written entirely in
RUST and integrated into Mesa3D. It enables the use of OpenCL
programs on top of existing Gallium drivers. RustiCL is a
modern and maintainable replacement for the old C-implemention
Clover.

To build Rusticl in Mesa3D, the following components are required:

  - host-rustc (Rust compiler)
  - host-rust-bindgen (for generating bindings)
  - spirv-tools
  - spirv-llvm-translator (providing libLLVMSPIRVLib.so matching the LLVM version)
  - LLVM built with libclc and -DLLVM_ENABLE_DUMP=ON
  - Mesa headers via mesa-clc-bundle-headers=enabled
  - There is a known meson bug and in order to fix it we set -Drust_std=2021, see:
    https://docs.mesa3d.org/rusticl.html#known-issues
    https://github.com/mesonbuild/meson/issues/10664

More details in the Mesa documentation:
https://docs.mesa3d.org/rusticl.html

Rusticl is the provider of OpenCL in Buildroot.
However, Mesa does not provide the `libOpenCL.so` library itself.
We therefore depend on the `opencl-icd-loader` package to
install this loader in the toolchain sysroot, so that other
OpenCL-dependent packages can build and link against it.

Without the ICD loader, only `libRustiOpenCL.so` is available and
tools like `clinfo` or `clpeak` fail.

- 'Dmesa-clc-bundle-headers=enabled' ensures that the OpenCL header
   files are bundled and available in the target. Without this,
   runtime compilation of OpenCL kernels via clpeak or clinfo fails
   with:
	fatal error: 'opencl-c-base.h' file not found

see 3619611b31

We add a Rust compiler override to Meson to use Buildroot’s
host Rust toolchain using MESA3D_MESON_EXTRA_BINARIES.
Rusticl requires Meson to invoke rustc with the correct target and linker:
    * 'rust=['$(HOST_DIR)/bin/rustc','--target=$(RUSTC_TARGET_NAME)']'
    * 'rust_ld='$(TARGET_CROSS)gcc''
Another solution was proposed to set rust and rust_ld globally in
cross-compilation.conf, we prefer to define them locally within mesa
for now to ensure precise control over the rust toolchain behavior
during the Mesa build.

see https://lore.kernel.org/buildroot/ZcOeEMfwX4XlRXO7@landeda/

Currently, we should always use RUSTICL_ENABLE= driver to use rusticl.
More information:
https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE

Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
[Julien: add references to meson bug]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-06-07 22:47:25 +02:00
2025-05-30 21:31:37 +02:00
2025-06-06 19:54:40 +02:00
2025-01-15 21:30:31 +01:00
2025-05-19 12:33:23 +02:00
2025-06-06 19:54:40 +02:00
2025-05-19 12:33:23 +02:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches
Description
No description provided
Readme 206 MiB
Languages
Makefile 62.5%
Python 19%
C 8.5%
Shell 6.1%
PHP 1.4%
Other 2.1%