Sparse BLAS SYCL Functionality

Sparse BLAS SYCL Functionality#

The following tables summarize the current support of SYCL Sparse BLAS APIs in Intel oneAPI Math Kernel Library (oneMKL).

In the tables, we use these symbols for the sparse and dense objects in the operation descriptions:

  • scalar values = \(\alpha\), \(\beta\), \(d\),

  • dense vectors = \(x\), \(y\),

  • sparse vectors = \(xs\), \(ys\),

  • dense matrices = \(X\), \(Y\) and

  • sparse matrices = \(A\), \(B\), \(C\),

  • identity matrix = \(I\).

Some operations involve the upper/lower decomposition of a sparse matrix into \(A=L+D+U\) with strictly lower (\(L\)), diagonal (\(D\)), and strictly upper (\(U\)) parts of the sparse matrix, \(A\). The choice of which part of the data to use in the operation is controlled by the input parameters:

  • \(\text{uplo::lower}\) for selecting \((L+D)\) or \((L+I)\) for the operation

  • \(\text{uplo::upper}\) for selecting \((D+U)\) or \((I+U)\) for the operation

Some of the triangular operations permit you to ignore the main diagonal data in the sparse matrix and replace it, in the operation, with ones on the diagonal:

  • \(\text{diag::nonunit}\) uses \(D\) as provided in the data and

  • \(\text{diag::unit}\) ignores \(D\) and instead uses the identity, \(I\).

Finally, the \(\text{op}()\) operation represents one of three “transpose” operations:

  • \(\text{op}\left(A\right) = A\) when using \(\text{transpose::nontrans}\)

  • \(\text{op}\left(A\right) = A^{T}\) when using \(\text{transpose::trans}\)

  • \(\text{op}\left(A\right) = A^{H}\) when using \(\text{transpose::conjtrans}\).

Typically all are intended to be supported, but the actual support list and limitations are provided in each API’s individual description page.

Level 1#

Sparse BLAS operations involving a sparse vector and other vectors.

There are currently no SYCL Sparse BLAS APIs in oneMKL supporting sparse vectors or Sparse Level 1 operations.

Level 2#

Sparse BLAS operations involving a sparse matrix and vectors.

Common Name

SYCL API name with oneapi::mkl:: namespace

Operation

CSR support

COO support

SpMV

sparse::gemv()

\(y=\alpha\cdot\text{op}\left(A\right)\cdot x + \beta\cdot y\)

CPU/GPU

CPU/GPU

sparse::symv() + uplo::lower

\(y=\alpha\cdot\left(L+D+L^T\right)\cdot x + \beta\cdot y\)

CPU/GPU

None

sparse::symv() + uplo::upper

\(y=\alpha\cdot\left(U^T+D+U\right)\cdot x + \beta\cdot y\)

CPU/GPU

None

sparse::trmv() + uplo::lower + diag::nonunit

\(y=\alpha\cdot\text{op}\left(L+D\right)\cdot x + \beta\cdot y\)

CPU/GPU

CPU

sparse::trmv() + uplo::lower + diag::unit

\(y=\alpha\cdot\text{op}\left(L+I\right)\cdot x + \beta\cdot y\)

CPU/GPU

CPU

sparse::trmv() + uplo::upper + diag::nonunit

\(y=\alpha\cdot\text{op}\left(D+U\right)\cdot x + \beta\cdot y\)

CPU/GPU

CPU

sparse::trmv() + uplo::upper + diag::unit

\(y=\alpha\cdot\text{op}\left(I+U\right)\cdot x + \beta\cdot y\)

CPU/GPU

CPU

SpMV + dot fusion

sparse::gemvdot()

\(y=\alpha\cdot\text{op}\left(A\right)\cdot x + \beta\cdot y\) \(d=\text{dot}\left(y,x\right)\)

CPU/GPU

CPU

SpSV or SpTRSV

sparse::trsv() + uplo::lower + diag::nonunit

Solve for \(y\):

\(\text{op}\left(L+D\right)\cdot y = \alpha\cdot x\)

CPU/GPU

CPU

sparse::trsv() + uplo::lower + diag::unit

Solve for \(y\):

\(\text{op}\left(L+I\right)\cdot y = \alpha\cdot x\)

CPU/GPU

CPU

sparse::trsv() + uplo::upper + diag::nonunit

Solve for \(y\):

\(\text{op}\left(D+U\right)\cdot y = \alpha\cdot x\)

CPU/GPU

CPU

sparse::trsv() + uplo::upper + diag::unit

Solve for \(y\):

\(\text{op}\left(I+U\right)\cdot y = \alpha\cdot x\)

CPU/GPU

CPU

Level 3#

Sparse BLAS operations involving one or more sparse/dense matrices.

Common Name

SYCL API name with oneapi::mkl:: namespace

Operation

CSR support

COO support

SpMM (Dn <- Sp * Dn)

sparse::gemm()

\(Y=\alpha\cdot\text{op}\left(A\right)\cdot\text{op}(X) + \beta\cdot Y\)

CPU/GPU

CPU

SpSM or SpTRSM

sparse::trsm() + uplo::lower + diag::nonunit

Solve for \(Y\):

\(\text{op}\left(L+D\right)\cdot Y = \alpha\cdot\text{op}(X)\)

CPU/GPU

CPU

sparse::trsm() + uplo::lower + diag::unit

Solve for \(Y\):

\(\text{op}\left(L+I\right)\cdot Y = \alpha\cdot\text{op}(X)\)

CPU/GPU

CPU

sparse::trsm() + uplo::upper + diag::nonunit

Solve for \(Y\):

\(\text{op}\left(D+U\right)\cdot Y = \alpha\cdot\text{op}(X)\)

CPU/GPU

CPU

sparse::trsm() + uplo::upper + diag::unit

Solve for \(Y\):

\(\text{op}\left(I+U\right)\cdot Y = \alpha\cdot\text{op}(X)\)

CPU/GPU

CPU

SpGEAM (Sp <- Sp + Sp)

sparse::omatadd()

\(C=\alpha\cdot\text{op}\left(A\right) + \beta\cdot\text{op}\left(B\right)\)

CPU/GPU

None

SpGEMM (Sp <- Sp * Sp)

sparse::matmat()

\(C=\text{op}\left(A\right)\cdot\text{op}\left(B\right)\)

CPU/GPU

None

SpGEMMD (Dn <- Sp * Sp)

sparse::matmatd()

\(C=\alpha\cdot\text{op}\left(A\right)\cdot\text{op}\left(B\right) + \beta\cdot C\)

GPU

None

Auxiliary Functions#

Operations that can manipulate the sparse matrix handle.

Common Name

SYCL API name with oneapi::mkl:: namespace

Operation

CSR support

COO support

Sparse Copy or Sparse Matrix Transpose

sparse::omatcopy()

\(B=\text{op}\left(A\right)\)

CPU/GPU

CPU/GPU

Sparse Matrix Conversion

sparse::omatconvert()

\(B=\text{convert}\left(A\right)\), where \(B\) and \(A\) are represented using different sparse matrix formats

CPU/GPU

CPU/GPU

Sparse Matrix Sort

sparse::sort_matrix()

\(A=\text{sort}\left(A\right)\) by natural ordering for the sparse matrix format

CPU/GPU

None (see note below)

Update Matrix Main Diagonal

sparse::update_diagonal_data()

update \(A\) in-place with new provided diagonal values, \(D\)

GPU

None

Note

COO format does not have a natural sparse ordering. It could be SortInRows, which is the natural ordering for the CSR format with column index sorted within each row, or it could be SortInColumns, which is the natural ordering for the CSC format with row index sorted within each column. A new API or overload for specifying which ordering to use for COO format will be provided in the future.