optimize_gemm#
Performs internal optimizations for oneapi::mkl::sparse::gemm by analyzing the matrix structure.
Description and Assumptions
The oneapi::mkl::sparse::optimize_gemm routine analyzes matrix structure and performs optimizations. Optimized data is then stored in the handle.
In contrast to other optimization routines in Sparse BLAS domain
which are done solely based on the sparse matrix pattern,
two versions of the sparse::optimize_gemm
routine are provided for preparing different
optimizations for sparse::gemm
routine. In particular, if the shape
of the dense matrix right hand side, \(B\), is unknown or widely varying in
subsequent calls to sparse::gemm
then a user might reasonably
only wish to perform optimizations for :sparse::gemm
with respect
to the sparse matrix structure. However, if one or more particular shapes of \(B\)
is available, then each \(B\) shape can be provided as an additional hint
along with the sparse matrix pattern in the call to sparse::optimize_gemm
. This
second version of the API with \(B\) shape should be callable one or
more times and may allow libraries to provide more targeted performance
optimizations.
optimize_gemm (based on Sparse Matrix)#
Syntax
namespace oneapi::mkl::sparse {
sycl::event optimize_gemm (sycl::queue &queue,
oneapi::mkl::transpose transpose_A,
oneapi::mkl::sparse::matrix_handle_t A_handle,
const std::vector<sycl::event> &dependencies = {});
}
Input Parameters
- queue
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- transpose_A
Specifies operation
op()
on input matrix \(A\). The possible options are described in transpose enum class.- A_handle
Handle to object containing sparse matrix and other internal data. Created using the oneapi::mkl::sparse::set_csr_data routine.
- dependencies
List of events that oneapi::mkl::sparse::optimize_gemm routine depends on.
Output Parameters
- handle
Handle might be updated with some internal optimized data by this routine.
Throws
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
Return Values
Output event that can be waited upon or added as a dependency for the completion of optimize_gemm routine.
optimize_gemm (based on Both Input Matrices)#
Syntax
namespace oneapi::mkl::sparse {
sycl::event optimize_gemm (sycl::queue &queue,
oneapi::mkl::transpose transpose_A,
oneapi::mkl::transpose transpose_B,
oneapi::mkl::layout dense_matrix_layout,
const std::int64_t columns,
oneapi::mkl::sparse::matrix_handle_t A_handle,
const std::vector<sycl::event> &dependencies = {});
}
Input Parameters
- queue
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- transpose_A
Specifies operation
op()
on input matrix \(A\). The possible options are described in transpose enum class.- transpose_B
Specifies operation
op()
on input matrix \(B\). The possible options are described in transpose enum class.- dense_matrix_layout
Specifies the storage scheme in memory for the dense matrices. Note that this layout applies to both \(B\) and \(C\) dense matrices. The possible options are described in layout enum class.
- columns
Number of columns of matrix \(C\).
- handle
Handle to object containing sparse matrix and other internal data. Created using the oneapi::mkl::sparse::set_csr_data routine.
- dependencies
List of events that oneapi::mkl::sparse::optimize_gemm routine depends on.
Output Parameters
- handle
Handle might be updated with some internal optimized data by this routine.
Throws
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
Return Values
Output event that can be waited upon or added as a dependency for the completion of optimize_gemm routine.
Parent topic: Sparse BLAS