Skip to content

Commit

Permalink
Merge pull request ROCm#1698 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][hipSPARSE] Sync with 6.3.0 - Step 2
  • Loading branch information
emankov authored Oct 11, 2024
2 parents e9e5883 + f4f4ed5 commit 4f76ecb
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 14 deletions.
6 changes: 3 additions & 3 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -6510,6 +6510,7 @@ sub simpleSubstitutions {
subst("curandStatus", "hiprandStatus", "type");
subst("curandStatus_t", "hiprandStatus_t", "type");
subst("cusolverAlgMode_t", "hipsolverAlgMode_t", "type");
subst("cusolverDeterministicMode_t", "hipsolverDeterministicMode_t", "type");
subst("cusolverDnFunction_t", "hipsolverDnFunction_t", "type");
subst("cusolverDnHandle_t", "hipsolverHandle_t", "type");
subst("cusolverDnParams_t", "hipsolverDnParams_t", "type");
Expand Down Expand Up @@ -6955,6 +6956,8 @@ sub simpleSubstitutions {
subst("CUSOLVERRF_UNIT_DIAGONAL_STORED_U", "HIPSOLVERRF_UNIT_DIAGONAL_STORED_U", "numeric_literal");
subst("CUSOLVER_ALG_0", "HIPSOLVER_ALG_0", "numeric_literal");
subst("CUSOLVER_ALG_1", "HIPSOLVER_ALG_1", "numeric_literal");
subst("CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", "HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", "numeric_literal");
subst("CUSOLVER_DETERMINISTIC_RESULTS", "HIPSOLVER_DETERMINISTIC_RESULTS", "numeric_literal");
subst("CUSOLVER_EIG_MODE_NOVECTOR", "HIPSOLVER_EIG_MODE_NOVECTOR", "numeric_literal");
subst("CUSOLVER_EIG_MODE_VECTOR", "HIPSOLVER_EIG_MODE_VECTOR", "numeric_literal");
subst("CUSOLVER_EIG_RANGE_ALL", "HIPSOLVER_EIG_RANGE_ALL", "numeric_literal");
Expand Down Expand Up @@ -9515,7 +9518,6 @@ sub warnUnsupportedFunctions {
"cusolverDnCEgels_bufferSize",
"cusolverDnCEgels",
"cusolverDirectMode_t",
"cusolverDeterministicMode_t",
"curand_mtgp32_specific",
"curand_mtgp32_single_specific",
"curand_mtgp32_single",
Expand Down Expand Up @@ -11270,7 +11272,6 @@ sub warnUnsupportedFunctions {
"CUSOLVER_IRS_REFINE_CLASSICAL",
"CUSOLVER_INF_NORM",
"CUSOLVER_FRO_NORM",
"CUSOLVER_DETERMINISTIC_RESULTS",
"CUSOLVER_C_TF32",
"CUSOLVER_C_AP",
"CUSOLVER_C_8U",
Expand All @@ -11279,7 +11280,6 @@ sub warnUnsupportedFunctions {
"CUSOLVER_C_32F",
"CUSOLVER_C_16F",
"CUSOLVER_C_16BF",
"CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS",
"CUSOLVER_ALG_2",
"CUSOLVERDN_POTRF",
"CURAND_REJECTION",
Expand Down
6 changes: 3 additions & 3 deletions docs/tables/CUSOLVER_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
|`CUSOLVER_ALG_0`|11.0| | | |`HIPSOLVER_ALG_0`|6.2.0| | | | |
|`CUSOLVER_ALG_1`|11.0| | | |`HIPSOLVER_ALG_1`|6.2.0| | | | |
|`CUSOLVER_ALG_2`|11.5| | | | | | | | | |
|`CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|12.2| | | | | | | | | |
|`CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|12.2| | | |`HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|6.3.0| | | | |
|`CUSOLVER_C_16BF`|11.0| | | | | | | | | |
|`CUSOLVER_C_16F`|11.0| | | | | | | | | |
|`CUSOLVER_C_32F`|11.0| | | | | | | | | |
Expand All @@ -40,7 +40,7 @@
|`CUSOLVER_C_8U`|11.0| | | | | | | | | |
|`CUSOLVER_C_AP`|11.0| | | | | | | | | |
|`CUSOLVER_C_TF32`|11.0| | | | | | | | | |
|`CUSOLVER_DETERMINISTIC_RESULTS`|12.2| | | | | | | | | |
|`CUSOLVER_DETERMINISTIC_RESULTS`|12.2| | | |`HIPSOLVER_DETERMINISTIC_RESULTS`|6.3.0| | | | |
|`CUSOLVER_EIG_MODE_NOVECTOR`|8.0| | | |`HIPSOLVER_EIG_MODE_NOVECTOR`|4.5.0| | | | |
|`CUSOLVER_EIG_MODE_VECTOR`|8.0| | | |`HIPSOLVER_EIG_MODE_VECTOR`|4.5.0| | | | |
|`CUSOLVER_EIG_RANGE_ALL`|10.1| | | |`HIPSOLVER_EIG_RANGE_ALL`|5.3.0| | | | |
Expand Down Expand Up @@ -109,7 +109,7 @@
|`cudaLibMgGrid_t`|10.1| | | | | | | | | |
|`cudaLibMgMatrixDesc_t`|10.1| | | | | | | | | |
|`cusolverAlgMode_t`|11.0| | | |`hipsolverAlgMode_t`|6.2.0| | | | |
|`cusolverDeterministicMode_t`|12.2| | | | | | | | | |
|`cusolverDeterministicMode_t`|12.2| | | |`hipsolverDeterministicMode_t`|6.3.0| | | | |
|`cusolverDirectMode_t`|11.0| | | | | | | | | |
|`cusolverDnContext`| | | | | | | | | | |
|`cusolverDnFunction_t`|11.0| | | |`hipsolverDnFunction_t`|6.2.0| | | | |
Expand Down
6 changes: 3 additions & 3 deletions docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
|`CUSOLVER_ALG_0`|11.0| | | |`HIPSOLVER_ALG_0`|6.2.0| | | | | | | | | | |
|`CUSOLVER_ALG_1`|11.0| | | |`HIPSOLVER_ALG_1`|6.2.0| | | | | | | | | | |
|`CUSOLVER_ALG_2`|11.5| | | | | | | | | | | | | | | |
|`CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|12.2| | | | | | | | | | | | | | | |
|`CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|12.2| | | |`HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS`|6.3.0| | | | | | | | | | |
|`CUSOLVER_C_16BF`|11.0| | | | | | | | | | | | | | | |
|`CUSOLVER_C_16F`|11.0| | | | | | | | | | | | | | | |
|`CUSOLVER_C_32F`|11.0| | | | | | | | | | | | | | | |
Expand All @@ -40,7 +40,7 @@
|`CUSOLVER_C_8U`|11.0| | | | | | | | | | | | | | | |
|`CUSOLVER_C_AP`|11.0| | | | | | | | | | | | | | | |
|`CUSOLVER_C_TF32`|11.0| | | | | | | | | | | | | | | |
|`CUSOLVER_DETERMINISTIC_RESULTS`|12.2| | | | | | | | | | | | | | | |
|`CUSOLVER_DETERMINISTIC_RESULTS`|12.2| | | |`HIPSOLVER_DETERMINISTIC_RESULTS`|6.3.0| | | | | | | | | | |
|`CUSOLVER_EIG_MODE_NOVECTOR`|8.0| | | |`HIPSOLVER_EIG_MODE_NOVECTOR`|4.5.0| | | | |`rocblas_evect_none`|4.1.0| | | | |
|`CUSOLVER_EIG_MODE_VECTOR`|8.0| | | |`HIPSOLVER_EIG_MODE_VECTOR`|4.5.0| | | | |`rocblas_evect_original`|4.1.0| | | | |
|`CUSOLVER_EIG_RANGE_ALL`|10.1| | | |`HIPSOLVER_EIG_RANGE_ALL`|5.3.0| | | | |`rocblas_erange_all`|5.2.0| | | | |
Expand Down Expand Up @@ -109,7 +109,7 @@
|`cudaLibMgGrid_t`|10.1| | | | | | | | | | | | | | | |
|`cudaLibMgMatrixDesc_t`|10.1| | | | | | | | | | | | | | | |
|`cusolverAlgMode_t`|11.0| | | |`hipsolverAlgMode_t`|6.2.0| | | | | | | | | | |
|`cusolverDeterministicMode_t`|12.2| | | | | | | | | | | | | | | |
|`cusolverDeterministicMode_t`|12.2| | | |`hipsolverDeterministicMode_t`|6.3.0| | | | | | | | | | |
|`cusolverDirectMode_t`|11.0| | | | | | | | | | | | | | | |
|`cusolverDnContext`| | | | | | | | | | | | | | | | |
|`cusolverDnFunction_t`|11.0| | | |`hipsolverDnFunction_t`|6.2.0| | | | | | | | | | |
Expand Down
9 changes: 6 additions & 3 deletions src/CUDA2HIP_SOLVER_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SOLVER_TYPE_NAME_MAP {
{"cusolverDnFunction_t", {"hipsolverDnFunction_t", "", CONV_TYPE, API_SOLVER, 1, ROC_UNSUPPORTED}},
{"CUSOLVERDN_GETRF", {"HIPSOLVERDN_GETRF", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, ROC_UNSUPPORTED}},
{"CUSOLVERDN_POTRF", {"HIPSOLVERDN_POTRF", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, UNSUPPORTED}},
{"cusolverDeterministicMode_t", {"hipsolverDeterministicMode_t", "", CONV_TYPE, API_SOLVER, 1, UNSUPPORTED}},
{"CUSOLVER_DETERMINISTIC_RESULTS", {"HIPSOLVER_DETERMINISTIC_RESULTS", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, UNSUPPORTED}},
{"CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", {"HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, UNSUPPORTED}},
{"cusolverDeterministicMode_t", {"hipsolverDeterministicMode_t", "", CONV_TYPE, API_SOLVER, 1, ROC_UNSUPPORTED}},
{"CUSOLVER_DETERMINISTIC_RESULTS", {"HIPSOLVER_DETERMINISTIC_RESULTS", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, ROC_UNSUPPORTED}},
{"CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", {"HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, ROC_UNSUPPORTED}},
{"cusolver_int_t", {"int", "rocblas_int", CONV_NUMERIC_LITERAL, API_SOLVER, 1}},
{"cusolverDnLoggerCallback_t", {"hipsolverDnLoggerCallback_t", "", CONV_NUMERIC_LITERAL, API_SOLVER, 1, UNSUPPORTED}},
{"cusolverMgContext", {"hipsolverMgContext", "", CONV_TYPE, API_SOLVER, 1, UNSUPPORTED}},
Expand Down Expand Up @@ -329,6 +329,9 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_TYPE_NAME_VER_MAP {
{"HIPSOLVER_ALG_1", {HIP_6020, HIP_0, HIP_0, }},
{"hipsolverDnFunction_t", {HIP_6020, HIP_0, HIP_0, }},
{"HIPSOLVERDN_GETRF", {HIP_6020, HIP_0, HIP_0, }},
{"hipsolverDeterministicMode_t", {HIP_6030, HIP_0, HIP_0, }},
{"HIPSOLVER_DETERMINISTIC_RESULTS", {HIP_6030, HIP_0, HIP_0, }},
{"HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS", {HIP_6030, HIP_0, HIP_0, }},

{"rocblas_int", {HIP_3000, HIP_0, HIP_0 }},
{"rocblas_status", {HIP_3000, HIP_0, HIP_0 }},
Expand Down
52 changes: 50 additions & 2 deletions tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ int main() {
void *Workspace = nullptr;
void *workOnDevice = nullptr;
void *workOnHost = nullptr;
void *bufferOnDevice = nullptr;
void *bufferOnHost = nullptr;
void *A = nullptr;
void *B = nullptr;
void *tau = nullptr;
int *piMp = nullptr;
int *piMi = nullptr;
double *pdMx = nullptr;
Expand Down Expand Up @@ -751,8 +754,8 @@ int main() {
status = cusolverSpDcsrlsvcholHost(SpHandle_t, m, nnzA, MatDescr_t, &dcsrVal, &icsrRowPtr, &icsrColInd, &dB, dtol, ireorder, &dX, &isingularity);

#if CUDA_VERSION >= 8000
// CHECK: hipDataType dataTypeA, dataTypeB, computeType;
cudaDataType dataTypeA, dataTypeB, computeType;
// CHECK: hipDataType dataTypeA, dataTypeB, dataTypeTau, computeType;
cudaDataType dataTypeA, dataTypeB, dataTypeTau, computeType;

// CHECK: hipsolverEigType_t eigType;
// CHECK-NEXT: hipsolverEigType_t EIG_TYPE_1 = HIPSOLVER_EIG_TYPE_1;
Expand Down Expand Up @@ -1729,6 +1732,51 @@ int main() {
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXgetrs(hipsolverDnHandle_t handle, hipsolverDnParams_t params, hipsolverOperation_t trans, int64_t n, int64_t nrhs, hipDataType dataTypeA, const void* A, int64_t lda, const int64_t* devIpiv, hipDataType dataTypeB, void* B, int64_t ldb, int* devInfo);
// CHECK: status = hipsolverDnXgetrs(handle, solverDnParams, blasOperation, n64, nrhs64, dataTypeA, A, lda64, &devIpiv64, dataTypeB, B, ldb64, &info);
status = cusolverDnXgetrs(handle, solverDnParams, blasOperation, n64, nrhs64, dataTypeA, A, lda64, &devIpiv64, dataTypeB, B, ldb64, &info);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnXpotrf_bufferSize(cusolverDnHandle_t handle, cusolverDnParams_t params, cublasFillMode_t uplo, int64_t n, cudaDataType dataTypeA, const void * A, int64_t lda, cudaDataType computeType, size_t * workspaceInBytesOnDevice, size_t * workspaceInBytesOnHost);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXpotrf_bufferSize(hipsolverDnHandle_t handle, hipsolverDnParams_t params, hipsolverFillMode_t uplo, int64_t n, hipDataType dataTypeA, const void* A, int64_t lda, hipDataType computeType, size_t* lworkOnDevice, size_t* lworkOnHost);
// CHECK: status = hipsolverDnXpotrf_bufferSize(handle, solverDnParams, fillMode, n64, dataTypeA, A, lda64, computeType, &lworkOnDevice, &lworkOnHost);
status = cusolverDnXpotrf_bufferSize(handle, solverDnParams, fillMode, n64, dataTypeA, A, lda64, computeType, &lworkOnDevice, &lworkOnHost);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnXpotrf(cusolverDnHandle_t handle, cusolverDnParams_t params, cublasFillMode_t uplo, int64_t n, cudaDataType dataTypeA, void * A, int64_t lda, cudaDataType computeType, void * bufferOnDevice, size_t workspaceInBytesOnDevice, void * bufferOnHost, size_t workspaceInBytesOnHost, int * info);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXpotrf(hipsolverDnHandle_t handle, hipsolverDnParams_t params, hipsolverFillMode_t uplo, int64_t n, hipDataType dataTypeA, void* A, int64_t lda, hipDataType computeType, void* workOnDevice, size_t lworkOnDevice, void* workOnHost, size_t lworkOnHost, int* info);
// CHECK: status = hipsolverDnXpotrf(handle, solverDnParams, fillMode, n64, dataTypeA, A, lda64, computeType, workOnDevice, lworkOnDevice, workOnHost, lworkOnHost, &info);
status = cusolverDnXpotrf(handle, solverDnParams, fillMode, n64, dataTypeA, A, lda64, computeType, workOnDevice, lworkOnDevice, workOnHost, lworkOnHost, &info);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnXpotrs(cusolverDnHandle_t handle, cusolverDnParams_t params, cublasFillMode_t uplo, int64_t n, int64_t nrhs, cudaDataType dataTypeA, const void * A, int64_t lda, cudaDataType dataTypeB, void * B, int64_t ldb, int * info);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXpotrs(hipsolverDnHandle_t handle, hipsolverDnParams_t params, hipsolverFillMode_t uplo, int64_t n, int64_t nrhs, hipDataType dataTypeA, const void* A, int64_t lda, hipDataType dataTypeB, void* B, int64_t ldb, int* info);
// CHECK: status = hipsolverDnXpotrs(handle, solverDnParams, fillMode, n64, nrhs64, dataTypeA, A, lda64, dataTypeB, B, ldb64, &info);
status = cusolverDnXpotrs(handle, solverDnParams, fillMode, n64, nrhs64, dataTypeA, A, lda64, dataTypeB, B, ldb64, &info);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnXgeqrf_bufferSize(cusolverDnHandle_t handle, cusolverDnParams_t params, int64_t m, int64_t n, cudaDataType dataTypeA, const void * A, int64_t lda, cudaDataType dataTypeTau, const void * tau, cudaDataType computeType, size_t * workspaceInBytesOnDevice, size_t * workspaceInBytesOnHost);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXgeqrf_bufferSize(hipsolverDnHandle_t handle, hipsolverDnParams_t params, int64_t m, int64_t n, hipDataType dataTypeA, const void* A, int64_t lda, hipDataType dataTypeTau, const void* tau, hipDataType computeType, size_t* lworkOnDevice, size_t* lworkOnHost);
// CHECK: status = hipsolverDnXgeqrf_bufferSize(handle, solverDnParams, m64, n64, dataTypeA, A, lda64, dataTypeTau, tau, computeType, &lworkOnDevice, &lworkOnHost);
status = cusolverDnXgeqrf_bufferSize(handle, solverDnParams, m64, n64, dataTypeA, A, lda64, dataTypeTau, tau, computeType, &lworkOnDevice, &lworkOnHost);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnXgeqrf(cusolverDnHandle_t handle, cusolverDnParams_t params, int64_t m, int64_t n, cudaDataType dataTypeA, void * A, int64_t lda, cudaDataType dataTypeTau, void * tau, cudaDataType computeType, void * bufferOnDevice, size_t workspaceInBytesOnDevice, void * bufferOnHost, size_t workspaceInBytesOnHost, int * info);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnXgeqrf(hipsolverDnHandle_t handle, hipsolverDnParams_t params, int64_t m, int64_t n, hipDataType dataTypeA, void* A, int64_t lda, hipDataType dataTypeTau, void* tau, hipDataType computeType, void* workOnDevice, size_t lworkOnDevice, void* workOnHost, size_t lworkOnHost, int* devInfo);
// CHECK: status = hipsolverDnXgeqrf(handle, solverDnParams, m64, n64, dataTypeA, A, lda64, dataTypeTau, tau, computeType, bufferOnDevice, lworkOnDevice, bufferOnHost, lworkOnHost, &devInfo);
status = cusolverDnXgeqrf(handle, solverDnParams, m64, n64, dataTypeA, A, lda64, dataTypeTau, tau, computeType, bufferOnDevice, lworkOnDevice, bufferOnHost, lworkOnHost, &devInfo);
#endif

#if CUDA_VERSION >= 12020
// CHECK: hipsolverDeterministicMode_t DeterministicMode_t;
// CHECK-NEXT: hipsolverDeterministicMode_t DETERMINISTIC_RESULTS = HIPSOLVER_DETERMINISTIC_RESULTS;
// CHECK-NEXT: hipsolverDeterministicMode_t ALLOW_NON_DETERMINISTIC_RESULTS = HIPSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS;
cusolverDeterministicMode_t DeterministicMode_t;
cusolverDeterministicMode_t DETERMINISTIC_RESULTS = CUSOLVER_DETERMINISTIC_RESULTS;
cusolverDeterministicMode_t ALLOW_NON_DETERMINISTIC_RESULTS = CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS;

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnSetDeterministicMode(cusolverDnHandle_t handle, cusolverDeterministicMode_t mode);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnSetDeterministicMode(hipsolverHandle_t handle, hipsolverDeterministicMode_t mode);
// CHECK: status = hipsolverDnSetDeterministicMode(handle, DeterministicMode_t);
status = cusolverDnSetDeterministicMode(handle, DeterministicMode_t);

// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnGetDeterministicMode(cusolverDnHandle_t handle, cusolverDeterministicMode_t* mode);
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnGetDeterministicMode(hipsolverHandle_t handle, hipsolverDeterministicMode_t* mode);
// CHECK: status = hipsolverDnGetDeterministicMode(handle, &DeterministicMode_t);
status = cusolverDnGetDeterministicMode(handle, &DeterministicMode_t);
#endif

return 0;
}

0 comments on commit 4f76ecb

Please sign in to comment.