PerfXLab is committed to accelerating the development of basic software for computing. Help the industry get rid of proprietary programming models, achieve efficient and agile development of accelerated computing, and realize the value of all innovative computing hardware. The R&D team also continues to invest resources in RISC-V software ecology, with the goal of building a heterogeneous computing software stack full stack solution for RISC-V system (from mathematical computing library, heterogeneous computing framework to scientific computing software).
Recently, PerfXLab implemented OpenCL 3.0 on RISC-V platform.
![](././../../images_dir/1667958332/1.png)
> OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators.[1]
![](././../../images_dir/1667958401/2.png)
As the first open, free, united, and unified programming standard of heterogeneous parallel platforms in HPC(High-Performance Computing), OpenCL is supported by many hardware manufacturers[2]. OpenCL can accelerate algorithm implementations in heterogeneous systems that lack GPU..
The latest PoCL3.0 implemented a minimized OpenCL3.0. OpenCL3.0 is not only backward compatible but brings many features[3], such as:
+ Support for asynchronous DMA translation + Support for SPIR-V IR + Support for most features of C++17 in kernel + ...... **
PoCL
**
(Portable Computing Language) is an open-source implementation of OpenCL. It aims at implementing both portability and performance portability. Performance Portability means avoiding writing repeat OpenCL codes to prevent the performance differences caused by the underly differences in heterogeneous accelerating devices. And PoCL3.0 enjoys the optimization ability brought from LLVM14 by using LLVM14 as the kernel compiler, such as[4]:
+ Support for various RISC-V vector extensions upgraded to version 1.0 and now stabled + Support for auto-vectorization for AArch64 + Support for limited FP intrinsics for scalar types in RISC-V + ...... **
RISC-V
**
is in the limelight in RISC ISA for its openness, freedom, flexibility, rapidness, low power consumption, and modularity, and is valued in many fields. More and more engineers are considering the use of RISC-V in HPC. However, there is no one directly supports RISC-V among many open-source implementations of OpenCL.
> There's no official support for RISC-V[5]. And errors may occur if cross-compiling directly. The former has added a pipeline for RISC-V and supports for Newlib and Vortex[6][7]. However, this work is too far back and not maintained. This work only supports PoCL1.5 and LLVM10, which cannot take advantage of the convenience of OpenCL3.0 and the optimization ability of vectorization support of LLVM14. **
PerfXLab
**
has modified the original PoCL sources so that the embedded engineers can build and run smoothly without compiling errors. Now RISC-V boards can also run OpenCL3.0 and enjoy the benefits of OpenCL3.0 and LLVM.
We forked the original PoCL repository and checkout a risc-v branch, which fixed some bugs and adjusted specially for cross-compiling. All the modifies are in that branch:
[https://github.com/PerfXLab/pocl/tree/risc-v](https://github.com/PerfXLab/pocl/tree/risc-v "https://github.com/PerfXLab/pocl/tree/risc-v")
Specific methods can be supported on the official website of www.rvboards.org. Screenshot of operation effect:
![](././../../images_dir/1667958829/3.png) ![](././../../images_dir/1667958847/4.png)
**
Conclusion:
**
It is just the first step to port PoCL to RISC-V, and there are many points to research: What's the acceleration effect of PoCL on RISC-V CPU? How does it support RVV? What's the performance improvement on the RISC-V platform without the "V" extension?...
Relevant reference links are as follows: [1] https://zh.m.wikipedia.org/zh-hans/OpenCL [2] https://www.khronos.org/conformance/adopters/conformant-products#opencl [3] https://cn.khronos.org/news/press/opencl-3.0-release [4] https://releases.llvm.org/14.0.0/docs/ReleaseNotes.html [5] https://github.com/pocl/pocl/issues/790 [6] https://github.com/vortexgpgpu/pocl [7] Blaise, Tine, Seyong Lee, Jeff Vetter, and Hyesoon Kim. “Bringing OpenCL to Commodity RISC-V CPUs,” 2017, 7. [8] https://github.com/pocl/pocl/issues/840 [opencl] https://www.khronos.org/opencl [llvm] https://llvm.org/ [pocl] http://portablecl.org/ [riscv] https://riscv.org/ [pocl3.0] http://portablecl.org/pocl-3.0.html [spirv] https://www.khronos.org/spir/ [newlib] https://sourceware.org/newlib/ [vortex] https://vortex.cc.gatech.edu/ [perfxlab] https://perfxlab.cn/ [poclcode] https://github.com/pocl/pocl [pocldoc] http://portablecl.org/docs/html/install.html --- ![](././../../images_dir/1632828056/1.png)