Skip to content

Commit

Permalink
[HIPIFY][ROCm#674][rocSPARSE][feature] rocSPARSE support - Step 20 - …
Browse files Browse the repository at this point in the history
…functions

+ [Fix] Revised `pruneInfo_t` in `hipSPARSE` and `rocSPARSE`
+ Updated synthetic tests and the regenerated hipify-perl and SPARSE docs
  • Loading branch information
emankov committed Jul 16, 2023
1 parent d6005f0 commit 399659d
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 18 deletions.
6 changes: 5 additions & 1 deletion bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,7 @@ sub rocSubstitutions {
subst("cusparseDnVecGet", "rocsparse_dnvec_get", "library");
subst("cusparseDnVecGetValues", "rocsparse_dnvec_get_values", "library");
subst("cusparseDnVecSetValues", "rocsparse_dnvec_set_values", "library");
subst("cusparseDpruneCsr2csrByPercentage", "rocsparse_dprune_csr2csr_by_percentage", "library");
subst("cusparseGather", "rocsparse_gather", "library");
subst("cusparseGetMatDiagType", "rocsparse_get_mat_diag_type", "library");
subst("cusparseGetMatFillMode", "rocsparse_get_mat_fill_mode", "library");
Expand Down Expand Up @@ -1542,6 +1543,7 @@ sub rocSubstitutions {
subst("cusparseSpVecGetIndexBase", "rocsparse_spvec_get_index_base", "library");
subst("cusparseSpVecGetValues", "rocsparse_spvec_get_values", "library");
subst("cusparseSpVecSetValues", "rocsparse_spvec_set_values", "library");
subst("cusparseXcoo2csr", "rocsparse_coo2csr", "library");
subst("cusparseXcoosortByColumn", "rocsparse_coosort_by_column", "library");
subst("cusparseXcoosortByRow", "rocsparse_coosort_by_row", "library");
subst("cusparseXcoosort_bufferSizeExt", "rocsparse_coosort_buffer_size", "library");
Expand Down Expand Up @@ -1650,6 +1652,8 @@ sub rocSubstitutions {
subst("cusparseSpVecDescr_t", "rocsparse_spvec_descr", "type");
subst("cusparseSparseToDenseAlg_t", "rocsparse_sparse_to_dense_alg", "type");
subst("cusparseStatus_t", "rocsparse_status", "type");
subst("pruneInfo", "_rocsparse_mat_info", "type");
subst("pruneInfo_t", "rocsparse_mat_info", "type");
subst("CUBLAS_ATOMICS_ALLOWED", "rocblas_atomics_allowed", "numeric_literal");
subst("CUBLAS_ATOMICS_NOT_ALLOWED", "rocblas_atomics_not_allowed", "numeric_literal");
subst("CUBLAS_DIAG_NON_UNIT", "rocblas_diagonal_non_unit", "numeric_literal");
Expand Down Expand Up @@ -4065,6 +4069,7 @@ sub simpleSubstitutions {
subst("cusparseStatus_t", "hipsparseStatus_t", "type");
subst("nvrtcProgram", "hiprtcProgram", "type");
subst("nvrtcResult", "hiprtcResult", "type");
subst("pruneInfo", "pruneInfo", "type");
subst("pruneInfo_t", "pruneInfo_t", "type");
subst("surfaceReference", "surfaceReference", "type");
subst("texture", "texture", "type");
Expand Down Expand Up @@ -6228,7 +6233,6 @@ sub warnUnsupportedFunctions {
my $line_num = shift;
my $k = 0;
foreach $func (
"pruneInfo",
"nvrtcGetSupportedArchs",
"nvrtcGetOptiXIRSize",
"nvrtcGetOptiXIR",
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/CUSPARSE_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
|`cusparseSpVecDescr_t`|10.2| | |`hipsparseSpVecDescr_t`|4.1.0| | | |
|`cusparseSparseToDenseAlg_t`|11.1| | |`hipsparseSparseToDenseAlg_t`|4.2.0| | | |
|`cusparseStatus_t`| | | |`hipsparseStatus_t`|1.9.2| | | |
|`pruneInfo`|9.0| | | | | | | |
|`pruneInfo`|9.0| | |`pruneInfo`|3.9.0| | | |
|`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | |

## **5. CUSPARSE Management Function Reference**
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 @@ -183,8 +183,8 @@
|`cusparseSpVecDescr_t`|10.2| | |`hipsparseSpVecDescr_t`|4.1.0| | | |`rocsparse_spvec_descr`|4.1.0| | | |
|`cusparseSparseToDenseAlg_t`|11.1| | |`hipsparseSparseToDenseAlg_t`|4.2.0| | | |`rocsparse_sparse_to_dense_alg`|4.1.0| | | |
|`cusparseStatus_t`| | | |`hipsparseStatus_t`|1.9.2| | | |`rocsparse_status`|1.9.0| | | |
|`pruneInfo`|9.0| | | | | | | | | | | | |
|`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | | | | | | |
|`pruneInfo`|9.0| | |`pruneInfo`|3.9.0| | | |`_rocsparse_mat_info`|1.9.0| | | |
|`pruneInfo_t`|9.0| | |`pruneInfo_t`|3.9.0| | | |`rocsparse_mat_info`|1.9.0| | | |

## **5. CUSPARSE Management Function Reference**

Expand Down Expand Up @@ -680,7 +680,7 @@
|`cusparseDnnz`| | | |`hipsparseDnnz`|3.2.0| | | | | | | | |
|`cusparseDnnz_compress`|8.0| | |`hipsparseDnnz_compress`|3.5.0| | | | | | | | |
|`cusparseDpruneCsr2csr`|9.0| | |`hipsparseDpruneCsr2csr`|3.9.0| | | | | | | | |
|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`hipsparseDpruneCsr2csrByPercentage`|3.9.0| | | | | | | | |
|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`hipsparseDpruneCsr2csrByPercentage`|3.9.0| | | |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | |
|`cusparseDpruneCsr2csrByPercentage_bufferSizeExt`|9.0| | |`hipsparseDpruneCsr2csrByPercentage_bufferSizeExt`|3.9.0| | | | | | | | |
|`cusparseDpruneCsr2csrNnz`|9.0| | |`hipsparseDpruneCsr2csrNnz`|3.9.0| | | | | | | | |
|`cusparseDpruneCsr2csrNnzByPercentage`|9.0| | |`hipsparseDpruneCsr2csrNnzByPercentage`|3.9.0| | | | | | | | |
Expand Down Expand Up @@ -744,7 +744,7 @@
|`cusparseSpruneDense2csrNnz`|9.0| | |`hipsparseSpruneDense2csrNnz`|3.9.0| | | | | | | | |
|`cusparseSpruneDense2csrNnzByPercentage`|9.0| | |`hipsparseSpruneDense2csrNnzByPercentage`|3.9.0| | | | | | | | |
|`cusparseSpruneDense2csr_bufferSizeExt`|9.0| | |`hipsparseSpruneDense2csr_bufferSizeExt`|3.9.0| | | | | | | | |
|`cusparseXcoo2csr`| | | |`hipsparseXcoo2csr`|1.9.2| | | | | | | | |
|`cusparseXcoo2csr`| | | |`hipsparseXcoo2csr`|1.9.2| | | |`rocsparse_coo2csr`|1.9.0| | | |
|`cusparseXcoosortByColumn`| | | |`hipsparseXcoosortByColumn`|1.9.2| | | |`rocsparse_coosort_by_column`|1.9.0| | | |
|`cusparseXcoosortByRow`| | | |`hipsparseXcoosortByRow`|1.9.2| | | |`rocsparse_coosort_by_row`|1.9.0| | | |
|`cusparseXcoosort_bufferSizeExt`| | | |`hipsparseXcoosort_bufferSizeExt`|1.9.2| | | |`rocsparse_coosort_buffer_size`|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 @@ -183,8 +183,8 @@
|`cusparseSpVecDescr_t`|10.2| | |`rocsparse_spvec_descr`|4.1.0| | | |
|`cusparseSparseToDenseAlg_t`|11.1| | |`rocsparse_sparse_to_dense_alg`|4.1.0| | | |
|`cusparseStatus_t`| | | |`rocsparse_status`|1.9.0| | | |
|`pruneInfo`|9.0| | | | | | | |
|`pruneInfo_t`|9.0| | | | | | | |
|`pruneInfo`|9.0| | |`_rocsparse_mat_info`|1.9.0| | | |
|`pruneInfo_t`|9.0| | |`rocsparse_mat_info`|1.9.0| | | |

## **5. CUSPARSE Management Function Reference**

Expand Down Expand Up @@ -680,7 +680,7 @@
|`cusparseDnnz`| | | | | | | | |
|`cusparseDnnz_compress`|8.0| | | | | | | |
|`cusparseDpruneCsr2csr`|9.0| | | | | | | |
|`cusparseDpruneCsr2csrByPercentage`|9.0| | | | | | | |
|`cusparseDpruneCsr2csrByPercentage`|9.0| | |`rocsparse_dprune_csr2csr_by_percentage`|3.9.0| | | |
|`cusparseDpruneCsr2csrByPercentage_bufferSizeExt`|9.0| | | | | | | |
|`cusparseDpruneCsr2csrNnz`|9.0| | | | | | | |
|`cusparseDpruneCsr2csrNnzByPercentage`|9.0| | | | | | | |
Expand Down Expand Up @@ -744,7 +744,7 @@
|`cusparseSpruneDense2csrNnz`|9.0| | | | | | | |
|`cusparseSpruneDense2csrNnzByPercentage`|9.0| | | | | | | |
|`cusparseSpruneDense2csr_bufferSizeExt`|9.0| | | | | | | |
|`cusparseXcoo2csr`| | | | | | | | |
|`cusparseXcoo2csr`| | | |`rocsparse_coo2csr`|1.9.0| | | |
|`cusparseXcoosortByColumn`| | | |`rocsparse_coosort_by_column`|1.9.0| | | |
|`cusparseXcoosortByRow`| | | |`rocsparse_coosort_by_row`|1.9.0| | | |
|`cusparseXcoosort_bufferSizeExt`| | | |`rocsparse_coosort_buffer_size`|1.9.0| | | |
Expand Down
18 changes: 12 additions & 6 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseCcsr2gebsr", {"hipsparseCcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},
{"cusparseZcsr2gebsr", {"hipsparseZcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},

{"cusparseXcoo2csr", {"hipsparseXcoo2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},
{"cusparseXcoo2csr", {"hipsparseXcoo2csr", "rocsparse_coo2csr", CONV_LIB_FUNC, API_SPARSE, 14}},

{"cusparseScsc2dense", {"hipsparseScsc2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDcsc2dense", {"hipsparseDcsc2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -615,10 +615,14 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseChyb2csc", {"hipsparseChyb2csc", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZhyb2csc", {"hipsparseZhyb2csc", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseShyb2csr", {"hipsparseShyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDhyb2csr", {"hipsparseDhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseChyb2csr", {"hipsparseChyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseZhyb2csr", {"hipsparseZhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED |CUDA_DEPRECATED | CUDA_REMOVED}},
// NOTE: rocsparse_shyb2csr has one additioanl attribute void* temp_buffer; see hipsparseShyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_shyb2csr
{"cusparseShyb2csr", {"hipsparseShyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
// NOTE: rocsparse_dhyb2csr has one additioanl attribute void* temp_buffer; see hipsparseDhyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_dhyb2csr
{"cusparseDhyb2csr", {"hipsparseDhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
// NOTE: rocsparse_chyb2csr has one additioanl attribute void* temp_buffer; see hipsparseChyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_chyb2csr
{"cusparseChyb2csr", {"hipsparseChyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
// NOTE: rocsparse_zhyb2csr has one additioanl attribute void* temp_buffer; see hipsparseZhyb2csr implementation, which wraps rocsparse_hyb2csr_buffer_size + rocsparse_zhyb2csr
{"cusparseZhyb2csr", {"hipsparseZhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

{"cusparseShyb2dense", {"hipsparseShyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
{"cusparseDhyb2dense", {"hipsparseDhyb2dense", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},
Expand Down Expand Up @@ -698,7 +702,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {

{"cusparseHpruneCsr2csrByPercentage", {"hipsparseHpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED}},
{"cusparseSpruneCsr2csrByPercentage", {"hipsparseSpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},
{"cusparseDpruneCsr2csrByPercentage", {"hipsparseDpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},
{"cusparseDpruneCsr2csrByPercentage", {"hipsparseDpruneCsr2csrByPercentage", "rocsparse_dprune_csr2csr_by_percentage", CONV_LIB_FUNC, API_SPARSE, 14}},

{"cusparseHpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseHpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 14, UNSUPPORTED}},
{"cusparseSpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseSpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 14, ROC_UNSUPPORTED}},
Expand Down Expand Up @@ -1901,6 +1905,8 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_csrsort", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_csrsort_buffer_size", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_create_identity_permutation", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_coo2csr", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_dprune_csr2csr_by_percentage", {HIP_3090, HIP_0, HIP_0 }},
};

const std::map<unsigned int, llvm::StringRef> CUDA_SPARSE_API_SECTION_MAP {
Expand Down
7 changes: 5 additions & 2 deletions src/CUDA2HIP_SPARSE_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_TYPE_NAME_MAP {
{"cusparseColorInfo", {"hipsparseColorInfo", "_rocsparse_color_info", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED}},
{"cusparseColorInfo_t", {"hipsparseColorInfo_t", "rocsparse_color_info", CONV_TYPE, API_SPARSE, 4}},

{"pruneInfo", {"pruneInfo", "", CONV_TYPE, API_SPARSE, 4, UNSUPPORTED}},
{"pruneInfo_t", {"pruneInfo_t", "", CONV_TYPE, API_SPARSE, 4, ROC_UNSUPPORTED}},
{"pruneInfo", {"pruneInfo", "_rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4}},
{"pruneInfo_t", {"pruneInfo_t", "rocsparse_mat_info", CONV_TYPE, API_SPARSE, 4}},

{"cusparseSpMatDescr", {"hipsparseSpMatDescr", "_rocsparse_spmat_descr", CONV_TYPE, API_SPARSE, 4, HIP_UNSUPPORTED}},
{"cusparseSpMatDescr_t", {"hipsparseSpMatDescr_t", "rocsparse_spmat_descr", CONV_TYPE, API_SPARSE, 4}},
Expand Down Expand Up @@ -401,6 +401,7 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_TYPE_NAME_VER_MAP {
{"csrilu02Info_t", {HIP_1092, HIP_0, HIP_0 }},
{"bsrilu02Info_t", {HIP_3090, 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 }},
{"hipsparseAction_t", {HIP_1092, HIP_0, HIP_0 }},
{"HIPSPARSE_ACTION_SYMBOLIC", {HIP_1092, HIP_0, HIP_0 }},
Expand Down Expand Up @@ -631,4 +632,6 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_TYPE_NAME_VER_MAP {
{"rocsparse_dense_to_sparse_alg_default", {HIP_4010, HIP_0, HIP_0 }},
{"rocsparse_spgemm_alg", {HIP_4010, HIP_0, HIP_0 }},
{"rocsparse_spgemm_alg_default", {HIP_4010, HIP_0, HIP_0 }},
{"_rocsparse_mat_info", {HIP_1090, HIP_0, HIP_0 }},
{"rocsparse_mat_info", {HIP_1090, HIP_0, HIP_0 }},
};
Loading

0 comments on commit 399659d

Please sign in to comment.