From c6d724625ef2339fa992753ddfb3a76785bad5ff Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Tue, 2 Jan 2024 17:55:48 +0000 Subject: [PATCH] [HIPIFY][#674][rocSPARSE][6.0.0][feature] rocSPARSE support - Step 83 - Functions (SpMat) + Added new const `SpMat` functions + Marked some const `SpMat` functions as `CHANGED` due to ABI breakage + Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation --- bin/hipify-perl | 3 + .../CUSPARSE_API_supported_by_HIP_and_ROC.md | 16 ++-- docs/tables/CUSPARSE_API_supported_by_ROC.md | 16 ++-- src/CUDA2HIP_SPARSE_API_functions.cpp | 14 ++- .../synthetic/libraries/cusparse2hipsparse.cu | 5 - .../synthetic/libraries/cusparse2rocsparse.cu | 91 ++++++++++++++----- 6 files changed, 100 insertions(+), 45 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index d39721f9..8c9e78d2 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -2326,8 +2326,11 @@ sub rocSubstitutions { subst("cusparseChybmv", "rocsparse_chybmv", "library"); subst("cusparseCnnz", "rocsparse_cnnz", "library"); subst("cusparseCnnz_compress", "rocsparse_cnnz_compress", "library"); + subst("cusparseConstBlockedEllGet", "rocsparse_const_bell_get", "library"); subst("cusparseConstCooGet", "rocsparse_const_coo_get", "library"); + subst("cusparseConstCscGet", "rocsparse_const_csc_get", "library"); subst("cusparseConstCsrGet", "rocsparse_const_csr_get", "library"); + subst("cusparseConstSpMatGetValues", "rocsparse_const_spmat_get_values", "library"); subst("cusparseConstSpVecGet", "rocsparse_const_spvec_get", "library"); subst("cusparseConstSpVecGetValues", "rocsparse_const_spvec_get_values", "library"); subst("cusparseCooAoSGet", "rocsparse_coo_aos_get", "library"); diff --git a/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md b/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md index bda3bf00..a51e8528 100644 --- a/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md @@ -801,15 +801,15 @@ |`cusparseAxpby`|11.0| |12.0| |`hipsparseAxpby`|4.1.0| |6.0.0| | |`rocsparse_axpby`|4.1.0| | | | | |`cusparseBlockedEllGet`|11.2| | | |`hipsparseBlockedEllGet`|4.5.0| | | | |`rocsparse_bell_get`|4.1.0| | | | | |`cusparseBsrSetStridedBatch`|12.1| | | | | | | | | | | | | | | | -|`cusparseConstBlockedEllGet`|12.0| | | |`hipsparseConstBlockedEllGet`|6.0.0| | | | | | | | | | | +|`cusparseConstBlockedEllGet`|12.0| | | |`hipsparseConstBlockedEllGet`|6.0.0| | | | |`rocsparse_const_bell_get`|6.0.0| | | | | |`cusparseConstCooGet`|12.0| | | |`hipsparseConstCooGet`|6.0.0| | | | |`rocsparse_const_coo_get`|6.0.0| | | | | -|`cusparseConstCscGet`|12.0| | | | | | | | | | | | | | | | +|`cusparseConstCscGet`|12.0| | | | | | | | | |`rocsparse_const_csc_get`|6.0.0| | | | | |`cusparseConstCsrGet`|12.0| | | |`hipsparseConstCsrGet`|6.0.0| | | | |`rocsparse_const_csr_get`|6.0.0| | | | | |`cusparseConstDnMatGet`|12.0| | | |`hipsparseConstDnMatGet`|6.0.0| | | | | | | | | | | |`cusparseConstDnMatGetValues`|12.0| | | |`hipsparseConstDnMatGetValues`|6.0.0| | | | | | | | | | | |`cusparseConstDnVecGet`|12.0| | | |`hipsparseConstDnVecGet`|6.0.0| | | | | | | | | | | |`cusparseConstDnVecGetValues`|12.0| | | |`hipsparseConstDnVecGetValues`|6.0.0| | | | | | | | | | | -|`cusparseConstSpMatGetValues`|12.0| | | |`hipsparseConstSpMatGetValues`|6.0.0| | | | | | | | | | | +|`cusparseConstSpMatGetValues`|12.0| | | |`hipsparseConstSpMatGetValues`|6.0.0| | | | |`rocsparse_const_spmat_get_values`|6.0.0| | | | | |`cusparseConstSpVecGet`|12.0| | | |`hipsparseConstSpVecGet`|6.0.0| | | | |`rocsparse_const_spvec_get`|6.0.0| | | | | |`cusparseConstSpVecGetValues`|12.0| | | |`hipsparseConstSpVecGetValues`|6.0.0| | | | |`rocsparse_const_spvec_get_values`|6.0.0| | | | | |`cusparseConstrainedGeMM`|10.2|11.2| |12.0| | | | | | | | | | | | | @@ -882,12 +882,12 @@ |`cusparseSpMM_preprocess`|11.2| |12.0| |`hipsparseSpMM_preprocess`|4.5.0| |6.0.0| | | | | | | | | |`cusparseSpMV`|10.2| |12.0| |`hipsparseSpMV`|4.1.0| |6.0.0| | |`rocsparse_spmv`|4.1.0| | | | | |`cusparseSpMV_bufferSize`|10.2| |12.0| |`hipsparseSpMV_bufferSize`|4.1.0| |6.0.0| | | | | | | | | -|`cusparseSpMatGetAttribute`|11.3| |12.0| |`hipsparseSpMatGetAttribute`|4.5.0| |6.0.0| | |`rocsparse_spmat_get_attribute`|4.5.0| | | | | -|`cusparseSpMatGetFormat`|10.1| |12.0| |`hipsparseSpMatGetFormat`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_format`|4.1.0| | | | | -|`cusparseSpMatGetIndexBase`|10.1| |12.0| |`hipsparseSpMatGetIndexBase`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_index_base`|4.1.0| | | | | +|`cusparseSpMatGetAttribute`|11.3| |12.0| |`hipsparseSpMatGetAttribute`|4.5.0| |6.0.0| | |`rocsparse_spmat_get_attribute`|4.5.0| |6.0.0| | | +|`cusparseSpMatGetFormat`|10.1| |12.0| |`hipsparseSpMatGetFormat`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_format`|4.1.0| |6.0.0| | | +|`cusparseSpMatGetIndexBase`|10.1| |12.0| |`hipsparseSpMatGetIndexBase`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_index_base`|4.1.0| |6.0.0| | | |`cusparseSpMatGetNumBatches`|10.1| | |10.2| | | | | | | | | | | | | -|`cusparseSpMatGetSize`|11.0| |12.0| |`hipsparseSpMatGetSize`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_size`|4.1.0| | | | | -|`cusparseSpMatGetStridedBatch`|10.2| |12.0| |`hipsparseSpMatGetStridedBatch`|5.2.0| |6.0.0| | |`rocsparse_spmat_get_strided_batch`|5.2.0| | | | | +|`cusparseSpMatGetSize`|11.0| |12.0| |`hipsparseSpMatGetSize`|4.1.0| |6.0.0| | |`rocsparse_spmat_get_size`|4.1.0| |6.0.0| | | +|`cusparseSpMatGetStridedBatch`|10.2| |12.0| |`hipsparseSpMatGetStridedBatch`|5.2.0| |6.0.0| | |`rocsparse_spmat_get_strided_batch`|5.2.0| |6.0.0| | | |`cusparseSpMatGetValues`|10.2| | | |`hipsparseSpMatGetValues`|4.1.0| | | | |`rocsparse_spmat_get_values`|4.1.0| | | | | |`cusparseSpMatSetAttribute`|11.3| | | |`hipsparseSpMatSetAttribute`|4.5.0| | | | |`rocsparse_spmat_set_attribute`|4.5.0| | | | | |`cusparseSpMatSetNumBatches`|10.1| | |10.2| | | | | | | | | | | | | diff --git a/docs/tables/CUSPARSE_API_supported_by_ROC.md b/docs/tables/CUSPARSE_API_supported_by_ROC.md index 021300f8..31ce17b7 100644 --- a/docs/tables/CUSPARSE_API_supported_by_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_ROC.md @@ -801,15 +801,15 @@ |`cusparseAxpby`|11.0| |12.0| |`rocsparse_axpby`|4.1.0| | | | | |`cusparseBlockedEllGet`|11.2| | | |`rocsparse_bell_get`|4.1.0| | | | | |`cusparseBsrSetStridedBatch`|12.1| | | | | | | | | | -|`cusparseConstBlockedEllGet`|12.0| | | | | | | | | | +|`cusparseConstBlockedEllGet`|12.0| | | |`rocsparse_const_bell_get`|6.0.0| | | | | |`cusparseConstCooGet`|12.0| | | |`rocsparse_const_coo_get`|6.0.0| | | | | -|`cusparseConstCscGet`|12.0| | | | | | | | | | +|`cusparseConstCscGet`|12.0| | | |`rocsparse_const_csc_get`|6.0.0| | | | | |`cusparseConstCsrGet`|12.0| | | |`rocsparse_const_csr_get`|6.0.0| | | | | |`cusparseConstDnMatGet`|12.0| | | | | | | | | | |`cusparseConstDnMatGetValues`|12.0| | | | | | | | | | |`cusparseConstDnVecGet`|12.0| | | | | | | | | | |`cusparseConstDnVecGetValues`|12.0| | | | | | | | | | -|`cusparseConstSpMatGetValues`|12.0| | | | | | | | | | +|`cusparseConstSpMatGetValues`|12.0| | | |`rocsparse_const_spmat_get_values`|6.0.0| | | | | |`cusparseConstSpVecGet`|12.0| | | |`rocsparse_const_spvec_get`|6.0.0| | | | | |`cusparseConstSpVecGetValues`|12.0| | | |`rocsparse_const_spvec_get_values`|6.0.0| | | | | |`cusparseConstrainedGeMM`|10.2|11.2| |12.0| | | | | | | @@ -882,12 +882,12 @@ |`cusparseSpMM_preprocess`|11.2| |12.0| | | | | | | | |`cusparseSpMV`|10.2| |12.0| |`rocsparse_spmv`|4.1.0| | | | | |`cusparseSpMV_bufferSize`|10.2| |12.0| | | | | | | | -|`cusparseSpMatGetAttribute`|11.3| |12.0| |`rocsparse_spmat_get_attribute`|4.5.0| | | | | -|`cusparseSpMatGetFormat`|10.1| |12.0| |`rocsparse_spmat_get_format`|4.1.0| | | | | -|`cusparseSpMatGetIndexBase`|10.1| |12.0| |`rocsparse_spmat_get_index_base`|4.1.0| | | | | +|`cusparseSpMatGetAttribute`|11.3| |12.0| |`rocsparse_spmat_get_attribute`|4.5.0| |6.0.0| | | +|`cusparseSpMatGetFormat`|10.1| |12.0| |`rocsparse_spmat_get_format`|4.1.0| |6.0.0| | | +|`cusparseSpMatGetIndexBase`|10.1| |12.0| |`rocsparse_spmat_get_index_base`|4.1.0| |6.0.0| | | |`cusparseSpMatGetNumBatches`|10.1| | |10.2| | | | | | | -|`cusparseSpMatGetSize`|11.0| |12.0| |`rocsparse_spmat_get_size`|4.1.0| | | | | -|`cusparseSpMatGetStridedBatch`|10.2| |12.0| |`rocsparse_spmat_get_strided_batch`|5.2.0| | | | | +|`cusparseSpMatGetSize`|11.0| |12.0| |`rocsparse_spmat_get_size`|4.1.0| |6.0.0| | | +|`cusparseSpMatGetStridedBatch`|10.2| |12.0| |`rocsparse_spmat_get_strided_batch`|5.2.0| |6.0.0| | | |`cusparseSpMatGetValues`|10.2| | | |`rocsparse_spmat_get_values`|4.1.0| | | | | |`cusparseSpMatSetAttribute`|11.3| | | |`rocsparse_spmat_set_attribute`|4.5.0| | | | | |`cusparseSpMatSetNumBatches`|10.1| | |10.2| | | | | | | diff --git a/src/CUDA2HIP_SPARSE_API_functions.cpp b/src/CUDA2HIP_SPARSE_API_functions.cpp index 44f8ee54..ed617002 100644 --- a/src/CUDA2HIP_SPARSE_API_functions.cpp +++ b/src/CUDA2HIP_SPARSE_API_functions.cpp @@ -751,13 +751,13 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseCsrSetPointers", {"hipsparseCsrSetPointers", "rocsparse_csr_set_pointers", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseCscSetPointers", {"hipsparseCscSetPointers", "rocsparse_csc_set_pointers", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseCscGet", {"hipsparseCscGet", "", CONV_LIB_FUNC, API_SPARSE, 15, UNSUPPORTED}}, - {"cusparseConstCscGet", {"hipsparseConstCscGet", "", CONV_LIB_FUNC, API_SPARSE, 15, UNSUPPORTED}}, + {"cusparseConstCscGet", {"hipsparseConstCscGet", "rocsparse_const_csc_get", CONV_LIB_FUNC, API_SPARSE, 15, HIP_UNSUPPORTED}}, {"cusparseCooSetPointers", {"hipsparseCooSetPointers", "rocsparse_coo_set_pointers", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseCsrSetStridedBatch", {"hipsparseCsrSetStridedBatch", "rocsparse_csr_set_strided_batch", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatGetFormat", {"hipsparseSpMatGetFormat", "rocsparse_spmat_get_format", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatGetIndexBase", {"hipsparseSpMatGetIndexBase", "rocsparse_spmat_get_index_base", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatGetValues", {"hipsparseSpMatGetValues", "rocsparse_spmat_get_values", CONV_LIB_FUNC, API_SPARSE, 15}}, - {"cusparseConstSpMatGetValues", {"hipsparseConstSpMatGetValues", "", CONV_LIB_FUNC, API_SPARSE, 15, ROC_UNSUPPORTED}}, + {"cusparseConstSpMatGetValues", {"hipsparseConstSpMatGetValues", "rocsparse_const_spmat_get_values", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatSetValues", {"hipsparseSpMatSetValues", "rocsparse_spmat_set_values", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatGetStridedBatch", {"hipsparseSpMatGetStridedBatch", "rocsparse_spmat_get_strided_batch", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatSetStridedBatch", {"hipsparseSpMatSetStridedBatch", "rocsparse_spmat_set_strided_batch", CONV_LIB_FUNC, API_SPARSE, 15, CUDA_REMOVED}}, @@ -767,7 +767,7 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseSpMatGetAttribute", {"hipsparseSpMatGetAttribute", "rocsparse_spmat_get_attribute", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseSpMatSetAttribute", {"hipsparseSpMatSetAttribute", "rocsparse_spmat_set_attribute", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseBlockedEllGet", {"hipsparseBlockedEllGet", "rocsparse_bell_get", CONV_LIB_FUNC, API_SPARSE, 15}}, - {"cusparseConstBlockedEllGet", {"hipsparseConstBlockedEllGet", "", CONV_LIB_FUNC, API_SPARSE, 15, ROC_UNSUPPORTED}}, + {"cusparseConstBlockedEllGet", {"hipsparseConstBlockedEllGet", "rocsparse_const_bell_get", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseCreateBlockedEll", {"hipsparseCreateBlockedEll", "rocsparse_create_bell_descr", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseCreateConstBlockedEll", {"hipsparseCreateConstBlockedEll", "rocsparse_create_const_bell_descr", CONV_LIB_FUNC, API_SPARSE, 15}}, {"cusparseBsrSetStridedBatch", {"hipsparseBsrSetStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, 15, UNSUPPORTED}}, @@ -2400,6 +2400,9 @@ const std::map HIP_SPARSE_FUNCTION_VER_MAP { {"rocsparse_create_const_bell_descr", {HIP_6000, HIP_0, HIP_0 }}, {"rocsparse_const_coo_get", {HIP_6000, HIP_0, HIP_0 }}, {"rocsparse_const_csr_get", {HIP_6000, HIP_0, HIP_0 }}, + {"rocsparse_const_csc_get", {HIP_6000, HIP_0, HIP_0 }}, + {"rocsparse_const_bell_get", {HIP_6000, HIP_0, HIP_0 }}, + {"rocsparse_const_spmat_get_values", {HIP_6000, HIP_0, HIP_0 }}, }; const std::map CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP { @@ -2494,6 +2497,11 @@ const std::map HIP_SPARSE_FUNCTION_CHANG {"rocsparse_destroy_spvec_descr", {HIP_6000}}, {"rocsparse_spvec_get_index_base", {HIP_6000}}, {"rocsparse_destroy_spmat_descr", {HIP_6000}}, + {"rocsparse_spmat_get_size", {HIP_6000}}, + {"rocsparse_spmat_get_format", {HIP_6000}}, + {"rocsparse_spmat_get_index_base", {HIP_6000}}, + {"rocsparse_spmat_get_strided_batch", {HIP_6000}}, + {"rocsparse_spmat_get_attribute", {HIP_6000}}, }; const std::map CUDA_SPARSE_API_SECTION_MAP { diff --git a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu index 8905ac76..26f89052 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu @@ -1751,13 +1751,11 @@ int main() { // CHECK: status_t = hipsparseDestroySpMat(spMatDescr_t); status_t = cusparseDestroySpMat(spMatDescr_t); - // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetFormat(cusparseSpMatDescr_t spMatDescr, cusparseFormat_t* format); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSpMatGetFormat(const hipsparseSpMatDescr_t spMatDescr, hipsparseFormat_t* format); // CHECK: status_t = hipsparseSpMatGetFormat(spMatDescr_t, &format_t); status_t = cusparseSpMatGetFormat(spMatDescr_t, &format_t); - // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetIndexBase(cusparseSpMatDescr_t spMatDescr, cusparseIndexBase_t* idxBase); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSpMatGetIndexBase(const hipsparseSpMatDescr_t spMatDescr, hipsparseIndexBase_t* idxBase); // CHECK: status_t = hipsparseSpMatGetIndexBase(spMatDescr_t, &indexBase_t); @@ -1854,7 +1852,6 @@ int main() { // CHECK: status_t = hipsparseSpVecGetIndexBase(spVecDescr_t, &indexBase_t); status_t = cusparseSpVecGetIndexBase(spVecDescr_t, &indexBase_t); - // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetStridedBatch(cusparseSpMatDescr_t spMatDescr, int* batchCount); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSpMatGetStridedBatch(hipsparseSpMatDescr_t spMatDescr, int* batchCount); // CHECK: status_t = hipsparseSpMatGetStridedBatch(spMatDescr_t, &batchCount); @@ -2266,7 +2263,6 @@ int main() { status_t = cusparseCsrSetPointers(spMatDescr_t, csrRowOffsets, csrColInd, csrValues); #if CUDA_VERSION < 12000 - // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetSize(cusparseSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSpMatGetSize(hipsparseSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz); // CHECK: status_t = hipsparseSpMatGetSize(spMatDescr_t, &rows, &cols, &nnz); @@ -2482,7 +2478,6 @@ int main() { cusparseSpSVDescr_t spSVDescr; #if CUDA_VERSION < 12000 - // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetAttribute(cusparseSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, void* data, size_t dataSize); // HIP: hipsparseStatus_t hipsparseSpMatGetAttribute(hipsparseSpMatDescr_t spMatDescr, hipsparseSpMatAttribute_t attribute, void* data, size_t dataSize); // CHECK: status_t = hipsparseSpMatGetAttribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); diff --git a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu index e84bd1db..2875e787 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu @@ -202,20 +202,25 @@ int main() { const void** const cooRowInd_const = const_cast(&cooRowInd); int icooRowInd = 0; void *cscRowInd = nullptr; - void *csrColInd = nullptr; + const void** const cscRowInd_const = const_cast(&cscRowInd); void *cooColInd = nullptr; const void** const cooColInd_const = const_cast(&cooColInd); void *ellColInd = nullptr; + const void** const ellColInd_const = const_cast(&ellColInd); + void *csrColInd = nullptr; const void** const csrColInd_const = const_cast(&csrColInd); void *cooValues = nullptr; const void** const cooValues_const = const_cast(&cooValues); void *csrValues = nullptr; const void** const csrValues_const = const_cast(&csrValues); void *cscValues = nullptr; + const void** const cscValues_const = const_cast(&cscValues); void *ellValue = nullptr; + const void** const ellValue_const = const_cast(&ellValue); void *csrRowOffsets = nullptr; const void** const csrRowOffsets_const = const_cast(&csrRowOffsets); void *cscColOffsets = nullptr; + const void** const cscColOffsets_const = const_cast(&cscColOffsets); void *cooRows = nullptr; int icooRows = 0; void *cooColumns = nullptr; @@ -1580,16 +1585,6 @@ int main() { // CHECK: status_t = rocsparse_coo_get(spMatDescr_t, &rows, &cols, &nnz, &cooRowInd, &cooColInd, &cooValues, &indexType_t, &indexBase_t, &dataType); status_t = cusparseCooGet(spMatDescr_t, &rows, &cols, &nnz, &cooRowInd, &cooColInd, &cooValues, &indexType_t, &indexBase_t, &dataType); - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetFormat(cusparseConstSpMatDescr_t spMatDescr, cusparseFormat_t* format); - // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_format(const rocsparse_spmat_descr descr, rocsparse_format* format); - // CHECK: status_t = rocsparse_spmat_get_format(spMatDescr_t, &format_t); - status_t = cusparseSpMatGetFormat(spMatDescr_t, &format_t); - - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetIndexBase(cusparseConstSpMatDescr_t spMatDescr, cusparseIndexBase_t* idxBase); - // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_index_base(const rocsparse_spmat_descr descr, rocsparse_index_base* idx_base); - // CHECK: status_t = rocsparse_spmat_get_index_base(spMatDescr_t, &indexBase_t); - status_t = cusparseSpMatGetIndexBase(spMatDescr_t, &indexBase_t); - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr, int64_t rows, int64_t cols, int64_t ld, void* values, cudaDataType valueType, cusparseOrder_t order); // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_create_dnmat_descr(rocsparse_dnmat_descr* descr, int64_t rows, int64_t cols, int64_t ld, void* values, rocsparse_datatype data_type, rocsparse_order order); // CHECK: status_t = rocsparse_create_dnmat_descr(&dnMatDescr_t, rows, cols, ld, values, dataType, order_t); @@ -1620,6 +1615,16 @@ int main() { // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_destroy_spmat_descr(rocsparse_spmat_descr descr); // CHECK: status_t = rocsparse_destroy_spmat_descr(spMatDescr_t); status_t = cusparseDestroySpMat(spMatDescr_t); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetFormat(cusparseConstSpMatDescr_t spMatDescr, cusparseFormat_t* format); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_format(const rocsparse_spmat_descr descr, rocsparse_format* format); + // CHECK: status_t = rocsparse_spmat_get_format(spMatDescr_t, &format_t); + status_t = cusparseSpMatGetFormat(spMatDescr_t, &format_t); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetIndexBase(cusparseConstSpMatDescr_t spMatDescr, cusparseIndexBase_t* idxBase); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_index_base(const rocsparse_spmat_descr descr, rocsparse_index_base* idx_base); + // CHECK: status_t = rocsparse_spmat_get_index_base(spMatDescr_t, &indexBase_t); + status_t = cusparseSpMatGetIndexBase(spMatDescr_t, &indexBase_t); #endif #endif @@ -1682,11 +1687,6 @@ int main() { // CHECK: status_t = rocsparse_spmat_set_values(spMatDescr_t, values); status_t = cusparseSpMatSetValues(spMatDescr_t, values); - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetStridedBatch(cusparseConstSpMatDescr_t spMatDescr, int* batchCount); - // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_strided_batch(rocsparse_spmat_descr descr, int* batch_count); - // CHECK: status_t = rocsparse_spmat_get_strided_batch(spMatDescr_t, &batchCount); - status_t = cusparseSpMatGetStridedBatch(spMatDescr_t, &batchCount); - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr, int64_t size, void* values, cudaDataType valueType); // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_create_dnvec_descr(rocsparse_dnvec_descr* descr, int64_t size, void* values, rocsparse_datatype data_type); // CHECK: status_t = rocsparse_create_dnvec_descr(&dnVecDescr_t, size, values, dataType); @@ -1755,6 +1755,11 @@ int main() { // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spvec_get_index_base(const rocsparse_spvec_descr descr, rocsparse_index_base* idx_base); // CHECK: status_t = rocsparse_spvec_get_index_base(spVecDescr_t, &indexBase_t); status_t = cusparseSpVecGetIndexBase(spVecDescr_t, &indexBase_t); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetStridedBatch(cusparseConstSpMatDescr_t spMatDescr, int* batchCount); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_strided_batch(rocsparse_spmat_descr descr, int* batch_count); + // CHECK: status_t = rocsparse_spmat_get_strided_batch(spMatDescr_t, &batchCount); + status_t = cusparseSpMatGetStridedBatch(spMatDescr_t, &batchCount); #endif #endif @@ -1922,11 +1927,13 @@ int main() { // CHECK: status_t = rocsparse_csr_set_pointers(spMatDescr_t, csrRowOffsets, csrColInd, csrValues); status_t = cusparseCsrSetPointers(spMatDescr_t, csrRowOffsets, csrColInd, csrValues); +#if CUDA_VERSION < 12000 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetSize(cusparseConstSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz); // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_size(rocsparse_spmat_descr descr, int64_t* rows, int64_t* cols, int64_t* nnz); // CHECK: status_t = rocsparse_spmat_get_size(spMatDescr_t, &rows, &cols, &nnz); status_t = cusparseSpMatGetSize(spMatDescr_t, &rows, &cols, &nnz); #endif +#endif #if CUDA_VERSION >= 11000 && CUSPARSE_VERSION >= 11100 // CHECK: rocsparse_spmm_alg SPMM_ALG_DEFAULT = rocsparse_spmm_alg_default; @@ -2064,15 +2071,17 @@ int main() { cusparseSpSVAlg_t spSVAlg_t; cusparseSpSVAlg_t SPSV_ALG_DEFAULT = CUSPARSE_SPSV_ALG_DEFAULT; - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetAttribute(cusparseConstSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, void* data, size_t dataSize); - // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_attribute(rocsparse_spmat_descr descr, rocsparse_spmat_attribute attribute, void* data, size_t data_size); - // CHECK: status_t = rocsparse_spmat_get_attribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); - status_t = cusparseSpMatGetAttribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, void* data, size_t dataSize); // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_set_attribute(rocsparse_spmat_descr descr, rocsparse_spmat_attribute attribute, const void* data, size_t data_size); // CHECK: status_t = rocsparse_spmat_set_attribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); status_t = cusparseSpMatSetAttribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); + +#if CUDA_VERSION < 12000 + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetAttribute(cusparseConstSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, void* data, size_t dataSize); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_attribute(rocsparse_spmat_descr descr, rocsparse_spmat_attribute attribute, void* data, size_t data_size); + // CHECK: status_t = rocsparse_spmat_get_attribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); + status_t = cusparseSpMatGetAttribute(spMatDescr_t, spMatAttribute_t, &data, dataSize); +#endif #endif #if CUDA_VERSION >= 11030 && CUSPARSE_VERSION >= 11600 @@ -2385,6 +2394,46 @@ int main() { // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_const_csr_get(rocsparse_const_spmat_descr descr, int64_t* rows, int64_t* cols, int64_t* nnz, const void** csr_row_ptr, const void** csr_col_ind, const void** csr_val, rocsparse_indextype* row_ptr_type, rocsparse_indextype* col_ind_type, rocsparse_index_base* idx_base, rocsparse_datatype* data_type); // CHECK: status_t = rocsparse_const_csr_get(constSpMatDescr, &rows, &cols, &nnz, csrRowOffsets_const, csrColInd_const, csrValues_const, &csrRowOffsetsType, &csrColIndType, &indexBase_t, &dataType); status_t = cusparseConstCsrGet(constSpMatDescr, &rows, &cols, &nnz, csrRowOffsets_const, csrColInd_const, csrValues_const, &csrRowOffsetsType, &csrColIndType, &indexBase_t, &dataType); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseConstCscGet(cusparseConstSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz, const void** cscColOffsets, const void** cscRowInd, const void** cscValues, cusparseIndexType_t* cscColOffsetsType, cusparseIndexType_t* cscRowIndType, cusparseIndexBase_t* idxBase, cudaDataType* valueType); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_const_csc_get(rocsparse_const_spmat_descr descr, int64_t* rows, int64_t* cols, int64_t* nnz, const void** csc_col_ptr, const void** csc_row_ind, const void** csc_val, rocsparse_indextype* col_ptr_type, rocsparse_indextype* row_ind_type, rocsparse_index_base* idx_base, rocsparse_datatype* data_type); + // CHECK: status_t = rocsparse_const_csc_get(constSpMatDescr, &rows, &cols, &nnz, cscColOffsets_const, cscRowInd_const, cscValues_const, &cscColOffsetsType, &cscRowIndType, &indexBase_t, &dataType); + status_t = cusparseConstCscGet(constSpMatDescr, &rows, &cols, &nnz, cscColOffsets_const, cscRowInd_const, cscValues_const, &cscColOffsetsType, &cscRowIndType, &indexBase_t, &dataType); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseConstBlockedEllGet(cusparseConstSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* ellBlockSize, int64_t* ellCols, const void** ellColInd, const void** ellValue, cusparseIndexType_t* ellIdxType, cusparseIndexBase_t* idxBase, cudaDataType* valueType); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_const_bell_get(rocsparse_const_spmat_descr descr, int64_t* rows, int64_t* cols, rocsparse_direction* ell_block_dir, int64_t* ell_block_dim, int64_t* ell_cols, const void** ell_col_ind, const void** ell_val, rocsparse_indextype* idx_type, rocsparse_index_base* idx_base, rocsparse_datatype* data_type); + // CHECK: status_t = rocsparse_const_bell_get(constSpMatDescr, &rows, &cols, &ellBlockSize, &ellCols, ellColInd_const, ellValue_const, &ellIdxType, &indexBase_t, &dataType); + status_t = cusparseConstBlockedEllGet(constSpMatDescr, &rows, &cols, &ellBlockSize, &ellCols, ellColInd_const, ellValue_const, &ellIdxType, &indexBase_t, &dataType); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetSize(cusparseConstSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_size(rocsparse_const_spmat_descr descr, int64_t* rows, int64_t* cols, int64_t* nnz); + // CHECK: status_t = rocsparse_spmat_get_size(constSpMatDescr, &rows, &cols, &nnz); + status_t = cusparseSpMatGetSize(constSpMatDescr, &rows, &cols, &nnz); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetFormat(cusparseConstSpMatDescr_t spMatDescr, cusparseFormat_t* format); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_format(rocsparse_const_spmat_descr descr, rocsparse_format* format); + // CHECK: status_t = rocsparse_spmat_get_format(constSpMatDescr, &format_t); + status_t = cusparseSpMatGetFormat(constSpMatDescr, &format_t); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetIndexBase(cusparseConstSpMatDescr_t spMatDescr, cusparseIndexBase_t* idxBase); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_index_base(rocsparse_const_spmat_descr descr, rocsparse_index_base* idx_base); + // CHECK: status_t = rocsparse_spmat_get_index_base(constSpMatDescr, &indexBase_t); + status_t = cusparseSpMatGetIndexBase(constSpMatDescr, &indexBase_t); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseConstSpMatGetValues(cusparseConstSpMatDescr_t spMatDescr, const void** values); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_const_spmat_get_values(rocsparse_const_spmat_descr descr, const void** values); + // CHECK: status_t = rocsparse_const_spmat_get_values(constSpMatDescr, values_const); + status_t = cusparseConstSpMatGetValues(constSpMatDescr, values_const); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetStridedBatch(cusparseConstSpMatDescr_t spMatDescr, int* batchCount); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_strided_batch(rocsparse_const_spmat_descr descr, int* batch_count); + // CHECK: status_t = rocsparse_spmat_get_strided_batch(constSpMatDescr, &batchCount); + status_t = cusparseSpMatGetStridedBatch(constSpMatDescr, &batchCount); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpMatGetAttribute(cusparseConstSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, void* data, size_t dataSize); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_spmat_get_attribute(rocsparse_const_spmat_descr descr, rocsparse_spmat_attribute attribute, void* data, size_t data_size); + // CHECK: status_t = rocsparse_spmat_get_attribute(constSpMatDescr, spMatAttribute_t, &data, dataSize); + status_t = cusparseSpMatGetAttribute(constSpMatDescr, spMatAttribute_t, &data, dataSize); #endif #if CUDA_VERSION >= 12010 && CUSPARSE_VERSION >= 12100