Skip to content

Commit

Permalink
Merge pull request #1129 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][#674][rocSPARSE][feature] rocSPARSE support - Step 57 - functions rocsparse_(s|d|c|z)csrsm_analysis`
  • Loading branch information
emankov authored Nov 12, 2023
2 parents db47b32 + b0accdf commit 5089f83
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 17 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,7 @@ sub rocSubstitutions {
subst("cusparseCcsrilu02_analysis", "rocsparse_ccsrilu0_analysis", "library");
subst("cusparseCcsrilu02_bufferSize", "rocsparse_ccsrilu0_buffer_size", "library");
subst("cusparseCcsrilu02_numericBoost", "rocsparse_dccsrilu0_numeric_boost", "library");
subst("cusparseCcsrsm2_analysis", "rocsparse_ccsrsm_analysis", "library");
subst("cusparseCcsrsm2_solve", "rocsparse_ccsrsm_solve", "library");
subst("cusparseCdense2csc", "rocsparse_cdense2csc", "library");
subst("cusparseCdense2csr", "rocsparse_cdense2csr", "library");
Expand Down Expand Up @@ -1832,6 +1833,7 @@ sub rocSubstitutions {
subst("cusparseDcsrilu02_analysis", "rocsparse_dcsrilu0_analysis", "library");
subst("cusparseDcsrilu02_bufferSize", "rocsparse_dcsrilu0_buffer_size", "library");
subst("cusparseDcsrilu02_numericBoost", "rocsparse_dcsrilu0_numeric_boost", "library");
subst("cusparseDcsrsm2_analysis", "rocsparse_dcsrsm_analysis", "library");
subst("cusparseDcsrsm2_solve", "rocsparse_dcsrsm_solve", "library");
subst("cusparseDdense2csc", "rocsparse_ddense2csc", "library");
subst("cusparseDdense2csr", "rocsparse_ddense2csr", "library");
Expand Down Expand Up @@ -1921,6 +1923,7 @@ sub rocSubstitutions {
subst("cusparseScsrilu02_analysis", "rocsparse_scsrilu0_analysis", "library");
subst("cusparseScsrilu02_bufferSize", "rocsparse_scsrilu0_buffer_size", "library");
subst("cusparseScsrilu02_numericBoost", "rocsparse_dscsrilu0_numeric_boost", "library");
subst("cusparseScsrsm2_analysis", "rocsparse_scsrsm_analysis", "library");
subst("cusparseScsrsm2_solve", "rocsparse_scsrsm_solve", "library");
subst("cusparseSdense2csc", "rocsparse_sdense2csc", "library");
subst("cusparseSdense2csr", "rocsparse_sdense2csr", "library");
Expand Down Expand Up @@ -2020,6 +2023,7 @@ sub rocSubstitutions {
subst("cusparseZcsrilu02_analysis", "rocsparse_zcsrilu0_analysis", "library");
subst("cusparseZcsrilu02_bufferSize", "rocsparse_zcsrilu0_buffer_size", "library");
subst("cusparseZcsrilu02_numericBoost", "rocsparse_zcsrilu0_numeric_boost", "library");
subst("cusparseZcsrsm2_analysis", "rocsparse_zcsrsm_analysis", "library");
subst("cusparseZcsrsm2_solve", "rocsparse_zcsrsm_solve", "library");
subst("cusparseZdense2csc", "rocsparse_zdense2csc", "library");
subst("cusparseZdense2csr", "rocsparse_zdense2csr", "library");
Expand Down
8 changes: 4 additions & 4 deletions docs/tables/CUSPARSE_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
|`cusparseCbsrsm2_solve`| |12.2| | |`hipsparseCbsrsm2_solve`|4.5.0| | | | |
|`cusparseCcsrmm`| |10.2| |11.0|`hipsparseCcsrmm`|3.1.0| | | | |
|`cusparseCcsrmm2`| |10.2| |11.0|`hipsparseCcsrmm2`|3.1.0| | | | |
|`cusparseCcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseCcsrsm2_analysis`|3.1.0| | | | |
|`cusparseCcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseCcsrsm2_analysis`|3.1.0| | | | |
|`cusparseCcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseCcsrsm2_bufferSizeExt`|3.1.0| | | | |
|`cusparseCcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseCcsrsm2_solve`|3.1.0| | | | |
|`cusparseCcsrsm_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -399,7 +399,7 @@
|`cusparseDbsrsm2_solve`| |12.2| | |`hipsparseDbsrsm2_solve`|4.5.0| | | | |
|`cusparseDcsrmm`| |10.2| |11.0|`hipsparseDcsrmm`|1.9.2| | | | |
|`cusparseDcsrmm2`| |10.2| |11.0|`hipsparseDcsrmm2`|1.9.2| | | | |
|`cusparseDcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseDcsrsm2_analysis`|3.1.0| | | | |
|`cusparseDcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseDcsrsm2_analysis`|3.1.0| | | | |
|`cusparseDcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseDcsrsm2_bufferSizeExt`|3.1.0| | | | |
|`cusparseDcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseDcsrsm2_solve`|3.1.0| | | | |
|`cusparseDcsrsm_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -412,7 +412,7 @@
|`cusparseSbsrsm2_solve`| |12.2| | |`hipsparseSbsrsm2_solve`|4.5.0| | | | |
|`cusparseScsrmm`| |10.2| |11.0|`hipsparseScsrmm`|1.9.2| | | | |
|`cusparseScsrmm2`| |10.2| |11.0|`hipsparseScsrmm2`|1.9.2| | | | |
|`cusparseScsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseScsrsm2_analysis`|3.1.0| | | | |
|`cusparseScsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseScsrsm2_analysis`|3.1.0| | | | |
|`cusparseScsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseScsrsm2_bufferSizeExt`|3.1.0| | | | |
|`cusparseScsrsm2_solve`|9.2|11.3| |12.0|`hipsparseScsrsm2_solve`|3.1.0| | | | |
|`cusparseScsrsm_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -427,7 +427,7 @@
|`cusparseZbsrsm2_solve`| |12.2| | |`hipsparseZbsrsm2_solve`|4.5.0| | | | |
|`cusparseZcsrmm`| |10.2| |11.0|`hipsparseZcsrmm`|3.1.0| | | | |
|`cusparseZcsrmm2`| |10.2| |11.0|`hipsparseZcsrmm2`|3.1.0| | | | |
|`cusparseZcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseZcsrsm2_analysis`|3.1.0| | | | |
|`cusparseZcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseZcsrsm2_analysis`|3.1.0| | | | |
|`cusparseZcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseZcsrsm2_bufferSizeExt`|3.1.0| | | | |
|`cusparseZcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseZcsrsm2_solve`|3.1.0| | | | |
|`cusparseZcsrsm_analysis`| |10.2| |11.0| | | | | | |
Expand Down
8 changes: 4 additions & 4 deletions docs/tables/CUSPARSE_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
|`cusparseCbsrsm2_solve`| |12.2| | |`hipsparseCbsrsm2_solve`|4.5.0| | | | |`rocsparse_cbsrsm_solve`|4.5.0| | | | |
|`cusparseCcsrmm`| |10.2| |11.0|`hipsparseCcsrmm`|3.1.0| | | | | | | | | | |
|`cusparseCcsrmm2`| |10.2| |11.0|`hipsparseCcsrmm2`|3.1.0| | | | | | | | | | |
|`cusparseCcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseCcsrsm2_analysis`|3.1.0| | | | | | | | | | |
|`cusparseCcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseCcsrsm2_analysis`|3.1.0| | | | |`rocsparse_ccsrsm_analysis`|3.1.0| | | | |
|`cusparseCcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseCcsrsm2_bufferSizeExt`|3.1.0| | | | | | | | | | |
|`cusparseCcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseCcsrsm2_solve`|3.1.0| | | | |`rocsparse_ccsrsm_solve`|3.1.0| | | | |
|`cusparseCcsrsm_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -399,7 +399,7 @@
|`cusparseDbsrsm2_solve`| |12.2| | |`hipsparseDbsrsm2_solve`|4.5.0| | | | |`rocsparse_dbsrsm_solve`|4.5.0| | | | |
|`cusparseDcsrmm`| |10.2| |11.0|`hipsparseDcsrmm`|1.9.2| | | | | | | | | | |
|`cusparseDcsrmm2`| |10.2| |11.0|`hipsparseDcsrmm2`|1.9.2| | | | | | | | | | |
|`cusparseDcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseDcsrsm2_analysis`|3.1.0| | | | | | | | | | |
|`cusparseDcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseDcsrsm2_analysis`|3.1.0| | | | |`rocsparse_dcsrsm_analysis`|3.1.0| | | | |
|`cusparseDcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseDcsrsm2_bufferSizeExt`|3.1.0| | | | | | | | | | |
|`cusparseDcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseDcsrsm2_solve`|3.1.0| | | | |`rocsparse_dcsrsm_solve`|3.1.0| | | | |
|`cusparseDcsrsm_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -412,7 +412,7 @@
|`cusparseSbsrsm2_solve`| |12.2| | |`hipsparseSbsrsm2_solve`|4.5.0| | | | |`rocsparse_sbsrsm_solve`|4.5.0| | | | |
|`cusparseScsrmm`| |10.2| |11.0|`hipsparseScsrmm`|1.9.2| | | | | | | | | | |
|`cusparseScsrmm2`| |10.2| |11.0|`hipsparseScsrmm2`|1.9.2| | | | | | | | | | |
|`cusparseScsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseScsrsm2_analysis`|3.1.0| | | | | | | | | | |
|`cusparseScsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseScsrsm2_analysis`|3.1.0| | | | |`rocsparse_scsrsm_analysis`|3.1.0| | | | |
|`cusparseScsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseScsrsm2_bufferSizeExt`|3.1.0| | | | | | | | | | |
|`cusparseScsrsm2_solve`|9.2|11.3| |12.0|`hipsparseScsrsm2_solve`|3.1.0| | | | |`rocsparse_scsrsm_solve`|3.1.0| | | | |
|`cusparseScsrsm_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -427,7 +427,7 @@
|`cusparseZbsrsm2_solve`| |12.2| | |`hipsparseZbsrsm2_solve`|4.5.0| | | | |`rocsparse_zbsrsm_solve`|4.5.0| | | | |
|`cusparseZcsrmm`| |10.2| |11.0|`hipsparseZcsrmm`|3.1.0| | | | | | | | | | |
|`cusparseZcsrmm2`| |10.2| |11.0|`hipsparseZcsrmm2`|3.1.0| | | | | | | | | | |
|`cusparseZcsrsm2_analysis`|10.0|11.3| |12.0|`hipsparseZcsrsm2_analysis`|3.1.0| | | | | | | | | | |
|`cusparseZcsrsm2_analysis`|9.2|11.3| |12.0|`hipsparseZcsrsm2_analysis`|3.1.0| | | | |`rocsparse_zcsrsm_analysis`|3.1.0| | | | |
|`cusparseZcsrsm2_bufferSizeExt`|10.0|11.3| |12.0|`hipsparseZcsrsm2_bufferSizeExt`|3.1.0| | | | | | | | | | |
|`cusparseZcsrsm2_solve`|9.2|11.3| |12.0|`hipsparseZcsrsm2_solve`|3.1.0| | | | |`rocsparse_zcsrsm_solve`|3.1.0| | | | |
|`cusparseZcsrsm_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand Down
20 changes: 12 additions & 8 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCcsrsm2_bufferSizeExt", {"hipsparseCcsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsm2_bufferSizeExt", {"hipsparseZcsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrsm2_analysis", {"hipsparseScsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsm2_analysis", {"hipsparseDcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrsm2_analysis", {"hipsparseCcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsm2_analysis", {"hipsparseZcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseScsrsm2_analysis", {"hipsparseScsrsm2_analysis", "rocsparse_scsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsm2_analysis", {"hipsparseDcsrsm2_analysis", "rocsparse_dcsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrsm2_analysis", {"hipsparseCcsrsm2_analysis", "rocsparse_ccsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsm2_analysis", {"hipsparseZcsrsm2_analysis", "rocsparse_zcsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrsm2_solve", {"hipsparseScsrsm2_solve", "rocsparse_scsrsm_solve", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsm2_solve", {"hipsparseDcsrsm2_solve", "rocsparse_dcsrsm_solve", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -951,10 +951,10 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseDcsrsm2_bufferSizeExt", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseCcsrsm2_bufferSizeExt", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseZcsrsm2_bufferSizeExt", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseScsrsm2_analysis", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseDcsrsm2_analysis", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseCcsrsm2_analysis", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseZcsrsm2_analysis", {CUDA_100, CUDA_113, CUDA_120}},
{"cusparseScsrsm2_analysis", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseDcsrsm2_analysis", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseCcsrsm2_analysis", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseZcsrsm2_analysis", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseScsrsm2_solve", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseDcsrsm2_solve", {CUDA_92, CUDA_113, CUDA_120}},
{"cusparseCcsrsm2_solve", {CUDA_92, CUDA_113, CUDA_120}},
Expand Down Expand Up @@ -2293,6 +2293,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_ccsrsm_solve", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_dcsrsm_solve", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_scsrsm_solve", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_scsrsm_analysis", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_dcsrsm_analysis", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_ccsrsm_analysis", {HIP_3010, HIP_0, HIP_0 }},
{"rocsparse_zcsrsm_analysis", {HIP_3010, HIP_0, HIP_0 }},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP {
Expand Down
51 changes: 50 additions & 1 deletion src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ const std::string sCusparseZcsrsm2_solve = "cusparseZcsrsm2_solve";
const std::string sCusparseCcsrsm2_solve = "cusparseCcsrsm2_solve";
const std::string sCusparseDcsrsm2_solve = "cusparseDcsrsm2_solve";
const std::string sCusparseScsrsm2_solve = "cusparseScsrsm2_solve";
const std::string sCusparseZcsrsm2_analysis = "cusparseZcsrsm2_analysis";
const std::string sCusparseCcsrsm2_analysis = "cusparseCcsrsm2_analysis";
const std::string sCusparseDcsrsm2_analysis = "cusparseDcsrsm2_analysis";
const std::string sCusparseScsrsm2_analysis = "cusparseScsrsm2_analysis";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
const std::string sCudaGraphInstantiate = "cudaGraphInstantiate";
Expand Down Expand Up @@ -1002,6 +1007,46 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZcsrsm2_analysis,
{
{
{15, {e_replace_argument_with_const, cw_None, "rocsparse_analysis_policy_force"}},
{16, {e_add_const_argument, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseCcsrsm2_analysis,
{
{
{15, {e_replace_argument_with_const, cw_None, "rocsparse_analysis_policy_force"}},
{16, {e_add_const_argument, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseDcsrsm2_analysis,
{
{
{15, {e_replace_argument_with_const, cw_None, "rocsparse_analysis_policy_force"}},
{16, {e_add_const_argument, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
{sCusparseScsrsm2_analysis,
{
{
{15, {e_replace_argument_with_const, cw_None, "rocsparse_analysis_policy_force"}},
{16, {e_add_const_argument, cw_None, "rocsparse_solve_policy_auto"}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -1773,7 +1818,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZcsrsm2_solve,
sCusparseCcsrsm2_solve,
sCusparseDcsrsm2_solve,
sCusparseScsrsm2_solve
sCusparseScsrsm2_solve,
sCusparseZcsrsm2_analysis,
sCusparseCcsrsm2_analysis,
sCusparseDcsrsm2_analysis,
sCusparseScsrsm2_analysis
)
)
)
Expand Down
Loading

0 comments on commit 5089f83

Please sign in to comment.