OpenCL Shared Virtual Memory Comes To Mesa's Rusticl Driver

Written by Michael Larabel in Mesa on 14 April 2023 at 08:00 AM EDT. 9 Comments
MESA
Mesa 23.1 enables RadeonSI Rusticl support while for next quarter's Mesa 23.2, which just started development, there is already a big ticket item for Rusticl: Shared Virtual Memory (SVM) support.

Shared Virtual Memory that was added in OpenCL 2.0 allows for the host and GPU device to easily share pointers and other pointer-based data structures. SVM's shared virtual address space also lays out requirements around coherent access, synchronization, and other functionality that opens up OpenCL for more use cases.

Rusticl developer Karol Herbst at Red Hat has maintained a Mesa merge request for four months to provide fine-grained system SVM support while that code was merged overnight into the newly-started Mesa 23.2-devel cycle.

Karol noted it's working mostly fine for the Nouveau Gallium3D driver besides hitting driver bugs. SVM support in Rusticl also reduces one less feature that was currently an advantage of the older but unmaintained Gallium3D Clover state tracker.

Rusticl SVM


Karol further explained in the commit enabling SVM for Rusticl:
At the moment it's an all or nothing. A driver supporting fine-grained system SVM can enable it in order to get full SVM support.

Lower levels could be emulated by userptrs and placing the bo at the same locations in the GPU's VM as well, but that would require reworking quite a bit on the drivers side.

For now supporting mmu_notifiers on the kernel side is the only way of getting SVM support with Rusticl.

The only driver having the gallium bits wired up atm is Nouveau, but I suspect it shouldn't be all to hard for iris and radeonsi as well.

See this merge request if interested in more details on this thousand lines of new code.
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