Skip to content

Commit

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

+ Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jan 9, 2024
1 parent cf6504b commit 448aaa9
Show file tree
Hide file tree
Showing 7 changed files with 106 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 @@ -2301,6 +2301,7 @@ sub rocSubstitutions {
subst("cusparseCcsrsm2_bufferSizeExt", "rocsparse_ccsrsm_buffer_size", "library");
subst("cusparseCcsrsm2_solve", "rocsparse_ccsrsm_solve", "library");
subst("cusparseCcsrsv2_analysis", "rocsparse_ccsrsv_analysis", "library");
subst("cusparseCcsrsv2_bufferSize", "rocsparse_ccsrsv_buffer_size", "library");
subst("cusparseCcsrsv2_bufferSizeExt", "rocsparse_ccsrsv_buffer_size", "library");
subst("cusparseCcsrsv2_solve", "rocsparse_ccsrsv_solve", "library");
subst("cusparseCdense2csc", "rocsparse_cdense2csc", "library");
Expand Down Expand Up @@ -2424,6 +2425,7 @@ sub rocSubstitutions {
subst("cusparseDcsrsm2_bufferSizeExt", "rocsparse_dcsrsm_buffer_size", "library");
subst("cusparseDcsrsm2_solve", "rocsparse_dcsrsm_solve", "library");
subst("cusparseDcsrsv2_analysis", "rocsparse_dcsrsv_analysis", "library");
subst("cusparseDcsrsv2_bufferSize", "rocsparse_dcsrsv_buffer_size", "library");
subst("cusparseDcsrsv2_bufferSizeExt", "rocsparse_dcsrsv_buffer_size", "library");
subst("cusparseDcsrsv2_solve", "rocsparse_dcsrsv_solve", "library");
subst("cusparseDdense2csc", "rocsparse_ddense2csc", "library");
Expand Down Expand Up @@ -2550,6 +2552,7 @@ sub rocSubstitutions {
subst("cusparseScsrsm2_bufferSizeExt", "rocsparse_scsrsm_buffer_size", "library");
subst("cusparseScsrsm2_solve", "rocsparse_scsrsm_solve", "library");
subst("cusparseScsrsv2_analysis", "rocsparse_scsrsv_analysis", "library");
subst("cusparseScsrsv2_bufferSize", "rocsparse_scsrsv_buffer_size", "library");
subst("cusparseScsrsv2_bufferSizeExt", "rocsparse_scsrsv_buffer_size", "library");
subst("cusparseScsrsv2_solve", "rocsparse_scsrsv_solve", "library");
subst("cusparseSdense2csc", "rocsparse_sdense2csc", "library");
Expand Down Expand Up @@ -2677,6 +2680,7 @@ sub rocSubstitutions {
subst("cusparseZcsrsm2_bufferSizeExt", "rocsparse_zcsrsm_buffer_size", "library");
subst("cusparseZcsrsm2_solve", "rocsparse_zcsrsm_solve", "library");
subst("cusparseZcsrsv2_analysis", "rocsparse_zcsrsv_analysis", "library");
subst("cusparseZcsrsv2_bufferSize", "rocsparse_zcsrsv_buffer_size", "library");
subst("cusparseZcsrsv2_bufferSizeExt", "rocsparse_zcsrsv_buffer_size", "library");
subst("cusparseZcsrsv2_solve", "rocsparse_zcsrsv_solve", "library");
subst("cusparseZdense2csc", "rocsparse_zdense2csc", "library");
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 @@ -301,7 +301,7 @@
|`cusparseCcsrmv`| |10.2| |11.0|`hipsparseCcsrmv`|3.1.0| | | | |`rocsparse_ccsrmv`|1.9.0| | | | |
|`cusparseCcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseCcsrsv2_analysis`| |11.3| |12.0|`hipsparseCcsrsv2_analysis`|3.1.0| | | | |`rocsparse_ccsrsv_analysis`|2.10.0| | | | |
|`cusparseCcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseCcsrsv2_bufferSize`|3.1.0| | | | | | | | | | |
|`cusparseCcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseCcsrsv2_bufferSize`|3.1.0| | | | |`rocsparse_ccsrsv_buffer_size`|2.10.0| | | | |
|`cusparseCcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseCcsrsv2_bufferSizeExt`|3.1.0| | | | |`rocsparse_ccsrsv_buffer_size`|2.10.0| | | | |
|`cusparseCcsrsv2_solve`| |11.3| |12.0|`hipsparseCcsrsv2_solve`|3.1.0| | | | |`rocsparse_ccsrsv_solve`|2.10.0| | | | |
|`cusparseCcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -324,7 +324,7 @@
|`cusparseDcsrmv`| |10.2| |11.0|`hipsparseDcsrmv`|1.9.2| | | | |`rocsparse_dcsrmv`|1.9.0| | | | |
|`cusparseDcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseDcsrsv2_analysis`| |11.3| |12.0|`hipsparseDcsrsv2_analysis`|1.9.2| | | | |`rocsparse_dcsrsv_analysis`|1.9.0| | | | |
|`cusparseDcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseDcsrsv2_bufferSize`|1.9.2| | | | | | | | | | |
|`cusparseDcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseDcsrsv2_bufferSize`|1.9.2| | | | |`rocsparse_dcsrsv_buffer_size`|1.9.0| | | | |
|`cusparseDcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseDcsrsv2_bufferSizeExt`|1.9.2| | | | |`rocsparse_dcsrsv_buffer_size`|1.9.0| | | | |
|`cusparseDcsrsv2_solve`| |11.3| |12.0|`hipsparseDcsrsv2_solve`|1.9.2| | | | |`rocsparse_dcsrsv_solve`|1.9.0| | | | |
|`cusparseDcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -343,7 +343,7 @@
|`cusparseScsrmv`| |10.2| |11.0|`hipsparseScsrmv`|1.9.2| | | | |`rocsparse_scsrmv`|1.9.0| | | | |
|`cusparseScsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseScsrsv2_analysis`| |11.3| |12.0|`hipsparseScsrsv2_analysis`|1.9.2| | | | |`rocsparse_scsrsv_analysis`|1.9.0| | | | |
|`cusparseScsrsv2_bufferSize`| |11.3| |12.0|`hipsparseScsrsv2_bufferSize`|1.9.2| | | | | | | | | | |
|`cusparseScsrsv2_bufferSize`| |11.3| |12.0|`hipsparseScsrsv2_bufferSize`|1.9.2| | | | |`rocsparse_scsrsv_buffer_size`|1.9.0| | | | |
|`cusparseScsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseScsrsv2_bufferSizeExt`|1.9.2| | | | |`rocsparse_scsrsv_buffer_size`|1.9.0| | | | |
|`cusparseScsrsv2_solve`| |11.3| |12.0|`hipsparseScsrsv2_solve`|1.9.2| | | | |`rocsparse_scsrsv_solve`|1.9.0| | | | |
|`cusparseScsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand All @@ -364,7 +364,7 @@
|`cusparseZcsrmv`| |10.2| |11.0|`hipsparseZcsrmv`|3.1.0| | | | |`rocsparse_zcsrmv`|1.9.0| | | | |
|`cusparseZcsrmv_mp`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseZcsrsv2_analysis`| |11.3| |12.0|`hipsparseZcsrsv2_analysis`|3.1.0| | | | |`rocsparse_zcsrsv_analysis`|2.10.0| | | | |
|`cusparseZcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseZcsrsv2_bufferSize`|3.1.0| | | | | | | | | | |
|`cusparseZcsrsv2_bufferSize`| |11.3| |12.0|`hipsparseZcsrsv2_bufferSize`|3.1.0| | | | |`rocsparse_zcsrsv_buffer_size`|2.10.0| | | | |
|`cusparseZcsrsv2_bufferSizeExt`| |11.3| |12.0|`hipsparseZcsrsv2_bufferSizeExt`|3.1.0| | | | |`rocsparse_zcsrsv_buffer_size`|2.10.0| | | | |
|`cusparseZcsrsv2_solve`| |11.3| |12.0|`hipsparseZcsrsv2_solve`|3.1.0| | | | |`rocsparse_zcsrsv_solve`|2.10.0| | | | |
|`cusparseZcsrsv_analysis`| |10.2| |11.0| | | | | | | | | | | | |
Expand Down
8 changes: 4 additions & 4 deletions docs/tables/CUSPARSE_API_supported_by_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
|`cusparseCcsrmv`| |10.2| |11.0|`rocsparse_ccsrmv`|1.9.0| | | | |
|`cusparseCcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
|`cusparseCcsrsv2_analysis`| |11.3| |12.0|`rocsparse_ccsrsv_analysis`|2.10.0| | | | |
|`cusparseCcsrsv2_bufferSize`| |11.3| |12.0| | | | | | |
|`cusparseCcsrsv2_bufferSize`| |11.3| |12.0|`rocsparse_ccsrsv_buffer_size`|2.10.0| | | | |
|`cusparseCcsrsv2_bufferSizeExt`| |11.3| |12.0|`rocsparse_ccsrsv_buffer_size`|2.10.0| | | | |
|`cusparseCcsrsv2_solve`| |11.3| |12.0|`rocsparse_ccsrsv_solve`|2.10.0| | | | |
|`cusparseCcsrsv_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -324,7 +324,7 @@
|`cusparseDcsrmv`| |10.2| |11.0|`rocsparse_dcsrmv`|1.9.0| | | | |
|`cusparseDcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
|`cusparseDcsrsv2_analysis`| |11.3| |12.0|`rocsparse_dcsrsv_analysis`|1.9.0| | | | |
|`cusparseDcsrsv2_bufferSize`| |11.3| |12.0| | | | | | |
|`cusparseDcsrsv2_bufferSize`| |11.3| |12.0|`rocsparse_dcsrsv_buffer_size`|1.9.0| | | | |
|`cusparseDcsrsv2_bufferSizeExt`| |11.3| |12.0|`rocsparse_dcsrsv_buffer_size`|1.9.0| | | | |
|`cusparseDcsrsv2_solve`| |11.3| |12.0|`rocsparse_dcsrsv_solve`|1.9.0| | | | |
|`cusparseDcsrsv_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -343,7 +343,7 @@
|`cusparseScsrmv`| |10.2| |11.0|`rocsparse_scsrmv`|1.9.0| | | | |
|`cusparseScsrmv_mp`|8.0|10.2| |11.0| | | | | | |
|`cusparseScsrsv2_analysis`| |11.3| |12.0|`rocsparse_scsrsv_analysis`|1.9.0| | | | |
|`cusparseScsrsv2_bufferSize`| |11.3| |12.0| | | | | | |
|`cusparseScsrsv2_bufferSize`| |11.3| |12.0|`rocsparse_scsrsv_buffer_size`|1.9.0| | | | |
|`cusparseScsrsv2_bufferSizeExt`| |11.3| |12.0|`rocsparse_scsrsv_buffer_size`|1.9.0| | | | |
|`cusparseScsrsv2_solve`| |11.3| |12.0|`rocsparse_scsrsv_solve`|1.9.0| | | | |
|`cusparseScsrsv_analysis`| |10.2| |11.0| | | | | | |
Expand All @@ -364,7 +364,7 @@
|`cusparseZcsrmv`| |10.2| |11.0|`rocsparse_zcsrmv`|1.9.0| | | | |
|`cusparseZcsrmv_mp`|8.0|10.2| |11.0| | | | | | |
|`cusparseZcsrsv2_analysis`| |11.3| |12.0|`rocsparse_zcsrsv_analysis`|2.10.0| | | | |
|`cusparseZcsrsv2_bufferSize`| |11.3| |12.0| | | | | | |
|`cusparseZcsrsv2_bufferSize`| |11.3| |12.0|`rocsparse_zcsrsv_buffer_size`|2.10.0| | | | |
|`cusparseZcsrsv2_bufferSizeExt`| |11.3| |12.0|`rocsparse_zcsrsv_buffer_size`|2.10.0| | | | |
|`cusparseZcsrsv2_solve`| |11.3| |12.0|`rocsparse_zcsrsv_solve`|2.10.0| | | | |
|`cusparseZcsrsv_analysis`| |10.2| |11.0| | | | | | |
Expand Down
16 changes: 8 additions & 8 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCsrsv_analysisEx", {"hipsparseCsrsv_analysisEx", "", CONV_LIB_FUNC, API_SPARSE, 9, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCsrsv_solveEx", {"hipsparseCsrsv_solveEx", "", CONV_LIB_FUNC, API_SPARSE, 9, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrsv2_bufferSize", {"hipsparseScsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseScsrsv2_bufferSize", {"hipsparseScsrsv2_bufferSize", "rocsparse_scsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseScsrsv2_bufferSizeExt", {"hipsparseScsrsv2_bufferSizeExt", "rocsparse_scsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsv2_bufferSize", {"hipsparseDcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsv2_bufferSize", {"hipsparseDcsrsv2_bufferSize", "rocsparse_dcsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrsv2_bufferSizeExt", {"hipsparseDcsrsv2_bufferSizeExt", "rocsparse_dcsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrsv2_bufferSize", {"hipsparseCcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrsv2_bufferSize", {"hipsparseCcsrsv2_bufferSize", "rocsparse_ccsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrsv2_bufferSizeExt", {"hipsparseCcsrsv2_bufferSizeExt", "rocsparse_ccsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsv2_bufferSize", {"hipsparseZcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsv2_bufferSize", {"hipsparseZcsrsv2_bufferSize", "rocsparse_zcsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrsv2_bufferSizeExt", {"hipsparseZcsrsv2_bufferSizeExt", "rocsparse_zcsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrsv2_analysis", {"hipsparseScsrsv2_analysis", "rocsparse_scsrsv_analysis", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -1231,10 +1231,10 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseCreateCsrsv2Info", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseDestroyCsrsv2Info", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseXcsrsv2_zeroPivot", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseScsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseDcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseCcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseZcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseScsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseDcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseCcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseZcsrsv2_bufferSize", {CUDA_0, CUDA_113, CUDA_120}}, // D: CUSPARSE_VERSION 11500 R: CUSPARSE_VERSION 12000
{"cusparseScsrsv2_bufferSizeExt", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseDcsrsv2_bufferSizeExt", {CUDA_0, CUDA_113, CUDA_120}},
{"cusparseCcsrsv2_bufferSizeExt", {CUDA_0, CUDA_113, CUDA_120}},
Expand Down
46 changes: 45 additions & 1 deletion src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ const std::string sCusparseZbsrsv2_bufferSize = "cusparseZbsrsv2_bufferSize";
const std::string sCusparseCbsrsv2_bufferSize = "cusparseCbsrsv2_bufferSize";
const std::string sCusparseDbsrsv2_bufferSize = "cusparseDbsrsv2_bufferSize";
const std::string sCusparseSbsrsv2_bufferSize = "cusparseSbsrsv2_bufferSize";
const std::string sCusparseZcsrsv2_bufferSize = "cusparseZcsrsv2_bufferSize";
const std::string sCusparseCcsrsv2_bufferSize = "cusparseCcsrsv2_bufferSize";
const std::string sCusparseDcsrsv2_bufferSize = "cusparseDcsrsv2_bufferSize";
const std::string sCusparseScsrsv2_bufferSize = "cusparseScsrsv2_bufferSize";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
Expand Down Expand Up @@ -1455,6 +1459,42 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZcsrsv2_bufferSize,
{
{
{9, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseCcsrsv2_bufferSize,
{
{
{9, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseDcsrsv2_bufferSize,
{
{
{9, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseScsrsv2_bufferSize,
{
{
{9, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -2282,7 +2322,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZbsrsv2_bufferSize,
sCusparseCbsrsv2_bufferSize,
sCusparseDbsrsv2_bufferSize,
sCusparseSbsrsv2_bufferSize
sCusparseSbsrsv2_bufferSize,
sCusparseZcsrsv2_bufferSize,
sCusparseCcsrsv2_bufferSize,
sCusparseDcsrsv2_bufferSize,
sCusparseScsrsv2_bufferSize
)
)
)
Expand Down
Loading

0 comments on commit 448aaa9

Please sign in to comment.