oneAPI-spec
oneAPI-spec copied to clipboard
[oneMKL][Sparse BLAS] Add matrix sorting API to oneMKL Specification
The sparse BLAS domain currently supports unsorted arrays in its sparse matrix handles. However, for some APIs to have good performance or for supporting certain algorithms in the future, having sorted data in the matrix handles is essential. Some examples:
- COO format: without at least partially sorted data, algorithms even for basic APIs must resort to atomics for parallelization, or have multiple passes over the sparse matrix, neither of which are performant
- Sparse + sparse = sparse matrix addition (not currently in oneAPI spec, but may be in the future) should be very performant with sorted data (simply merging two sorted arrays to get a sorted array, O(m+n) complexity) compared to unsorted case (e.g., requires extra O(n) space for hash algorithm leading to unsorted output matrix).
This is a tracker for adding a sorting API to the sparse BLAS domain in the oneMKL Specification. A starting point in this direction may be Intel oneMKL's oneapi::mkl::sort_matrix()
API:
namespace oneapi::mkl::sparse {
sycl::event sort_matrix (sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t spMat,
const std::vector<sycl::event> &dependencies = {});
}