Skip to content

Commit

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

+ Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jan 11, 2024
1 parent 97be4d8 commit fc766b4
Show file tree
Hide file tree
Showing 7 changed files with 109 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 @@ -2264,6 +2264,7 @@ sub rocSubstitutions {
subst("cusparseCbsric02_bufferSize", "rocsparse_cbsric0_buffer_size", "library");
subst("cusparseCbsrilu02", "rocsparse_cbsrilu0", "library");
subst("cusparseCbsrilu02_analysis", "rocsparse_cbsrilu0_analysis", "library");
subst("cusparseCbsrilu02_bufferSize", "rocsparse_cbsrilu0_buffer_size", "library");
subst("cusparseCbsrilu02_numericBoost", "rocsparse_dcbsrilu0_numeric_boost", "library");
subst("cusparseCbsrmm", "rocsparse_cbsrmm", "library");
subst("cusparseCbsrmv", "rocsparse_cbsrmv", "library");
Expand Down Expand Up @@ -2390,6 +2391,7 @@ sub rocSubstitutions {
subst("cusparseDbsric02_bufferSize", "rocsparse_dbsric0_buffer_size", "library");
subst("cusparseDbsrilu02", "rocsparse_dbsrilu0", "library");
subst("cusparseDbsrilu02_analysis", "rocsparse_dbsrilu0_analysis", "library");
subst("cusparseDbsrilu02_bufferSize", "rocsparse_dbsrilu0_buffer_size", "library");
subst("cusparseDbsrilu02_numericBoost", "rocsparse_dbsrilu0_numeric_boost", "library");
subst("cusparseDbsrmm", "rocsparse_dbsrmm", "library");
subst("cusparseDbsrmv", "rocsparse_dbsrmv", "library");
Expand Down Expand Up @@ -2518,6 +2520,7 @@ sub rocSubstitutions {
subst("cusparseSbsric02_bufferSize", "rocsparse_sbsric0_buffer_size", "library");
subst("cusparseSbsrilu02", "rocsparse_sbsrilu0", "library");
subst("cusparseSbsrilu02_analysis", "rocsparse_sbsrilu0_analysis", "library");
subst("cusparseSbsrilu02_bufferSize", "rocsparse_sbsrilu0_buffer_size", "library");
subst("cusparseSbsrilu02_numericBoost", "rocsparse_dsbsrilu0_numeric_boost", "library");
subst("cusparseSbsrmm", "rocsparse_sbsrmm", "library");
subst("cusparseSbsrmv", "rocsparse_sbsrmv", "library");
Expand Down Expand Up @@ -2649,6 +2652,7 @@ sub rocSubstitutions {
subst("cusparseZbsric02_bufferSize", "rocsparse_zbsric0_buffer_size", "library");
subst("cusparseZbsrilu02", "rocsparse_zbsrilu0", "library");
subst("cusparseZbsrilu02_analysis", "rocsparse_zbsrilu0_analysis", "library");
subst("cusparseZbsrilu02_bufferSize", "rocsparse_zbsrilu0_buffer_size", "library");
subst("cusparseZbsrilu02_numericBoost", "rocsparse_zbsrilu0_numeric_boost", "library");
subst("cusparseZbsrmm", "rocsparse_zbsrmm", "library");
subst("cusparseZbsrmv", "rocsparse_zbsrmv", "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 @@ -477,7 +477,7 @@
|`cusparseCbsric02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseCbsrilu02`| |12.2| | |`hipsparseCbsrilu02`|3.9.0| | | | |`rocsparse_cbsrilu0`|3.9.0| | | | |
|`cusparseCbsrilu02_analysis`| |12.2| | |`hipsparseCbsrilu02_analysis`|3.9.0| | | | |`rocsparse_cbsrilu0_analysis`|3.6.0| | | | |
|`cusparseCbsrilu02_bufferSize`| |12.2| | |`hipsparseCbsrilu02_bufferSize`|3.9.0| | | | | | | | | | |
|`cusparseCbsrilu02_bufferSize`| |12.2| | |`hipsparseCbsrilu02_bufferSize`|3.9.0| | | | |`rocsparse_cbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseCbsrilu02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseCbsrilu02_numericBoost`| |12.2| | |`hipsparseCbsrilu02_numericBoost`|3.9.0| | | | |`rocsparse_dcbsrilu0_numeric_boost`|4.5.0| | | | |
|`cusparseCcsric0`| |10.2| |11.0| | | | | | | | | | | | |
Expand Down Expand Up @@ -511,7 +511,7 @@
|`cusparseDbsric02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseDbsrilu02`| |12.2| | |`hipsparseDbsrilu02`|3.9.0| | | | |`rocsparse_dbsrilu0`|3.9.0| | | | |
|`cusparseDbsrilu02_analysis`| |12.2| | |`hipsparseDbsrilu02_analysis`|3.9.0| | | | |`rocsparse_dbsrilu0_analysis`|3.6.0| | | | |
|`cusparseDbsrilu02_bufferSize`| |12.2| | |`hipsparseDbsrilu02_bufferSize`|3.9.0| | | | | | | | | | |
|`cusparseDbsrilu02_bufferSize`| |12.2| | |`hipsparseDbsrilu02_bufferSize`|3.9.0| | | | |`rocsparse_dbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseDbsrilu02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseDbsrilu02_numericBoost`| |12.2| | |`hipsparseDbsrilu02_numericBoost`|3.9.0| | | | |`rocsparse_dbsrilu0_numeric_boost`|3.9.0| | | | |
|`cusparseDcsric0`| |10.2| |11.0| | | | | | | | | | | | |
Expand Down Expand Up @@ -544,7 +544,7 @@
|`cusparseSbsric02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseSbsrilu02`| |12.2| | |`hipsparseSbsrilu02`|3.9.0| | | | |`rocsparse_sbsrilu0`|3.9.0| | | | |
|`cusparseSbsrilu02_analysis`| |12.2| | |`hipsparseSbsrilu02_analysis`|3.9.0| | | | |`rocsparse_sbsrilu0_analysis`|3.6.0| | | | |
|`cusparseSbsrilu02_bufferSize`| |12.2| | |`hipsparseSbsrilu02_bufferSize`|3.9.0| | | | | | | | | | |
|`cusparseSbsrilu02_bufferSize`| |12.2| | |`hipsparseSbsrilu02_bufferSize`|3.9.0| | | | |`rocsparse_sbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseSbsrilu02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseSbsrilu02_numericBoost`| |12.2| | |`hipsparseSbsrilu02_numericBoost`|3.9.0| | | | |`rocsparse_dsbsrilu0_numeric_boost`|4.5.0| | | | |
|`cusparseScsric0`| |10.2| |11.0| | | | | | | | | | | | |
Expand Down Expand Up @@ -581,7 +581,7 @@
|`cusparseZbsric02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseZbsrilu02`| |12.2| | |`hipsparseZbsrilu02`|3.9.0| | | | |`rocsparse_zbsrilu0`|3.9.0| | | | |
|`cusparseZbsrilu02_analysis`| |12.2| | |`hipsparseZbsrilu02_analysis`|3.9.0| | | | |`rocsparse_zbsrilu0_analysis`|3.6.0| | | | |
|`cusparseZbsrilu02_bufferSize`| |12.2| | |`hipsparseZbsrilu02_bufferSize`|3.9.0| | | | | | | | | | |
|`cusparseZbsrilu02_bufferSize`| |12.2| | |`hipsparseZbsrilu02_bufferSize`|3.9.0| | | | |`rocsparse_zbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseZbsrilu02_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseZbsrilu02_numericBoost`| |12.2| | |`hipsparseZbsrilu02_numericBoost`|3.9.0| | | | |`rocsparse_zbsrilu0_numeric_boost`|3.9.0| | | | |
|`cusparseZcsric0`| |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 @@ -477,7 +477,7 @@
|`cusparseCbsric02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseCbsrilu02`| |12.2| | |`rocsparse_cbsrilu0`|3.9.0| | | | |
|`cusparseCbsrilu02_analysis`| |12.2| | |`rocsparse_cbsrilu0_analysis`|3.6.0| | | | |
|`cusparseCbsrilu02_bufferSize`| |12.2| | | | | | | | |
|`cusparseCbsrilu02_bufferSize`| |12.2| | |`rocsparse_cbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseCbsrilu02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseCbsrilu02_numericBoost`| |12.2| | |`rocsparse_dcbsrilu0_numeric_boost`|4.5.0| | | | |
|`cusparseCcsric0`| |10.2| |11.0| | | | | | |
Expand Down Expand Up @@ -511,7 +511,7 @@
|`cusparseDbsric02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseDbsrilu02`| |12.2| | |`rocsparse_dbsrilu0`|3.9.0| | | | |
|`cusparseDbsrilu02_analysis`| |12.2| | |`rocsparse_dbsrilu0_analysis`|3.6.0| | | | |
|`cusparseDbsrilu02_bufferSize`| |12.2| | | | | | | | |
|`cusparseDbsrilu02_bufferSize`| |12.2| | |`rocsparse_dbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseDbsrilu02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseDbsrilu02_numericBoost`| |12.2| | |`rocsparse_dbsrilu0_numeric_boost`|3.9.0| | | | |
|`cusparseDcsric0`| |10.2| |11.0| | | | | | |
Expand Down Expand Up @@ -544,7 +544,7 @@
|`cusparseSbsric02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseSbsrilu02`| |12.2| | |`rocsparse_sbsrilu0`|3.9.0| | | | |
|`cusparseSbsrilu02_analysis`| |12.2| | |`rocsparse_sbsrilu0_analysis`|3.6.0| | | | |
|`cusparseSbsrilu02_bufferSize`| |12.2| | | | | | | | |
|`cusparseSbsrilu02_bufferSize`| |12.2| | |`rocsparse_sbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseSbsrilu02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseSbsrilu02_numericBoost`| |12.2| | |`rocsparse_dsbsrilu0_numeric_boost`|4.5.0| | | | |
|`cusparseScsric0`| |10.2| |11.0| | | | | | |
Expand Down Expand Up @@ -581,7 +581,7 @@
|`cusparseZbsric02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseZbsrilu02`| |12.2| | |`rocsparse_zbsrilu0`|3.9.0| | | | |
|`cusparseZbsrilu02_analysis`| |12.2| | |`rocsparse_zbsrilu0_analysis`|3.6.0| | | | |
|`cusparseZbsrilu02_bufferSize`| |12.2| | | | | | | | |
|`cusparseZbsrilu02_bufferSize`| |12.2| | |`rocsparse_zbsrilu0_buffer_size`|3.8.0| | | | |
|`cusparseZbsrilu02_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseZbsrilu02_numericBoost`| |12.2| | |`rocsparse_zbsrilu0_numeric_boost`|3.9.0| | | | |
|`cusparseZcsric0`| |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 @@ -413,13 +413,13 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseZbsrilu02_numericBoost", {"hipsparseZbsrilu02_numericBoost", "rocsparse_zbsrilu0_numeric_boost", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},

// NOTE: rocsparse_(s|d|c|z)bsrilu0_buffer_size have an additional parameter void* temp_buffer
{"cusparseSbsrilu02_bufferSize", {"hipsparseSbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseSbsrilu02_bufferSize", {"hipsparseSbsrilu02_bufferSize", "rocsparse_sbsrilu0_buffer_size", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseSbsrilu02_bufferSizeExt", {"hipsparseSbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDbsrilu02_bufferSize", {"hipsparseDbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDbsrilu02_bufferSize", {"hipsparseDbsrilu02_bufferSize", "rocsparse_dbsrilu0_buffer_size", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseDbsrilu02_bufferSizeExt", {"hipsparseDbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCbsrilu02_bufferSize", {"hipsparseCbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCbsrilu02_bufferSize", {"hipsparseCbsrilu02_bufferSize", "rocsparse_cbsrilu0_buffer_size", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseCbsrilu02_bufferSizeExt", {"hipsparseCbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrilu02_bufferSize", {"hipsparseZbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrilu02_bufferSize", {"hipsparseZbsrilu02_bufferSize", "rocsparse_zbsrilu0_buffer_size", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseZbsrilu02_bufferSizeExt", {"hipsparseZbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED}},

{"cusparseSbsrilu02_analysis", {"hipsparseSbsrilu02_analysis", "rocsparse_sbsrilu0_analysis", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
Expand Down Expand Up @@ -1386,10 +1386,10 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseCbsrilu02_numericBoost", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZbsrilu02_numericBoost", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseXbsrilu02_zeroPivot", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseSbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseSbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseDbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseZbsrilu02_bufferSize", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseSbsrilu02_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDbsrilu02_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCbsrilu02_bufferSizeExt", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
Expand Down Expand Up @@ -2419,6 +2419,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_dcsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_ccsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_zcsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_sbsrilu0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_dbsrilu0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_cbsrilu0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_zbsrilu0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP {
Expand Down
46 changes: 45 additions & 1 deletion src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ const std::string sCusparseZcsrilu02_bufferSize = "cusparseZcsrilu02_bufferSize"
const std::string sCusparseCcsrilu02_bufferSize = "cusparseCcsrilu02_bufferSize";
const std::string sCusparseDcsrilu02_bufferSize = "cusparseDcsrilu02_bufferSize";
const std::string sCusparseScsrilu02_bufferSize = "cusparseScsrilu02_bufferSize";
const std::string sCusparseZbsrilu02_bufferSize = "cusparseZbsrilu02_bufferSize";
const std::string sCusparseCbsrilu02_bufferSize = "cusparseCbsrilu02_bufferSize";
const std::string sCusparseDbsrilu02_bufferSize = "cusparseDbsrilu02_bufferSize";
const std::string sCusparseSbsrilu02_bufferSize = "cusparseSbsrilu02_bufferSize";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
Expand Down Expand Up @@ -1575,6 +1579,42 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZbsrilu02_bufferSize,
{
{
{10, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseCbsrilu02_bufferSize,
{
{
{10, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseDbsrilu02_bufferSize,
{
{
{10, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
{sCusparseSbsrilu02_bufferSize,
{
{
{10, {e_reinterpret_cast_size_t, cw_None}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -2414,7 +2454,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZcsrilu02_bufferSize,
sCusparseCcsrilu02_bufferSize,
sCusparseDcsrilu02_bufferSize,
sCusparseScsrilu02_bufferSize
sCusparseScsrilu02_bufferSize,
sCusparseZbsrilu02_bufferSize,
sCusparseCbsrilu02_bufferSize,
sCusparseDbsrilu02_bufferSize,
sCusparseSbsrilu02_bufferSize
)
)
)
Expand Down
Loading

0 comments on commit fc766b4

Please sign in to comment.