Skip to content

Commit

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

+ Updated synthetic tests and the regenerated hipify-perl and SPARSE docs
  • Loading branch information
emankov committed Nov 4, 2023
1 parent 8c40864 commit 2ac1279
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 @@ -1758,6 +1758,7 @@ sub rocSubstitutions {
subst("cusparseCbsrilu02", "rocsparse_cbsrilu0", "library");
subst("cusparseCbsrilu02_analysis", "rocsparse_cbsrilu0_analysis", "library");
subst("cusparseCbsrilu02_numericBoost", "rocsparse_dcbsrilu0_numeric_boost", "library");
subst("cusparseCbsrsm2_analysis", "rocsparse_cbsrsm_analysis", "library");
subst("cusparseCbsrsm2_solve", "rocsparse_cbsrsm_solve", "library");
subst("cusparseCcsc2dense", "rocsparse_ccsc2dense", "library");
subst("cusparseCcsr2bsr", "rocsparse_ccsr2bsr", "library");
Expand Down Expand Up @@ -1825,6 +1826,7 @@ sub rocSubstitutions {
subst("cusparseDbsrilu02", "rocsparse_dbsrilu0", "library");
subst("cusparseDbsrilu02_analysis", "rocsparse_dbsrilu0_analysis", "library");
subst("cusparseDbsrilu02_numericBoost", "rocsparse_dbsrilu0_numeric_boost", "library");
subst("cusparseDbsrsm2_analysis", "rocsparse_dbsrsm_analysis", "library");
subst("cusparseDbsrsm2_solve", "rocsparse_dbsrsm_solve", "library");
subst("cusparseDcsc2dense", "rocsparse_dcsc2dense", "library");
subst("cusparseDcsr2bsr", "rocsparse_dcsr2bsr", "library");
Expand Down Expand Up @@ -1910,6 +1912,7 @@ sub rocSubstitutions {
subst("cusparseSbsrilu02", "rocsparse_sbsrilu0", "library");
subst("cusparseSbsrilu02_analysis", "rocsparse_sbsrilu0_analysis", "library");
subst("cusparseSbsrilu02_numericBoost", "rocsparse_dsbsrilu0_numeric_boost", "library");
subst("cusparseSbsrsm2_analysis", "rocsparse_sbsrsm_analysis", "library");
subst("cusparseSbsrsm2_solve", "rocsparse_sbsrsm_solve", "library");
subst("cusparseScatter", "rocsparse_scatter", "library");
subst("cusparseScsc2dense", "rocsparse_scsc2dense", "library");
Expand Down Expand Up @@ -2006,6 +2009,7 @@ sub rocSubstitutions {
subst("cusparseZbsrilu02", "rocsparse_zbsrilu0", "library");
subst("cusparseZbsrilu02_analysis", "rocsparse_zbsrilu0_analysis", "library");
subst("cusparseZbsrilu02_numericBoost", "rocsparse_zbsrilu0_numeric_boost", "library");
subst("cusparseZbsrsm2_analysis", "rocsparse_zbsrsm_analysis", "library");
subst("cusparseZbsrsm2_solve", "rocsparse_zbsrsm_solve", "library");
subst("cusparseZcsc2dense", "rocsparse_zcsc2dense", "library");
subst("cusparseZcsr2bsr", "rocsparse_zcsr2bsr", "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 @@ -380,7 +380,7 @@
|**CUDA**|**A**|**D**|**C**|**R**|**HIP**|**A**|**D**|**C**|**R**|**E**|**ROC**|**A**|**D**|**C**|**R**|**E**|
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmm`| | | | |`hipsparseCbsrmm`|3.7.0| | | | | | | | | | |
|`cusparseCbsrsm2_analysis`| |12.2| | |`hipsparseCbsrsm2_analysis`|4.5.0| | | | | | | | | | |
|`cusparseCbsrsm2_analysis`| |12.2| | |`hipsparseCbsrsm2_analysis`|4.5.0| | | | |`rocsparse_cbsrsm_analysis`|3.6.0| | | | |
|`cusparseCbsrsm2_bufferSize`| |12.2| | |`hipsparseCbsrsm2_bufferSize`|4.5.0| | | | | | | | | | |
|`cusparseCbsrsm2_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseCbsrsm2_solve`| |12.2| | |`hipsparseCbsrsm2_solve`|4.5.0| | | | |`rocsparse_cbsrsm_solve`|4.5.0| | | | |
Expand All @@ -393,7 +393,7 @@
|`cusparseCcsrsm_solve`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseCgemmi`|8.0|11.0| |12.0|`hipsparseCgemmi`|3.7.0| | | | | | | | | | |
|`cusparseDbsrmm`| | | | |`hipsparseDbsrmm`|3.7.0| | | | | | | | | | |
|`cusparseDbsrsm2_analysis`| |12.2| | |`hipsparseDbsrsm2_analysis`|4.5.0| | | | | | | | | | |
|`cusparseDbsrsm2_analysis`| |12.2| | |`hipsparseDbsrsm2_analysis`|4.5.0| | | | |`rocsparse_dbsrsm_analysis`|3.6.0| | | | |
|`cusparseDbsrsm2_bufferSize`| |12.2| | |`hipsparseDbsrsm2_bufferSize`|4.5.0| | | | | | | | | | |
|`cusparseDbsrsm2_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseDbsrsm2_solve`| |12.2| | |`hipsparseDbsrsm2_solve`|4.5.0| | | | |`rocsparse_dbsrsm_solve`|4.5.0| | | | |
Expand All @@ -406,7 +406,7 @@
|`cusparseDcsrsm_solve`| |10.2| |11.0| | | | | | | | | | | | |
|`cusparseDgemmi`|8.0|11.0| |12.0|`hipsparseDgemmi`|3.7.0| | | | | | | | | | |
|`cusparseSbsrmm`| | | | |`hipsparseSbsrmm`|3.7.0| | | | | | | | | | |
|`cusparseSbsrsm2_analysis`| |12.2| | |`hipsparseSbsrsm2_analysis`|4.5.0| | | | | | | | | | |
|`cusparseSbsrsm2_analysis`| |12.2| | |`hipsparseSbsrsm2_analysis`|4.5.0| | | | |`rocsparse_sbsrsm_analysis`|3.6.0| | | | |
|`cusparseSbsrsm2_bufferSize`| |12.2| | |`hipsparseSbsrsm2_bufferSize`|4.5.0| | | | | | | | | | |
|`cusparseSbsrsm2_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseSbsrsm2_solve`| |12.2| | |`hipsparseSbsrsm2_solve`|4.5.0| | | | |`rocsparse_sbsrsm_solve`|4.5.0| | | | |
Expand All @@ -421,7 +421,7 @@
|`cusparseXbsrsm2_zeroPivot`| |12.2| | |`hipsparseXbsrsm2_zeroPivot`|4.5.0| | | | | | | | | | |
|`cusparseXcsrsm2_zeroPivot`|10.0|11.3| |12.0|`hipsparseXcsrsm2_zeroPivot`|3.1.0| | | | | | | | | | |
|`cusparseZbsrmm`| | | | |`hipsparseZbsrmm`|3.7.0| | | | | | | | | | |
|`cusparseZbsrsm2_analysis`| |12.2| | |`hipsparseZbsrsm2_analysis`|4.5.0| | | | | | | | | | |
|`cusparseZbsrsm2_analysis`| |12.2| | |`hipsparseZbsrsm2_analysis`|4.5.0| | | | |`rocsparse_zbsrsm_analysis`|3.6.0| | | | |
|`cusparseZbsrsm2_bufferSize`| |12.2| | |`hipsparseZbsrsm2_bufferSize`|4.5.0| | | | | | | | | | |
|`cusparseZbsrsm2_bufferSizeExt`| |12.2| | | | | | | | | | | | | | |
|`cusparseZbsrsm2_solve`| |12.2| | |`hipsparseZbsrsm2_solve`|4.5.0| | | | |`rocsparse_zbsrsm_solve`|4.5.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 @@ -380,7 +380,7 @@
|**CUDA**|**A**|**D**|**C**|**R**|**ROC**|**A**|**D**|**C**|**R**|**E**|
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cusparseCbsrmm`| | | | | | | | | | |
|`cusparseCbsrsm2_analysis`| |12.2| | | | | | | | |
|`cusparseCbsrsm2_analysis`| |12.2| | |`rocsparse_cbsrsm_analysis`|3.6.0| | | | |
|`cusparseCbsrsm2_bufferSize`| |12.2| | | | | | | | |
|`cusparseCbsrsm2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseCbsrsm2_solve`| |12.2| | |`rocsparse_cbsrsm_solve`|4.5.0| | | | |
Expand All @@ -393,7 +393,7 @@
|`cusparseCcsrsm_solve`| |10.2| |11.0| | | | | | |
|`cusparseCgemmi`|8.0|11.0| |12.0| | | | | | |
|`cusparseDbsrmm`| | | | | | | | | | |
|`cusparseDbsrsm2_analysis`| |12.2| | | | | | | | |
|`cusparseDbsrsm2_analysis`| |12.2| | |`rocsparse_dbsrsm_analysis`|3.6.0| | | | |
|`cusparseDbsrsm2_bufferSize`| |12.2| | | | | | | | |
|`cusparseDbsrsm2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseDbsrsm2_solve`| |12.2| | |`rocsparse_dbsrsm_solve`|4.5.0| | | | |
Expand All @@ -406,7 +406,7 @@
|`cusparseDcsrsm_solve`| |10.2| |11.0| | | | | | |
|`cusparseDgemmi`|8.0|11.0| |12.0| | | | | | |
|`cusparseSbsrmm`| | | | | | | | | | |
|`cusparseSbsrsm2_analysis`| |12.2| | | | | | | | |
|`cusparseSbsrsm2_analysis`| |12.2| | |`rocsparse_sbsrsm_analysis`|3.6.0| | | | |
|`cusparseSbsrsm2_bufferSize`| |12.2| | | | | | | | |
|`cusparseSbsrsm2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseSbsrsm2_solve`| |12.2| | |`rocsparse_sbsrsm_solve`|4.5.0| | | | |
Expand All @@ -421,7 +421,7 @@
|`cusparseXbsrsm2_zeroPivot`| |12.2| | | | | | | | |
|`cusparseXcsrsm2_zeroPivot`|10.0|11.3| |12.0| | | | | | |
|`cusparseZbsrmm`| | | | | | | | | | |
|`cusparseZbsrsm2_analysis`| |12.2| | | | | | | | |
|`cusparseZbsrsm2_analysis`| |12.2| | |`rocsparse_zbsrsm_analysis`|3.6.0| | | | |
|`cusparseZbsrsm2_bufferSize`| |12.2| | | | | | | | |
|`cusparseZbsrsm2_bufferSizeExt`| |12.2| | | | | | | | |
|`cusparseZbsrsm2_solve`| |12.2| | |`rocsparse_zbsrsm_solve`|4.5.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 @@ -268,10 +268,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP {
{"cusparseZbsrsm2_bufferSize", {"hipsparseZbsrsm2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrsm2_bufferSizeExt", {"hipsparseZbsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, 10, UNSUPPORTED | CUDA_DEPRECATED}},

{"cusparseSbsrsm2_analysis", {"hipsparseSbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseDbsrsm2_analysis", {"hipsparseDbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseCbsrsm2_analysis", {"hipsparseCbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseZbsrsm2_analysis", {"hipsparseZbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, 10, ROC_UNSUPPORTED | CUDA_DEPRECATED}},
{"cusparseSbsrsm2_analysis", {"hipsparseSbsrsm2_analysis", "rocsparse_sbsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},
{"cusparseDbsrsm2_analysis", {"hipsparseDbsrsm2_analysis", "rocsparse_dbsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},
{"cusparseCbsrsm2_analysis", {"hipsparseCbsrsm2_analysis", "rocsparse_cbsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},
{"cusparseZbsrsm2_analysis", {"hipsparseZbsrsm2_analysis", "rocsparse_zbsrsm_analysis", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},

{"cusparseSbsrsm2_solve", {"hipsparseSbsrsm2_solve", "rocsparse_sbsrsm_solve", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},
{"cusparseDbsrsm2_solve", {"hipsparseDbsrsm2_solve", "rocsparse_dbsrsm_solve", CONV_LIB_FUNC, API_SPARSE, 10, CUDA_DEPRECATED}},
Expand Down Expand Up @@ -2280,6 +2280,10 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_cbsrsm_solve", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_dbsrsm_solve", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_sbsrsm_solve", {HIP_4050, HIP_0, HIP_0 }},
{"rocsparse_zbsrsm_analysis", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_cbsrsm_analysis", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_dbsrsm_analysis", {HIP_3060, HIP_0, HIP_0 }},
{"rocsparse_sbsrsm_analysis", {HIP_3060, HIP_0, 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 @@ -1040,6 +1040,26 @@ int main() {
// CHECK: status_t = hipsparseSbsrsm2_solve(handle_t, direction_t, opA, opX, mb, nrhs, nnzb, &fA, matDescr_A, &fbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, &fB, ldb, &fx, ldx, solvePolicy_t, pBuffer);
status_t = cusparseSbsrsm2_solve(handle_t, direction_t, opA, opX, mb, nrhs, nnzb, &fA, matDescr_A, &fbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, &fB, ldb, &fx, ldx, solvePolicy_t, pBuffer);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseZbsrsm2_analysis(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, cusparseOperation_t transXY, int mb, int n, int nnzb, const cusparseMatDescr_t descrA, const cuDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockSize, bsrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseZbsrsm2_analysis(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, hipsparseOperation_t transX, int mb, int nrhs, int nnzb, const hipsparseMatDescr_t descrA, const hipDoubleComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, bsrsm2Info_t info, hipsparseSolvePolicy_t policy, void* pBuffer);
// CHECK: status_t = hipsparseZbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &dComplexbsrSortedValA, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);
status_t = cusparseZbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &dComplexbsrSortedValA, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseCbsrsm2_analysis(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, cusparseOperation_t transXY, int mb, int n, int nnzb, const cusparseMatDescr_t descrA, const cuComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockSize, bsrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCbsrsm2_analysis(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, hipsparseOperation_t transX, int mb, int nrhs, int nnzb, const hipsparseMatDescr_t descrA, const hipComplex* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, bsrsm2Info_t info, hipsparseSolvePolicy_t policy, void* pBuffer);
// CHECK: status_t = hipsparseCbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &complexbsrValA, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);
status_t = cusparseCbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &complexbsrValA, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseDbsrsm2_analysis(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, cusparseOperation_t transXY, int mb, int n, int nnzb, const cusparseMatDescr_t descrA, const double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockSize, bsrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseDbsrsm2_analysis(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, hipsparseOperation_t transX, int mb, int nrhs, int nnzb, const hipsparseMatDescr_t descrA, const double* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, bsrsm2Info_t info, hipsparseSolvePolicy_t policy, void* pBuffer);
// CHECK: status_t = hipsparseDbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &dbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);
status_t = cusparseDbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &dbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);

// CUDA: CUSPARSE_DEPRECATED cusparseStatus_t CUSPARSEAPI cusparseSbsrsm2_analysis(cusparseHandle_t handle, cusparseDirection_t dirA, cusparseOperation_t transA, cusparseOperation_t transXY, int mb, int n, int nnzb, const cusparseMatDescr_t descrA, const float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockSize, bsrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer);
// HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseSbsrsm2_analysis(hipsparseHandle_t handle, hipsparseDirection_t dirA, hipsparseOperation_t transA, hipsparseOperation_t transX, int mb, int nrhs, int nnzb, const hipsparseMatDescr_t descrA, const float* bsrSortedValA, const int* bsrSortedRowPtrA, const int* bsrSortedColIndA, int blockDim, bsrsm2Info_t info, hipsparseSolvePolicy_t policy, void* pBuffer);
// CHECK: status_t = hipsparseSbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &fbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);
status_t = cusparseSbsrsm2_analysis(handle_t, direction_t, opA, opX, mb, n, nnzb, matDescr_A, &fbsrSortedVal, &bsrRowPtrA, &bsrColIndA, blockDim, bsrsm2_info, solvePolicy_t, pBuffer);

#if CUDA_VERSION >= 8000
// CHECK: hipDataType dataType_t;
// CHECK-NEXT: hipDataType dataType;
Expand Down
Loading

0 comments on commit 2ac1279

Please sign in to comment.