diff --git a/bin/hipify-perl b/bin/hipify-perl index 79aa2a71..11f52dc6 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -1812,6 +1812,7 @@ sub rocSubstitutions { subst("cusparseCcsrsm2_analysis", "rocsparse_ccsrsm_analysis", "library"); subst("cusparseCcsrsm2_bufferSizeExt", "rocsparse_ccsrsm_buffer_size", "library"); subst("cusparseCcsrsm2_solve", "rocsparse_ccsrsm_solve", "library"); + subst("cusparseCcsrsv2_solve", "rocsparse_ccsrsv_solve", "library"); subst("cusparseCdense2csc", "rocsparse_cdense2csc", "library"); subst("cusparseCdense2csr", "rocsparse_cdense2csr", "library"); subst("cusparseCgebsr2csr", "rocsparse_cgebsr2csr", "library"); @@ -1889,6 +1890,7 @@ sub rocSubstitutions { subst("cusparseDcsrsm2_analysis", "rocsparse_dcsrsm_analysis", "library"); subst("cusparseDcsrsm2_bufferSizeExt", "rocsparse_dcsrsm_buffer_size", "library"); subst("cusparseDcsrsm2_solve", "rocsparse_dcsrsm_solve", "library"); + subst("cusparseDcsrsv2_solve", "rocsparse_dcsrsv_solve", "library"); subst("cusparseDdense2csc", "rocsparse_ddense2csc", "library"); subst("cusparseDdense2csr", "rocsparse_ddense2csr", "library"); subst("cusparseDestroy", "rocsparse_destroy_handle", "library"); @@ -1985,6 +1987,7 @@ sub rocSubstitutions { subst("cusparseScsrsm2_analysis", "rocsparse_scsrsm_analysis", "library"); subst("cusparseScsrsm2_bufferSizeExt", "rocsparse_scsrsm_buffer_size", "library"); subst("cusparseScsrsm2_solve", "rocsparse_scsrsm_solve", "library"); + subst("cusparseScsrsv2_solve", "rocsparse_scsrsv_solve", "library"); subst("cusparseSdense2csc", "rocsparse_sdense2csc", "library"); subst("cusparseSdense2csr", "rocsparse_sdense2csr", "library"); subst("cusparseSetMatDiagType", "rocsparse_set_mat_diag_type", "library"); @@ -2092,6 +2095,7 @@ sub rocSubstitutions { subst("cusparseZcsrsm2_analysis", "rocsparse_zcsrsm_analysis", "library"); subst("cusparseZcsrsm2_bufferSizeExt", "rocsparse_zcsrsm_buffer_size", "library"); subst("cusparseZcsrsm2_solve", "rocsparse_zcsrsm_solve", "library"); + subst("cusparseZcsrsv2_solve", "rocsparse_zcsrsv_solve", "library"); subst("cusparseZdense2csc", "rocsparse_zdense2csc", "library"); subst("cusparseZdense2csr", "rocsparse_zdense2csr", "library"); subst("cusparseZgebsr2csr", "rocsparse_zgebsr2csr", "library"); @@ -2132,6 +2136,8 @@ sub rocSubstitutions { subst("csrilu02Info_t", "rocsparse_mat_info", "type"); subst("csrsm2Info", "_rocsparse_mat_info", "type"); subst("csrsm2Info_t", "rocsparse_mat_info", "type"); + subst("csrsv2Info", "_rocsparse_mat_descr", "type"); + subst("csrsv2Info_t", "rocsparse_mat_descr", "type"); subst("cuComplex", "rocblas_float_complex", "type"); subst("cuDoubleComplex", "rocblas_double_complex", "type"); subst("cuFloatComplex", "rocblas_float_complex", "type"); 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 c218a44f..a865a084 100644 --- a/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md @@ -124,8 +124,8 @@ |`csrilu02Info_t`| |12.2| | |`csrilu02Info_t`|1.9.2| | | | |`rocsparse_mat_info`|1.9.0| | | | | |`csrsm2Info`|9.2| | |12.0| | | | | | |`_rocsparse_mat_info`|1.9.0| | | | | |`csrsm2Info_t`|9.2| | |12.0|`csrsm2Info_t`|3.1.0| | | | |`rocsparse_mat_info`|1.9.0| | | | | -|`csrsv2Info`| | | |12.0| | | | | | | | | | | | | -|`csrsv2Info_t`| | | |12.0|`csrsv2Info_t`|1.9.2| | | | | | | | | | | +|`csrsv2Info`| | | |12.0| | | | | | |`_rocsparse_mat_descr`|1.9.0| | | | | +|`csrsv2Info_t`| | | |12.0|`csrsv2Info_t`|1.9.2| | | | |`rocsparse_mat_descr`|1.9.0| | | | | |`csru2csrInfo`| |12.2| | |`csru2csrInfo`|4.2.0| | | | | | | | | | | |`csru2csrInfo_t`| |12.2| | |`csru2csrInfo_t`|4.2.0| | | | | | | | | | | |`cusparseAction_t`| | | | |`hipsparseAction_t`|1.9.2| | | | |`rocsparse_action`|1.9.0| | | | | @@ -303,7 +303,7 @@ |`cusparseCcsrsv2_analysis`| |11.3| |12.0|`hipsparseCcsrsv2_analysis`|3.1.0| | | | | | | | | | | |`cusparseCcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseCcsrsv2_bufferSize`|3.1.0| | | | | | | | | | | |`cusparseCcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseCcsrsv2_bufferSizeExt`|3.1.0| | | | | | | | | | | -|`cusparseCcsrsv2_solve`| |11.3| |12.0|`hipsparseCcsrsv2_solve`|3.1.0| | | | | | | | | | | +|`cusparseCcsrsv2_solve`| |11.3| |12.0|`hipsparseCcsrsv2_solve`|3.1.0| | | | |`rocsparse_ccsrsv_solve`|2.10.0| | | | | |`cusparseCcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseCcsrsv_solve`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseCgemvi`|7.5| | | |`hipsparseCgemvi`|4.3.0| | | | |`rocsparse_cgemvi`|4.3.0| | | | | @@ -326,7 +326,7 @@ |`cusparseDcsrsv2_analysis`| |11.3| |12.0|`hipsparseDcsrsv2_analysis`|1.9.2| | | | | | | | | | | |`cusparseDcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseDcsrsv2_bufferSize`|1.9.2| | | | | | | | | | | |`cusparseDcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseDcsrsv2_bufferSizeExt`|1.9.2| | | | | | | | | | | -|`cusparseDcsrsv2_solve`| |11.3| |12.0|`hipsparseDcsrsv2_solve`|1.9.2| | | | | | | | | | | +|`cusparseDcsrsv2_solve`| |11.3| |12.0|`hipsparseDcsrsv2_solve`|1.9.2| | | | |`rocsparse_dcsrsv_solve`|1.9.0| | | | | |`cusparseDcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseDcsrsv_solve`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseDgemvi`|7.5| | | |`hipsparseDgemvi`|4.3.0| | | | |`rocsparse_dgemvi`|4.3.0| | | | | @@ -345,7 +345,7 @@ |`cusparseScsrsv2_analysis`| |11.3| |12.0|`hipsparseScsrsv2_analysis`|1.9.2| | | | | | | | | | | |`cusparseScsrsv2_bufferSize`| |11.3| |12.0|`hipsparseScsrsv2_bufferSize`|1.9.2| | | | | | | | | | | |`cusparseScsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseScsrsv2_bufferSizeExt`|1.9.2| | | | | | | | | | | -|`cusparseScsrsv2_solve`| |11.3| |12.0|`hipsparseScsrsv2_solve`|1.9.2| | | | | | | | | | | +|`cusparseScsrsv2_solve`| |11.3| |12.0|`hipsparseScsrsv2_solve`|1.9.2| | | | |`rocsparse_scsrsv_solve`|1.9.0| | | | | |`cusparseScsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseScsrsv_solve`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseSgemvi`|7.5| | | |`hipsparseSgemvi`|4.3.0| | | | |`rocsparse_sgemvi`|4.3.0| | | | | @@ -366,7 +366,7 @@ |`cusparseZcsrsv2_analysis`| |11.3| |12.0|`hipsparseZcsrsv2_analysis`|3.1.0| | | | | | | | | | | |`cusparseZcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseZcsrsv2_bufferSize`|3.1.0| | | | | | | | | | | |`cusparseZcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseZcsrsv2_bufferSizeExt`|3.1.0| | | | | | | | | | | -|`cusparseZcsrsv2_solve`| |11.3| |12.0|`hipsparseZcsrsv2_solve`|3.1.0| | | | | | | | | | | +|`cusparseZcsrsv2_solve`| |11.3| |12.0|`hipsparseZcsrsv2_solve`|3.1.0| | | | |`rocsparse_zcsrsv_solve`|2.10.0| | | | | |`cusparseZcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseZcsrsv_solve`| |10.2| |11.0| | | | | | | | | | | | | |`cusparseZgemvi`|7.5| | | |`hipsparseZgemvi`|4.3.0| | | | |`rocsparse_zgemvi`|4.3.0| | | | | diff --git a/docs/tables/CUSPARSE_API_supported_by_ROC.md b/docs/tables/CUSPARSE_API_supported_by_ROC.md index 8166e070..1eb763d5 100644 --- a/docs/tables/CUSPARSE_API_supported_by_ROC.md +++ b/docs/tables/CUSPARSE_API_supported_by_ROC.md @@ -124,8 +124,8 @@ |`csrilu02Info_t`| |12.2| | |`rocsparse_mat_info`|1.9.0| | | | | |`csrsm2Info`|9.2| | |12.0|`_rocsparse_mat_info`|1.9.0| | | | | |`csrsm2Info_t`|9.2| | |12.0|`rocsparse_mat_info`|1.9.0| | | | | -|`csrsv2Info`| | | |12.0| | | | | | | -|`csrsv2Info_t`| | | |12.0| | | | | | | +|`csrsv2Info`| | | |12.0|`_rocsparse_mat_descr`|1.9.0| | | | | +|`csrsv2Info_t`| | | |12.0|`rocsparse_mat_descr`|1.9.0| | | | | |`csru2csrInfo`| |12.2| | | | | | | | | |`csru2csrInfo_t`| |12.2| | | | | | | | | |`cusparseAction_t`| | | | |`rocsparse_action`|1.9.0| | | | | @@ -303,7 +303,7 @@ |`cusparseCcsrsv2_analysis`| |11.3| |12.0| | | | | | | |`cusparseCcsrsv2_bufferSize`| |11.3| |12.0| | | | | | | |`cusparseCcsrsv2_bufferSizeExt`| |11.3| |12.0| | | | | | | -|`cusparseCcsrsv2_solve`| |11.3| |12.0| | | | | | | +|`cusparseCcsrsv2_solve`| |11.3| |12.0|`rocsparse_ccsrsv_solve`|2.10.0| | | | | |`cusparseCcsrsv_analysis`| |10.2| |11.0| | | | | | | |`cusparseCcsrsv_solve`| |10.2| |11.0| | | | | | | |`cusparseCgemvi`|7.5| | | |`rocsparse_cgemvi`|4.3.0| | | | | @@ -326,7 +326,7 @@ |`cusparseDcsrsv2_analysis`| |11.3| |12.0| | | | | | | |`cusparseDcsrsv2_bufferSize`| |11.3| |12.0| | | | | | | |`cusparseDcsrsv2_bufferSizeExt`| |11.3| |12.0| | | | | | | -|`cusparseDcsrsv2_solve`| |11.3| |12.0| | | | | | | +|`cusparseDcsrsv2_solve`| |11.3| |12.0|`rocsparse_dcsrsv_solve`|1.9.0| | | | | |`cusparseDcsrsv_analysis`| |10.2| |11.0| | | | | | | |`cusparseDcsrsv_solve`| |10.2| |11.0| | | | | | | |`cusparseDgemvi`|7.5| | | |`rocsparse_dgemvi`|4.3.0| | | | | @@ -345,7 +345,7 @@ |`cusparseScsrsv2_analysis`| |11.3| |12.0| | | | | | | |`cusparseScsrsv2_bufferSize`| |11.3| |12.0| | | | | | | |`cusparseScsrsv2_bufferSizeExt`| |11.3| |12.0| | | | | | | -|`cusparseScsrsv2_solve`| |11.3| |12.0| | | | | | | +|`cusparseScsrsv2_solve`| |11.3| |12.0|`rocsparse_scsrsv_solve`|1.9.0| | | | | |`cusparseScsrsv_analysis`| |10.2| |11.0| | | | | | | |`cusparseScsrsv_solve`| |10.2| |11.0| | | | | | | |`cusparseSgemvi`|7.5| | | |`rocsparse_sgemvi`|4.3.0| | | | | @@ -366,7 +366,7 @@ |`cusparseZcsrsv2_analysis`| |11.3| |12.0| | | | | | | |`cusparseZcsrsv2_bufferSize`| |11.3| |12.0| | | | | | | |`cusparseZcsrsv2_bufferSizeExt`| |11.3| |12.0| | | | | | | -|`cusparseZcsrsv2_solve`| |11.3| |12.0| | | | | | | +|`cusparseZcsrsv2_solve`| |11.3| |12.0|`rocsparse_zcsrsv_solve`|2.10.0| | | | | |`cusparseZcsrsv_analysis`| |10.2| |11.0| | | | | | | |`cusparseZcsrsv_solve`| |10.2| |11.0| | | | | | | |`cusparseZgemvi`|7.5| | | |`rocsparse_zgemvi`|4.3.0| | | | | diff --git a/src/CUDA2HIP_SPARSE_API_functions.cpp b/src/CUDA2HIP_SPARSE_API_functions.cpp index 7441ac52..c126bf03 100644 --- a/src/CUDA2HIP_SPARSE_API_functions.cpp +++ b/src/CUDA2HIP_SPARSE_API_functions.cpp @@ -196,10 +196,10 @@ const std::map CUDA_SPARSE_FUNCTION_MAP { {"cusparseCcsrsv2_analysis", {"hipsparseCcsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseZcsrsv2_analysis", {"hipsparseZcsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseScsrsv2_solve", {"hipsparseScsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseDcsrsv2_solve", {"hipsparseDcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseCcsrsv2_solve", {"hipsparseCcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"cusparseZcsrsv2_solve", {"hipsparseZcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, + {"cusparseScsrsv2_solve", {"hipsparseScsrsv2_solve", "rocsparse_scsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}}, + {"cusparseDcsrsv2_solve", {"hipsparseDcsrsv2_solve", "rocsparse_dcsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}}, + {"cusparseCcsrsv2_solve", {"hipsparseCcsrsv2_solve", "rocsparse_ccsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}}, + {"cusparseZcsrsv2_solve", {"hipsparseZcsrsv2_solve", "rocsparse_zcsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseXcsrsv2_zeroPivot", {"hipsparseXcsrsv2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseShybmv", {"hipsparseShybmv", "rocsparse_shybmv", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}}, @@ -2323,6 +2323,10 @@ const std::map HIP_SPARSE_FUNCTION_VER_MAP { {"rocsparse_chybmv", {HIP_2100, HIP_0, HIP_0 }}, {"rocsparse_dhybmv", {HIP_1090, HIP_0, HIP_0 }}, {"rocsparse_shybmv", {HIP_1090, HIP_0, HIP_0 }}, + {"rocsparse_zcsrsv_solve", {HIP_2100, HIP_0, HIP_0 }}, + {"rocsparse_ccsrsv_solve", {HIP_2100, HIP_0, HIP_0 }}, + {"rocsparse_dcsrsv_solve", {HIP_1090, HIP_0, HIP_0 }}, + {"rocsparse_scsrsv_solve", {HIP_1090, HIP_0, HIP_0 }}, }; const std::map CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP { diff --git a/src/CUDA2HIP_SPARSE_API_types.cpp b/src/CUDA2HIP_SPARSE_API_types.cpp index 52fabf62..5c09511a 100644 --- a/src/CUDA2HIP_SPARSE_API_types.cpp +++ b/src/CUDA2HIP_SPARSE_API_types.cpp @@ -38,8 +38,8 @@ const std::map CUDA_SPARSE_TYPE_NAME_MAP { {"cusparseSolveAnalysisInfo", {"hipsparseSolveAnalysisInfo", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, {"cusparseSolveAnalysisInfo_t", {"hipsparseSolveAnalysisInfo_t", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}}, - {"csrsv2Info", {"csrsv2Info", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED | CUDA_REMOVED}}, - {"csrsv2Info_t", {"csrsv2Info_t", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED | CUDA_REMOVED}}, + {"csrsv2Info", {"csrsv2Info", "_rocsparse_mat_descr", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED | CUDA_REMOVED}}, + {"csrsv2Info_t", {"csrsv2Info_t", "rocsparse_mat_descr", CONV_TYPE, API_SPARSE, 4, CUDA_REMOVED}}, {"csrsm2Info", {"csrsm2Info", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED | CUDA_REMOVED}}, {"csrsm2Info_t", {"csrsm2Info_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_REMOVED}}, diff --git a/src/HipifyAction.cpp b/src/HipifyAction.cpp index e025ced4..2eb3df78 100644 --- a/src/HipifyAction.cpp +++ b/src/HipifyAction.cpp @@ -155,6 +155,10 @@ const std::string sCusparseZgemvi_bufferSize = "cusparseZgemvi_bufferSize"; const std::string sCusparseCgemvi_bufferSize = "cusparseCgemvi_bufferSize"; const std::string sCusparseDgemvi_bufferSize = "cusparseDgemvi_bufferSize"; const std::string sCusparseSgemvi_bufferSize = "cusparseSgemvi_bufferSize"; +const std::string sCusparseZcsrsv2_solve = "cusparseZcsrsv2_solve"; +const std::string sCusparseCcsrsv2_solve = "cusparseCcsrsv2_solve"; +const std::string sCusparseDcsrsv2_solve = "cusparseDcsrsv2_solve"; +const std::string sCusparseScsrsv2_solve = "cusparseScsrsv2_solve"; // CUDA_OVERLOADED const std::string sCudaEventCreate = "cudaEventCreate"; @@ -1127,6 +1131,42 @@ std::map FuncArgCasts { false } }, + {sCusparseZcsrsv2_solve, + { + { + {12, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}} + }, + true, + false + } + }, + {sCusparseCcsrsv2_solve, + { + { + {12, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}} + }, + true, + false + } + }, + {sCusparseDcsrsv2_solve, + { + { + {12, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}} + }, + true, + false + } + }, + {sCusparseScsrsv2_solve, + { + { + {12, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}} + }, + true, + false + } + }, }; void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) { @@ -1910,7 +1950,11 @@ std::unique_ptr HipifyAction::CreateASTConsumer(clang::Compi sCusparseZgemvi_bufferSize, sCusparseCgemvi_bufferSize, sCusparseDgemvi_bufferSize, - sCusparseSgemvi_bufferSize + sCusparseSgemvi_bufferSize, + sCusparseZcsrsv2_solve, + sCusparseCcsrsv2_solve, + sCusparseDcsrsv2_solve, + sCusparseScsrsv2_solve ) ) ) diff --git a/tests/lit.cfg b/tests/lit.cfg index 638378b6..8058e5d7 100644 --- a/tests/lit.cfg +++ b/tests/lit.cfg @@ -104,6 +104,7 @@ if config.cuda_version_major >= 12: config.excludes.append('cub_02.cu') config.excludes.append('cub_03.cu') config.excludes.append('cusparse2rocsparse_9200_12000.cu') + config.excludes.append('cusparse2rocsparse_before_12000.cu') if config.llvm_version_major < 8: config.excludes.append('cd_intro.cu') diff --git a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu index da054162..23e89bd3 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu @@ -276,6 +276,7 @@ int main() { double dB = 0.f; double dBeta = 0.f; double dC = 0.f; + double dF = 0.f; double dX = 0.f; double dY = 0.f; float fA = 0.f; @@ -283,6 +284,7 @@ int main() { float fB = 0.f; float fBeta = 0.f; float fC = 0.f; + float fF = 0.f; float fX = 0.f; float fY = 0.f; int algo = 0; @@ -308,8 +310,8 @@ int main() { bsric02Info_t bsric02_info; bsrsm2Info_t bsrsm2_info; - // CHECK: hipDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; - cuDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; + // CHECK: hipDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; + cuDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; // CHECK: hipComplex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; cuComplex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; @@ -1725,6 +1727,8 @@ int main() { status_t = cusparseCreateSpVec(&spVecDescr_t, size, nnz, indices, values, indexType_t, indexBase_t, dataType); #if CUDA_VERSION < 12000 + csrsv2Info_t csrsv2_info; + // TODO: Mark as C-Changed in 12.0.0 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDestroySpVec(cusparseSpVecDescr_t spVecDescr); // HIP: hipsparseStatus_t hipsparseDestroySpVec(hipsparseSpVecDescr_t spVecDescr); @@ -1772,6 +1776,26 @@ int main() { // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSpMV(hipsparseHandle_t handle, hipsparseOperation_t opA, const void* alpha, const hipsparseSpMatDescr_t matA, const hipsparseDnVecDescr_t vecX, const void* beta, const hipsparseDnVecDescr_t vecY, hipDataType computeType, hipsparseSpMVAlg_t alg, void* externalBuffer); // CHECK: status_t = hipsparseSpMV(handle_t, opA, alpha, spmatA, vecX, beta, vecY, dataType, spMVAlg_t, tempBuffer); status_t = cusparseSpMV(handle_t, opA, alpha, spmatA, vecX, beta, vecY, dataType, spMVAlg_t, tempBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseZcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const cuDoubleComplex* alpha, const cusparseMatDescr_t descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const cuDoubleComplex* f, cuDoubleComplex* x, cusparseSolvePolicy_t policy, void* pBuffer); + // HIP: DEPRECATED_CUDA_11000("The routine will be removed in CUDA 12") HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZcsrsv2_solve(hipsparseHandle_t handle, hipsparseOperation_t transA, int m, int nnz, const hipDoubleComplex* alpha, const hipsparseMatDescr_t descrA, const hipDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const hipDoubleComplex* f, hipDoubleComplex* x, hipsparseSolvePolicy_t policy, void* pBuffer); + // CHECK: status_t = hipsparseZcsrsv2_solve(handle_t, opA, m, innz, &dcomplexAlpha, matDescr_A, &dComplexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dcomplexF, &dcomplexX, solvePolicy_t, pBuffer); + status_t = cusparseZcsrsv2_solve(handle_t, opA, m, innz, &dcomplexAlpha, matDescr_A, &dComplexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dcomplexF, &dcomplexX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseCcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const cuComplex* alpha, const cusparseMatDescr_t descrA, const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const cuComplex* f, cuComplex* x,cusparseSolvePolicy_t policy, void* pBuffer); + // HIP: DEPRECATED_CUDA_11000("The routine will be removed in CUDA 12") HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCcsrsv2_solve(hipsparseHandle_t handle, hipsparseOperation_t transA, int m, int nnz, const hipComplex* alpha, const hipsparseMatDescr_t descrA, const hipComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const hipComplex* f, hipComplex* x, hipsparseSolvePolicy_t policy, void* pBuffer); + // CHECK: status_t = hipsparseCcsrsv2_solve(handle_t, opA, m, innz, &complexAlpha, matDescr_A, &complexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &complexF, &complexX, solvePolicy_t, pBuffer); + status_t = cusparseCcsrsv2_solve(handle_t, opA, m, innz, &complexAlpha, matDescr_A, &complexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &complexF, &complexX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseDcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const double* alpha, const cusparseMatDescr_t descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const double* f, double* x, cusparseSolvePolicy_t policy, void* pBuffer); + // HIP: DEPRECATED_CUDA_11000("The routine will be removed in CUDA 12") HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDcsrsv2_solve(hipsparseHandle_t handle, hipsparseOperation_t transA, int m, int nnz, const double* alpha, const hipsparseMatDescr_t descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const double* f, double* x, hipsparseSolvePolicy_t policy, void* pBuffer); + // CHECK: status_t = hipsparseDcsrsv2_solve(handle_t, opA, m, innz, &dAlpha, matDescr_A, &dcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dF, &dX, solvePolicy_t, pBuffer); + status_t = cusparseDcsrsv2_solve(handle_t, opA, m, innz, &dAlpha, matDescr_A, &dcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dF, &dX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseScsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const float* alpha, const cusparseMatDescr_t descrA, const float* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const float* f, float* x, cusparseSolvePolicy_t policy, void* pBuffer); + // HIP: DEPRECATED_CUDA_11000("The routine will be removed in CUDA 12") HIPSPARSE_EXPORT hipsparseStatus_t hipsparseScsrsv2_solve(hipsparseHandle_t handle, hipsparseOperation_t transA, int m, int nnz, const float* alpha, const hipsparseMatDescr_t descrA, const float* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const float* f, float* x, hipsparseSolvePolicy_t policy, void* pBuffer); + // CHECK: status_t = hipsparseScsrsv2_solve(handle_t, opA, m, innz, &fAlpha, matDescr_A, &csrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &fF, &fX, solvePolicy_t, pBuffer); + status_t = cusparseScsrsv2_solve(handle_t, opA, m, innz, &fAlpha, matDescr_A, &csrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &fF, &fX, solvePolicy_t, pBuffer); #endif // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr, int64_t* size, int64_t* nnz, void** indices, void** values, cusparseIndexType_t* idxType, cusparseIndexBase_t* idxBase, cudaDataType* valueType); diff --git a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse_before_12000.cu b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse_before_12000.cu new file mode 100644 index 00000000..e3100013 --- /dev/null +++ b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse_before_12000.cu @@ -0,0 +1,84 @@ +// RUN: %run_test hipify "%s" "%t" %hipify_args 4 --skip-excluded-preprocessor-conditional-blocks --experimental --roc --use-hip-data-types %clang_args -ferror-limit=500 + +// CHECK: #include +#include +// CHECK: #include "hip/hip_complex.h" +#include "cuComplex.h" +#include +// CHECK: #include "rocsparse.h" +#include "cusparse.h" +// CHECK-NOT: #include "rocsparse.h" + +int main() { + printf("18.1. cuSPARSE API to rocSPARSE API synthetic test\n"); + + // CHECK: rocsparse_status status_t; + cusparseStatus_t status_t; + + // CHECK: _rocsparse_handle *handle = nullptr; + // CHECK-NEXT: rocsparse_handle handle_t; + cusparseContext *handle = nullptr; + cusparseHandle_t handle_t; + + // CHECK: _rocsparse_mat_descr *matDescr = nullptr; + // CHECK-NEXT: rocsparse_mat_descr matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D; + cusparseMatDescr *matDescr = nullptr; + cusparseMatDescr_t matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D; + + // CHECK: rocsparse_operation opA, opB, opX; + cusparseOperation_t opA, opB, opX; + + // CHECK: rocsparse_solve_policy solvePolicy_t; + cusparseSolvePolicy_t solvePolicy_t; + + int m = 0; + int innz = 0; + int csrRowPtrA = 0; + int csrColIndA = 0; + double dAlpha = 0.f; + double dF = 0.f; + double dX = 0.f; + double dcsrSortedValA = 0.f; + float fAlpha = 0.f; + float fF = 0.f; + float fX = 0.f; + float csrSortedValA = 0.f; + void *pBuffer = nullptr; + + // TODO: should be rocsparse_double_complex + // TODO: add to TypeOverloads cuDoubleComplex -> rocsparse_double_complex under a new option --sparse + // CHECK: rocblas_double_complex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; + cuDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; + + // TODO: should be rocsparse_double_complex + // TODO: add to TypeOverloads cuComplex -> rocsparse_float_complex under a new option --sparse + // CHECK: rocblas_float_complex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexF, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; + cuComplex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexF, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; + +#if CUDA_VERSION < 12000 + // CHECK: rocsparse_mat_descr csrsv2_info; + csrsv2Info_t csrsv2_info; + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseZcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const cuDoubleComplex* alpha, const cusparseMatDescr_t descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const cuDoubleComplex* f, cuDoubleComplex* x, cusparseSolvePolicy_t policy, void* pBuffer); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_zcsrsv_solve(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int nnz, const rocsparse_double_complex* alpha, const rocsparse_mat_descr descr, const rocsparse_double_complex* csr_val, const rocsparse_int* csr_row_ptr, const rocsparse_int* csr_col_ind, rocsparse_mat_info info, const rocsparse_double_complex* x, rocsparse_double_complex* y, rocsparse_solve_policy policy, void* temp_buffer); + // CHECK: status_t = rocsparse_zcsrsv_solve(handle_t, opA, m, innz, &dcomplexAlpha, matDescr_A, &dComplexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dcomplexF, &dcomplexX, rocsparse_solve_policy_auto, pBuffer); + status_t = cusparseZcsrsv2_solve(handle_t, opA, m, innz, &dcomplexAlpha, matDescr_A, &dComplexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dcomplexF, &dcomplexX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseCcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const cuComplex* alpha, const cusparseMatDescr_t descrA, const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const cuComplex* f, cuComplex* x,cusparseSolvePolicy_t policy, void* pBuffer); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_ccsrsv_solve(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int nnz, const rocsparse_float_complex* alpha, const rocsparse_mat_descr descr, const rocsparse_float_complex* csr_val, const rocsparse_int* csr_row_ptr, const rocsparse_int* csr_col_ind, rocsparse_mat_info info, const rocsparse_float_complex* x, rocsparse_float_complex* y, rocsparse_solve_policy policy, void* temp_buffer); + // CHECK: status_t = rocsparse_ccsrsv_solve(handle_t, opA, m, innz, &complexAlpha, matDescr_A, &complexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &complexF, &complexX, rocsparse_solve_policy_auto, pBuffer); + status_t = cusparseCcsrsv2_solve(handle_t, opA, m, innz, &complexAlpha, matDescr_A, &complexcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &complexF, &complexX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseDcsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const double* alpha, const cusparseMatDescr_t descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const double* f, double* x, cusparseSolvePolicy_t policy, void* pBuffer); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_dcsrsv_solve(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int nnz, const double* alpha, const rocsparse_mat_descr descr, const double* csr_val, const rocsparse_int* csr_row_ptr, const rocsparse_int* csr_col_ind, rocsparse_mat_info info, const double* x, double* y, rocsparse_solve_policy policy, void* temp_buffer); + // CHECK: status_t = rocsparse_dcsrsv_solve(handle_t, opA, m, innz, &dAlpha, matDescr_A, &dcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dF, &dX, rocsparse_solve_policy_auto, pBuffer); + status_t = cusparseDcsrsv2_solve(handle_t, opA, m, innz, &dAlpha, matDescr_A, &dcsrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &dF, &dX, solvePolicy_t, pBuffer); + + // CUDA: CUSPARSE_DEPRECATED(cusparseSpSV) cusparseStatus_t CUSPARSEAPI cusparseScsrsv2_solve(cusparseHandle_t handle, cusparseOperation_t transA, int m, int nnz, const float* alpha, const cusparseMatDescr_t descrA, const float* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, const float* f, float* x, cusparseSolvePolicy_t policy, void* pBuffer); + // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_scsrsv_solve(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int nnz, const float* alpha, const rocsparse_mat_descr descr, const float* csr_val, const rocsparse_int* csr_row_ptr, const rocsparse_int* csr_col_ind, rocsparse_mat_info info, const float* x, float* y, rocsparse_solve_policy policy, void* temp_buffer); + // CHECK: status_t = rocsparse_scsrsv_solve(handle_t, opA, m, innz, &fAlpha, matDescr_A, &csrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &fF, &fX, rocsparse_solve_policy_auto, pBuffer); + status_t = cusparseScsrsv2_solve(handle_t, opA, m, innz, &fAlpha, matDescr_A, &csrSortedValA, &csrRowPtrA, &csrColIndA, csrsv2_info, &fF, &fX, solvePolicy_t, pBuffer); +#endif + + return 0; +}