Red Hat’s Karol Herbst, who is involved in the development of Mesa, the Nouveau driver, and the OpenCL open stack, has published rusticl , an experimental software implementation of OpenCL (OpenCL frontend) for Mesa written in Rust. Rusticl acts as an analogue of the frontend already present in Mesa OpenCL Clover and is also developed using the interface provided in Mesa Gallium .
The development was presented on September 17 at the conference XDC 2021 (X.Org Developers Conference). The goal of the development was to study Rust, work out the best ways to integrate Rust into Mesa, try out creating API implementations in another language, and test the compatibility of Rust components with the rest of the C code. Development is not yet fully completed – CL CTS tests related to copying, reading and writing buffers are already successfully running, but compiler integration is not yet provided and there is no support for external crate packages in the build system. To generate bindings for Mesa and OpenCL, allowing cause Rust-functions in C code and vice versa, is involved rust-bindgen .
Recall that a year ago, the Mesa developers already discussed the advisability of using the Rust language. Among the advantages of supporting Rust, they mentioned an increase in the safety and quality of drivers by getting rid of typical problems when working with memory, as well as the possibility of including third-party developments such as into Mesa Kazan (Vulkan implementation in Rust) . Among the shortcomings, it is noted the complication of the build system, the unwillingness to bind to the cargo package system, the expansion of the requirements for the build environment and the need to include the Rust compiler in the build dependencies, which are required to build the key components of the Linux desktop.