diff --git a/bin/hipify-perl b/bin/hipify-perl index b5c75213..98b8b8c2 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -1504,6 +1504,7 @@ sub rocSubstitutions { subst("cusparseDnVecGet", "rocsparse_dnvec_get", "library"); subst("cusparseDnVecGetValues", "rocsparse_dnvec_get_values", "library"); subst("cusparseDnVecSetValues", "rocsparse_dnvec_set_values", "library"); + subst("cusparseDpruneCsr2csrByPercentage", "rocsparse_dprune_csr2csr_by_percentage", "library"); subst("cusparseGather", "rocsparse_gather", "library"); subst("cusparseGetMatDiagType", "rocsparse_get_mat_diag_type", "library"); subst("cusparseGetMatFillMode", "rocsparse_get_mat_fill_mode", "library"); @@ -1542,6 +1543,7 @@ sub rocSubstitutions { subst("cusparseSpVecGetIndexBase", "rocsparse_spvec_get_index_base", "library"); subst("cusparseSpVecGetValues", "rocsparse_spvec_get_values", "library"); subst("cusparseSpVecSetValues", "rocsparse_spvec_set_values", "library"); + subst("cusparseXcoo2csr", "rocsparse_coo2csr", "library"); subst("cusparseXcoosortByColumn", "rocsparse_coosort_by_column", "library"); subst("cusparseXcoosortByRow", "rocsparse_coosort_by_row", "library"); subst("cusparseXcoosort_bufferSizeExt", "rocsparse_coosort_buffer_size", "library"); @@ -1650,6 +1652,8 @@ sub rocSubstitutions { subst("cusparseSpVecDescr_t", "rocsparse_spvec_descr", "type"); subst("cusparseSparseToDenseAlg_t", "rocsparse_sparse_to_dense_alg", "type"); subst("cusparseStatus_t", "rocsparse_status", "type"); + subst("pruneInfo", "_rocsparse_mat_info", "type"); + subst("pruneInfo_t", "rocsparse_mat_info", "type"); subst("CUBLAS_ATOMICS_ALLOWED", "rocblas_atomics_allowed", "numeric_literal"); subst("CUBLAS_ATOMICS_NOT_ALLOWED", "rocblas_atomics_not_allowed", "numeric_literal"); subst("CUBLAS_DIAG_NON_UNIT", "rocblas_diagonal_non_unit", "numeric_literal"); @@ -4065,6 +4069,7 @@ sub simpleSubstitutions { subst("cusparseStatus_t", "hipsparseStatus_t", "type"); subst("nvrtcProgram", "hiprtcProgram", "type"); subst("nvrtcResult", "hiprtcResult", "type"); + subst("pruneInfo", "pruneInfo", "type"); subst("pruneInfo_t", "pruneInfo_t", "type"); subst("surfaceReference", "surfaceReference", "type"); subst("texture", "texture", "type"); @@ -6228,7 +6233,6 @@ sub warnUnsupportedFunctions { my $line_num = shift; my $k = 0; foreach $func ( - "pruneInfo", "nvrtcGetSupportedArchs", "nvrtcGetOptiXIRSize", "nvrtcGetOptiXIR", diff --git a/docs/tables/CUSPARSE_API_supported_by_HIP.md b/docs/tables/CUSPARSE_API_supported_by_HIP.md index 496269da..089f9327 100644 --- a/docs/tables/CUSPARSE_API_supported_by_HIP.md +++ b/docs/tables/CUSPARSE_API_supported_by_HIP.md @@ -183,7 +183,7 @@ |`cusparseSpVecDescr_t`|10.2| | |`hipsparseSpVecDescr_t`|4.1.0| | | | |`cusparseSparseToDenseAlg_t`|11.1| | |`hipsparseSparseToDenseAlg_t`|4.2.0| | | | |`cusparseStatus_t`| | | |`hipsparseStatus_t`|1.9.2| | | | -|`pruneInfo`|9.0| | | | | | | | +|`pruneInfo`|9.0| | |`pruneInfo`|3.9.0| | | | |`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | | ## **5. CUSPARSE Management Function Reference** 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 34a5e78c..07efeb46 100644 --- a/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md @@ -183,8 +183,8 @@ |`cusparseSpVecDescr_t`|10.2| | |`hipsparseSpVecDescr_t`|4.1.0| | | |`rocsparse_spvec_descr`|4.1.0| | | | |`cusparseSparseToDenseAlg_t`|11.1| | |`hipsparseSparseToDenseAlg_t`|4.2.0| | | |`rocsparse_sparse_to_dense_alg`|4.1.0| | | | |`cusparseStatus_t`| | | |`hipsparseStatus_t`|1.9.2| | | |`rocsparse_status`|1.9.0| | | | -|`pruneInfo`|9.0| | | | | | | | | | | | | -|`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | | | | | | | +|`pruneInfo`|9.0| | |`pruneInfo`|3.9.0| | | |`_rocsparse_mat_info`|1.9.0| | | | +|`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | |`rocsparse_mat_info`|1.9.0| | | | ## **5. CUSPARSE Management Function Reference** @@ -680,7 +680,7 @@ |`cusparseDnnz`| | | |`hipsparseDnnz`|3.2.0| | | | | | | | | |`cusparseDnnz_compress`|8.0| | |`hipsparseDnnz_compress`|3.5.0| | | | | | | | | |`cusparseDpruneCsr2csr`|9.0| | |`hipsparseDpruneCsr2csr`|3.9.0| | | | | | | | | -|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`hipsparseDpruneCsr2csrByPercentage`|3.9.0| | | | | | | | | +|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`hipsparseDpruneCsr2csrByPercentage`|3.9.0| | | |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | | |`cusparseDpruneCsr2csrByPercentage_bufferSizeExt`|9.0| | |`hipsparseDpruneCsr2csrByPercentage_bufferSizeExt`|3.9.0| | | | | | | | | |`cusparseDpruneCsr2csrNnz`|9.0| | |`hipsparseDpruneCsr2csrNnz`|3.9.0| | | | | | | | | |`cusparseDpruneCsr2csrNnzByPercentage`|9.0| | |`hipsparseDpruneCsr2csrNnzByPercentage`|3.9.0| | | | | | | | | @@ -744,7 +744,7 @@ |`cusparseSpruneDense2csrNnz`|9.0| | |`hipsparseSpruneDense2csrNnz`|3.9.0| | | | | | | | | |`cusparseSpruneDense2csrNnzByPercentage`|9.0| | |`hipsparseSpruneDense2csrNnzByPercentage`|3.9.0| | | | | | | | | |`cusparseSpruneDense2csr_bufferSizeExt`|9.0| | |`hipsparseSpruneDense2csr_bufferSizeExt`|3.9.0| | | | | | | | | -|`cusparseXcoo2csr`| | | |`hipsparseXcoo2csr`|1.9.2| | | | | | | | | +|`cusparseXcoo2csr`| | | |`hipsparseXcoo2csr`|1.9.2| | | |`rocsparse_coo2csr`|1.9.0| | | | |`cusparseXcoosortByColumn`| | | |`hipsparseXcoosortByColumn`|1.9.2| | | |`rocsparse_coosort_by_column`|1.9.0| | | | |`cusparseXcoosortByRow`| | | |`hipsparseXcoosortByRow`|1.9.2| | | |`rocsparse_coosort_by_row`|1.9.0| | | | |`cusparseXcoosort_bufferSizeExt`| | | |`hipsparseXcoosort_bufferSizeExt`|1.9.2| | | |`rocsparse_coosort_buffer_size`|1.9.0| | | | diff --git a/docs/tables/CUSPARSE_API_supported_by_ROC.md b/docs/tables/CUSPARSE_API_supported_by_ROC.md index 22f00e66..aa15c8da 100644 --- a/docs/tables/CUSPARSE_API_supported_by_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_ROC.md @@ -183,8 +183,8 @@ |`cusparseSpVecDescr_t`|10.2| | |`rocsparse_spvec_descr`|4.1.0| | | | |`cusparseSparseToDenseAlg_t`|11.1| | |`rocsparse_sparse_to_dense_alg`|4.1.0| | | | |`cusparseStatus_t`| | | |`rocsparse_status`|1.9.0| | | | -|`pruneInfo`|9.0| | | | | | | | -|`pruneInfo_t`|9.0| | | | | | | | +|`pruneInfo`|9.0| | |`_rocsparse_mat_info`|1.9.0| | | | +|`pruneInfo_t`|9.0| | |`rocsparse_mat_info`|1.9.0| | | | ## **5. CUSPARSE Management Function Reference** @@ -680,7 +680,7 @@ |`cusparseDnnz`| | | | | | | | | |`cusparseDnnz_compress`|8.0| | | | | | | | |`cusparseDpruneCsr2csr`|9.0| | | | | | | | -|`cusparseDpruneCsr2csrByPercentage`|9.0| | | | | | | | +|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | | |`cusparseDpruneCsr2csrByPercentage_bufferSizeExt`|9.0| | | | | | | | |`cusparseDpruneCsr2csrNnz`|9.0| | | | | | | | |`cusparseDpruneCsr2csrNnzByPercentage`|9.0| | | | | | | | @@ -744,7 +744,7 @@ |`cusparseSpruneDense2csrNnz`|9.0| | | | | | | | |`cusparseSpruneDense2csrNnzByPercentage`|9.0| | | | | | | | |`cusparseSpruneDense2csr_bufferSizeExt`|9.0| | | | | | | | -|`cusparseXcoo2csr`| | | | | | | | | +|`cusparseXcoo2csr`| | | |`rocsparse_coo2csr`|1.9.0| | | | |`cusparseXcoosortByColumn`| | | |`rocsparse_coosort_by_column`|1.9.0| | | | |`cusparseXcoosortByRow`| | | |`rocsparse_coosort_by_row`|1.9.0| | | | |`cusparseXcoosort_bufferSizeExt`| | | |`rocsparse_coosort_buffer_size`|1.9.0| | | | diff --git a/src/CUDA2HIP_SPARSE_API_functions.cpp b/src/CUDA2HIP_SPARSE_API_functions.cpp index 330f26cc..70562a19 100644 --- a/src/CUDA2HIP_SPARSE_API_functions.cpp +++ b/src/CUDA2HIP_SPARSE_API_functions.cpp @@ -551,7 +551,7 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseCcsr2gebsr", {"hipsparseCcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, {"cusparseZcsr2gebsr", {"hipsparseZcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, - {"cusparseXcoo2csr", {"hipsparseXcoo2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, + {"cusparseXcoo2csr", {"hipsparseXcoo2csr", "rocsparse_coo2csr", CONV_LIB_FUNC, API_SPARSE, 14}}, {"cusparseScsc2dense", {"hipsparseScsc2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseDcsc2dense", {"hipsparseDcsc2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, @@ -615,10 +615,14 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseChyb2csc", {"hipsparseChyb2csc", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseZhyb2csc", {"hipsparseZhyb2csc", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseShyb2csr", {"hipsparseShyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseDhyb2csr", {"hipsparseDhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseChyb2csr", {"hipsparseChyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseZhyb2csr", {"hipsparseZhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}}, + // NOTE: rocsparse_shyb2csr has one additioanl attribute void* temp_buffer; see hipsparseShyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_shyb2csr + {"cusparseShyb2csr", {"hipsparseShyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, + // NOTE: rocsparse_dhyb2csr has one additioanl attribute void* temp_buffer; see hipsparseDhyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_dhyb2csr + {"cusparseDhyb2csr", {"hipsparseDhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, + // NOTE: rocsparse_chyb2csr has one additioanl attribute void* temp_buffer; see hipsparseChyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_chyb2csr + {"cusparseChyb2csr", {"hipsparseChyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, + // NOTE: rocsparse_zhyb2csr has one additioanl attribute void* temp_buffer; see hipsparseZhyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_zhyb2csr + {"cusparseZhyb2csr", {"hipsparseZhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseShyb2dense", {"hipsparseShyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseDhyb2dense", {"hipsparseDhyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, @@ -698,7 +702,7 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseHpruneCsr2csrByPercentage", {"hipsparseHpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED}}, {"cusparseSpruneCsr2csrByPercentage", {"hipsparseSpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, - {"cusparseDpruneCsr2csrByPercentage", {"hipsparseDpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, + {"cusparseDpruneCsr2csrByPercentage", {"hipsparseDpruneCsr2csrByPercentage", "rocsparse_dprune_csr2csr_by_percentage", CONV_LIB_FUNC, API_SPARSE, 14}}, {"cusparseHpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseHpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED}}, {"cusparseSpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseSpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, @@ -1901,6 +1905,8 @@ const std::map HIP_SPARSE_FUNCTION_VER_MAP { {"rocsparse_csrsort", {HIP_1090, HIP_0, HIP_0 }}, {"rocsparse_csrsort_buffer_size", {HIP_1090, HIP_0, HIP_0 }}, {"rocsparse_create_identity_permutation", {HIP_1090, HIP_0, HIP_0 }}, + {"rocsparse_coo2csr", {HIP_1090, HIP_0, HIP_0 }}, + {"rocsparse_dprune_csr2csr_by_percentage", {HIP_3090, HIP_0, HIP_0 }}, }; const std::map CUDA_SPARSE_API_SECTION_MAP { diff --git a/src/CUDA2HIP_SPARSE_API_types.cpp b/src/CUDA2HIP_SPARSE_API_types.cpp index 3ae22cf2..233912cd 100644 --- a/src/CUDA2HIP_SPARSE_API_types.cpp +++ b/src/CUDA2HIP_SPARSE_API_types.cpp @@ -68,8 +68,8 @@ const std::map CUDA_SPARSE_TYPE_NAME_MAP { {"cusparseColorInfo", {"hipsparseColorInfo", "_rocsparse_color_info", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED}}, {"cusparseColorInfo_t", {"hipsparseColorInfo_t", "rocsparse_color_info", CONV_TYPE, API_SPARSE, 4}}, - {"pruneInfo", {"pruneInfo", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED}}, - {"pruneInfo_t", {"pruneInfo_t", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED}}, + {"pruneInfo", {"pruneInfo", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4}}, + {"pruneInfo_t", {"pruneInfo_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4}}, {"cusparseSpMatDescr", {"hipsparseSpMatDescr", "_rocsparse_spmat_descr", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED}}, {"cusparseSpMatDescr_t", {"hipsparseSpMatDescr_t", "rocsparse_spmat_descr", CONV_TYPE, API_SPARSE, 4}}, @@ -401,6 +401,7 @@ const std::map HIP_SPARSE_TYPE_NAME_VER_MAP { {"csrilu02Info_t", {HIP_1092, HIP_0, HIP_0 }}, {"bsrilu02Info_t", {HIP_3090, HIP_0, HIP_0 }}, {"csrgemm2Info_t", {HIP_2080, HIP_0, HIP_0 }}, + {"pruneInfo", {HIP_3090, HIP_0, HIP_0 }}, {"pruneInfo_t", {HIP_3090, HIP_0, HIP_0 }}, {"hipsparseAction_t", {HIP_1092, HIP_0, HIP_0 }}, {"HIPSPARSE_ACTION_SYMBOLIC", {HIP_1092, HIP_0, HIP_0 }}, @@ -631,4 +632,6 @@ const std::map HIP_SPARSE_TYPE_NAME_VER_MAP { {"rocsparse_dense_to_sparse_alg_default", {HIP_4010, HIP_0, HIP_0 }}, {"rocsparse_spgemm_alg", {HIP_4010, HIP_0, HIP_0 }}, {"rocsparse_spgemm_alg_default", {HIP_4010, HIP_0, HIP_0 }}, + {"_rocsparse_mat_info", {HIP_1090, HIP_0, HIP_0 }}, + {"rocsparse_mat_info", {HIP_1090, HIP_0, HIP_0 }}, }; diff --git a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu index 2755bc7e..382bd209 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu @@ -159,6 +159,7 @@ int main() { void *indices = nullptr; void *values = nullptr; void *cooRowInd = nullptr; + int icooRowInd = 0; void *cscRowInd = nullptr; void *csrColInd = nullptr; void *cooColInd = nullptr; @@ -187,6 +188,7 @@ int main() { float ffractionToColor = 0.f; double bsrValA = 0.f; double csrValA = 0.f; + float fcsrValA = 0.f; double csrValC = 0.f; float csrSortedValA = 0.f; double dbsrSortedValA = 0.f; @@ -194,6 +196,9 @@ int main() { float fbsrSortedValA = 0.f; float fbsrSortedValC = 0.f; float fcsrSortedValC = 0.f; + double percentage = 0.f; + + pruneInfo_t prune_info; // CHECK: hipDoubleComplex dcomplex, dComplexbsrSortedValA, dComplexbsrSortedValC; cuDoubleComplex dcomplex, dComplexbsrSortedValA, dComplexbsrSortedValC; @@ -444,6 +449,11 @@ int main() { // CHECK: status_t = hipsparseCreateIdentityPermutation(handle_t, n, P); status_t = cusparseCreateIdentityPermutation(handle_t, n, P); + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseXcoo2csr(cusparseHandle_t handle, const int* cooRowInd, int nnz, int m, int* csrSortedRowPtr, cusparseIndexBase_t idxBase); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseXcoo2csr(hipsparseHandle_t handle, const int* cooRowInd, int nnz, int m, int* csrRowPtr, hipsparseIndexBase_t idxBase); + // CHECK: status_t = hipsparseXcoo2csr(handle_t, &icooRowInd, nnz, m, &csrRowPtrA, indexBase_t); + status_t = cusparseXcoo2csr(handle_t, &icooRowInd, nnz, m, &csrRowPtrA, indexBase_t); + #if CUDA_VERSION >= 8000 // CHECK: hipDataType dataType_t; // CHECK-NEXT: hipDataType dataType; @@ -451,6 +461,13 @@ int main() { cudaDataType dataType; #endif +#if CUDA_VERSION >= 9000 + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDpruneCsr2csrByPercentage(cusparseHandle_t handle, int m, int n, int nnzA, const cusparseMatDescr_t descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, float percentage, const cusparseMatDescr_t descrC, double* csrSortedValC, const int* csrSortedRowPtrC, int* csrSortedColIndC, pruneInfo_t info, void* pBuffer); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double* csrValA, const int* csrRowPtrA, const int* csrColIndA, double percentage, const hipsparseMatDescr_t descrC, double* csrValC, const int* csrRowPtrC, int* csrColIndC, pruneInfo_t info, void* buffer); + // CHECK: status_t = hipsparseDpruneCsr2csrByPercentage(handle_t, m, n, nnz, matDescr_A, &csrValA, &csrRowPtrA, &csrColIndA, percentage, matDescr_C, &csrValC, &csrRowPtrC, &csrColIndC, prune_info, pBuffer); + status_t = cusparseDpruneCsr2csrByPercentage(handle_t, m, n, nnz, matDescr_A, &csrValA, &csrRowPtrA, &csrColIndA, percentage, matDescr_C, &csrValC, &csrRowPtrC, &csrColIndC, prune_info, pBuffer); +#endif + #if CUDA_VERSION >= 8000 && CUDA_VERSION < 12000 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCopyMatDescr(cusparseMatDescr_t dest, const cusparseMatDescr_t src); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCopyMatDescr(hipsparseMatDescr_t dest, const hipsparseMatDescr_t src); @@ -810,6 +827,26 @@ int main() { // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDestroyHybMat(hipsparseHybMat_t hybA); // CHECK: status_t = hipsparseDestroyHybMat(hybMat_t); status_t = cusparseDestroyHybMat(hybMat_t); + + // CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseZhyb2csr(cusparseHandle_t handle, const cusparseMatDescr_t descrA, const cusparseHybMat_t hybA, cuDoubleComplex* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZhyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, hipDoubleComplex* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // CHECK: status_t = hipsparseZhyb2csr(handle_t, matDescr_t, hybMat_t, &dComplexbsrSortedValA, &csrRowPtrA, &csrColIndA); + status_t = cusparseZhyb2csr(handle_t, matDescr_t, hybMat_t, &dComplexbsrSortedValA, &csrRowPtrA, &csrColIndA); + + // CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseChyb2csr(cusparseHandle_t handle, const cusparseMatDescr_t descrA, const cusparseHybMat_t hybA, cuComplex* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseChyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, hipComplex* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // CHECK: status_t = hipsparseChyb2csr(handle_t, matDescr_t, hybMat_t, &complex, &csrRowPtrA, &csrColIndA); + status_t = cusparseChyb2csr(handle_t, matDescr_t, hybMat_t, &complex, &csrRowPtrA, &csrColIndA); + + // CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDhyb2csr(cusparseHandle_t handle, const cusparseMatDescr_t descrA, const cusparseHybMat_t hybA, double* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDhyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, double* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // CHECK: status_t = hipsparseDhyb2csr(handle_t, matDescr_t, hybMat_t, &csrValA, &csrRowPtrA, &csrColIndA); + status_t = cusparseDhyb2csr(handle_t, matDescr_t, hybMat_t, &csrValA, &csrRowPtrA, &csrColIndA); + + // CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseShyb2csr(cusparseHandle_t handle, const cusparseMatDescr_t descrA, const cusparseHybMat_t hybA, float* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseShyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, float* csrSortedValA, int* csrSortedRowPtrA, int* csrSortedColIndA); + // CHECK: status_t = hipsparseShyb2csr(handle_t, matDescr_t, hybMat_t, &fcsrValA, &csrRowPtrA, &csrColIndA); + status_t = cusparseShyb2csr(handle_t, matDescr_t, hybMat_t, &fcsrValA, &csrRowPtrA, &csrColIndA); #endif #if CUDA_VERSION >= 11010 && CUSPARSE_VERSION >= 11300 diff --git a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu index 9565220e..9c484183 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu @@ -159,6 +159,7 @@ int main() { void *indices = nullptr; void *values = nullptr; void *cooRowInd = nullptr; + int icooRowInd = 0; void *cscRowInd = nullptr; void *csrColInd = nullptr; void *cooColInd = nullptr; @@ -194,6 +195,10 @@ int main() { float fbsrSortedValA = 0.f; float fbsrSortedValC = 0.f; float fcsrSortedValC = 0.f; + double percentage = 0.f; + + // CHECK: rocsparse_mat_info prune_info; + pruneInfo_t prune_info; // TODO: should be rocsparse_double_complex // TODO: add to TypeOverloads cuDoubleComplex -> rocsparse_double_complex under a new option --sparse @@ -448,6 +453,11 @@ int main() { // CHECK: status_t = rocsparse_create_identity_permutation(handle_t, n, P); status_t = cusparseCreateIdentityPermutation(handle_t, n, P); + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseXcoo2csr(cusparseHandle_t handle, const int* cooRowInd, int nnz, int m, int* csrSortedRowPtr, cusparseIndexBase_t idxBase); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_coo2csr(rocsparse_handle handle, const rocsparse_int* coo_row_ind, rocsparse_int nnz, rocsparse_int m, rocsparse_int* csr_row_ptr, rocsparse_index_base idx_base); + // CHECK: status_t = rocsparse_coo2csr(handle_t, &icooRowInd, nnz, m, &csrRowPtrA, indexBase_t); + status_t = cusparseXcoo2csr(handle_t, &icooRowInd, nnz, m, &csrRowPtrA, indexBase_t); + #if CUDA_VERSION >= 8000 // CHECK: hipDataType dataType_t; // TODO: [#899] There should be rocsparse_datatype @@ -456,6 +466,13 @@ int main() { cudaDataType dataType; #endif +#if CUDA_VERSION >= 9000 + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDpruneCsr2csrByPercentage(cusparseHandle_t handle, int m, int n, int nnzA, const cusparseMatDescr_t descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, float percentage, const cusparseMatDescr_t descrC, double* csrSortedValC, const int* csrSortedRowPtrC, int* csrSortedColIndC, pruneInfo_t info, void* pBuffer); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_dprune_csr2csr_by_percentage(rocsparse_handle handle, rocsparse_int m, rocsparse_int n, rocsparse_int nnz_A, const rocsparse_mat_descr csr_descr_A, const double* csr_val_A, const rocsparse_int* csr_row_ptr_A, const rocsparse_int* csr_col_ind_A, double percentage, const rocsparse_mat_descr csr_descr_C, double* csr_val_C, const rocsparse_int* csr_row_ptr_C, rocsparse_int* csr_col_ind_C, rocsparse_mat_info info, void* temp_buffer); + // CHECK: status_t = rocsparse_dprune_csr2csr_by_percentage(handle_t, m, n, nnz, matDescr_A, &csrValA, &csrRowPtrA, &csrColIndA, percentage, matDescr_C, &csrValC, &csrRowPtrC, &csrColIndC, prune_info, pBuffer); + status_t = cusparseDpruneCsr2csrByPercentage(handle_t, m, n, nnz, matDescr_A, &csrValA, &csrRowPtrA, &csrColIndA, percentage, matDescr_C, &csrValC, &csrRowPtrC, &csrColIndC, prune_info, pBuffer); +#endif + #if CUDA_VERSION >= 8000 && CUDA_VERSION < 12000 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCopyMatDescr(cusparseMatDescr_t dest, const cusparseMatDescr_t src); // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_copy_mat_descr(rocsparse_mat_descr dest, const rocsparse_mat_descr src);