Skip to content

Commit

Permalink
Merge pull request #1054 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][#674][rocSPARSE][feature] rocSPARSE support - Step 50 - functions `rocsparse_csrgemm_nnz` and `rocsparse_bsric0_zero_pivot`
  • Loading branch information
emankov authored Oct 7, 2023
2 parents 915b643 + 213a4d0 commit 291878e
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 20 deletions.
7 changes: 6 additions & 1 deletion bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ my %deprecated_funcs = (
"cusparseXbsrsv2_zeroPivot" => "12.2",
"cusparseXbsrsm2_zeroPivot" => "12.2",
"cusparseXbsrilu02_zeroPivot" => "12.2",
"cusparseXbsric02_zeroPivot" => "12.2",
"cusparseSsctr" => "11.0",
"cusparseSroti" => "11.0",
"cusparseSpruneDense2csr_bufferSizeExt" => "12.2",
Expand Down Expand Up @@ -1894,6 +1895,7 @@ sub rocSubstitutions {
subst("cusparseSpruneDense2csrNnz", "rocsparse_sprune_dense2csr_nnz", "library");
subst("cusparseSpruneDense2csrNnzByPercentage", "rocsparse_sprune_dense2csr_nnz_by_percentage", "library");
subst("cusparseSpruneDense2csr_bufferSizeExt", "rocsparse_sprune_dense2csr_buffer_size", "library");
subst("cusparseXbsric02_zeroPivot", "rocsparse_bsric0_zero_pivot", "library");
subst("cusparseXbsrilu02_zeroPivot", "rocsparse_bsrilu0_zero_pivot", "library");
subst("cusparseXcoo2csr", "rocsparse_coo2csr", "library");
subst("cusparseXcoosortByColumn", "rocsparse_coosort_by_column", "library");
Expand All @@ -1904,6 +1906,7 @@ sub rocSubstitutions {
subst("cusparseXcsr2bsrNnz", "rocsparse_csr2bsr_nnz", "library");
subst("cusparseXcsr2coo", "rocsparse_csr2coo", "library");
subst("cusparseXcsr2gebsrNnz", "rocsparse_csr2gebsr_nnz", "library");
subst("cusparseXcsrgemm2Nnz", "rocsparse_csrgemm_nnz", "library");
subst("cusparseXcsric02_zeroPivot", "rocsparse_csric0_zero_pivot", "library");
subst("cusparseXcsrilu02_zeroPivot", "rocsparse_csrilu0_zero_pivot", "library");
subst("cusparseXcsrsort", "rocsparse_csrsort", "library");
Expand Down Expand Up @@ -1957,6 +1960,8 @@ sub rocSubstitutions {
subst("bsric02Info_t", "rocsparse_mat_info", "type");
subst("bsrilu02Info", "_rocsparse_mat_info", "type");
subst("bsrilu02Info_t", "rocsparse_mat_info", "type");
subst("csrgemm2Info", "_rocsparse_mat_info", "type");
subst("csrgemm2Info_t", "rocsparse_mat_info", "type");
subst("csric02Info", "_rocsparse_mat_info", "type");
subst("csric02Info_t", "rocsparse_mat_info", "type");
subst("csrilu02Info", "_rocsparse_mat_info", "type");
Expand Down Expand Up @@ -4241,6 +4246,7 @@ sub simpleSubstitutions {
subst("bsrsm2Info_t", "bsrsm2Info_t", "type");
subst("bsrsv2Info", "bsrsv2Info", "type");
subst("bsrsv2Info_t", "bsrsv2Info_t", "type");
subst("csrgemm2Info", "csrgemm2Info", "type");
subst("csrgemm2Info_t", "csrgemm2Info_t", "type");
subst("csric02Info", "csric02Info", "type");
subst("csric02Info_t", "csric02Info_t", "type");
Expand Down Expand Up @@ -7874,7 +7880,6 @@ sub warnUnsupportedFunctions {
"cuArrayGetMemoryRequirements",
"csrsv2Info",
"csrsm2Info",
"csrgemm2Info",
"cl_event_flags_enum",
"cl_event_flags",
"cl_context_flags_enum",
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/CUSPARSE_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
|`bsrsm2Info_t`| |12.2| |`bsrsm2Info_t`|4.5.0| | | |
|`bsrsv2Info`| |12.2| |`bsrsv2Info`|3.6.0| | | |
|`bsrsv2Info_t`| |12.2| |`bsrsv2Info_t`|3.6.0| | | |
|`csrgemm2Info`| | |12.0| | | | | |
|`csrgemm2Info`| | |12.0|`csrgemm2Info`|2.8.0| | | |
|`csrgemm2Info_t`| | |12.0|`csrgemm2Info_t`|2.8.0| | | |
|`csric02Info`| |12.2| |`csric02Info`|3.1.0| | | |
|`csric02Info_t`| |12.2| |`csric02Info_t`|3.1.0| | | |
Expand Down Expand Up @@ -569,7 +569,7 @@
|`cusparseSgtsvInterleavedBatch_bufferSizeExt`|9.2| | |`hipsparseSgtsvInterleavedBatch_bufferSizeExt`|5.1.0| | | |
|`cusparseSgtsvStridedBatch`| |10.2|11.0| | | | | |
|`cusparseSgtsv_nopivot`| |10.2|11.0| | | | | |
|`cusparseXbsric02_zeroPivot`| | | |`hipsparseXbsric02_zeroPivot`|3.8.0| | | |
|`cusparseXbsric02_zeroPivot`| |12.2| |`hipsparseXbsric02_zeroPivot`|3.8.0| | | |
|`cusparseXbsrilu02_zeroPivot`| |12.2| |`hipsparseXbsrilu02_zeroPivot`|3.9.0| | | |
|`cusparseXcsric02_zeroPivot`| |12.2| |`hipsparseXcsric02_zeroPivot`|3.1.0| | | |
|`cusparseXcsrilu02_zeroPivot`| |12.2| |`hipsparseXcsrilu02_zeroPivot`|1.9.2| | | |
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 @@ -116,8 +116,8 @@
|`bsrsm2Info_t`| |12.2| |`bsrsm2Info_t`|4.5.0| | | | | | | | |
|`bsrsv2Info`| |12.2| |`bsrsv2Info`|3.6.0| | | | | | | | |
|`bsrsv2Info_t`| |12.2| |`bsrsv2Info_t`|3.6.0| | | | | | | | |
|`csrgemm2Info`| | |12.0| | | | | | | | | | |
|`csrgemm2Info_t`| | |12.0|`csrgemm2Info_t`|2.8.0| | | | | | | | |
|`csrgemm2Info`| | |12.0|`csrgemm2Info`|2.8.0| | | |`_rocsparse_mat_info`|1.9.0| | | |
|`csrgemm2Info_t`| | |12.0|`csrgemm2Info_t`|2.8.0| | | |`rocsparse_mat_info`|1.9.0| | | |
|`csric02Info`| |12.2| |`csric02Info`|3.1.0| | | |`_rocsparse_mat_info`|1.9.0| | | |
|`csric02Info_t`| |12.2| |`csric02Info_t`|3.1.0| | | |`rocsparse_mat_info`|1.9.0| | | |
|`csrilu02Info`| |12.2| |`csrilu02Info`|1.9.2| | | |`_rocsparse_mat_info`|1.9.0| | | |
Expand Down Expand Up @@ -456,7 +456,7 @@
|`cusparseScsrgemm2_bufferSizeExt`| |11.0|12.0|`hipsparseScsrgemm2_bufferSizeExt`|2.8.0| | | | | | | | |
|`cusparseXcsrgeam2Nnz`|10.0| | |`hipsparseXcsrgeam2Nnz`|3.5.0| | | | | | | | |
|`cusparseXcsrgeamNnz`| |10.2|11.0|`hipsparseXcsrgeamNnz`|3.5.0| | | | | | | | |
|`cusparseXcsrgemm2Nnz`| |11.0|12.0|`hipsparseXcsrgemm2Nnz`|2.8.0| | | | | | | | |
|`cusparseXcsrgemm2Nnz`| |11.0|12.0|`hipsparseXcsrgemm2Nnz`|2.8.0| | | |`rocsparse_csrgemm_nnz`|2.8.0| | | |
|`cusparseXcsrgemmNnz`| |10.2|11.0|`hipsparseXcsrgemmNnz`|2.8.0| | | | | | | | |
|`cusparseZcsrgeam`| |10.2|11.0|`hipsparseZcsrgeam`|3.5.0| | | | | | | | |
|`cusparseZcsrgeam2`|10.0| | |`hipsparseZcsrgeam2`|3.5.0| | | | | | | | |
Expand Down Expand Up @@ -569,7 +569,7 @@
|`cusparseSgtsvInterleavedBatch_bufferSizeExt`|9.2| | |`hipsparseSgtsvInterleavedBatch_bufferSizeExt`|5.1.0| | | |`rocsparse_sgtsv_interleaved_batch_buffer_size`|5.1.0| | | |
|`cusparseSgtsvStridedBatch`| |10.2|11.0| | | | | | | | | | |
|`cusparseSgtsv_nopivot`| |10.2|11.0| | | | | | | | | | |
|`cusparseXbsric02_zeroPivot`| | | |`hipsparseXbsric02_zeroPivot`|3.8.0| | | | | | | | |
|`cusparseXbsric02_zeroPivot`| |12.2| |`hipsparseXbsric02_zeroPivot`|3.8.0| | | |`rocsparse_bsric0_zero_pivot`|3.8.0| | | |
|`cusparseXbsrilu02_zeroPivot`| |12.2| |`hipsparseXbsrilu02_zeroPivot`|3.9.0| | | |`rocsparse_bsrilu0_zero_pivot`|3.9.0| | | |
|`cusparseXcsric02_zeroPivot`| |12.2| |`hipsparseXcsric02_zeroPivot`|3.1.0| | | |`rocsparse_csric0_zero_pivot`|3.1.0| | | |
|`cusparseXcsrilu02_zeroPivot`| |12.2| |`hipsparseXcsrilu02_zeroPivot`|1.9.2| | | |`rocsparse_csrilu0_zero_pivot`|1.9.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 @@ -116,8 +116,8 @@
|`bsrsm2Info_t`| |12.2| | | | | | |
|`bsrsv2Info`| |12.2| | | | | | |
|`bsrsv2Info_t`| |12.2| | | | | | |
|`csrgemm2Info`| | |12.0| | | | | |
|`csrgemm2Info_t`| | |12.0| | | | | |
|`csrgemm2Info`| | |12.0|`_rocsparse_mat_info`|1.9.0| | | |
|`csrgemm2Info_t`| | |12.0|`rocsparse_mat_info`|1.9.0| | | |
|`csric02Info`| |12.2| |`_rocsparse_mat_info`|1.9.0| | | |
|`csric02Info_t`| |12.2| |`rocsparse_mat_info`|1.9.0| | | |
|`csrilu02Info`| |12.2| |`_rocsparse_mat_info`|1.9.0| | | |
Expand Down Expand Up @@ -456,7 +456,7 @@
|`cusparseScsrgemm2_bufferSizeExt`| |11.0|12.0| | | | | |
|`cusparseXcsrgeam2Nnz`|10.0| | | | | | | |
|`cusparseXcsrgeamNnz`| |10.2|11.0| | | | | |
|`cusparseXcsrgemm2Nnz`| |11.0|12.0| | | | | |
|`cusparseXcsrgemm2Nnz`| |11.0|12.0|`rocsparse_csrgemm_nnz`|2.8.0| | | |
|`cusparseXcsrgemmNnz`| |10.2|11.0| | | | | |
|`cusparseZcsrgeam`| |10.2|11.0| | | | | |
|`cusparseZcsrgeam2`|10.0| | | | | | | |
Expand Down Expand Up @@ -569,7 +569,7 @@
|`cusparseSgtsvInterleavedBatch_bufferSizeExt`|9.2| | |`rocsparse_sgtsv_interleaved_batch_buffer_size`|5.1.0| | | |
|`cusparseSgtsvStridedBatch`| |10.2|11.0| | | | | |
|`cusparseSgtsv_nopivot`| |10.2|11.0| | | | | |
|`cusparseXbsric02_zeroPivot`| | | | | | | | |
|`cusparseXbsric02_zeroPivot`| |12.2| |`rocsparse_bsric0_zero_pivot`|3.8.0| | | |
|`cusparseXbsrilu02_zeroPivot`| |12.2| |`rocsparse_bsrilu0_zero_pivot`|3.9.0| | | |
|`cusparseXcsric02_zeroPivot`| |12.2| |`rocsparse_csric0_zero_pivot`|3.1.0| | | |
|`cusparseXcsrilu02_zeroPivot`| |12.2| |`rocsparse_csrilu0_zero_pivot`|1.9.0| | | |
Expand Down
12 changes: 9 additions & 3 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,19 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCcsrgeam2_bufferSizeExt", {"hipsparseCcsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED}},
{"cusparseZcsrgeam2_bufferSizeExt", {"hipsparseZcsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED}},

// NOTE: rocsparse_(s|d|c|z)csrgemm have different signatures, thus they are unsupported yet
{"cusparseScsrgemm", {"hipsparseScsrgemm", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrgemm", {"hipsparseDcsrgemm", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrgemm", {"hipsparseCcsrgemm", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZcsrgemm", {"hipsparseZcsrgemm", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
// 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}},
{"cusparseXcsrgemm2Nnz", {"hipsparseXcsrgemm2Nnz", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseXcsrgemm2Nnz", {"hipsparseXcsrgemm2Nnz", "rocsparse_csrgemm_nnz", CONV_LIB_FUNC, API_SPARSE, 11, CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseScsrgemm2_bufferSizeExt", {"hipsparseScsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrgemm2_bufferSizeExt", {"hipsparseDcsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 11, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -362,10 +364,11 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseDbsric02", {"hipsparseDbsric02", "rocsparse_dbsric0", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseCbsric02", {"hipsparseCbsric02", "rocsparse_cbsric0", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseZbsric02", {"hipsparseZbsric02", "rocsparse_zbsric0", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},
{"cusparseXbsric02_zeroPivot", {"hipsparseXbsric02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, 12, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
// TODO: rocsparse_get_stream and hipStreamSynchronize need to be added correspondingly before and after rocsparse_bsric0_zero_pivot call, because cusparseXbsric02_zeroPivot is blocking, and rocsparse_bsric0_zero_pivot is not
{"cusparseXbsric02_zeroPivot", {"hipsparseXbsric02_zeroPivot", "rocsparse_bsric0_zero_pivot", CONV_LIB_FUNC, API_SPARSE, 12, CUDA_DEPRECATED}},

// 12.2. Incomplete LU Factorization: level 0
// NOTE: rocsparse_(s|d|c|z)csrilu0 have different signatures
// NOTE: rocsparse_(s|d|c|z)csrilu0 have different signatures, thus they are also unsupported yet
{"cusparseScsrilu0", {"hipsparseScsrilu0", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsrilu0", {"hipsparseDcsrilu0", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseCcsrilu0", {"hipsparseCcsrilu0", "", CONV_LIB_FUNC, API_SPARSE, 12, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -1441,6 +1444,7 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseDcsr2csru", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCcsr2csru", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseZcsr2csru", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseXbsric02_zeroPivot", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
};

const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
Expand Down Expand Up @@ -2231,6 +2235,8 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_cbsric0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_dbsric0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_sbsric0_buffer_size", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_bsric0_zero_pivot", {HIP_3080, HIP_0, HIP_0 }},
{"rocsparse_csrgemm_nnz", {HIP_2080, HIP_0, HIP_0 }},
};

const std::map<unsigned int, llvm::StringRef> CUDA_SPARSE_API_SECTION_MAP {
Expand Down
5 changes: 3 additions & 2 deletions src/CUDA2HIP_SPARSE_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_TYPE_NAME_MAP {
{"csric02Info", {"csric02Info", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},
{"csric02Info_t", {"csric02Info_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},

{"csrgemm2Info", {"csrgemm2Info", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED | CUDA_REMOVED}},
{"csrgemm2Info_t", {"csrgemm2Info_t", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED | CUDA_REMOVED}},
{"csrgemm2Info", {"csrgemm2Info", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_REMOVED}},
{"csrgemm2Info_t", {"csrgemm2Info_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4, CUDA_REMOVED}},

{"cusparseColorInfo", {"hipsparseColorInfo", "_rocsparse_color_info", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseColorInfo_t", {"hipsparseColorInfo_t", "rocsparse_color_info", CONV_TYPE, API_SPARSE, 4, CUDA_DEPRECATED}},
Expand Down Expand Up @@ -433,6 +433,7 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_TYPE_NAME_VER_MAP {
{"csrilu02Info_t", {HIP_1092, HIP_0, HIP_0 }},
{"bsrilu02Info", {HIP_3090, HIP_0, HIP_0 }},
{"bsrilu02Info_t", {HIP_3090, HIP_0, HIP_0 }},
{"csrgemm2Info", {HIP_2080, HIP_0, HIP_0 }},
{"csrgemm2Info_t", {HIP_2080, HIP_0, HIP_0 }},
{"pruneInfo", {HIP_3090, HIP_0, HIP_0 }},
{"pruneInfo_t", {HIP_3090, HIP_0, HIP_0 }},
Expand Down
Loading

0 comments on commit 291878e

Please sign in to comment.