From 2582c397a24f12314abf3e0c709aea4c996e88e7 Mon Sep 17 00:00:00 2001 From: Yvan Mokwinski Date: Mon, 14 Aug 2023 14:29:28 -0600 Subject: [PATCH] Revert "Revert "reverted 5.6 api change (#371)" (#375)" (#378) This reverts commit b480dd9f700f01705df44ed3b0624186dbd3c69d. --- CHANGELOG.md | 4 +++ CMakeLists.txt | 2 +- clients/include/testing_spsv_coo.hpp | 18 +++++----- clients/include/testing_spsv_csr.hpp | 18 +++++----- library/include/hipsparse.h | 3 +- library/src/hcc_detail/hipsparse.cpp | 52 +++++++++------------------ library/src/nvcc_detail/hipsparse.cpp | 3 +- 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ee89fd7..3ae41fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log for hipSPARSE +## hipSPARSE 2.3.7 for ROCm 5.6.1 +### Bugfix +- Reverted an undocumented API change in hipSPARSE 2.3.6 that affected hipsparseSpSV_solve function + ## hipSPARSE 2.3.6 for ROCm 5.6.0 ### Added - Added SpGEMM algorithms diff --git a/CMakeLists.txt b/CMakeLists.txt index 97a256d5..3c4ab1a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,7 @@ endif() # Setup version -rocm_setup_version(VERSION 2.3.6) +rocm_setup_version(VERSION 2.3.7) set(hipsparse_SOVERSION 0.1) # hipSPARSE library diff --git a/clients/include/testing_spsv_coo.hpp b/clients/include/testing_spsv_coo.hpp index f07c8dc7..b47840fd 100644 --- a/clients/include/testing_spsv_coo.hpp +++ b/clients/include/testing_spsv_coo.hpp @@ -138,23 +138,23 @@ void testing_spsv_coo_bad_arg(void) // SpSV solve verify_hipsparse_status_invalid_handle( - hipsparseSpSV_solve(nullptr, transA, &alpha, A, x, y, dataType, alg, descr)); + hipsparseSpSV_solve(nullptr, transA, &alpha, A, x, y, dataType, alg, descr, dbuf)); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, nullptr, A, x, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, nullptr, A, x, y, dataType, alg, descr, dbuf), "Error: alpha is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, nullptr, x, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, nullptr, x, y, dataType, alg, descr, dbuf), "Error: A is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, nullptr, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, A, nullptr, y, dataType, alg, descr, dbuf), "Error: x is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, x, nullptr, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, A, x, nullptr, dataType, alg, descr, dbuf), "Error: y is nullptr"); #if(!defined(CUDART_VERSION)) verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, x, y, dataType, alg, nullptr), - "Error: descr is nullptr"); + hipsparseSpSV_solve(handle, transA, &alpha, A, x, y, dataType, alg, descr, nullptr), + "Error: dbuf is nullptr"); #endif // Destruct @@ -307,12 +307,12 @@ hipsparseStatus_t testing_spsv_coo(void) // HIPSPARSE pointer mode host CHECK_HIPSPARSE_ERROR(hipsparseSetPointerMode(handle, HIPSPARSE_POINTER_MODE_HOST)); CHECK_HIPSPARSE_ERROR( - hipsparseSpSV_solve(handle, transA, &h_alpha, A, x, y1, typeT, alg, descr)); + hipsparseSpSV_solve(handle, transA, &h_alpha, A, x, y1, typeT, alg, descr, buffer)); // HIPSPARSE pointer mode device CHECK_HIPSPARSE_ERROR(hipsparseSetPointerMode(handle, HIPSPARSE_POINTER_MODE_DEVICE)); CHECK_HIPSPARSE_ERROR( - hipsparseSpSV_solve(handle, transA, d_alpha, A, x, y2, typeT, alg, descr)); + hipsparseSpSV_solve(handle, transA, d_alpha, A, x, y2, typeT, alg, descr, buffer)); // copy output from device to CPU CHECK_HIP_ERROR(hipMemcpy(hy_1.data(), dy_1, sizeof(T) * m, hipMemcpyDeviceToHost)); diff --git a/clients/include/testing_spsv_csr.hpp b/clients/include/testing_spsv_csr.hpp index 8265baa8..ff65fa3a 100644 --- a/clients/include/testing_spsv_csr.hpp +++ b/clients/include/testing_spsv_csr.hpp @@ -139,23 +139,23 @@ void testing_spsv_csr_bad_arg(void) // SpSV solve verify_hipsparse_status_invalid_handle( - hipsparseSpSV_solve(nullptr, transA, &alpha, A, x, y, dataType, alg, descr)); + hipsparseSpSV_solve(nullptr, transA, &alpha, A, x, y, dataType, alg, descr, dbuf)); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, nullptr, A, x, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, nullptr, A, x, y, dataType, alg, descr, dbuf), "Error: alpha is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, nullptr, x, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, nullptr, x, y, dataType, alg, descr, dbuf), "Error: A is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, nullptr, y, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, A, nullptr, y, dataType, alg, descr, dbuf), "Error: x is nullptr"); verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, x, nullptr, dataType, alg, descr), + hipsparseSpSV_solve(handle, transA, &alpha, A, x, nullptr, dataType, alg, descr, dbuf), "Error: y is nullptr"); #if(!defined(CUDART_VERSION)) verify_hipsparse_status_invalid_pointer( - hipsparseSpSV_solve(handle, transA, &alpha, A, x, y, dataType, alg, nullptr), - "Error: descr is nullptr"); + hipsparseSpSV_solve(handle, transA, &alpha, A, x, y, dataType, alg, descr, nullptr), + "Error: dbuf is nullptr"); #endif // Destruct @@ -300,12 +300,12 @@ hipsparseStatus_t testing_spsv_csr(void) // HIPSPARSE pointer mode host CHECK_HIPSPARSE_ERROR(hipsparseSetPointerMode(handle, HIPSPARSE_POINTER_MODE_HOST)); CHECK_HIPSPARSE_ERROR( - hipsparseSpSV_solve(handle, transA, &h_alpha, A, x, y1, typeT, alg, descr)); + hipsparseSpSV_solve(handle, transA, &h_alpha, A, x, y1, typeT, alg, descr, buffer)); // HIPSPARSE pointer mode device CHECK_HIPSPARSE_ERROR(hipsparseSetPointerMode(handle, HIPSPARSE_POINTER_MODE_DEVICE)); CHECK_HIPSPARSE_ERROR( - hipsparseSpSV_solve(handle, transA, d_alpha, A, x, y2, typeT, alg, descr)); + hipsparseSpSV_solve(handle, transA, d_alpha, A, x, y2, typeT, alg, descr, buffer)); // copy output from device to CPU CHECK_HIP_ERROR(hipMemcpy(hy_1.data(), dy_1, sizeof(T) * m, hipMemcpyDeviceToHost)); diff --git a/library/include/hipsparse.h b/library/include/hipsparse.h index c72f4b78..d28b53dc 100644 --- a/library/include/hipsparse.h +++ b/library/include/hipsparse.h @@ -10394,7 +10394,8 @@ hipsparseStatus_t hipsparseSpSV_solve(hipsparseHandle_t handle, const hipsparseDnVecDescr_t y, hipDataType computeType, hipsparseSpSVAlg_t alg, - hipsparseSpSVDescr_t spsvDescr); + hipsparseSpSVDescr_t spsvDescr, + void* externalBuffer); #endif /*! \ingroup generic_module diff --git a/library/src/hcc_detail/hipsparse.cpp b/library/src/hcc_detail/hipsparse.cpp index 98187524..f3820957 100644 --- a/library/src/hcc_detail/hipsparse.cpp +++ b/library/src/hcc_detail/hipsparse.cpp @@ -14259,25 +14259,15 @@ hipsparseStatus_t hipsparseSDDMM_preprocess(hipsparseHandle_t handle, tempBuffer)); } -struct hipsparseSpSVDescr -{ - void* externalBuffer{}; -}; - hipsparseStatus_t hipsparseSpSV_createDescr(hipsparseSpSVDescr_t* descr) { - *descr = new hipsparseSpSVDescr; + // Do nothing return HIPSPARSE_STATUS_SUCCESS; } hipsparseStatus_t hipsparseSpSV_destroyDescr(hipsparseSpSVDescr_t descr) { - if(descr != nullptr) - { - descr->externalBuffer = nullptr; - delete descr; - } - + // Do nothing return HIPSPARSE_STATUS_SUCCESS; } @@ -14316,24 +14306,17 @@ hipsparseStatus_t hipsparseSpSV_analysis(hipsparseHandle_t handle, hipsparseSpSVDescr_t spsvDescr, void* externalBuffer) { - - if(spsvDescr == nullptr) - { - return HIPSPARSE_STATUS_INVALID_VALUE; - } - RETURN_IF_ROCSPARSE_ERROR(rocsparse_spsv((rocsparse_handle)handle, - hipOperationToHCCOperation(opA), - alpha, - (const rocsparse_spmat_descr)matA, - (const rocsparse_dnvec_descr)x, - (const rocsparse_dnvec_descr)y, - hipDataTypeToHCCDataType(computeType), - hipSpSVAlgToHCCSpSVAlg(alg), - rocsparse_spsv_stage_preprocess, - nullptr, - externalBuffer)); - spsvDescr->externalBuffer = externalBuffer; - return HIPSPARSE_STATUS_SUCCESS; + return rocSPARSEStatusToHIPStatus(rocsparse_spsv((rocsparse_handle)handle, + hipOperationToHCCOperation(opA), + alpha, + (const rocsparse_spmat_descr)matA, + (const rocsparse_dnvec_descr)x, + (const rocsparse_dnvec_descr)y, + hipDataTypeToHCCDataType(computeType), + hipSpSVAlgToHCCSpSVAlg(alg), + rocsparse_spsv_stage_preprocess, + nullptr, + externalBuffer)); } hipsparseStatus_t hipsparseSpSV_solve(hipsparseHandle_t handle, @@ -14344,12 +14327,9 @@ hipsparseStatus_t hipsparseSpSV_solve(hipsparseHandle_t handle, const hipsparseDnVecDescr_t y, hipDataType computeType, hipsparseSpSVAlg_t alg, - hipsparseSpSVDescr_t spsvDescr) + hipsparseSpSVDescr_t spsvDescr, + void* externalBuffer) { - if(spsvDescr == nullptr) - { - return HIPSPARSE_STATUS_INVALID_VALUE; - } return rocSPARSEStatusToHIPStatus(rocsparse_spsv((rocsparse_handle)handle, hipOperationToHCCOperation(opA), alpha, @@ -14360,7 +14340,7 @@ hipsparseStatus_t hipsparseSpSV_solve(hipsparseHandle_t handle, hipSpSVAlgToHCCSpSVAlg(alg), rocsparse_spsv_stage_compute, nullptr, - spsvDescr->externalBuffer)); + externalBuffer)); } hipsparseStatus_t hipsparseSpSM_createDescr(hipsparseSpSMDescr_t* descr) diff --git a/library/src/nvcc_detail/hipsparse.cpp b/library/src/nvcc_detail/hipsparse.cpp index 7d35f0d4..75a6e1b9 100644 --- a/library/src/nvcc_detail/hipsparse.cpp +++ b/library/src/nvcc_detail/hipsparse.cpp @@ -12102,7 +12102,8 @@ hipsparseStatus_t hipsparseSpSV_solve(hipsparseHandle_t handle, const hipsparseDnVecDescr_t y, hipDataType computeType, hipsparseSpSVAlg_t alg, - hipsparseSpSVDescr_t spsvDescr) + hipsparseSpSVDescr_t spsvDescr, + void* externalBuffer) { return hipCUSPARSEStatusToHIPStatus(cusparseSpSV_solve((cusparseHandle_t)handle, hipOperationToCudaOperation(opA),