Skip to content

Commit

Permalink
Merge pull request ROCm#1237 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][ROCm#674][rocSPARSE][feature] rocSPARSE support - Step 72 - functions `rocsparse_(s|d|c|z)bsrmv`
  • Loading branch information
emankov authored Dec 27, 2023
2 parents 5349ea3 + 32637b4 commit 8d80343
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 12 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,7 @@ sub rocSubstitutions {
subst("cusparseCbsrilu02_analysis", "rocsparse_cbsrilu0_analysis", "library");
subst("cusparseCbsrilu02_numericBoost", "rocsparse_dcbsrilu0_numeric_boost", "library");
subst("cusparseCbsrmm", "rocsparse_cbsrmm", "library");
subst("cusparseCbsrmv", "rocsparse_cbsrmv", "library");
subst("cusparseCbsrsm2_analysis", "rocsparse_cbsrsm_analysis", "library");
subst("cusparseCbsrsm2_bufferSize", "rocsparse_cbsrsm_buffer_size", "library");
subst("cusparseCbsrsm2_solve", "rocsparse_cbsrsm_solve", "library");
Expand Down Expand Up @@ -2350,6 +2351,7 @@ sub rocSubstitutions {
subst("cusparseDbsrilu02_analysis", "rocsparse_dbsrilu0_analysis", "library");
subst("cusparseDbsrilu02_numericBoost", "rocsparse_dbsrilu0_numeric_boost", "library");
subst("cusparseDbsrmm", "rocsparse_dbsrmm", "library");
subst("cusparseDbsrmv", "rocsparse_dbsrmv", "library");
subst("cusparseDbsrsm2_analysis", "rocsparse_dbsrsm_analysis", "library");
subst("cusparseDbsrsm2_bufferSize", "rocsparse_dbsrsm_buffer_size", "library");
subst("cusparseDbsrsm2_solve", "rocsparse_dbsrsm_solve", "library");
Expand Down Expand Up @@ -2453,6 +2455,7 @@ sub rocSubstitutions {
subst("cusparseSbsrilu02_analysis", "rocsparse_sbsrilu0_analysis", "library");
subst("cusparseSbsrilu02_numericBoost", "rocsparse_dsbsrilu0_numeric_boost", "library");
subst("cusparseSbsrmm", "rocsparse_sbsrmm", "library");
subst("cusparseSbsrmv", "rocsparse_sbsrmv", "library");
subst("cusparseSbsrsm2_analysis", "rocsparse_sbsrsm_analysis", "library");
subst("cusparseSbsrsm2_bufferSize", "rocsparse_sbsrsm_buffer_size", "library");
subst("cusparseSbsrsm2_solve", "rocsparse_sbsrsm_solve", "library");
Expand Down Expand Up @@ -2571,6 +2574,7 @@ sub rocSubstitutions {
subst("cusparseZbsrilu02_analysis", "rocsparse_zbsrilu0_analysis", "library");
subst("cusparseZbsrilu02_numericBoost", "rocsparse_zbsrilu0_numeric_boost", "library");
subst("cusparseZbsrmm", "rocsparse_zbsrmm", "library");
subst("cusparseZbsrmv", "rocsparse_zbsrmv", "library");
subst("cusparseZbsrsm2_analysis", "rocsparse_zbsrsm_analysis", "library");
subst("cusparseZbsrsm2_bufferSize", "rocsparse_zbsrsm_buffer_size", "library");
subst("cusparseZbsrsm2_solve", "rocsparse_zbsrsm_solve", "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 @@ -292,7 +292,7 @@

|**CUDA**|**A**|**D**|**C**|**R**|**HIP**|**A**|**D**|**C**|**R**|**E**|**ROC**|**A**|**D**|**C**|**R**|**E**|
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmv`| | | | |`hipsparseCbsrmv`|3.5.0| | | | | | | | | | |
|`cusparseCbsrmv`| | | | |`hipsparseCbsrmv`|3.5.0| | | | |`rocsparse_cbsrmv`|3.5.0|5.4.0| | | |
|`cusparseCbsrsv2_analysis`| |12.2| | |`hipsparseCbsrsv2_analysis`|3.6.0| | | | |`rocsparse_cbsrsv_analysis`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | |`hipsparseCbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseCbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_cbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -315,7 +315,7 @@
|`cusparseCsrmvEx_bufferSize`|8.0|11.2| |12.0| | | | | | | | | | | | |
|`cusparseCsrsv_analysisEx`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseCsrsv_solveEx`|8.0|10.2| |11.0| | | | | | | | | | | | |
|`cusparseDbsrmv`| | | | |`hipsparseDbsrmv`|3.5.0| | | | | | | | | | |
|`cusparseDbsrmv`| | | | |`hipsparseDbsrmv`|3.5.0| | | | |`rocsparse_dbsrmv`|3.5.0|5.4.0| | | |
|`cusparseDbsrsv2_analysis`| |12.2| | |`hipsparseDbsrsv2_analysis`|3.6.0| | | | |`rocsparse_dbsrsv_analysis`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | |`hipsparseDbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseDbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_dbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -334,7 +334,7 @@
|`cusparseDhybmv`| |10.2| |11.0|`hipsparseDhybmv`|1.9.2| | | | |`rocsparse_dhybmv`|1.9.0| | | | |
|`cusparseDhybsv_analysis`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseDhybsv_solve`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseSbsrmv`| | | | |`hipsparseSbsrmv`|3.5.0| | | | | | | | | | |
|`cusparseSbsrmv`| | | | |`hipsparseSbsrmv`|3.5.0| | | | |`rocsparse_sbsrmv`|3.5.0|5.4.0| | | |
|`cusparseSbsrsv2_analysis`| |12.2| | |`hipsparseSbsrsv2_analysis`|3.6.0| | | | |`rocsparse_sbsrsv_analysis`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | |`hipsparseSbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseSbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_sbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -355,7 +355,7 @@
|`cusparseShybsv_solve`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseXbsrsv2_zeroPivot`| |12.2| | |`hipsparseXbsrsv2_zeroPivot`|3.6.0| | | | |`rocsparse_bsrsv_zero_pivot`|3.6.0| | | | |
|`cusparseXcsrsv2_zeroPivot`| |11.3| |12.0|`hipsparseXcsrsv2_zeroPivot`|1.9.2| | | | |`rocsparse_csrsv_zero_pivot`|1.9.0| | | | |
|`cusparseZbsrmv`| | | | |`hipsparseZbsrmv`|3.5.0| | | | | | | | | | |
|`cusparseZbsrmv`| | | | |`hipsparseZbsrmv`|3.5.0| | | | |`rocsparse_zbsrmv`|3.5.0|5.4.0| | | |
|`cusparseZbsrsv2_analysis`| |12.2| | |`hipsparseZbsrsv2_analysis`|3.6.0| | | | |`rocsparse_zbsrsv_analysis`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | |`hipsparseZbsrsv2_bufferSize`|3.6.0| | | | | | | | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | |`hipsparseZbsrsv2_bufferSizeExt`|3.6.0| | | | |`rocsparse_zbsrsv_buffer_size`|3.6.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 @@ -292,7 +292,7 @@

|**CUDA**|**A**|**D**|**C**|**R**|**ROC**|**A**|**D**|**C**|**R**|**E**|
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmv`| | | | | | | | | | |
|`cusparseCbsrmv`| | | | |`rocsparse_cbsrmv`|3.5.0|5.4.0| | | |
|`cusparseCbsrsv2_analysis`| |12.2| | |`rocsparse_cbsrsv_analysis`|3.6.0| | | | |
|`cusparseCbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseCbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_cbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -315,7 +315,7 @@
|`cusparseCsrmvEx_bufferSize`|8.0|11.2| |12.0| | | | | | |
|`cusparseCsrsv_analysisEx`|8.0|10.2| |11.0| | | | | | |
|`cusparseCsrsv_solveEx`|8.0|10.2| |11.0| | | | | | |
|`cusparseDbsrmv`| | | | | | | | | | |
|`cusparseDbsrmv`| | | | |`rocsparse_dbsrmv`|3.5.0|5.4.0| | | |
|`cusparseDbsrsv2_analysis`| |12.2| | |`rocsparse_dbsrsv_analysis`|3.6.0| | | | |
|`cusparseDbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseDbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_dbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -334,7 +334,7 @@
|`cusparseDhybmv`| |10.2| |11.0|`rocsparse_dhybmv`|1.9.0| | | | |
|`cusparseDhybsv_analysis`| |10.2| |11.0| | | | | | |
|`cusparseDhybsv_solve`| |10.2| |11.0| | | | | | |
|`cusparseSbsrmv`| | | | | | | | | | |
|`cusparseSbsrmv`| | | | |`rocsparse_sbsrmv`|3.5.0|5.4.0| | | |
|`cusparseSbsrsv2_analysis`| |12.2| | |`rocsparse_sbsrsv_analysis`|3.6.0| | | | |
|`cusparseSbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseSbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_sbsrsv_buffer_size`|3.6.0| | | | |
Expand All @@ -355,7 +355,7 @@
|`cusparseShybsv_solve`| |10.2| |11.0| | | | | | |
|`cusparseXbsrsv2_zeroPivot`| |12.2| | |`rocsparse_bsrsv_zero_pivot`|3.6.0| | | | |
|`cusparseXcsrsv2_zeroPivot`| |11.3| |12.0|`rocsparse_csrsv_zero_pivot`|1.9.0| | | | |
|`cusparseZbsrmv`| | | | | | | | | | |
|`cusparseZbsrmv`| | | | |`rocsparse_zbsrmv`|3.5.0|5.4.0| | | |
|`cusparseZbsrsv2_analysis`| |12.2| | |`rocsparse_zbsrsv_analysis`|3.6.0| | | | |
|`cusparseZbsrsv2_bufferSize`| |12.2| | | | | | | | |
|`cusparseZbsrsv2_bufferSizeExt`| |12.2| | |`rocsparse_zbsrsv_buffer_size`|3.6.0| | | | |
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 @@ -116,10 +116,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseZsctr", {"hipsparseZsctr", "", CONV_LIB_FUNC, API_SPARSE, 8, ROC_UNSUPPORTED | CUDA_DEPRECATED | CUDA_REMOVED}},

// 9. cuSPARSE Level 2 Function Reference
{"cusparseSbsrmv", {"hipsparseSbsrmv", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED}},
{"cusparseDbsrmv", {"hipsparseDbsrmv", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED}},
{"cusparseCbsrmv", {"hipsparseCbsrmv", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED}},
{"cusparseZbsrmv", {"hipsparseZbsrmv", "", CONV_LIB_FUNC, API_SPARSE, 9, ROC_UNSUPPORTED}},
{"cusparseSbsrmv", {"hipsparseSbsrmv", "rocsparse_sbsrmv", CONV_LIB_FUNC, API_SPARSE, 9, ROC_DEPRECATED}},
{"cusparseDbsrmv", {"hipsparseDbsrmv", "rocsparse_dbsrmv", CONV_LIB_FUNC, API_SPARSE, 9, ROC_DEPRECATED}},
{"cusparseCbsrmv", {"hipsparseCbsrmv", "rocsparse_cbsrmv", CONV_LIB_FUNC, API_SPARSE, 9, ROC_DEPRECATED}},
{"cusparseZbsrmv", {"hipsparseZbsrmv", "rocsparse_zbsrmv", CONV_LIB_FUNC, API_SPARSE, 9, ROC_DEPRECATED}},

{"cusparseSbsrxmv", {"hipsparseSbsrxmv", "rocsparse_sbsrxmv", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
{"cusparseDbsrxmv", {"hipsparseDbsrxmv", "rocsparse_dbsrxmv", CONV_LIB_FUNC, API_SPARSE, 9, CUDA_DEPRECATED}},
Expand Down Expand Up @@ -2359,6 +2359,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_cbsrxmv", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_dbsrxmv", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_sbsrxmv", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_zbsrmv", {HIP_3050, HIP_5040, HIP_0 }},
{"rocsparse_cbsrmv", {HIP_3050, HIP_5040, HIP_0 }},
{"rocsparse_dbsrmv", {HIP_3050, HIP_5040, HIP_0 }},
{"rocsparse_sbsrmv", {HIP_3050, HIP_5040, HIP_0 }},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP {
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 @@ -1168,6 +1168,26 @@ int main() {
// CHECK: status_t = hipsparseSbsrxmv(handle_t, direction_t, opA, sizeOfMask, mb, nb, nnzb, &fAlpha, matDescr_t, &fbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, &bsrEndPtrA, &bsrColIndA, blockDim, &fX, &fBeta, &fY);
status_t = cusparseSbsrxmv(handle_t, direction_t, opA, sizeOfMask, mb, nb, nnzb, &fAlpha, matDescr_t, &fbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, &bsrEndPtrA, &bsrColIndA, blockDim, &fX, &fBeta, &fY);

// CUDA: cusparseStatus_t CUSPARSEAPI cusparseZbsrmv(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, int mb, int nb, int nnzb, const cuDoubleComplex* alpha, const cusparseMatDescr_t descrA, const cuDoubleComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const cuDoubleComplex* x, const cuDoubleComplex* beta, cuDoubleComplex* y);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZbsrmv(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, int mb, int nb, int nnzb, const hipDoubleComplex* alpha, const hipsparseMatDescr_t descrA, const hipDoubleComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const hipDoubleComplex* x, const hipDoubleComplex* beta, hipDoubleComplex* y);
// CHECK: status_t = hipsparseZbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &dcomplexAlpha, matDescr_t, &dComplexbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &dcomplexX, &dcomplexBeta, &dcomplexY);
status_t = cusparseZbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &dcomplexAlpha, matDescr_t, &dComplexbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &dcomplexX, &dcomplexBeta, &dcomplexY);

// CUDA: cusparseStatus_t CUSPARSEAPI cusparseCbsrmv(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, int mb, int nb, int nnzb, const cuComplex* alpha, const cusparseMatDescr_t descrA, const cuComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const cuComplex* x, const cuComplex* beta, cuComplex* y);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCbsrmv(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, int mb, int nb, int nnzb, const hipComplex* alpha, const hipsparseMatDescr_t descrA, const hipComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const hipComplex* x, const hipComplex* beta, hipComplex* y);
// CHECK: status_t = hipsparseCbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &complexAlpha, matDescr_t, &complexbsrValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &complexX, &complexBeta, &complexY);
status_t = cusparseCbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &complexAlpha, matDescr_t, &complexbsrValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &complexX, &complexBeta, &complexY);

// CUDA: cusparseStatus_t CUSPARSEAPI cusparseDbsrmv(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, int mb, int nb, int nnzb, const double* alpha, const cusparseMatDescr_t descrA, const double* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const double* x, const double* beta, double* y);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDbsrmv(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, int mb, int nb, int nnzb, const double* alpha, const hipsparseMatDescr_t descrA, const double* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const double* x, const double* beta, double* y);
// CHECK: status_t = hipsparseDbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &dAlpha, matDescr_t, &dbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &dX, &dBeta, &dY);
status_t = cusparseDbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &dAlpha, matDescr_t, &dbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &dX, &dBeta, &dY);

// CUDA: cusparseStatus_t CUSPARSEAPI cusparseSbsrmv(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, int mb, int nb, int nnzb, const float* alpha, const cusparseMatDescr_t descrA, const float* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const float* x, const float* beta, float* y);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSbsrmv(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, int mb, int nb, int nnzb, const float* alpha, const hipsparseMatDescr_t descrA, const float* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, const float* x, const float* beta, float* y);
// CHECK: status_t = hipsparseSbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &fAlpha, matDescr_t, &fbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &fX, &fBeta, &fY);
status_t = cusparseSbsrmv(handle_t, direction_t, opA, mb, nb, nnzb, &fAlpha, matDescr_t, &fbsrSortedValA, &bsrSortedMaskPtrA, &bsrRowPtrA, blockDim, &fX, &fBeta, &fY);

#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
Loading

0 comments on commit 8d80343

Please sign in to comment.