From 30ab08940c6acf7d8ed1f48e8bff995f1363d1d6 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 7 Jul 2023 20:41:43 +0200 Subject: [PATCH] [HIPIFY][SPARSE][test][Windows][fix] Take into account APIs unsupported on WIN32 for some CUDA versions in the corresponding hipSPARSE and rocSPARSE tests + [Reason] Some APIs were appeared in CUDA 10.x only for Linux initially, and then they are appeared in CUDA 11.0 for Windows as well, so we need to distinguish them on Windows; otherwise some tests will fail there --- .../synthetic/libraries/cusparse2hipsparse.cu | 30 +++++++++++-------- .../synthetic/libraries/cusparse2rocsparse.cu | 14 +++++---- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu index b59e9adc..615a00b6 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu @@ -426,7 +426,7 @@ int main() { status_t = cusparseCopyMatDescr(matDescr_t, matDescr_t_2); #endif -#if CUDA_VERSION >= 10010 +#if (CUDA_VERSION >= 10010 && CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000 // CHECK: hipsparseSpMatDescr_t spMatDescr_t, matC; cusparseSpMatDescr_t spMatDescr_t, matC; @@ -471,11 +471,6 @@ int main() { // CHECK: hipsparseSpMMAlg_t spMMAlg_t; cusparseSpMMAlg_t spMMAlg_t; - // CHECK: hipsparseCsr2CscAlg_t Csr2CscAlg_t; - // CHECK-NEXT: hipsparseCsr2CscAlg_t CSR2CSC_ALG1 = HIPSPARSE_CSR2CSC_ALG1; - cusparseCsr2CscAlg_t Csr2CscAlg_t; - cusparseCsr2CscAlg_t CSR2CSC_ALG1 = CUSPARSE_CSR2CSC_ALG1; - // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCreateCoo(cusparseSpMatDescr_t* spMatDescr, int64_t ows, int64_t cols, int64_t nnz, void* cooRowInd, void* cooColInd, void* cooValues, cusparseIndexType_t cooIdxType, cusparseIndexBase_t idxBase, cudaDataType valueType); // HIP: HIPSPARSE_EXPORT hipsparseStatus_t hipsparseCreateCoo(hipsparseSpMatDescr_t* spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void* cooRowInd, void* cooColInd, void* cooValues, hipsparseIndexType_t cooIdxType, hipsparseIndexBase_t idxBase, hipDataType valueType); // CHECK: status_t = hipsparseCreateCoo(&spMatDescr_t, rows, cols, nnz, cooRowInd, cooColInd, cooValues, indexType_t, indexBase_t, dataType); @@ -527,28 +522,34 @@ int main() { status_t = cusparseDnMatSetStridedBatch(dnMatDescr_t, batchCount, batchStride); #endif -#if CUDA_VERSION >= 10010 && CUDA_VERSION < 12000 +#if CUDA_VERSION >= 10010 + // CHECK: hipsparseCsr2CscAlg_t Csr2CscAlg_t; + // CHECK-NEXT: hipsparseCsr2CscAlg_t CSR2CSC_ALG1 = HIPSPARSE_CSR2CSC_ALG1; + cusparseCsr2CscAlg_t Csr2CscAlg_t; + cusparseCsr2CscAlg_t CSR2CSC_ALG1 = CUSPARSE_CSR2CSC_ALG1; +#endif + +#if (CUDA_VERSION >= 10010 && CUDA_VERSION < 11000 && !defined(_WIN32)) || (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) // CHECK: hipsparseSpMMAlg_t COOMM_ALG1 = HIPSPARSE_COOMM_ALG1; // CHECK-NEXT: hipsparseSpMMAlg_t COOMM_ALG2 = HIPSPARSE_COOMM_ALG2; // CHECK-NEXT: hipsparseSpMMAlg_t COOMM_ALG3 = HIPSPARSE_COOMM_ALG3; cusparseSpMMAlg_t COOMM_ALG1 = CUSPARSE_COOMM_ALG1; cusparseSpMMAlg_t COOMM_ALG2 = CUSPARSE_COOMM_ALG2; cusparseSpMMAlg_t COOMM_ALG3 = CUSPARSE_COOMM_ALG3; +#endif +#if CUDA_VERSION >= 10010 && CUDA_VERSION < 12000 // CHECK: hipsparseCsr2CscAlg_t CSR2CSC_ALG2 = HIPSPARSE_CSR2CSC_ALG2; cusparseCsr2CscAlg_t CSR2CSC_ALG2 = CUSPARSE_CSR2CSC_ALG2; #endif -#if CUDA_VERSION >= 10020 +#if (CUDA_VERSION >= 10020 && CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000 // CHECK: hipsparseSpVecDescr_t spVecDescr_t; cusparseSpVecDescr_t spVecDescr_t; // CHECK: hipsparseDnVecDescr_t dnVecDescr_t, vecX, vecY; cusparseDnVecDescr_t dnVecDescr_t, vecX, vecY; - // CHECK: hipsparseStatus_t STATUS_NOT_SUPPORTED = HIPSPARSE_STATUS_NOT_SUPPORTED; - cusparseStatus_t STATUS_NOT_SUPPORTED = CUSPARSE_STATUS_NOT_SUPPORTED; - // CHECK: hipsparseSpMVAlg_t spMVAlg_t; cusparseSpMVAlg_t spMVAlg_t; @@ -648,7 +649,12 @@ int main() { status_t = cusparseSpMV(handle_t, opA, alpha, spMatDescr_t, vecX, beta, vecY, dataType, spMVAlg_t, tempBuffer); #endif -#if CUDA_VERSION >= 10020 && CUDA_VERSION < 12000 +#if CUDA_VERSION >= 10020 + // CHECK: hipsparseStatus_t STATUS_NOT_SUPPORTED = HIPSPARSE_STATUS_NOT_SUPPORTED; + cusparseStatus_t STATUS_NOT_SUPPORTED = CUSPARSE_STATUS_NOT_SUPPORTED; +#endif + +#if (CUDA_VERSION >= 10020 && CUDA_VERSION < 11000 && !defined(_WIN32)) || (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) // CHECK: hipsparseFormat_t FORMAT_COO_AOS = HIPSPARSE_FORMAT_COO_AOS; cusparseFormat_t FORMAT_COO_AOS = CUSPARSE_FORMAT_COO_AOS; diff --git a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu index 14a3dc10..4e4d65f6 100644 --- a/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu +++ b/tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu @@ -431,7 +431,7 @@ int main() { status_t = cusparseCopyMatDescr(matDescr_t, matDescr_t_2); #endif -#if CUDA_VERSION >= 10010 +#if (CUDA_VERSION >= 10010 && CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000 // CHECK: _rocsparse_spmat_descr *spMatDescr = nullptr; // CHECK-NEXT: rocsparse_spmat_descr spMatDescr_t, matC; cusparseSpMatDescr *spMatDescr = nullptr; @@ -531,7 +531,7 @@ int main() { status_t = cusparseDnMatSetStridedBatch(dnMatDescr_t, batchCount, batchStride); #endif -#if CUDA_VERSION >= 10020 +#if (CUDA_VERSION >= 10020 && CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000 // CHECK: _rocsparse_spvec_descr *spVecDescr = nullptr; // CHECK-NEXT: rocsparse_spvec_descr spVecDescr_t; cusparseSpVecDescr *spVecDescr = nullptr; @@ -542,9 +542,6 @@ int main() { cusparseDnVecDescr *dnVecDescr = nullptr; cusparseDnVecDescr_t dnVecDescr_t, vecX, vecY; - // CHECK: rocsparse_status STATUS_NOT_SUPPORTED = rocsparse_status_not_implemented; - cusparseStatus_t STATUS_NOT_SUPPORTED = CUSPARSE_STATUS_NOT_SUPPORTED; - // CHECK: rocsparse_spmv_alg spMVAlg_t; cusparseSpMVAlg_t spMVAlg_t; @@ -644,7 +641,12 @@ int main() { status_t = cusparseSpMV(handle_t, opA, alpha, spMatDescr_t, vecX, beta, vecY, dataType, spMVAlg_t, tempBuffer); #endif -#if CUDA_VERSION >= 10020 && CUDA_VERSION < 12000 +#if CUDA_VERSION >= 10020 + // CHECK: rocsparse_status STATUS_NOT_SUPPORTED = rocsparse_status_not_implemented; + cusparseStatus_t STATUS_NOT_SUPPORTED = CUSPARSE_STATUS_NOT_SUPPORTED; +#endif + +#if (CUDA_VERSION >= 10020 && CUDA_VERSION < 11000 && !defined(_WIN32)) || (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) // CHECK: rocsparse_format FORMAT_COO_AOS = rocsparse_format_coo_aos; cusparseFormat_t FORMAT_COO_AOS = CUSPARSE_FORMAT_COO_AOS;