From 17e440f47888ba71dfa048a34d20cabbc7c3a50b Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 25 Aug 2023 19:21:19 +0200 Subject: [PATCH] [HIPIFY][#674][rocSPARSE][feature] rocSPARSE support - Step 31 - functions + Updated synthetic tests and the regenerated hipify-perl and SPARSE docs --- bin/hipify-perl | 4 ++ .../CUSPARSE_API_supported_by_HIP_and_ROC.md | 8 +-- docs/tables/CUSPARSE_API_supported_by_ROC.md | 8 +-- src/CUDA2HIP_SPARSE_API_functions.cpp | 13 ++-- .../synthetic/libraries/cusparse2hipsparse.cu | 65 +++++++++++++++++-- .../synthetic/libraries/cusparse2rocsparse.cu | 21 ++++++ 6 files changed, 102 insertions(+), 17 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index a83ee511..2b4a30c2 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -1689,6 +1689,7 @@ sub rocSubstitutions { subst("cusparseCgebsr2gebsc_bufferSize", "rocsparse_cgebsr2gebsc_buffer_size", "library"); subst("cusparseCgebsr2gebsr", "rocsparse_cgebsr2gebsr", "library"); subst("cusparseCgebsr2gebsr_bufferSize", "rocsparse_cgebsr2gebsr_buffer_size", "library"); + subst("cusparseCnnz", "rocsparse_cnnz", "library"); subst("cusparseCnnz_compress", "rocsparse_cnnz_compress", "library"); subst("cusparseCooAoSGet", "rocsparse_coo_aos_get", "library"); subst("cusparseCooGet", "rocsparse_coo_get", "library"); @@ -1744,6 +1745,7 @@ sub rocSubstitutions { subst("cusparseDnVecGet", "rocsparse_dnvec_get", "library"); subst("cusparseDnVecGetValues", "rocsparse_dnvec_get_values", "library"); subst("cusparseDnVecSetValues", "rocsparse_dnvec_set_values", "library"); + subst("cusparseDnnz", "rocsparse_dnnz", "library"); subst("cusparseDnnz_compress", "rocsparse_dnnz_compress", "library"); subst("cusparseDpruneCsr2csr", "rocsparse_dprune_csr2csr", "library"); subst("cusparseDpruneCsr2csrByPercentage", "rocsparse_dprune_csr2csr_by_percentage", "library"); @@ -1792,6 +1794,7 @@ sub rocSubstitutions { subst("cusparseSgebsr2gebsc_bufferSize", "rocsparse_sgebsr2gebsc_buffer_size", "library"); subst("cusparseSgebsr2gebsr", "rocsparse_sgebsr2gebsr", "library"); subst("cusparseSgebsr2gebsr_bufferSize", "rocsparse_sgebsr2gebsr_buffer_size", "library"); + subst("cusparseSnnz", "rocsparse_snnz", "library"); subst("cusparseSnnz_compress", "rocsparse_snnz_compress", "library"); subst("cusparseSpMV", "rocsparse_spmv", "library"); subst("cusparseSpMatGetAttribute", "rocsparse_spmat_get_attribute", "library"); @@ -1847,6 +1850,7 @@ sub rocSubstitutions { subst("cusparseZgebsr2gebsc_bufferSize", "rocsparse_zgebsr2gebsc_buffer_size", "library"); subst("cusparseZgebsr2gebsr", "rocsparse_zgebsr2gebsr", "library"); subst("cusparseZgebsr2gebsr_bufferSize", "rocsparse_zgebsr2gebsr_buffer_size", "library"); + subst("cusparseZnnz", "rocsparse_znnz", "library"); subst("cusparseZnnz_compress", "rocsparse_znnz_compress", "library"); subst("cublas.h", "rocblas.h", "include_cuda_main_header"); subst("cublas_v2.h", "rocblas.h", "include_cuda_main_header_v2"); 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 d0029f6d..c7a50c89 100644 --- a/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md @@ -647,7 +647,7 @@ |`cusparseChyb2csc`| |10.2|11.0| | | | | | | | | | | |`cusparseChyb2csr`| |10.2|11.0|`hipsparseChyb2csr`|3.1.0| | | | | | | | | |`cusparseChyb2dense`| |10.2|11.0| | | | | | | | | | | -|`cusparseCnnz`| | | |`hipsparseCnnz`|3.2.0| | | | | | | | | +|`cusparseCnnz`| | | |`hipsparseCnnz`|3.2.0| | | |`rocsparse_cnnz`|3.2.0| | | | |`cusparseCnnz_compress`|8.0|12.2| |`hipsparseCnnz_compress`|3.5.0| | | |`rocsparse_cnnz_compress`|3.5.0| | | | |`cusparseCreateCsru2csrInfo`| |12.2| |`hipsparseCreateCsru2csrInfo`|4.2.0| | | | | | | | | |`cusparseCreateIdentityPermutation`| |12.2| |`hipsparseCreateIdentityPermutation`|1.9.2| | | |`rocsparse_create_identity_permutation`|1.9.0| | | | @@ -682,7 +682,7 @@ |`cusparseDhyb2csc`| |10.2|11.0| | | | | | | | | | | |`cusparseDhyb2csr`| |10.2|11.0|`hipsparseDhyb2csr`|3.1.0| | | | | | | | | |`cusparseDhyb2dense`| |10.2|11.0| | | | | | | | | | | -|`cusparseDnnz`| | | |`hipsparseDnnz`|3.2.0| | | | | | | | | +|`cusparseDnnz`| | | |`hipsparseDnnz`|3.2.0| | | |`rocsparse_dnnz`|3.2.0| | | | |`cusparseDnnz_compress`|8.0|12.2| |`hipsparseDnnz_compress`|3.5.0| | | |`rocsparse_dnnz_compress`|3.5.0| | | | |`cusparseDpruneCsr2csr`|9.0|12.2| |`hipsparseDpruneCsr2csr`|3.9.0| | | |`rocsparse_dprune_csr2csr`|3.9.0| | | | |`cusparseDpruneCsr2csrByPercentage`|9.0|12.2| |`hipsparseDpruneCsr2csrByPercentage`|3.9.0| | | |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | | @@ -735,7 +735,7 @@ |`cusparseShyb2csc`| |10.2|11.0| | | | | | | | | | | |`cusparseShyb2csr`| |10.2|11.0|`hipsparseShyb2csr`|3.1.0| | | | | | | | | |`cusparseShyb2dense`| |10.2|11.0| | | | | | | | | | | -|`cusparseSnnz`| | | |`hipsparseSnnz`|3.2.0| | | | | | | | | +|`cusparseSnnz`| | | |`hipsparseSnnz`|3.2.0| | | |`rocsparse_snnz`|3.2.0| | | | |`cusparseSnnz_compress`|8.0|12.2| |`hipsparseSnnz_compress`|3.5.0| | | |`rocsparse_snnz_compress`|3.5.0| | | | |`cusparseSpruneCsr2csr`|9.0|12.2| |`hipsparseSpruneCsr2csr`|3.9.0| | | |`rocsparse_sprune_csr2csr`|3.9.0| | | | |`cusparseSpruneCsr2csrByPercentage`|9.0|12.2| |`hipsparseSpruneCsr2csrByPercentage`|3.9.0| | | |`rocsparse_sprune_csr2csr_by_percentage`|3.9.0| | | | @@ -789,7 +789,7 @@ |`cusparseZhyb2csc`| |10.2|11.0| | | | | | | | | | | |`cusparseZhyb2csr`| |10.2|11.0|`hipsparseZhyb2csr`|3.1.0| | | | | | | | | |`cusparseZhyb2dense`| |10.2|11.0| | | | | | | | | | | -|`cusparseZnnz`| | | |`hipsparseZnnz`|3.2.0| | | | | | | | | +|`cusparseZnnz`| | | |`hipsparseZnnz`|3.2.0| | | |`rocsparse_znnz`|3.2.0| | | | |`cusparseZnnz_compress`|8.0|12.2| |`hipsparseZnnz_compress`|3.5.0| | | |`rocsparse_znnz_compress`|3.5.0| | | | ## **15. CUSPARSE Generic API Reference** diff --git a/docs/tables/CUSPARSE_API_supported_by_ROC.md b/docs/tables/CUSPARSE_API_supported_by_ROC.md index 38596ee7..e935db68 100644 --- a/docs/tables/CUSPARSE_API_supported_by_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_ROC.md @@ -647,7 +647,7 @@ |`cusparseChyb2csc`| |10.2|11.0| | | | | | |`cusparseChyb2csr`| |10.2|11.0| | | | | | |`cusparseChyb2dense`| |10.2|11.0| | | | | | -|`cusparseCnnz`| | | | | | | | | +|`cusparseCnnz`| | | |`rocsparse_cnnz`|3.2.0| | | | |`cusparseCnnz_compress`|8.0|12.2| |`rocsparse_cnnz_compress`|3.5.0| | | | |`cusparseCreateCsru2csrInfo`| |12.2| | | | | | | |`cusparseCreateIdentityPermutation`| |12.2| |`rocsparse_create_identity_permutation`|1.9.0| | | | @@ -682,7 +682,7 @@ |`cusparseDhyb2csc`| |10.2|11.0| | | | | | |`cusparseDhyb2csr`| |10.2|11.0| | | | | | |`cusparseDhyb2dense`| |10.2|11.0| | | | | | -|`cusparseDnnz`| | | | | | | | | +|`cusparseDnnz`| | | |`rocsparse_dnnz`|3.2.0| | | | |`cusparseDnnz_compress`|8.0|12.2| |`rocsparse_dnnz_compress`|3.5.0| | | | |`cusparseDpruneCsr2csr`|9.0|12.2| |`rocsparse_dprune_csr2csr`|3.9.0| | | | |`cusparseDpruneCsr2csrByPercentage`|9.0|12.2| |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | | @@ -735,7 +735,7 @@ |`cusparseShyb2csc`| |10.2|11.0| | | | | | |`cusparseShyb2csr`| |10.2|11.0| | | | | | |`cusparseShyb2dense`| |10.2|11.0| | | | | | -|`cusparseSnnz`| | | | | | | | | +|`cusparseSnnz`| | | |`rocsparse_snnz`|3.2.0| | | | |`cusparseSnnz_compress`|8.0|12.2| |`rocsparse_snnz_compress`|3.5.0| | | | |`cusparseSpruneCsr2csr`|9.0|12.2| |`rocsparse_sprune_csr2csr`|3.9.0| | | | |`cusparseSpruneCsr2csrByPercentage`|9.0|12.2| |`rocsparse_sprune_csr2csr_by_percentage`|3.9.0| | | | @@ -789,7 +789,7 @@ |`cusparseZhyb2csc`| |10.2|11.0| | | | | | |`cusparseZhyb2csr`| |10.2|11.0| | | | | | |`cusparseZhyb2dense`| |10.2|11.0| | | | | | -|`cusparseZnnz`| | | | | | | | | +|`cusparseZnnz`| | | |`rocsparse_znnz`|3.2.0| | | | |`cusparseZnnz_compress`|8.0|12.2| |`rocsparse_znnz_compress`|3.5.0| | | | ## **15. CUSPARSE Generic API Reference** diff --git a/src/CUDA2HIP_SPARSE_API_functions.cpp b/src/CUDA2HIP_SPARSE_API_functions.cpp index 80265336..da4e4764 100644 --- a/src/CUDA2HIP_SPARSE_API_functions.cpp +++ b/src/CUDA2HIP_SPARSE_API_functions.cpp @@ -484,6 +484,7 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseCgpsvInterleavedBatch_bufferSizeExt", {"hipsparseCgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED}}, {"cusparseZgpsvInterleavedBatch_bufferSizeExt", {"hipsparseZgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED}}, + // NOTE: rocsparse_(s|d|c|z)gpsv_interleaved_batch have an additional parameter rocsparse_int batch_stride {"cusparseSgpsvInterleavedBatch", {"hipsparseSgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED}}, {"cusparseDgpsvInterleavedBatch", {"hipsparseDgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED}}, {"cusparseCgpsvInterleavedBatch", {"hipsparseCgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED}}, @@ -629,10 +630,10 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseChyb2dense", {"hipsparseChyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseZhyb2dense", {"hipsparseZhyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseSnnz", {"hipsparseSnnz", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, - {"cusparseDnnz", {"hipsparseDnnz", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, - {"cusparseCnnz", {"hipsparseCnnz", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, - {"cusparseZnnz", {"hipsparseZnnz", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}}, + {"cusparseSnnz", {"hipsparseSnnz", "rocsparse_snnz", CONV_LIB_FUNC, API_SPARSE, 14}}, + {"cusparseDnnz", {"hipsparseDnnz", "rocsparse_dnnz", CONV_LIB_FUNC, API_SPARSE, 14}}, + {"cusparseCnnz", {"hipsparseCnnz", "rocsparse_cnnz", CONV_LIB_FUNC, API_SPARSE, 14}}, + {"cusparseZnnz", {"hipsparseZnnz", "rocsparse_znnz", CONV_LIB_FUNC, API_SPARSE, 14}}, {"cusparseCreateIdentityPermutation", {"hipsparseCreateIdentityPermutation", "rocsparse_create_identity_permutation", CONV_LIB_FUNC, API_SPARSE, 14, CUDA_DEPRECATED}}, @@ -2128,6 +2129,10 @@ const std::map HIP_SPARSE_FUNCTION_VER_MAP { {"rocsparse_cdense2csr", {HIP_3020, HIP_0, HIP_0 }}, {"rocsparse_ddense2csr", {HIP_3020, HIP_0, HIP_0 }}, {"rocsparse_sdense2csr", {HIP_3020, HIP_0, HIP_0 }}, + {"rocsparse_znnz", {HIP_3020, HIP_0, HIP_0 }}, + {"rocsparse_cnnz", {HIP_3020, HIP_0, HIP_0 }}, + {"rocsparse_dnnz", {HIP_3020, HIP_0, HIP_0 }}, + {"rocsparse_snnz", {HIP_3020, HIP_0, HIP_0 }}, }; 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 d4c0f000..9097f41e 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu @@ -159,6 +159,7 @@ int main() { int bsrSortedColIndC = 0; int bufferSizeInBytes = 0; int nnzTotalDevHostPtr = 0; + int nnzPerRowCol = 0; int userEllWidth = 0; int64_t size = 0; int64_t nnz = 0; @@ -229,14 +230,26 @@ int main() { float fbscVal = 0.f; double dA = 0.f; float fA = 0.f; - + int algo = 0; + double dds = 0.f; + double ddl = 0.f; + double dd = 0.f; + double ddu = 0.f; + double ddw = 0.f; + double dx = 0.f; + float fds = 0.f; + float fdl = 0.f; + float fd = 0.f; + float fdu = 0.f; + float fdw = 0.f; + float fx = 0.f; pruneInfo_t prune_info; - // CHECK: hipDoubleComplex dcomplex, dcomplexA, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal; - cuDoubleComplex dcomplex, dcomplexA, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal; + // CHECK: hipDoubleComplex dcomplex, dcomplexA, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx; + cuDoubleComplex dcomplex, dcomplexA, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx; - // CHECK: hipComplex complex, complexA, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal; - cuComplex complex, complexA, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal; + // CHECK: hipComplex complex, complexA, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx; + cuComplex complex, complexA, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx; // CHECK: hipsparseOperation_t opA, opB; cusparseOperation_t opA, opB; @@ -601,6 +614,26 @@ int main() { // CHECK: status_t = hipsparseXcsr2coo(handle_t, &csrSortedRowPtr, nnz, m, &icooRowInd, indexBase_t); status_t = cusparseXcsr2coo(handle_t, &csrSortedRowPtr, nnz, m, &icooRowInd, indexBase_t); + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseZnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const cuDoubleComplex* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipDoubleComplex* A, int lda, int* nnzPerRowColumn, int* nnzTotalDevHostPtr); + // CHECK: status_t = hipsparseZnnz(handle_t, direction_t, m, n, matDescr_A, &dcomplexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseZnnz(handle_t, direction_t, m, n, matDescr_A, &dcomplexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const cuComplex* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipComplex* A, int lda, int* nnzPerRowColumn, int* nnzTotalDevHostPtr); + // CHECK: status_t = hipsparseCnnz(handle_t, direction_t, m, n, matDescr_A, &complexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseCnnz(handle_t, direction_t, m, n, matDescr_A, &complexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const double* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const double* A, int lda, int* nnzPerRowColumn, int* nnzTotalDevHostPtr); + // CHECK: status_t = hipsparseDnnz(handle_t, direction_t, m, n, matDescr_A, &dA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseDnnz(handle_t, direction_t, m, n, matDescr_A, &dA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const float* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const float* A, int lda, int* nnzPerRowColumn, int* nnzTotalDevHostPtr); + // CHECK: status_t = hipsparseSnnz(handle_t, direction_t, m, n, matDescr_A, &fA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseSnnz(handle_t, direction_t, m, n, matDescr_A, &fA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + #if CUDA_VERSION >= 8000 // CHECK: hipDataType dataType_t; // CHECK-NEXT: hipDataType dataType; @@ -777,6 +810,28 @@ int main() { status_t = cusparseSpruneDense2csr_bufferSizeExt(handle_t, m, n, &fA, lda, &fthreshold, matDescr_C, &fcsrSortedValC, &csrRowPtrC, &csrColIndC, &bufferSize); #endif +#if CUDA_VERSION >= 9020 + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseZgpsvInterleavedBatch(cusparseHandle_t handle, int algo, int m, cuDoubleComplex* ds, cuDoubleComplex* dl, cuDoubleComplex* d, cuDoubleComplex* du, cuDoubleComplex* dw, cuDoubleComplex* x, int batchCount, void* pBuffer); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZgpsvInterleavedBatch(hipsparseHandle_t handle, int algo, int m, hipDoubleComplex* ds, hipDoubleComplex* dl, hipDoubleComplex* d, hipDoubleComplex* du, hipDoubleComplex* dw, hipDoubleComplex* x, int batchCount, void* pBuffer); + // CHECK: status_t = hipsparseZgpsvInterleavedBatch(handle_t, algo, m, &dcomplexds, &dcomplexdl, &dcomplexd, &dcomplexdu, &dcomplexdw, &dcomplexx, batchCount, pBuffer); + status_t = cusparseZgpsvInterleavedBatch(handle_t, algo, m, &dcomplexds, &dcomplexdl, &dcomplexd, &dcomplexdu, &dcomplexdw, &dcomplexx, batchCount, pBuffer); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCgpsvInterleavedBatch(cusparseHandle_t handle, int algo, int m, cuComplex* ds, cuComplex* dl, cuComplex* d, cuComplex* du, cuComplex* dw, cuComplex* x, int batchCount, void* pBuffer); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCgpsvInterleavedBatch(hipsparseHandle_t handle, int algo, int m, hipComplex* ds, hipComplex* dl, hipComplex* d, hipComplex* du, hipComplex* dw, hipComplex* x, int batchCount, void* pBuffer); + // CHECK: status_t = hipsparseCgpsvInterleavedBatch(handle_t, algo, m, &complexds, &complexdl, &complexd, &complexdu, &complexdw, &complexx, batchCount, pBuffer); + status_t = cusparseCgpsvInterleavedBatch(handle_t, algo, m, &complexds, &complexdl, &complexd, &complexdu, &complexdw, &complexx, batchCount, pBuffer); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDgpsvInterleavedBatch(cusparseHandle_t handle, int algo, int m, double* ds, double* dl, double* d, double* du, double* dw, double* x, int batchCount, void* pBuffer); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDgpsvInterleavedBatch(hipsparseHandle_t handle, int algo, int m, double* ds, double* dl, double* d, double* du, double* dw, double* x, int batchCount, void* pBuffer); + // CHECK: status_t = hipsparseDgpsvInterleavedBatch(handle_t, algo, m, &dds, &ddl, &dd, &ddu, &ddw, &dx, batchCount, pBuffer); + status_t = cusparseDgpsvInterleavedBatch(handle_t, algo, m, &dds, &ddl, &dd, &ddu, &ddw, &dx, batchCount, pBuffer); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSgpsvInterleavedBatch(cusparseHandle_t handle, int algo, int m, float* ds, float* dl, float* d, float* du, float* dw, float* x, int batchCount, void* pBuffer); + // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSgpsvInterleavedBatch(hipsparseHandle_t handle, int algo, int m, float* ds, float* dl, float* d, float* du, float* dw, float* x, int batchCount, void* pBuffer); + // CHECK: status_t = hipsparseSgpsvInterleavedBatch(handle_t, algo, m, &fds, &fdl, &fd, &fdu, &fdw, &fx, batchCount, pBuffer); + status_t = cusparseSgpsvInterleavedBatch(handle_t, algo, m, &fds, &fdl, &fd, &fdu, &fdw, &fx, batchCount, pBuffer); +#endif + #if CUDA_VERSION >= 10010 // CHECK: hipsparseCsr2CscAlg_t Csr2CscAlg_t; // CHECK-NEXT: hipsparseCsr2CscAlg_t CSR2CSC_ALG1 = HIPSPARSE_CSR2CSC_ALG1; diff --git a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu index dc0f7881..cd3708d3 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu @@ -159,6 +159,7 @@ int main() { int bsrSortedColIndC = 0; int bufferSizeInBytes = 0; int nnzTotalDevHostPtr = 0; + int nnzPerRowCol = 0; int userEllWidth = 0; int64_t size = 0; int64_t nnz = 0; @@ -606,6 +607,26 @@ int main() { // CHECK: status_t = rocsparse_csr2coo(handle_t, &csrSortedRowPtr, nnz, m, &icooRowInd, indexBase_t); status_t = cusparseXcsr2coo(handle_t, &csrSortedRowPtr, nnz, m, &icooRowInd, indexBase_t); + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseZnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const cuDoubleComplex* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_znnz(rocsparse_handle handle, rocsparse_direction dir, rocsparse_int m, rocsparse_int n, const rocsparse_mat_descr descr, const rocsparse_double_complex* A, rocsparse_int ld, rocsparse_int* nnz_per_row_columns, rocsparse_int* nnz_total_dev_host_ptr); + // CHECK: status_t = rocsparse_znnz(handle_t, direction_t, m, n, matDescr_A, &dcomplexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseZnnz(handle_t, direction_t, m, n, matDescr_A, &dcomplexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const cuComplex* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_cnnz(rocsparse_handle handle, rocsparse_direction dir, rocsparse_int m, rocsparse_int n, const rocsparse_mat_descr descr, const rocsparse_float_complex* A, rocsparse_int ld, rocsparse_int* nnz_per_row_columns, rocsparse_int* nnz_total_dev_host_ptr); + // CHECK: status_t = rocsparse_cnnz(handle_t, direction_t, m, n, matDescr_A, &complexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseCnnz(handle_t, direction_t, m, n, matDescr_A, &complexA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const double* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_dnnz(rocsparse_handle handle, rocsparse_direction dir, rocsparse_int m, rocsparse_int n, const rocsparse_mat_descr descr, const double* A, rocsparse_int ld, rocsparse_int* nnz_per_row_columns, rocsparse_int* nnz_total_dev_host_ptr); + // CHECK: status_t = rocsparse_dnnz(handle_t, direction_t, m, n, matDescr_A, &dA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseDnnz(handle_t, direction_t, m, n, matDescr_A, &dA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + + // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSnnz(cusparseHandle_t handle, cusparseDirection_t dirA, int m, int n, const cusparseMatDescr_t descrA, const float* A, int lda, int* nnzPerRowCol, int* nnzTotalDevHostPtr); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_snnz(rocsparse_handle handle, rocsparse_direction dir, rocsparse_int m, rocsparse_int n, const rocsparse_mat_descr descr, const float* A, rocsparse_int ld, rocsparse_int* nnz_per_row_columns, rocsparse_int* nnz_total_dev_host_ptr); + // CHECK: status_t = rocsparse_snnz(handle_t, direction_t, m, n, matDescr_A, &fA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + status_t = cusparseSnnz(handle_t, direction_t, m, n, matDescr_A, &fA, lda, &nnzPerRowCol, &nnzTotalDevHostPtr); + #if CUDA_VERSION >= 8000 // CHECK: hipDataType dataType_t; // TODO: [#899] There should be rocsparse_datatype