Skip to content

Commit

Permalink
[HIPIFY][ROCm#674][rocSPARSE][feature] rocSPARSE support - Step 87 - …
Browse files Browse the repository at this point in the history
…functions (Bsrsv2, Bsrsm2)

+ Added partial support for `rocsparse_create_mat_info` and `rocsparse_destroy_mat_info`
+ Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jan 4, 2024
1 parent 072c344 commit 677ffcd
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 16 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -2344,6 +2344,8 @@ sub rocSubstitutions {
subst("cusparseCopyMatDescr", "rocsparse_copy_mat_descr", "library");
subst("cusparseCreate", "rocsparse_create_handle", "library");
subst("cusparseCreateBlockedEll", "rocsparse_create_bell_descr", "library");
subst("cusparseCreateBsrsm2Info", "rocsparse_create_mat_info", "library");
subst("cusparseCreateBsrsv2Info", "rocsparse_create_mat_info", "library");
subst("cusparseCreateColorInfo", "rocsparse_create_color_info", "library");
subst("cusparseCreateConstBlockedEll", "rocsparse_create_const_bell_descr", "library");
subst("cusparseCreateConstCoo", "rocsparse_create_const_coo_descr", "library");
Expand Down Expand Up @@ -2418,6 +2420,8 @@ sub rocSubstitutions {
subst("cusparseDdense2csr", "rocsparse_ddense2csr", "library");
subst("cusparseDdoti", "rocsparse_ddoti", "library");
subst("cusparseDestroy", "rocsparse_destroy_handle", "library");
subst("cusparseDestroyBsrsm2Info", "rocsparse_destroy_mat_info", "library");
subst("cusparseDestroyBsrsv2Info", "rocsparse_destroy_mat_info", "library");
subst("cusparseDestroyColorInfo", "rocsparse_destroy_color_info", "library");
subst("cusparseDestroyCsric02Info", "rocsparse_destroy_mat_info", "library");
subst("cusparseDestroyCsrilu02Info", "rocsparse_destroy_mat_info", "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 @@ -223,8 +223,8 @@
|`cusparseCopyMatDescr`|8.0| | |12.0|`hipsparseCopyMatDescr`|1.9.2| | | | |`rocsparse_copy_mat_descr`|1.9.0| | | | |
|`cusparseCreateBsric02Info`| |12.2| | |`hipsparseCreateBsric02Info`|3.8.0| | | | | | | | | | |
|`cusparseCreateBsrilu02Info`| |12.2| | |`hipsparseCreateBsrilu02Info`|3.9.0| | | | | | | | | | |
|`cusparseCreateBsrsm2Info`| |12.2| | |`hipsparseCreateBsrsm2Info`|4.5.0| | | | | | | | | | |
|`cusparseCreateBsrsv2Info`| |12.2| | |`hipsparseCreateBsrsv2Info`|3.6.0| | | | | | | | | | |
|`cusparseCreateBsrsm2Info`| |12.2| | |`hipsparseCreateBsrsm2Info`|4.5.0| | | | |`rocsparse_create_mat_info`|1.9.0| | | | |
|`cusparseCreateBsrsv2Info`| |12.2| | |`hipsparseCreateBsrsv2Info`|3.6.0| | | | |`rocsparse_create_mat_info`|1.9.0| | | | |
|`cusparseCreateColorInfo`| |12.2| | |`hipsparseCreateColorInfo`|4.5.0| | | | |`rocsparse_create_color_info`|4.5.0| | | | |
|`cusparseCreateCsrgemm2Info`| |11.0| |12.0|`hipsparseCreateCsrgemm2Info`|2.8.0| | | | | | | | | | |
|`cusparseCreateCsric02Info`| |12.2| | |`hipsparseCreateCsric02Info`|3.1.0| | | | |`rocsparse_create_mat_info`|1.9.0| | | | |
Expand All @@ -237,8 +237,8 @@
|`cusparseCreateSolveAnalysisInfo`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseDestroyBsric02Info`| |12.2| | |`hipsparseDestroyBsric02Info`|3.8.0| | | | | | | | | | |
|`cusparseDestroyBsrilu02Info`| |12.2| | |`hipsparseDestroyBsrilu02Info`|3.9.0| | | | | | | | | | |
|`cusparseDestroyBsrsm2Info`| |12.2| | |`hipsparseDestroyBsrsm2Info`|4.5.0| | | | | | | | | | |
|`cusparseDestroyBsrsv2Info`| |12.2| | |`hipsparseDestroyBsrsv2Info`|3.6.0| | | | | | | | | | |
|`cusparseDestroyBsrsm2Info`| |12.2| | |`hipsparseDestroyBsrsm2Info`|4.5.0| | | | |`rocsparse_destroy_mat_info`|1.9.0| | | | |
|`cusparseDestroyBsrsv2Info`| |12.2| | |`hipsparseDestroyBsrsv2Info`|3.6.0| | | | |`rocsparse_destroy_mat_info`|1.9.0| | | | |
|`cusparseDestroyColorInfo`| |12.2| | |`hipsparseDestroyColorInfo`|4.5.0| | | | |`rocsparse_destroy_color_info`|4.5.0| | | | |
|`cusparseDestroyCsrgemm2Info`| |11.0| |12.0|`hipsparseDestroyCsrgemm2Info`|2.8.0| | | | | | | | | | |
|`cusparseDestroyCsric02Info`| |12.2| | |`hipsparseDestroyCsric02Info`|3.1.0| | | | |`rocsparse_destroy_mat_info`|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 @@ -223,8 +223,8 @@
|`cusparseCopyMatDescr`|8.0| | |12.0|`rocsparse_copy_mat_descr`|1.9.0| | | | |
|`cusparseCreateBsric02Info`| |12.2| | | | | | | | |
|`cusparseCreateBsrilu02Info`| |12.2| | | | | | | | |
|`cusparseCreateBsrsm2Info`| |12.2| | | | | | | | |
|`cusparseCreateBsrsv2Info`| |12.2| | | | | | | | |
|`cusparseCreateBsrsm2Info`| |12.2| | |`rocsparse_create_mat_info`|1.9.0| | | | |
|`cusparseCreateBsrsv2Info`| |12.2| | |`rocsparse_create_mat_info`|1.9.0| | | | |
|`cusparseCreateColorInfo`| |12.2| | |`rocsparse_create_color_info`|4.5.0| | | | |
|`cusparseCreateCsrgemm2Info`| |11.0| |12.0| | | | | | |
|`cusparseCreateCsric02Info`| |12.2| | |`rocsparse_create_mat_info`|1.9.0| | | | |
Expand All @@ -237,8 +237,8 @@
|`cusparseCreateSolveAnalysisInfo`| |10.2| |11.0| | | | | | |
|`cusparseDestroyBsric02Info`| |12.2| | | | | | | | |
|`cusparseDestroyBsrilu02Info`| |12.2| | | | | | | | |
|`cusparseDestroyBsrsm2Info`| |12.2| | | | | | | | |
|`cusparseDestroyBsrsv2Info`| |12.2| | | | | | | | |
|`cusparseDestroyBsrsm2Info`| |12.2| | |`rocsparse_destroy_mat_info`|1.9.0| | | | |
|`cusparseDestroyBsrsv2Info`| |12.2| | |`rocsparse_destroy_mat_info`|1.9.0| | | | |
|`cusparseDestroyColorInfo`| |12.2| | |`rocsparse_destroy_color_info`|4.5.0| | | | |
|`cusparseDestroyCsrgemm2Info`| |11.0| |12.0| | | | | | |
|`cusparseDestroyCsric02Info`| |12.2| | |`rocsparse_destroy_mat_info`|1.9.0| | | | |
Expand Down
16 changes: 8 additions & 8 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseDestroyCsric02Info", {"hipsparseDestroyCsric02Info", "rocsparse_destroy_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseCreateCsrilu02Info", {"hipsparseCreateCsrilu02Info", "rocsparse_create_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseDestroyCsrilu02Info", {"hipsparseDestroyCsrilu02Info", "rocsparse_destroy_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseCreateBsrsv2Info", {"hipsparseCreateBsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDestroyBsrsv2Info", {"hipsparseDestroyBsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCreateBsrsm2Info", {"hipsparseCreateBsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDestroyBsrsm2Info", {"hipsparseDestroyBsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCreateBsrsv2Info", {"hipsparseCreateBsrsv2Info", "rocsparse_create_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseDestroyBsrsv2Info", {"hipsparseDestroyBsrsv2Info", "rocsparse_destroy_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseCreateBsrsm2Info", {"hipsparseCreateBsrsm2Info", "rocsparse_create_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseDestroyBsrsm2Info", {"hipsparseDestroyBsrsm2Info", "rocsparse_destroy_mat_info", CONV_LIB_FUNC, API_SPARSE, 7, CUDA_DEPRECATED}},
{"cusparseCreateBsric02Info", {"hipsparseCreateBsric02Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDestroyBsric02Info", {"hipsparseDestroyBsric02Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCreateBsrilu02Info", {"hipsparseCreateBsrilu02Info", "", CONV_LIB_FUNC, API_SPARSE, 7, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
Expand Down Expand Up @@ -1314,10 +1314,10 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SPARSE_FUNCTION_VER_MAP {
{"cusparseDestroyCsrilu02Info", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCreateBsrilu02Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDestroyBsrilu02Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCreateBsrsv2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDestroyBsrsv2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCreateBsrsm2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDestroyBsrsm2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCreateBsrsv2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseDestroyBsrsv2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCreateBsrsm2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseDestroyBsrsm2Info", {CUDA_0, CUDA_122, CUDA_0 }}, // D: CUSPARSE_VERSION 12102
{"cusparseCreateCsru2csrInfo", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseDestroyCsru2csrInfo", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
{"cusparseCreateColorInfo", {CUDA_0, CUDA_122, CUDA_0 }}, // CUSPARSE_VERSION 12120
Expand Down
20 changes: 20 additions & 0 deletions tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,26 @@ int main() {
// CHECK: status_t = hipsparseDestroyCsrilu02Info(csrilu02_info);
status_t = cusparseDestroyCsrilu02Info(csrilu02_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseCreateBsrsv2Info(bsrsv2Info_t* info);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCreateBsrsv2Info(bsrsv2Info_t* info);
// CHECK: status_t = hipsparseCreateBsrsv2Info(&bsrsv2_info);
status_t = cusparseCreateBsrsv2Info(&bsrsv2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDestroyBsrsv2Info(bsrsv2Info_t info);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDestroyBsrsv2Info(bsrsv2Info_t info);
// CHECK: status_t = hipsparseDestroyBsrsv2Info(bsrsv2_info);
status_t = cusparseDestroyBsrsv2Info(bsrsv2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseCreateBsrsm2Info(bsrsm2Info_t* info);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCreateBsrsm2Info(bsrsm2Info_t* info);
// CHECK: status_t = hipsparseCreateBsrsm2Info(&bsrsm2_info);
status_t = cusparseCreateBsrsm2Info(&bsrsm2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDestroyBsrsm2Info(bsrsm2Info_t info);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDestroyBsrsm2Info(bsrsm2Info_t info);
// CHECK: status_t = hipsparseDestroyBsrsm2Info(bsrsm2_info);
status_t = cusparseDestroyBsrsm2Info(bsrsm2_info);

#if CUDA_VERSION >= 7050
// CUDA: cusparseStatus_t CUSPARSEAPI cusparseZgemvi(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, const cuDoubleComplex* alpha, const cuDoubleComplex* A, int lda, int nnz, const cuDoubleComplex* xVal, const int* xInd, const cuDoubleComplex* beta, cuDoubleComplex* y, cusparseIndexBase_t idxBase, void* pBuffer);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZgemvi(hipsparseHandle_t handle, hipsparseOperation_t transA, int m, int n, const hipDoubleComplex* alpha, const hipDoubleComplex* A, int lda, int nnz, const hipDoubleComplex* x, const int* xInd, const hipDoubleComplex* beta, hipDoubleComplex* y, hipsparseIndexBase_t idxBase, void* pBuffer);
Expand Down
20 changes: 20 additions & 0 deletions tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,26 @@ int main() {
// CHECK: status_t = rocsparse_destroy_mat_info(csrilu02_info);
status_t = cusparseDestroyCsrilu02Info(csrilu02_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseCreateBsrsv2Info(bsrsv2Info_t* info);
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_create_mat_info(rocsparse_mat_info* info);
// CHECK: status_t = rocsparse_create_mat_info(&bsrsv2_info);
status_t = cusparseCreateBsrsv2Info(&bsrsv2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDestroyBsrsv2Info(bsrsv2Info_t info);
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_destroy_mat_info(rocsparse_mat_info info);
// CHECK: status_t = rocsparse_destroy_mat_info(bsrsv2_info);
status_t = cusparseDestroyBsrsv2Info(bsrsv2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseCreateBsrsm2Info(bsrsm2Info_t* info);
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_create_mat_info(rocsparse_mat_info* info);
// CHECK: status_t = rocsparse_create_mat_info(&bsrsm2_info);
status_t = cusparseCreateBsrsm2Info(&bsrsm2_info);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDestroyBsrsm2Info(bsrsm2Info_t info);
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_destroy_mat_info(rocsparse_mat_info info);
// CHECK: status_t = rocsparse_destroy_mat_info(bsrsm2_info);
status_t = cusparseDestroyBsrsm2Info(bsrsm2_info);

#if CUDA_VERSION >= 7050
// CUDA: cusparseStatus_t CUSPARSEAPI cusparseZgemvi(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, const cuDoubleComplex* alpha, const cuDoubleComplex* A, int lda, int nnz, const cuDoubleComplex* xVal, const int* xInd, const cuDoubleComplex* beta, cuDoubleComplex* y, cusparseIndexBase_t idxBase, void* pBuffer);
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_zgemvi(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int n, const rocsparse_double_complex* alpha, const rocsparse_double_complex* A, rocsparse_int lda, rocsparse_int nnz, const rocsparse_double_complex* x_val, const rocsparse_int* x_ind, const rocsparse_double_complex* beta, rocsparse_double_complex* y, rocsparse_index_base idx_base,void* temp_buffer);
Expand Down

0 comments on commit 677ffcd

Please sign in to comment.