Skip to content

Commit

Permalink
[HIPIFY][SPARSE][test][Windows][fix] Take into account APIs unsupport…
Browse files Browse the repository at this point in the history
…ed 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
  • Loading branch information
emankov committed Jul 7, 2023
1 parent 5c2bad1 commit 30ab089
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
30 changes: 18 additions & 12 deletions tests/unit_tests/synthetic/libraries/cusparse2hipsparse.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
14 changes: 8 additions & 6 deletions tests/unit_tests/synthetic/libraries/cusparse2rocsparse.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 30ab089

Please sign in to comment.