forked from ROCm/HIPIFY
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HIPIFY][ROCm#674][rocSPARSE][feature] rocSPARSE support - Step 98 - …
…function `rocsparse_sparse_to_dense` + [IMP] `rocsparse_sparse_to_dense` has been changed in 6.0.0; so reflected that in HIPIFY, docs, and tests + Updated `SPARSE` synthetic tests, the regenerated hipify-perl, and `SPARSE` `CUDA2HIP` documentation
- Loading branch information
Showing
9 changed files
with
150 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
tests/unit_tests/synthetic/libraries/cusparse2rocsparse_12000.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// RUN: %run_test hipify "%s" "%t" %hipify_args 4 --skip-excluded-preprocessor-conditional-blocks --experimental --roc --use-hip-data-types %clang_args -ferror-limit=500 | ||
|
||
// CHECK: #include <hip/hip_runtime.h> | ||
#include <cuda_runtime.h> | ||
// CHECK: #include "hip/hip_complex.h" | ||
#include "cuComplex.h" | ||
#include <stdio.h> | ||
// CHECK: #include "rocsparse.h" | ||
#include "cusparse.h" | ||
// CHECK-NOT: #include "rocsparse.h" | ||
|
||
int main() { | ||
printf("18.1. cuSPARSE API to rocSPARSE API synthetic test\n"); | ||
|
||
// CHECK: rocsparse_status status_t; | ||
cusparseStatus_t status_t; | ||
|
||
// CHECK: _rocsparse_handle *handle = nullptr; | ||
// CHECK-NEXT: rocsparse_handle handle_t; | ||
cusparseContext *handle = nullptr; | ||
cusparseHandle_t handle_t; | ||
|
||
// CHECK: _rocsparse_mat_descr *matDescr = nullptr; | ||
// CHECK-NEXT: rocsparse_mat_descr matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D; | ||
cusparseMatDescr *matDescr = nullptr; | ||
cusparseMatDescr_t matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D; | ||
|
||
// CHECK: rocsparse_operation opA, opB, opX; | ||
cusparseOperation_t opA, opB, opX; | ||
|
||
// CHECK: rocsparse_solve_policy solvePolicy_t; | ||
cusparseSolvePolicy_t solvePolicy_t; | ||
|
||
int m = 0; | ||
int n = 0; | ||
int k = 0; | ||
int innz = 0; | ||
int nnza = 0; | ||
int nnzb = 0; | ||
int nnzc = 0; | ||
int nnzd = 0; | ||
int csrRowPtrA = 0; | ||
int csrRowPtrB = 0; | ||
int csrRowPtrC = 0; | ||
int csrRowPtrD = 0; | ||
int csrColIndA = 0; | ||
int csrColIndB = 0; | ||
int csrColIndC = 0; | ||
int csrColIndD = 0; | ||
int bufferSizeInBytes = 0; | ||
double dA = 0.f; | ||
double dB = 0.f; | ||
double dAlpha = 0.f; | ||
double dF = 0.f; | ||
double dX = 0.f; | ||
double dcsrSortedValA = 0.f; | ||
double dcsrSortedValB = 0.f; | ||
double dcsrSortedValC = 0.f; | ||
double dcsrSortedValD = 0.f; | ||
float fAlpha = 0.f; | ||
float fA = 0.f; | ||
float fB = 0.f; | ||
float fF = 0.f; | ||
float fX = 0.f; | ||
float csrSortedValA = 0.f; | ||
float csrSortedValB = 0.f; | ||
float csrSortedValC = 0.f; | ||
float csrSortedValD = 0.f; | ||
void *pBuffer = nullptr; | ||
void *tempBuffer = nullptr; | ||
|
||
// TODO: should be rocsparse_double_complex | ||
// TODO: add to TypeOverloads cuDoubleComplex -> rocsparse_double_complex under a new option --sparse | ||
// CHECK: rocblas_double_complex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dComplexcsrSortedValD, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; | ||
cuDoubleComplex dcomplex, dcomplexA, dcomplexAlpha, dcomplexB, dcomplexBeta, dcomplexC, dcomplexF, dcomplexX, dcomplexY, dComplexbsrSortedValA, dComplexbsrSortedValC, dComplexcsrSortedValA, dComplexcsrSortedValB, dComplexcsrSortedValC, dComplexcsrSortedValD, dcomplextol, dComplexbsrSortedVal, dComplexbscVal, dComplexcscSortedVal, dcomplexds, dcomplexdl, dcomplexd, dcomplexdu, dcomplexdw, dcomplexx, dcomplex_boost_val; | ||
|
||
// TODO: should be rocsparse_double_complex | ||
// TODO: add to TypeOverloads cuComplex -> rocsparse_float_complex under a new option --sparse | ||
// CHECK: rocblas_float_complex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexF, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complexcsrSortedValD, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; | ||
cuComplex complex, complexA, complexAlpha, complexB, complexBeta, complexC, complexF, complexX, complexY, complexbsrValA, complexbsrSortedValC, complexcsrSortedValA, complexcsrSortedValB, complexcsrSortedValC, complexcsrSortedValD, complextol, complexbsrSortedVal, complexbscVal, complexcscSortedVal, complexds, complexdl, complexd, complexdu, complexdw, complexx, complex_boost_val; | ||
|
||
#if CUDA_VERSION >= 11010 && CUSPARSE_VERSION >= 11300 | ||
// CHECK: rocsparse_sparse_to_dense_alg sparseToDenseAlg_t; | ||
cusparseSparseToDenseAlg_t sparseToDenseAlg_t; | ||
#endif | ||
|
||
#if (CUDA_VERSION >= 10010 && CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000 | ||
// CHECK: rocsparse_spmat_descr spMatDescr_t, spmatA, spmatB, spmatC; | ||
cusparseSpMatDescr_t spMatDescr_t, spmatA, spmatB, spmatC; | ||
|
||
// CHECK: rocsparse_dnmat_descr dnMatDescr_t, dnmatA, dnmatB, dnmatC; | ||
cusparseDnMatDescr_t dnMatDescr_t, dnmatA, dnmatB, dnmatC; | ||
#endif | ||
|
||
#if CUDA_VERSION >= 12000 | ||
// CHECK: rocsparse_const_spmat_descr constSpMatDescr = nullptr; | ||
// CHECK-NEXT: rocsparse_const_spmat_descr constSpMatDescrB = nullptr; | ||
cusparseConstSpMatDescr_t constSpMatDescr = nullptr; | ||
cusparseConstSpMatDescr_t constSpMatDescrB = nullptr; | ||
|
||
// CUDA: cusparseStatus_t CUSPARSEAPI cusparseSparseToDense(cusparseHandle_t handle, cusparseConstSpMatDescr_t matA, cusparseDnMatDescr_t matB, cusparseSparseToDenseAlg_t alg, void* externalBuffer); | ||
// ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_sparse_to_dense(rocsparse_handle handle, rocsparse_const_spmat_descr mat_A, rocsparse_dnmat_descr mat_B, rocsparse_sparse_to_dense_alg alg, size_t* buffer_size, void* temp_buffer); | ||
// CHECK: status_t = rocsparse_sparse_to_dense(handle_t, constSpMatDescr, dnmatB, sparseToDenseAlg_t, nullptr, tempBuffer); | ||
status_t = cusparseSparseToDense(handle_t, constSpMatDescr, dnmatB, sparseToDenseAlg_t, tempBuffer); | ||
#endif | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters