SYCL


SYCL is a higher-level programming model for OpenCL as a single-source domain specific embedded language based on pure C++11 for SYCL 1.2.1 to improve programming productivity. This is a standard developed by Khronos Group, announced in March 2014.

Purpose

SYCL is a royalty-free, cross-platform abstraction layer that builds on the underlying concepts, portability and efficiency of OpenCL that enables code for heterogeneous processors to be written in a “single-source” style using completely standard C++. SYCL enables single source development where C++ template functions can contain both host and device code to construct complex algorithms that use OpenCL acceleration, and then re-use them throughout their source code on different types of data.
While originally developed for use with OpenCL and SPIR, it is actually a more general heterogeneous framework able to target other systems. For example, the hipSYCL implementation targets CUDA. While the SYCL standard started as the higher-level programming model sub-group of the OpenCL working group, it is a Khronos Group workgroup independent from the OpenCL working group since September 20, 2019.

Versions

The latest version is SYCL 1.2.1 revision 7 which was published on April 27, 2020.
SYCL was introduced at GDC in March 2014 with
provisional version 1.2, then the SYCL 1.2 final version was
introduced at IWOCL 2015 in May 2015.
SYCL 2.2 provisional was introduced at IWOCL 2016 in May 2016 targeting C++14 and OpenCL 2.2. But the SYCL committee preferred not to finalize this version and is working on a more flexible SYCL specification to address the increasing diversity of current accelerators, including artificial-intelligence engines.
The public version is:
The following example shows the single-source pure C++ programming model defining an implicit task graph of 3 kernels running on a default accelerator.

  1. include
  2. include
// Declare some types just to give names to compute kernels
class init_a;
class init_b;
class matrix_add;
using namespace cl::sycl;
// Size of the matrices
constexpr size_t N = 2000;
constexpr size_t M = 3000;
int main

Tutorials

There are a few tutorials in the ComputeCpp SYCL guides.

Comparison with other APIs

The open standards SYCL and OpenCL are similar to vendor-specific CUDA from Nvidia.
In the Khronos Group realm, OpenCL is the low-level non-single source API and SYCL is the high-level single-source C++ domain-specific embedded language.
By comparison, the single-source C++ domain-specific embedded language version of CUDA, which is actually named "CUDA Runtime API", is somehow similar to SYCL.
But there is actually a less known non single-source version of CUDA which is called "CUDA Driver API", similar to OpenCL, and used for example by the CUDA Runtime API implementation itself.
SYCL extends the C++ AMP features relieving the programmer from explicitly transferring the data between the host and devices, by opposition to CUDA.
SYCL is higher-level than C++ AMP and CUDA since you do not need building an explicit dependency graph between all the kernels, and
provides you automatic asynchronous scheduling of the kernels with communication and computation overlap. This is
all done by using the concept of accessors, without requiring any compiler support.
Unlike C++ AMP and CUDA, SYCL is a pure C++ DSEL without any C++ extension, allowing some basic CPU implementation relying on pure runtime without any specific compiler. This is very useful for debugging application or to prototype for a new architecture without having the architecture and compiler available yet.
The hipSYCL implementation adds SYCL higher-level programming to CUDA.