Skip to content

Commit

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

+ Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jan 7, 2024
1 parent 559c59d commit a020eac
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 21 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -2271,6 +2271,7 @@ sub rocSubstitutions {
subst("cusparseCbsrsm2_bufferSize", "rocsparse_cbsrsm_buffer_size", "library");
subst("cusparseCbsrsm2_solve", "rocsparse_cbsrsm_solve", "library");
subst("cusparseCbsrsv2_analysis", "rocsparse_cbsrsv_analysis", "library");
subst("cusparseCbsrsv2_bufferSize", "rocsparse_cbsrsv_buffer_size", "library");
subst("cusparseCbsrsv2_bufferSizeExt", "rocsparse_cbsrsv_buffer_size", "library");
subst("cusparseCbsrsv2_solve", "rocsparse_cbsrsv_solve", "library");
subst("cusparseCbsrxmv", "rocsparse_cbsrxmv", "library");
Expand Down Expand Up @@ -2393,6 +2394,7 @@ sub rocSubstitutions {
subst("cusparseDbsrsm2_bufferSize", "rocsparse_dbsrsm_buffer_size", "library");
subst("cusparseDbsrsm2_solve", "rocsparse_dbsrsm_solve", "library");
subst("cusparseDbsrsv2_analysis", "rocsparse_dbsrsv_analysis", "library");
subst("cusparseDbsrsv2_bufferSize", "rocsparse_dbsrsv_buffer_size", "library");
subst("cusparseDbsrsv2_bufferSizeExt", "rocsparse_dbsrsv_buffer_size", "library");
subst("cusparseDbsrsv2_solve", "rocsparse_dbsrsv_solve", "library");
subst("cusparseDbsrxmv", "rocsparse_dbsrxmv", "library");
Expand Down Expand Up @@ -2517,6 +2519,7 @@ sub rocSubstitutions {
subst("cusparseSbsrsm2_bufferSize", "rocsparse_sbsrsm_buffer_size", "library");
subst("cusparseSbsrsm2_solve", "rocsparse_sbsrsm_solve", "library");
subst("cusparseSbsrsv2_analysis", "rocsparse_sbsrsv_analysis", "library");
subst("cusparseSbsrsv2_bufferSize", "rocsparse_sbsrsv_buffer_size", "library");
subst("cusparseSbsrsv2_bufferSizeExt", "rocsparse_sbsrsv_buffer_size", "library");
subst("cusparseSbsrsv2_solve", "rocsparse_sbsrsv_solve", "library");
subst("cusparseSbsrxmv", "rocsparse_sbsrxmv", "library");
Expand Down Expand Up @@ -2644,6 +2647,7 @@ sub rocSubstitutions {
subst("cusparseZbsrsm2_bufferSize", "rocsparse_zbsrsm_buffer_size", "library");
subst("cusparseZbsrsm2_solve", "rocsparse_zbsrsm_solve", "library");
subst("cusparseZbsrsv2_analysis", "rocsparse_zbsrsv_analysis", "library");
subst("cusparseZbsrsv2_bufferSize", "rocsparse_zbsrsv_buffer_size", "library");
subst("cusparseZbsrsv2_bufferSizeExt", "rocsparse_zbsrsv_buffer_size", "library");
subst("cusparseZbsrsv2_solve", "rocsparse_zbsrsv_solve", "library");
subst("cusparseZbsrxmv", "rocsparse_zbsrxmv", "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 @@ -294,7 +294,7 @@
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmv`| | | | |`hipsparseCbsrmv`|3.5.0| | | | |`rocsparse_cbsrmv`|3.5.0|5.4.0| | | |
|`cusparseCbsrsv2_analysis`| |12.2| | |`hipsparseCbsrsv2_analysis`|3.6.0| | | | |`rocsparse_cbsrsv_analysis`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | |`hipsparseCbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | |`hipsparseCbsrsv2_bufferSize`|3.6.0| | | | |`rocsparse_cbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseCbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_cbsrsv_buffer_size`|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| | | | |`rocsparse_cbsrxmv`|4.5.0| | | | |
Expand All @@ -317,7 +317,7 @@
|`cusparseCsrsv_solveEx`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseDbsrmv`| | | | |`hipsparseDbsrmv`|3.5.0| | | | |`rocsparse_dbsrmv`|3.5.0|5.4.0| | | |
|`cusparseDbsrsv2_analysis`| |12.2| | |`hipsparseDbsrsv2_analysis`|3.6.0| | | | |`rocsparse_dbsrsv_analysis`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | |`hipsparseDbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | |`hipsparseDbsrsv2_bufferSize`|3.6.0| | | | |`rocsparse_dbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseDbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_dbsrsv_buffer_size`|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| | | | |`rocsparse_dbsrxmv`|4.5.0| | | | |
Expand All @@ -336,7 +336,7 @@
|`cusparseDhybsv_solve`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseSbsrmv`| | | | |`hipsparseSbsrmv`|3.5.0| | | | |`rocsparse_sbsrmv`|3.5.0|5.4.0| | | |
|`cusparseSbsrsv2_analysis`| |12.2| | |`hipsparseSbsrsv2_analysis`|3.6.0| | | | |`rocsparse_sbsrsv_analysis`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | |`hipsparseSbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | |`hipsparseSbsrsv2_bufferSize`|3.6.0| | | | |`rocsparse_sbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseSbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_sbsrsv_buffer_size`|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| | | | |`rocsparse_sbsrxmv`|4.5.0| | | | |
Expand All @@ -357,7 +357,7 @@
|`cusparseXcsrsv2_zeroPivot`| |11.3| |12.0|`hipsparseXcsrsv2_zeroPivot`|1.9.2| | | | |`rocsparse_csrsv_zero_pivot`|1.9.0| | | | |
|`cusparseZbsrmv`| | | | |`hipsparseZbsrmv`|3.5.0| | | | |`rocsparse_zbsrmv`|3.5.0|5.4.0| | | |
|`cusparseZbsrsv2_analysis`| |12.2| | |`hipsparseZbsrsv2_analysis`|3.6.0| | | | |`rocsparse_zbsrsv_analysis`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | |`hipsparseZbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | |`hipsparseZbsrsv2_bufferSize`|3.6.0| | | | |`rocsparse_zbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseZbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_zbsrsv_buffer_size`|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| | | | |`rocsparse_zbsrxmv`|4.5.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 @@ -294,7 +294,7 @@
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmv`| | | | |`rocsparse_cbsrmv`|3.5.0|5.4.0| | | |
|`cusparseCbsrsv2_analysis`| |12.2| | |`rocsparse_cbsrsv_analysis`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | |`rocsparse_cbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_cbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseCbsrsv2_solve`| |12.2| | |`rocsparse_cbsrsv_solve`|3.6.0| | | | |
|`cusparseCbsrxmv`| |12.2| | |`rocsparse_cbsrxmv`|4.5.0| | | | |
Expand All @@ -317,7 +317,7 @@
|`cusparseCsrsv_solveEx`|8.0|10.2| |11.0| | | | | | |
|`cusparseDbsrmv`| | | | |`rocsparse_dbsrmv`|3.5.0|5.4.0| | | |
|`cusparseDbsrsv2_analysis`| |12.2| | |`rocsparse_dbsrsv_analysis`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | |`rocsparse_dbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_dbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseDbsrsv2_solve`| |12.2| | |`rocsparse_dbsrsv_solve`|3.6.0| | | | |
|`cusparseDbsrxmv`| |12.2| | |`rocsparse_dbsrxmv`|4.5.0| | | | |
Expand All @@ -336,7 +336,7 @@
|`cusparseDhybsv_solve`| |10.2| |11.0| | | | | | |
|`cusparseSbsrmv`| | | | |`rocsparse_sbsrmv`|3.5.0|5.4.0| | | |
|`cusparseSbsrsv2_analysis`| |12.2| | |`rocsparse_sbsrsv_analysis`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | |`rocsparse_sbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_sbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseSbsrsv2_solve`| |12.2| | |`rocsparse_sbsrsv_solve`|3.6.0| | | | |
|`cusparseSbsrxmv`| |12.2| | |`rocsparse_sbsrxmv`|4.5.0| | | | |
Expand All @@ -357,7 +357,7 @@
|`cusparseXcsrsv2_zeroPivot`| |11.3| |12.0|`rocsparse_csrsv_zero_pivot`|1.9.0| | | | |
|`cusparseZbsrmv`| | | | |`rocsparse_zbsrmv`|3.5.0|5.4.0| | | |
|`cusparseZbsrsv2_analysis`| |12.2| | |`rocsparse_zbsrsv_analysis`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | |`rocsparse_zbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_zbsrsv_buffer_size`|3.6.0| | | | |
|`cusparseZbsrsv2_solve`| |12.2| | |`rocsparse_zbsrsv_solve`|3.6.0| | | | |
|`cusparseZbsrxmv`| |12.2| | |`rocsparse_zbsrxmv`|4.5.0| | | | |
Expand Down
24 changes: 12 additions & 12 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCgemvi_bufferSize", {"hipsparseCgemvi_bufferSize", "rocsparse_cgemvi_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9}},
{"cusparseZgemvi_bufferSize", {"hipsparseZgemvi_bufferSize", "rocsparse_zgemvi_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9}},

{"cusparseSbsrsv2_bufferSize", {"hipsparseSbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseSbsrsv2_bufferSize", {"hipsparseSbsrsv2_bufferSize", "rocsparse_sbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseSbsrsv2_bufferSizeExt", {"hipsparseSbsrsv2_bufferSizeExt", "rocsparse_sbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseDbsrsv2_bufferSize", {"hipsparseDbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDbsrsv2_bufferSize", {"hipsparseDbsrsv2_bufferSize", "rocsparse_dbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseDbsrsv2_bufferSizeExt", {"hipsparseDbsrsv2_bufferSizeExt", "rocsparse_dbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseCbsrsv2_bufferSize", {"hipsparseCbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCbsrsv2_bufferSize", {"hipsparseCbsrsv2_bufferSize", "rocsparse_cbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseCbsrsv2_bufferSizeExt", {"hipsparseCbsrsv2_bufferSizeExt", "rocsparse_cbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseZbsrsv2_bufferSize", {"hipsparseZbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrsv2_bufferSize", {"hipsparseZbsrsv2_bufferSize", "rocsparse_zbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseZbsrsv2_bufferSizeExt", {"hipsparseZbsrsv2_bufferSizeExt", "rocsparse_zbsrsv_buffer_size", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},

{"cusparseSbsrsv2_analysis", {"hipsparseSbsrsv2_analysis", "rocsparse_sbsrsv_analysis", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
Expand Down Expand Up @@ -1327,14 +1327,14 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseCbsrxmv", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZbsrxmv", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseXbsrsv2_zeroPivot", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseSbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseSbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseSbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseDbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseZbsrsv2_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseSbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseDbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseZbsrsv2_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseSbsrsv2_analysis", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDbsrsv2_analysis", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCbsrsv2_analysis", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
Expand Down
46 changes: 45 additions & 1 deletion src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ const std::string sCusparseZcsrgeam2 = "cusparseZcsrgeam2";
const std::string sCusparseCcsrgeam2 = "cusparseCcsrgeam2";
const std::string sCusparseDcsrgeam2 = "cusparseDcsrgeam2";
const std::string sCusparseScsrgeam2 = "cusparseScsrgeam2";
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";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
Expand Down Expand Up @@ -1415,6 +1419,42 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZbsrsv2_bufferSize,
{
{
{11, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseCbsrsv2_bufferSize,
{
{
{11, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseDbsrsv2_bufferSize,
{
{
{11, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseSbsrsv2_bufferSize,
{
{
{11, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -2238,7 +2278,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZcsrgeam2,
sCusparseCcsrgeam2,
sCusparseDcsrgeam2,
sCusparseScsrgeam2
sCusparseScsrgeam2,
sCusparseZbsrsv2_bufferSize,
sCusparseCbsrsv2_bufferSize,
sCusparseDbsrsv2_bufferSize,
sCusparseSbsrsv2_bufferSize
)
)
)
Expand Down
Loading

0 comments on commit a020eac

Please sign in to comment.