Skip to content

Commit

Permalink
[HIPIFY][ROCm#674][rocSPARSE][feature] rocSPARSE support - Step 68 - …
Browse files Browse the repository at this point in the history
…functions `rocsparse_(s|d|c|z)bsrsv_solve`

+ `bsrsv2Info_t` -> `rocsparse_mat_descr`
+ Updated `hipSPARSE` and `rocSPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` docs
  • Loading branch information
emankov committed Nov 28, 2023
1 parent ab091ec commit 7f774b4
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 25 deletions.
6 changes: 6 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1834,6 +1834,7 @@ sub rocSubstitutions {
subst("cusparseCbsrsm2_analysis", "rocsparse_cbsrsm_analysis", "library");
subst("cusparseCbsrsm2_bufferSize", "rocsparse_cbsrsm_buffer_size", "library");
subst("cusparseCbsrsm2_solve", "rocsparse_cbsrsm_solve", "library");
subst("cusparseCbsrsv2_solve", "rocsparse_cbsrsv_solve", "library");
subst("cusparseCcsc2dense", "rocsparse_ccsc2dense", "library");
subst("cusparseCcsr2bsr", "rocsparse_ccsr2bsr", "library");
subst("cusparseCcsr2csr_compress", "rocsparse_ccsr2csr_compress", "library");
Expand Down Expand Up @@ -1915,6 +1916,7 @@ sub rocSubstitutions {
subst("cusparseDbsrsm2_analysis", "rocsparse_dbsrsm_analysis", "library");
subst("cusparseDbsrsm2_bufferSize", "rocsparse_dbsrsm_buffer_size", "library");
subst("cusparseDbsrsm2_solve", "rocsparse_dbsrsm_solve", "library");
subst("cusparseDbsrsv2_solve", "rocsparse_dbsrsv_solve", "library");
subst("cusparseDcsc2dense", "rocsparse_dcsc2dense", "library");
subst("cusparseDcsr2bsr", "rocsparse_dcsr2bsr", "library");
subst("cusparseDcsr2csr_compress", "rocsparse_dcsr2csr_compress", "library");
Expand Down Expand Up @@ -2014,6 +2016,7 @@ sub rocSubstitutions {
subst("cusparseSbsrsm2_analysis", "rocsparse_sbsrsm_analysis", "library");
subst("cusparseSbsrsm2_bufferSize", "rocsparse_sbsrsm_buffer_size", "library");
subst("cusparseSbsrsm2_solve", "rocsparse_sbsrsm_solve", "library");
subst("cusparseSbsrsv2_solve", "rocsparse_sbsrsv_solve", "library");
subst("cusparseScatter", "rocsparse_scatter", "library");
subst("cusparseScsc2dense", "rocsparse_scsc2dense", "library");
subst("cusparseScsr2bsr", "rocsparse_scsr2bsr", "library");
Expand Down Expand Up @@ -2127,6 +2130,7 @@ sub rocSubstitutions {
subst("cusparseZbsrsm2_analysis", "rocsparse_zbsrsm_analysis", "library");
subst("cusparseZbsrsm2_bufferSize", "rocsparse_zbsrsm_buffer_size", "library");
subst("cusparseZbsrsm2_solve", "rocsparse_zbsrsm_solve", "library");
subst("cusparseZbsrsv2_solve", "rocsparse_zbsrsv_solve", "library");
subst("cusparseZcsc2dense", "rocsparse_zcsc2dense", "library");
subst("cusparseZcsr2bsr", "rocsparse_zcsr2bsr", "library");
subst("cusparseZcsr2csr_compress", "rocsparse_zcsr2csr_compress", "library");
Expand Down Expand Up @@ -2185,6 +2189,8 @@ sub rocSubstitutions {
subst("bsrilu02Info_t", "rocsparse_mat_info", "type");
subst("bsrsm2Info", "_rocsparse_mat_info", "type");
subst("bsrsm2Info_t", "rocsparse_mat_info", "type");
subst("bsrsv2Info", "_rocsparse_mat_info", "type");
subst("bsrsv2Info_t", "rocsparse_mat_info", "type");
subst("csrgemm2Info", "_rocsparse_mat_info", "type");
subst("csrgemm2Info_t", "rocsparse_mat_info", "type");
subst("csric02Info", "_rocsparse_mat_info", "type");
Expand Down
12 changes: 6 additions & 6 deletions docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
|`bsrilu02Info_t`| |12.2| | |`bsrilu02Info_t`|3.9.0| | | | |`rocsparse_mat_info`|1.9.0| | | | |
|`bsrsm2Info`| |12.2| | |`bsrsm2Info`|4.5.0| | | | |`_rocsparse_mat_info`|1.9.0| | | | |
|`bsrsm2Info_t`| |12.2| | |`bsrsm2Info_t`|4.5.0| | | | |`rocsparse_mat_info`|1.9.0| | | | |
|`bsrsv2Info`| |12.2| | |`bsrsv2Info`|3.6.0| | | | | | | | | | |
|`bsrsv2Info_t`| |12.2| | |`bsrsv2Info_t`|3.6.0| | | | | | | | | | |
|`bsrsv2Info`| |12.2| | |`bsrsv2Info`|3.6.0| | | | |`_rocsparse_mat_info`|1.9.0| | | | |
|`bsrsv2Info_t`| |12.2| | |`bsrsv2Info_t`|3.6.0| | | | |`rocsparse_mat_info`|1.9.0| | | | |
|`csrgemm2Info`| | | |12.0|`csrgemm2Info`|2.8.0| | | | |`_rocsparse_mat_info`|1.9.0| | | | |
|`csrgemm2Info_t`| | | |12.0|`csrgemm2Info_t`|2.8.0| | | | |`rocsparse_mat_info`|1.9.0| | | | |
|`csric02Info`| |12.2| | |`csric02Info`|3.1.0| | | | |`_rocsparse_mat_info`|1.9.0| | | | |
Expand Down Expand Up @@ -296,7 +296,7 @@
|`cusparseCbsrsv2_analysis`| |12.2| | |`hipsparseCbsrsv2_analysis`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | |`hipsparseCbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseCbsrsv2_bufferSizeExt`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_solve`| |12.2| | |`hipsparseCbsrsv2_solve`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_solve`| |12.2| | |`hipsparseCbsrsv2_solve`|3.6.0| | | | |`rocsparse_cbsrsv_solve`|3.6.0| | | | |
|`cusparseCbsrxmv`| |12.2| | |`hipsparseCbsrxmv`|4.5.0| | | | | | | | | | |
|`cusparseCcsrmv`| |10.2| |11.0|`hipsparseCcsrmv`|3.1.0| | | | |`rocsparse_ccsrmv`|1.9.0| | | | |
|`cusparseCcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -319,7 +319,7 @@
|`cusparseDbsrsv2_analysis`| |12.2| | |`hipsparseDbsrsv2_analysis`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | |`hipsparseDbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseDbsrsv2_bufferSizeExt`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_solve`| |12.2| | |`hipsparseDbsrsv2_solve`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_solve`| |12.2| | |`hipsparseDbsrsv2_solve`|3.6.0| | | | |`rocsparse_dbsrsv_solve`|3.6.0| | | | |
|`cusparseDbsrxmv`| |12.2| | |`hipsparseDbsrxmv`|4.5.0| | | | | | | | | | |
|`cusparseDcsrmv`| |10.2| |11.0|`hipsparseDcsrmv`|1.9.2| | | | |`rocsparse_dcsrmv`|1.9.0| | | | |
|`cusparseDcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -338,7 +338,7 @@
|`cusparseSbsrsv2_analysis`| |12.2| | |`hipsparseSbsrsv2_analysis`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | |`hipsparseSbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseSbsrsv2_bufferSizeExt`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_solve`| |12.2| | |`hipsparseSbsrsv2_solve`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_solve`| |12.2| | |`hipsparseSbsrsv2_solve`|3.6.0| | | | |`rocsparse_sbsrsv_solve`|3.6.0| | | | |
|`cusparseSbsrxmv`| |12.2| | |`hipsparseSbsrxmv`|4.5.0| | | | | | | | | | |
|`cusparseScsrmv`| |10.2| |11.0|`hipsparseScsrmv`|1.9.2| | | | |`rocsparse_scsrmv`|1.9.0| | | | |
|`cusparseScsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -359,7 +359,7 @@
|`cusparseZbsrsv2_analysis`| |12.2| | |`hipsparseZbsrsv2_analysis`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | |`hipsparseZbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseZbsrsv2_bufferSizeExt`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_solve`| |12.2| | |`hipsparseZbsrsv2_solve`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_solve`| |12.2| | |`hipsparseZbsrsv2_solve`|3.6.0| | | | |`rocsparse_zbsrsv_solve`|3.6.0| | | | |
|`cusparseZbsrxmv`| |12.2| | |`hipsparseZbsrxmv`|4.5.0| | | | | | | | | | |
|`cusparseZcsrmv`| |10.2| |11.0|`hipsparseZcsrmv`|3.1.0| | | | |`rocsparse_zcsrmv`|1.9.0| | | | |
|`cusparseZcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
Expand Down
12 changes: 6 additions & 6 deletions docs/tables/CUSPARSE_API_supported_by_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
|`bsrilu02Info_t`| |12.2| | |`rocsparse_mat_info`|1.9.0| | | | |
|`bsrsm2Info`| |12.2| | |`_rocsparse_mat_info`|1.9.0| | | | |
|`bsrsm2Info_t`| |12.2| | |`rocsparse_mat_info`|1.9.0| | | | |
|`bsrsv2Info`| |12.2| | | | | | | | |
|`bsrsv2Info_t`| |12.2| | | | | | | | |
|`bsrsv2Info`| |12.2| | |`_rocsparse_mat_info`|1.9.0| | | | |
|`bsrsv2Info_t`| |12.2| | |`rocsparse_mat_info`|1.9.0| | | | |
|`csrgemm2Info`| | | |12.0|`_rocsparse_mat_info`|1.9.0| | | | |
|`csrgemm2Info_t`| | | |12.0|`rocsparse_mat_info`|1.9.0| | | | |
|`csric02Info`| |12.2| | |`_rocsparse_mat_info`|1.9.0| | | | |
Expand Down Expand Up @@ -296,7 +296,7 @@
|`cusparseCbsrsv2_analysis`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_solve`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_solve`| |12.2| | |`rocsparse_cbsrsv_solve`|3.6.0| | | | |
|`cusparseCbsrxmv`| |12.2| | | | | | | | |
|`cusparseCcsrmv`| |10.2| |11.0|`rocsparse_ccsrmv`|1.9.0| | | | |
|`cusparseCcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
Expand All @@ -319,7 +319,7 @@
|`cusparseDbsrsv2_analysis`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_solve`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_solve`| |12.2| | |`rocsparse_dbsrsv_solve`|3.6.0| | | | |
|`cusparseDbsrxmv`| |12.2| | | | | | | | |
|`cusparseDcsrmv`| |10.2| |11.0|`rocsparse_dcsrmv`|1.9.0| | | | |
|`cusparseDcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
Expand All @@ -338,7 +338,7 @@
|`cusparseSbsrsv2_analysis`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_solve`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_solve`| |12.2| | |`rocsparse_sbsrsv_solve`|3.6.0| | | | |
|`cusparseSbsrxmv`| |12.2| | | | | | | | |
|`cusparseScsrmv`| |10.2| |11.0|`rocsparse_scsrmv`|1.9.0| | | | |
|`cusparseScsrmv_mp`|8.0|10.2| |11.0| | | | | | |
Expand All @@ -359,7 +359,7 @@
|`cusparseZbsrsv2_analysis`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_solve`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_solve`| |12.2| | |`rocsparse_zbsrsv_solve`|3.6.0| | | | |
|`cusparseZbsrxmv`| |12.2| | | | | | | | |
|`cusparseZcsrmv`| |10.2| |11.0|`rocsparse_zcsrmv`|1.9.0| | | | |
|`cusparseZcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
Expand Down
12 changes: 8 additions & 4 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCcsrsv_solve", {"hipsparseCcsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsv_solve", {"hipsparseZcsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseSbsrsv2_solve", {"hipsparseSbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDbsrsv2_solve", {"hipsparseDbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCbsrsv2_solve", {"hipsparseCbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrsv2_solve", {"hipsparseZbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseSbsrsv2_solve", {"hipsparseSbsrsv2_solve", "rocsparse_sbsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseDbsrsv2_solve", {"hipsparseDbsrsv2_solve", "rocsparse_dbsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseCbsrsv2_solve", {"hipsparseCbsrsv2_solve", "rocsparse_cbsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseZbsrsv2_solve", {"hipsparseZbsrsv2_solve", "rocsparse_zbsrsv_solve", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseXbsrsv2_zeroPivot", {"hipsparseXbsrsv2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},

{"cusparseScsrsv_analysis", {"hipsparseScsrsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, 9, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -2342,6 +2342,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_ccsrmv", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_dcsrmv", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_scsrmv", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_zbsrsv_solve", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_cbsrsv_solve", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_dbsrsv_solve", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_sbsrsv_solve", {HIP_3060, HIP_0, HIP_0 }},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP {
Expand Down
4 changes: 2 additions & 2 deletions src/CUDA2HIP_SPARSE_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_TYPE_NAME_MAP {
{"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}},

{"bsrsv2Info", {"bsrsv2Info", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"bsrsv2Info_t", {"bsrsv2Info_t", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"bsrsv2Info", {"bsrsv2Info", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},
{"bsrsv2Info_t", {"bsrsv2Info_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},

{"bsrsm2Info", {"bsrsm2Info", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},
{"bsrsm2Info_t", {"bsrsm2Info_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},
Expand Down
46 changes: 45 additions & 1 deletion src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ const std::string sCusparseZcsrmv = "cusparseZcsrmv";
const std::string sCusparseCcsrmv = "cusparseCcsrmv";
const std::string sCusparseDcsrmv = "cusparseDcsrmv";
const std::string sCusparseScsrmv = "cusparseScsrmv";
const std::string sCusparseZbsrsv2_solve = "cusparseZbsrsv2_solve";
const std::string sCusparseCbsrsv2_solve = "cusparseCbsrsv2_solve";
const std::string sCusparseDbsrsv2_solve = "cusparseDbsrsv2_solve";
const std::string sCusparseSbsrsv2_solve = "cusparseSbsrsv2_solve";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
Expand Down Expand Up @@ -1251,6 +1255,42 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZbsrsv2_solve,
{
{
{14, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseCbsrsv2_solve,
{
{
{14, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseDbsrsv2_solve,
{
{
{14, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseSbsrsv2_solve,
{
{
{14, {e_replace_argument_with_const, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -2046,7 +2086,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZcsrmv,
sCusparseCcsrmv,
sCusparseDcsrmv,
sCusparseScsrmv
sCusparseScsrmv,
sCusparseZbsrsv2_solve,
sCusparseCbsrsv2_solve,
sCusparseDbsrsv2_solve,
sCusparseSbsrsv2_solve
)
)
)
Expand Down
Loading

0 comments on commit 7f774b4

Please sign in to comment.