Mesa 25.0 Introduces Standard Library For Driver OpenCL C

Written by Michael Larabel in Mesa on 14 December 2024 at 08:50 AM EST. 5 Comments
MESA
An interesting addition to Mesa 25.0 this week is Alyssa Rosenzweig adding a standard library for the driver OpenCL C code, including the initial abbility to support assert() on device and other standard C constructs for the OpenCL C code.

Alyssa Rosenzweig explained in the recently landed merge request for Mesa 25.0:
"Now that we have common code for precompiling driver CL C to hw binaries, the fundamentals are there for implementing driver code on CL. However, that infrastructure is still pretty barebones. This MR adds lots of common code providing a standard library for driver CL C, including lots of standard C constructs available in host C but not out-of-the-box in application CL:

abort
static_assert
assert
assorted routines ported from util/macros.h, math.h, etc

The combination of printf, abort, and assert facilitate debugging driver CL. If correctly integrated (as done here for Honeykrisp), these all work anywhere in the driver CL library - both precompiled shaders and library functions injected into application shaders."

This is good news for the Honeykrisp driver effort for Apple Silicon as part of the Asahi Linux project as well as for other Mesa open-source drivers.

Code example


Those interested in more details on this standard library implementation for driver OpenCL C code can see this merge request that was merged to Mesa 25.0-devel on Friday.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week