-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARSE] Add support for rocSPARSE backend #544
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,31 @@ Currently known limitations: | |
``cusparseSpMV_preprocess``. Feel free to create an issue if this is needed. | ||
|
||
|
||
rocSPARSE backend | ||
---------------- | ||
|
||
Currently known limitations: | ||
|
||
- Using ``spmv`` with a ``type_view`` other than ``matrix_descr::general`` will | ||
throw a ``oneapi::mkl::unimplemented`` exception. | ||
- The COO format requires the indices to be sorted by row then by column. See | ||
the `rocSPARSE COO documentation | ||
<https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/how-to/basics.html#coo-storage-format>`_. | ||
Sparse operations using matrices with the COO format without the property | ||
``matrix_property::sorted`` will throw a ``oneapi::mkl::unimplemented`` | ||
exception. | ||
- The CSR format requires the column indices to be sorted within each row. See | ||
the `rocSPARSE CSR documentation | ||
<https://rocm.docs.amd.com/projects/rocSPARSE/en/latest/how-to/basics.html#csr-storage-format>`_. | ||
Sparse operations using matrices with the CSR format without the property | ||
``matrix_property::sorted`` will throw a ``oneapi::mkl::unimplemented`` | ||
exception. | ||
- The same sparse matrix handle cannot be reused for multiple operations | ||
``spmm``, ``spmv``, or ``spsv``. Doing so will throw a | ||
``oneapi::mkl::unimplemented`` exception. See `#332 | ||
<https://github.com/ROCm/rocSPARSE/issues/332>`_. | ||
Comment on lines
+90
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, this is quite severe, but seems to be a legitimate issue on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If and when they fix this issue, though, will it be easy for us to make changes (with a version check of course) that correctly performs the operations rather than throwing an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's easy to fix on oneMath side. The issue is also referenced in this comment: https://github.com/oneapi-src/oneMKL/pull/544/files#diff-3b8c1c2c71abd54f8f90f43415c2f17b2a7fdb81c2b882c210f3cba56b4679adR63 |
||
|
||
|
||
Operation algorithms mapping | ||
---------------------------- | ||
|
||
|
@@ -89,33 +114,43 @@ spmm | |
* - ``spmm_alg`` value | ||
- MKLCPU/MKLGPU | ||
- cuSPARSE | ||
- rocSPARSE | ||
* - ``default_alg`` | ||
- none | ||
- ``CUSPARSE_SPMM_ALG_DEFAULT`` | ||
- ``rocsparse_spmm_alg_default`` | ||
* - ``no_optimize_alg`` | ||
- none | ||
- ``CUSPARSE_SPMM_ALG_DEFAULT`` | ||
- ``rocsparse_spmm_alg_default`` | ||
* - ``coo_alg1`` | ||
- none | ||
- ``CUSPARSE_SPMM_COO_ALG1`` | ||
- ``rocsparse_spmm_alg_coo_segmented`` | ||
* - ``coo_alg2`` | ||
- none | ||
- ``CUSPARSE_SPMM_COO_ALG2`` | ||
- ``rocsparse_spmm_alg_coo_atomic`` | ||
* - ``coo_alg3`` | ||
- none | ||
- ``CUSPARSE_SPMM_COO_ALG3`` | ||
- ``rocsparse_spmm_alg_coo_segmented_atomic`` | ||
* - ``coo_alg4`` | ||
- none | ||
- ``CUSPARSE_SPMM_COO_ALG4`` | ||
- ``rocsparse_spmm_alg_default`` | ||
* - ``csr_alg1`` | ||
- none | ||
- ``CUSPARSE_SPMM_CSR_ALG1`` | ||
- ``rocsparse_spmm_alg_csr`` | ||
* - ``csr_alg2`` | ||
- none | ||
- ``CUSPARSE_SPMM_CSR_ALG2`` | ||
- ``rocsparse_spmm_alg_csr_row_split`` | ||
* - ``csr_alg3`` | ||
- none | ||
- ``CUSPARSE_SPMM_CSR_ALG3`` | ||
- ``rocsparse_spmm_alg_csr_merge`` | ||
|
||
|
||
spmv | ||
|
@@ -128,27 +163,35 @@ spmv | |
* - ``spmv_alg`` value | ||
- MKLCPU/MKLGPU | ||
- cuSPARSE | ||
- rocSPARSE | ||
* - ``default_alg`` | ||
- none | ||
- ``CUSPARSE_SPMV_ALG_DEFAULT`` | ||
- ``rocsparse_spmv_alg_default`` | ||
* - ``no_optimize_alg`` | ||
- none | ||
- ``CUSPARSE_SPMV_ALG_DEFAULT`` | ||
- ``rocsparse_spmv_alg_default`` | ||
* - ``coo_alg1`` | ||
- none | ||
- ``CUSPARSE_SPMV_COO_ALG1`` | ||
- ``rocsparse_spmv_alg_coo`` | ||
* - ``coo_alg2`` | ||
- none | ||
- ``CUSPARSE_SPMV_COO_ALG2`` | ||
- ``rocsparse_spmv_alg_coo_atomic`` | ||
* - ``csr_alg1`` | ||
- none | ||
- ``CUSPARSE_SPMV_CSR_ALG1`` | ||
- ``rocsparse_spmv_alg_csr_adaptive`` | ||
* - ``csr_alg2`` | ||
- none | ||
- ``CUSPARSE_SPMV_CSR_ALG2`` | ||
- ``rocsparse_spmv_alg_csr_stream`` | ||
* - ``csr_alg3`` | ||
- none | ||
- ``CUSPARSE_SPMV_ALG_DEFAULT`` | ||
- ``rocsparse_spmv_alg_csr_lrb`` | ||
|
||
|
||
spsv | ||
|
@@ -161,9 +204,12 @@ spsv | |
* - ``spsv_alg`` value | ||
- MKLCPU/MKLGPU | ||
- cuSPARSE | ||
- rocSPARSE | ||
* - ``default_alg`` | ||
- none | ||
- ``CUSPARSE_SPSV_ALG_DEFAULT`` | ||
- ``rocsparse_spsv_alg_default`` | ||
* - ``no_optimize_alg`` | ||
- none | ||
- ``CUSPARSE_SPSV_ALG_DEFAULT`` | ||
- ``rocsparse_spsv_alg_default`` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*************************************************************************** | ||
* Copyright (C) Codeplay Software Limited | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* For your convenience, a copy of the License has been included in this | ||
* repository. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
|
||
#ifndef _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_ONEMKL_SPARSE_BLAS_ROCSPARSE_HPP_ | ||
#define _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_ONEMKL_SPARSE_BLAS_ROCSPARSE_HPP_ | ||
|
||
#include "oneapi/mkl/detail/export.hpp" | ||
#include "oneapi/mkl/sparse_blas/detail/helper_types.hpp" | ||
#include "oneapi/mkl/sparse_blas/types.hpp" | ||
|
||
namespace oneapi::mkl::sparse::rocsparse { | ||
|
||
#include "oneapi/mkl/sparse_blas/detail/onemkl_sparse_blas_backends.hxx" | ||
|
||
} // namespace oneapi::mkl::sparse::rocsparse | ||
|
||
#endif // _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_ONEMKL_SPARSE_BLAS_ROCSPARSE_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
* Copyright (C) Codeplay Software Limited | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* For your convenience, a copy of the License has been included in this | ||
* repository. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
|
||
#ifndef _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_SPARSE_BLAS_CT_HPP_ | ||
#define _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_SPARSE_BLAS_CT_HPP_ | ||
|
||
#include "oneapi/mkl/detail/backends.hpp" | ||
#include "oneapi/mkl/detail/backend_selector.hpp" | ||
|
||
#include "onemkl_sparse_blas_rocsparse.hpp" | ||
|
||
namespace oneapi { | ||
namespace mkl { | ||
namespace sparse { | ||
|
||
#define BACKEND rocsparse | ||
#include "oneapi/mkl/sparse_blas/detail/sparse_blas_ct.hxx" | ||
#undef BACKEND | ||
|
||
} //namespace sparse | ||
} //namespace mkl | ||
} //namespace oneapi | ||
|
||
#endif // _ONEMKL_SPARSE_BLAS_DETAIL_ROCSPARSE_SPARSE_BLAS_CT_HPP_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add rocSPARSE version info in the table later in this README file in the table in the Product and Version Information section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that, done in dc22051