Skip to content

Commit

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

+ Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jan 9, 2024
1 parent 13da6f6 commit 86f36d4
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 22 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,7 @@ sub rocSubstitutions {
subst("cusparseCcsrcolor", "rocsparse_ccsrcolor", "library");
subst("cusparseCcsrgeam", "rocsparse_ccsrgeam", "library");
subst("cusparseCcsrgeam2", "rocsparse_ccsrgeam", "library");
subst("cusparseCcsrgemm2", "rocsparse_ccsrgemm", "library");
subst("cusparseCcsrgemm2_bufferSizeExt", "rocsparse_ccsrgemm_buffer_size", "library");
subst("cusparseCcsric02", "rocsparse_ccsric0", "library");
subst("cusparseCcsric02_analysis", "rocsparse_ccsric0_analysis", "library");
Expand Down Expand Up @@ -2409,6 +2410,7 @@ sub rocSubstitutions {
subst("cusparseDcsrcolor", "rocsparse_dcsrcolor", "library");
subst("cusparseDcsrgeam", "rocsparse_dcsrgeam", "library");
subst("cusparseDcsrgeam2", "rocsparse_dcsrgeam", "library");
subst("cusparseDcsrgemm2", "rocsparse_dcsrgemm", "library");
subst("cusparseDcsrgemm2_bufferSizeExt", "rocsparse_dcsrgemm_buffer_size", "library");
subst("cusparseDcsric02", "rocsparse_dcsric0", "library");
subst("cusparseDcsric02_analysis", "rocsparse_dcsric0_analysis", "library");
Expand Down Expand Up @@ -2536,6 +2538,7 @@ sub rocSubstitutions {
subst("cusparseScsrcolor", "rocsparse_scsrcolor", "library");
subst("cusparseScsrgeam", "rocsparse_scsrgeam", "library");
subst("cusparseScsrgeam2", "rocsparse_scsrgeam", "library");
subst("cusparseScsrgemm2", "rocsparse_scsrgemm", "library");
subst("cusparseScsrgemm2_bufferSizeExt", "rocsparse_scsrgemm_buffer_size", "library");
subst("cusparseScsric02", "rocsparse_scsric0", "library");
subst("cusparseScsric02_analysis", "rocsparse_scsric0_analysis", "library");
Expand Down Expand Up @@ -2664,6 +2667,7 @@ sub rocSubstitutions {
subst("cusparseZcsrcolor", "rocsparse_zcsrcolor", "library");
subst("cusparseZcsrgeam", "rocsparse_zcsrgeam", "library");
subst("cusparseZcsrgeam2", "rocsparse_zcsrgeam", "library");
subst("cusparseZcsrgemm2", "rocsparse_zcsrgemm", "library");
subst("cusparseZcsrgemm2_bufferSizeExt", "rocsparse_zcsrgemm_buffer_size", "library");
subst("cusparseZcsric02", "rocsparse_zcsric0", "library");
subst("cusparseZcsric02_analysis", "rocsparse_zcsric0_analysis", "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 @@ -442,19 +442,19 @@
|`cusparseCcsrgeam2`|10.0| | | |`hipsparseCcsrgeam2`|3.5.0| | | | |`rocsparse_ccsrgeam`|3.5.0| | | | |
|`cusparseCcsrgeam2_bufferSizeExt`|10.0| | | |`hipsparseCcsrgeam2_bufferSizeExt`|3.5.0| | | | | | | | | | |
|`cusparseCcsrgemm`| |10.2| |11.0|`hipsparseCcsrgemm`|3.1.0| | | | | | | | | | |
|`cusparseCcsrgemm2`| |11.0| |12.0|`hipsparseCcsrgemm2`|3.1.0| | | | | | | | | | |
|`cusparseCcsrgemm2`| |11.0| |12.0|`hipsparseCcsrgemm2`|3.1.0| | | | |`rocsparse_ccsrgemm`|2.8.0| | | | |
|`cusparseCcsrgemm2_bufferSizeExt`| |11.0| |12.0|`hipsparseCcsrgemm2_bufferSizeExt`|3.1.0| | | | |`rocsparse_ccsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseDcsrgeam`| |10.2| |11.0|`hipsparseDcsrgeam`|3.5.0| | | | |`rocsparse_dcsrgeam`|3.5.0| | | | |
|`cusparseDcsrgeam2`|10.0| | | |`hipsparseDcsrgeam2`|3.5.0| | | | |`rocsparse_dcsrgeam`|3.5.0| | | | |
|`cusparseDcsrgeam2_bufferSizeExt`|10.0| | | |`hipsparseDcsrgeam2_bufferSizeExt`|3.5.0| | | | | | | | | | |
|`cusparseDcsrgemm`| |10.2| |11.0|`hipsparseDcsrgemm`|2.8.0| | | | | | | | | | |
|`cusparseDcsrgemm2`| |11.0| |12.0|`hipsparseDcsrgemm2`|2.8.0| | | | | | | | | | |
|`cusparseDcsrgemm2`| |11.0| |12.0|`hipsparseDcsrgemm2`|2.8.0| | | | |`rocsparse_dcsrgemm`|2.8.0| | | | |
|`cusparseDcsrgemm2_bufferSizeExt`| |11.0| |12.0|`hipsparseDcsrgemm2_bufferSizeExt`|2.8.0| | | | |`rocsparse_dcsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseScsrgeam`| |10.2| |11.0|`hipsparseScsrgeam`|3.5.0| | | | |`rocsparse_scsrgeam`|3.5.0| | | | |
|`cusparseScsrgeam2`|10.0| | | |`hipsparseScsrgeam2`|3.5.0| | | | |`rocsparse_scsrgeam`|3.5.0| | | | |
|`cusparseScsrgeam2_bufferSizeExt`|10.0| | | |`hipsparseScsrgeam2_bufferSizeExt`|3.5.0| | | | | | | | | | |
|`cusparseScsrgemm`| |10.2| |11.0|`hipsparseScsrgemm`|2.8.0| | | | | | | | | | |
|`cusparseScsrgemm2`| |11.0| |12.0|`hipsparseScsrgemm2`|2.8.0| | | | | | | | | | |
|`cusparseScsrgemm2`| |11.0| |12.0|`hipsparseScsrgemm2`|2.8.0| | | | |`rocsparse_scsrgemm`|2.8.0| | | | |
|`cusparseScsrgemm2_bufferSizeExt`| |11.0| |12.0|`hipsparseScsrgemm2_bufferSizeExt`|2.8.0| | | | |`rocsparse_scsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseXcsrgeam2Nnz`|10.0| | | |`hipsparseXcsrgeam2Nnz`|3.5.0| | | | | | | | | | |
|`cusparseXcsrgeamNnz`| |10.2| |11.0|`hipsparseXcsrgeamNnz`|3.5.0| | | | |`rocsparse_csrgeam_nnz`|3.5.0| | | | |
Expand All @@ -464,7 +464,7 @@
|`cusparseZcsrgeam2`|10.0| | | |`hipsparseZcsrgeam2`|3.5.0| | | | |`rocsparse_zcsrgeam`|3.5.0| | | | |
|`cusparseZcsrgeam2_bufferSizeExt`|10.0| | | |`hipsparseZcsrgeam2_bufferSizeExt`|3.5.0| | | | | | | | | | |
|`cusparseZcsrgemm`| |10.2| |11.0|`hipsparseZcsrgemm`|3.1.0| | | | | | | | | | |
|`cusparseZcsrgemm2`| |11.0| |12.0|`hipsparseZcsrgemm2`|3.1.0| | | | | | | | | | |
|`cusparseZcsrgemm2`| |11.0| |12.0|`hipsparseZcsrgemm2`|3.1.0| | | | |`rocsparse_zcsrgemm`|2.8.0| | | | |
|`cusparseZcsrgemm2_bufferSizeExt`| |11.0| |12.0|`hipsparseZcsrgemm2_bufferSizeExt`|3.1.0| | | | |`rocsparse_zcsrgemm_buffer_size`|2.8.0| | | | |

## **12. CUSPARSE Preconditioners Reference**
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 @@ -442,19 +442,19 @@
|`cusparseCcsrgeam2`|10.0| | | |`rocsparse_ccsrgeam`|3.5.0| | | | |
|`cusparseCcsrgeam2_bufferSizeExt`|10.0| | | | | | | | | |
|`cusparseCcsrgemm`| |10.2| |11.0| | | | | | |
|`cusparseCcsrgemm2`| |11.0| |12.0| | | | | | |
|`cusparseCcsrgemm2`| |11.0| |12.0|`rocsparse_ccsrgemm`|2.8.0| | | | |
|`cusparseCcsrgemm2_bufferSizeExt`| |11.0| |12.0|`rocsparse_ccsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseDcsrgeam`| |10.2| |11.0|`rocsparse_dcsrgeam`|3.5.0| | | | |
|`cusparseDcsrgeam2`|10.0| | | |`rocsparse_dcsrgeam`|3.5.0| | | | |
|`cusparseDcsrgeam2_bufferSizeExt`|10.0| | | | | | | | | |
|`cusparseDcsrgemm`| |10.2| |11.0| | | | | | |
|`cusparseDcsrgemm2`| |11.0| |12.0| | | | | | |
|`cusparseDcsrgemm2`| |11.0| |12.0|`rocsparse_dcsrgemm`|2.8.0| | | | |
|`cusparseDcsrgemm2_bufferSizeExt`| |11.0| |12.0|`rocsparse_dcsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseScsrgeam`| |10.2| |11.0|`rocsparse_scsrgeam`|3.5.0| | | | |
|`cusparseScsrgeam2`|10.0| | | |`rocsparse_scsrgeam`|3.5.0| | | | |
|`cusparseScsrgeam2_bufferSizeExt`|10.0| | | | | | | | | |
|`cusparseScsrgemm`| |10.2| |11.0| | | | | | |
|`cusparseScsrgemm2`| |11.0| |12.0| | | | | | |
|`cusparseScsrgemm2`| |11.0| |12.0|`rocsparse_scsrgemm`|2.8.0| | | | |
|`cusparseScsrgemm2_bufferSizeExt`| |11.0| |12.0|`rocsparse_scsrgemm_buffer_size`|2.8.0| | | | |
|`cusparseXcsrgeam2Nnz`|10.0| | | | | | | | | |
|`cusparseXcsrgeamNnz`| |10.2| |11.0|`rocsparse_csrgeam_nnz`|3.5.0| | | | |
Expand All @@ -464,7 +464,7 @@
|`cusparseZcsrgeam2`|10.0| | | |`rocsparse_zcsrgeam`|3.5.0| | | | |
|`cusparseZcsrgeam2_bufferSizeExt`|10.0| | | | | | | | | |
|`cusparseZcsrgemm`| |10.2| |11.0| | | | | | |
|`cusparseZcsrgemm2`| |11.0| |12.0| | | | | | |
|`cusparseZcsrgemm2`| |11.0| |12.0|`rocsparse_zcsrgemm`|2.8.0| | | | |
|`cusparseZcsrgemm2_bufferSizeExt`| |11.0| |12.0|`rocsparse_zcsrgemm_buffer_size`|2.8.0| | | | |

## **12. CUSPARSE Preconditioners Reference**
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 @@ -315,10 +315,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
// NOTE: rocsparse_csrgemm_nnz has different signature, thus it is unsupported yet
{"cusparseXcsrgemmNnz", {"hipsparseXcsrgemmNnz", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrgemm2", {"hipsparseScsrgemm2", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrgemm2", {"hipsparseDcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrgemm2", {"hipsparseCcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrgemm2", {"hipsparseZcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseScsrgemm2", {"hipsparseScsrgemm2", "rocsparse_scsrgemm", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrgemm2", {"hipsparseDcsrgemm2", "rocsparse_dcsrgemm", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrgemm2", {"hipsparseCcsrgemm2", "rocsparse_ccsrgemm", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrgemm2", {"hipsparseZcsrgemm2", "rocsparse_zcsrgemm", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseXcsrgemm2Nnz", {"hipsparseXcsrgemm2Nnz", "rocsparse_csrgemm_nnz", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrgemm2_bufferSizeExt", {"hipsparseScsrgemm2_bufferSizeExt", "rocsparse_scsrgemm_buffer_size", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -2415,6 +2415,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_dcsrmm", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_ccsrmm", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_zcsrmm", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_scsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_dcsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_ccsrgemm", {HIP_2080, HIP_0, HIP_0 }},
{"rocsparse_zcsrgemm", {HIP_2080, 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 @@ -191,6 +191,10 @@ 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";
const std::string sCusparseZcsrgemm2 = "cusparseZcsrgemm2";
const std::string sCusparseCcsrgemm2 = "cusparseCcsrgemm2";
const std::string sCusparseDcsrgemm2 = "cusparseDcsrgemm2";
const std::string sCusparseScsrgemm2 = "cusparseScsrgemm2";

// CUDA_OVERLOADED
const std::string sCudaEventCreate = "cudaEventCreate";
Expand Down Expand Up @@ -1495,6 +1499,42 @@ std::map<std::string, ArgCastStruct> FuncArgCasts {
false
}
},
{sCusparseZcsrgemm2,
{
{
{1, {e_add_const_argument, cw_None, "rocsparse_operation_none, rocsparse_operation_none"}}
},
true,
false
}
},
{sCusparseCcsrgemm2,
{
{
{1, {e_add_const_argument, cw_None, "rocsparse_operation_none, rocsparse_operation_none"}}
},
true,
false
}
},
{sCusparseDcsrgemm2,
{
{
{1, {e_add_const_argument, cw_None, "rocsparse_operation_none, rocsparse_operation_none"}}
},
true,
false
}
},
{sCusparseScsrgemm2,
{
{
{1, {e_add_const_argument, cw_None, "rocsparse_operation_none, rocsparse_operation_none"}}
},
true,
false
}
},
};

void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
Expand Down Expand Up @@ -2326,7 +2366,11 @@ std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::Compi
sCusparseZcsrsv2_bufferSize,
sCusparseCcsrsv2_bufferSize,
sCusparseDcsrsv2_bufferSize,
sCusparseScsrsv2_bufferSize
sCusparseScsrsv2_bufferSize,
sCusparseZcsrgemm2,
sCusparseCcsrgemm2,
sCusparseDcsrgemm2,
sCusparseScsrgemm2
)
)
)
Expand Down
Loading

0 comments on commit 86f36d4

Please sign in to comment.