A new implementation of OpenCL (rusticl) developed for the Mesa project, written in Rust, has successfully passed the CTS (Kronos Conformance Test Suite) test suite used by the Khronos consortium to assess compatibility with the OpenCL 3.0 specifications. The project is being developed by Karol Herbst of Red Hat, who is involved in the development of Mesa, the Nouveau driver, and the OpenCL open stack. It is noted that Carol contacted Khronos for official certification of support for OpenCL 3.0 in rusticl.
Tests performed on a system with 12 generation Intel GPUs (Alder Lake). The work was done using the Iris Mesa driver, but the project should work with other Mesa drivers that use the untyped intermediate representation (IR) of NIR shaders. The request to merge Rusticl with Mesa is still pending and no decision has yet been made to include the Rust language code in Mesa. Before Rusticl is accepted into the main composition of Mesa, a separate branch can be used for assembly, when compiling which, the build parameters "-Dgallium-rusticl=true -Dopencl-spirv=true -Dshader-cache=true -Dllvm=true" should be specified.
Rusticl acts as a counterpart to Mesa's OpenCL Clover frontend and is also developed using Mesa's Gallium interface. The Clover stake has long been in a derelict state and rusticl is positioned as its future replacement. In addition to achieving compatibility with OpenCL 3.0, the Rusticl project differs from Clover in supporting OpenCL extensions for image processing, but does not yet support the FP16 format.
Rusticl uses rust-bindgen to generate bindings for Mesa and OpenCL, allowing Rust functions to be called from C code and vice versa. The possibility of using the Rust language in the Mesa project has been discussed since 2020. Among the advantages of supporting Rust are increased driver security and quality due to the elimination of common memory issues, as well as the ability to incorporate third-party developments into Mesa, such as Kazan (a Rust implementation of Vulkan). Disadvantages include increased build system complexity, a reluctance to rely on the cargo packaging system, expanded build environment requirements, and the need to include the Rust compiler in build dependencies required for building key desktop components. Linux.
Source: opennet.ru
