Re: [eigen] Eigen to use OpenCL on GPUs and FPGAs using SYCL.

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Adding support for OpenCL/SYCL to the tensor module would make a number of people very happy as it would enable them to use tensors on a much broader set of GPUs. However I am not aware of any existing effort to work on this, so your contribution would be very welcome.

The main problem with OpenCL is that the computation kernel and the host code must be in separate files. Since SYCL supports having both in a single source file it's a much better fit for Eigen.  

The best way to start is to look at the GPUDevice class (it really should be called CudaDevice though since it only supports CUDA). It provides a simple abstraction on top of cuda streams to launch kernels. It also implements an API common to all the devices to handle basic operations such as memory allocation and memcpy. You'll need to create a SYCL device that provides a similar service for OpenCL.

The second step would be to create a specialization of TensorExecutor for your SYCL device. The job of the tensor executor is to schedule and launch the computation on the target device. The executor for a GPU Device simply shards the computation over the streaming multipprocessors of a CUDA GPU.

With these 2 components in place the entire tensor module should work. However the performance of some operations (such as the contractions) will be disappointing. If that's a problem, I can help you write an optimized implementation of contractions for OpenCL, probably following the approach from TensorContractionCuda.h


On Wed, Sep 2, 2015 at 6:37 AM, Luke Iwanski <luke@xxxxxxxxxxxx> wrote:
Hi all,

We at Codeplay would like to port Eigen to use OpenCL for acceleration on GPUs and FPGAs by using the SYCL open standard for C++ on OpenCL. The design of the SYCL standard should integrate quite easily with Eigen as it supports C++ template metaprogramming for offloading to accelerators.

Our plan currently is to start by porting tensor to use SYCL on top of OpenCL.

Is anyone looking into porting tensor or any other parts of Eigen to OpenCL? Is there interest in a SYCL approach? And if so, any advice on where we should start?

Thanks,
Luke





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/