Skip to content

Commit

Permalink
[HIPIFY][ROCm#675][ROCm#677][SOLVER][feature] cuSOLVER support - St…
Browse files Browse the repository at this point in the history
…ep 18 - Functions (DN)

+ `cusolverDnZ(S|D|C|Z)potrf` are `SUPPORTED` by both `hipSOLVER` and `rocSOLVER`
+ [TODO] `rocsolver_(s|d|c|z)potrf` needs second call to calculate workspace
+ Updated `SOLVER` synthetic tests, the regenerated hipify-perl, and `SOLVER` `CUDA2HIP` documentation
+ [fix] `cusolverDn(S|D|C|Z)potrf_bufferSize` are appeared before CUDA 7.0, in fact
  • Loading branch information
emankov committed Nov 26, 2023
1 parent d1d29b7 commit 278e834
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 42 deletions.
12 changes: 12 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1081,11 +1081,13 @@ my %experimental_funcs = (
"cusolverEigRange_t" => "6.1.0",
"cusolverEigMode_t" => "6.1.0",
"cusolverDnZpotrf_bufferSize" => "6.1.0",
"cusolverDnZpotrf" => "6.1.0",
"cusolverDnZZgesv_bufferSize" => "6.1.0",
"cusolverDnZZgesv" => "6.1.0",
"cusolverDnZZgels_bufferSize" => "6.1.0",
"cusolverDnZZgels" => "6.1.0",
"cusolverDnSpotrf_bufferSize" => "6.1.0",
"cusolverDnSpotrf" => "6.1.0",
"cusolverDnSgetrs" => "6.1.0",
"cusolverDnSgetrf_bufferSize" => "6.1.0",
"cusolverDnSgetrf" => "6.1.0",
Expand All @@ -1097,6 +1099,7 @@ my %experimental_funcs = (
"cusolverDnHandle_t" => "6.1.0",
"cusolverDnGetStream" => "6.1.0",
"cusolverDnDpotrf_bufferSize" => "6.1.0",
"cusolverDnDpotrf" => "6.1.0",
"cusolverDnDgetrs" => "6.1.0",
"cusolverDnDgetrf_bufferSize" => "6.1.0",
"cusolverDnDgetrf" => "6.1.0",
Expand All @@ -1107,6 +1110,7 @@ my %experimental_funcs = (
"cusolverDnDDgels" => "6.1.0",
"cusolverDnCreate" => "6.1.0",
"cusolverDnCpotrf_bufferSize" => "6.1.0",
"cusolverDnCpotrf" => "6.1.0",
"cusolverDnCCgesv_bufferSize" => "6.1.0",
"cusolverDnCCgesv" => "6.1.0",
"cusolverDnCCgels_bufferSize" => "6.1.0",
Expand Down Expand Up @@ -1270,6 +1274,7 @@ sub experimentalSubstitutions {
subst("cusolverDnCCgels_bufferSize", "hipsolverDnCCgels_bufferSize", "library");
subst("cusolverDnCCgesv", "hipsolverDnCCgesv", "library");
subst("cusolverDnCCgesv_bufferSize", "hipsolverDnCCgesv_bufferSize", "library");
subst("cusolverDnCpotrf", "hipsolverDnCpotrf", "library");
subst("cusolverDnCpotrf_bufferSize", "hipsolverDnCpotrf_bufferSize", "library");
subst("cusolverDnCreate", "hipsolverDnCreate", "library");
subst("cusolverDnDDgels", "hipsolverDnDDgels", "library");
Expand All @@ -1280,6 +1285,7 @@ sub experimentalSubstitutions {
subst("cusolverDnDgetrf", "hipsolverDnDgetrf", "library");
subst("cusolverDnDgetrf_bufferSize", "hipsolverDnDgetrf_bufferSize", "library");
subst("cusolverDnDgetrs", "hipsolverDnDgetrs", "library");
subst("cusolverDnDpotrf", "hipsolverDnDpotrf", "library");
subst("cusolverDnDpotrf_bufferSize", "hipsolverDnDpotrf_bufferSize", "library");
subst("cusolverDnGetStream", "hipsolverGetStream", "library");
subst("cusolverDnSSgels", "hipsolverDnSSgels", "library");
Expand All @@ -1290,11 +1296,13 @@ sub experimentalSubstitutions {
subst("cusolverDnSgetrf", "hipsolverDnSgetrf", "library");
subst("cusolverDnSgetrf_bufferSize", "hipsolverDnSgetrf_bufferSize", "library");
subst("cusolverDnSgetrs", "hipsolverDnSgetrs", "library");
subst("cusolverDnSpotrf", "hipsolverDnSpotrf", "library");
subst("cusolverDnSpotrf_bufferSize", "hipsolverDnSpotrf_bufferSize", "library");
subst("cusolverDnZZgels", "hipsolverDnZZgels", "library");
subst("cusolverDnZZgels_bufferSize", "hipsolverDnZZgels_bufferSize", "library");
subst("cusolverDnZZgesv", "hipsolverDnZZgesv", "library");
subst("cusolverDnZZgesv_bufferSize", "hipsolverDnZZgesv_bufferSize", "library");
subst("cusolverDnZpotrf", "hipsolverDnZpotrf", "library");
subst("cusolverDnZpotrf_bufferSize", "hipsolverDnZpotrf_bufferSize", "library");
subst("cusolverDnHandle_t", "hipsolverHandle_t", "type");
subst("cusolverEigMode_t", "hipsolverEigMode_t", "type");
Expand Down Expand Up @@ -1789,10 +1797,14 @@ sub rocSubstitutions {
subst("cudnnSoftmaxBackward", "miopenSoftmaxBackward_V2", "library");
subst("cudnnSoftmaxForward", "miopenSoftmaxForward_V2", "library");
subst("cudnnTransformTensor", "miopenTransformTensor", "library");
subst("cusolverDnCpotrf", "rocsolver_cpotrf", "library");
subst("cusolverDnCreate", "rocblas_create_handle", "library");
subst("cusolverDnDestroy", "rocblas_destroy_handle", "library");
subst("cusolverDnDpotrf", "rocsolver_dpotrf", "library");
subst("cusolverDnGetStream", "rocblas_get_stream", "library");
subst("cusolverDnSetStream", "rocblas_set_stream", "library");
subst("cusolverDnSpotrf", "rocsolver_spotrf", "library");
subst("cusolverDnZpotrf", "rocsolver_zpotrf", "library");
subst("cusparseAxpby", "rocsparse_axpby", "library");
subst("cusparseBlockedEllGet", "rocsparse_bell_get", "library");
subst("cusparseCbsr2csr", "rocsparse_cbsr2csr", "library");
Expand Down
12 changes: 8 additions & 4 deletions docs/tables/CUSOLVER_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
|`cusolverDnCYgels_bufferSize`|11.0| | | | | | | | | |
|`cusolverDnCYgesv`|11.0| | | | | | | | | |
|`cusolverDnCYgesv_bufferSize`|11.0| | | | | | | | | |
|`cusolverDnCpotrf_bufferSize`|10.0| | | |`hipsolverDnCpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnCpotrf`| | | | |`hipsolverDnCpotrf`|5.1.0| | | |6.1.0|
|`cusolverDnCpotrf_bufferSize`| | | | |`hipsolverDnCpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnCreate`| | | | |`hipsolverDnCreate`|5.1.0| | | |6.1.0|
|`cusolverDnCreateParams`|11.0| | | | | | | | | |
|`cusolverDnDBgels`|11.0| | | | | | | | | |
Expand All @@ -151,7 +152,8 @@
|`cusolverDnDgetrf`| | | | |`hipsolverDnDgetrf`|5.1.0| | | |6.1.0|
|`cusolverDnDgetrf_bufferSize`| | | | |`hipsolverDnDgetrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnDgetrs`| | | | |`hipsolverDnDgetrs`|5.1.0| | | |6.1.0|
|`cusolverDnDpotrf_bufferSize`|10.0| | | |`hipsolverDnDpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnDpotrf`| | | | |`hipsolverDnDpotrf`|5.1.0| | | |6.1.0|
|`cusolverDnDpotrf_bufferSize`| | | | |`hipsolverDnDpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnGetDeterministicMode`|12.2| | | | | | | | | |
|`cusolverDnGetStream`| | | | |`hipsolverGetStream`|4.5.0| | | |6.1.0|
|`cusolverDnIRSInfosCreate`|10.2| | | | | | | | | |
Expand Down Expand Up @@ -200,7 +202,8 @@
|`cusolverDnSgetrf`| | | | |`hipsolverDnSgetrf`|5.1.0| | | |6.1.0|
|`cusolverDnSgetrf_bufferSize`| | | | |`hipsolverDnSgetrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnSgetrs`| | | | |`hipsolverDnSgetrs`|5.1.0| | | |6.1.0|
|`cusolverDnSpotrf_bufferSize`|10.0| | | |`hipsolverDnSpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnSpotrf`| | | | |`hipsolverDnSpotrf`|5.1.0| | | |6.1.0|
|`cusolverDnSpotrf_bufferSize`| | | | |`hipsolverDnSpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnXgetrf`|11.1| | | | | | | | | |
|`cusolverDnXgetrf_bufferSize`|11.1| | | | | | | | | |
|`cusolverDnXgetrs`|11.1| | | | | | | | | |
Expand All @@ -224,7 +227,8 @@
|`cusolverDnZZgels_bufferSize`|11.0| | | |`hipsolverDnZZgels_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnZZgesv`|10.2| | | |`hipsolverDnZZgesv`|5.1.0| | | |6.1.0|
|`cusolverDnZZgesv_bufferSize`|10.2| | | |`hipsolverDnZZgesv_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnZpotrf_bufferSize`|10.0| | | |`hipsolverDnZpotrf_bufferSize`|5.1.0| | | |6.1.0|
|`cusolverDnZpotrf`| | | | |`hipsolverDnZpotrf`|5.1.0| | | |6.1.0|
|`cusolverDnZpotrf_bufferSize`| | | | |`hipsolverDnZpotrf_bufferSize`|5.1.0| | | |6.1.0|


\*A - Added; D - Deprecated; C - Changed; R - Removed; E - Experimental
12 changes: 8 additions & 4 deletions docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
|`cusolverDnCYgels_bufferSize`|11.0| | | | | | | | | | | | | | | |
|`cusolverDnCYgesv`|11.0| | | | | | | | | | | | | | | |
|`cusolverDnCYgesv_bufferSize`|11.0| | | | | | | | | | | | | | | |
|`cusolverDnCpotrf_bufferSize`|10.0| | | |`hipsolverDnCpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnCpotrf`| | | | |`hipsolverDnCpotrf`|5.1.0| | | |6.1.0|`rocsolver_cpotrf`|3.6.0| | | |6.1.0|
|`cusolverDnCpotrf_bufferSize`| | | | |`hipsolverDnCpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnCreate`| | | | |`hipsolverDnCreate`|5.1.0| | | |6.1.0|`rocblas_create_handle`| | | | | |
|`cusolverDnCreateParams`|11.0| | | | | | | | | | | | | | | |
|`cusolverDnDBgels`|11.0| | | | | | | | | | | | | | | |
Expand All @@ -151,7 +152,8 @@
|`cusolverDnDgetrf`| | | | |`hipsolverDnDgetrf`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnDgetrf_bufferSize`| | | | |`hipsolverDnDgetrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnDgetrs`| | | | |`hipsolverDnDgetrs`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnDpotrf_bufferSize`|10.0| | | |`hipsolverDnDpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnDpotrf`| | | | |`hipsolverDnDpotrf`|5.1.0| | | |6.1.0|`rocsolver_dpotrf`|3.2.0| | | |6.1.0|
|`cusolverDnDpotrf_bufferSize`| | | | |`hipsolverDnDpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnGetDeterministicMode`|12.2| | | | | | | | | | | | | | | |
|`cusolverDnGetStream`| | | | |`hipsolverGetStream`|4.5.0| | | |6.1.0|`rocblas_get_stream`| | | | | |
|`cusolverDnIRSInfosCreate`|10.2| | | | | | | | | | | | | | | |
Expand Down Expand Up @@ -200,7 +202,8 @@
|`cusolverDnSgetrf`| | | | |`hipsolverDnSgetrf`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnSgetrf_bufferSize`| | | | |`hipsolverDnSgetrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnSgetrs`| | | | |`hipsolverDnSgetrs`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnSpotrf_bufferSize`|10.0| | | |`hipsolverDnSpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnSpotrf`| | | | |`hipsolverDnSpotrf`|5.1.0| | | |6.1.0|`rocsolver_spotrf`|3.2.0| | | |6.1.0|
|`cusolverDnSpotrf_bufferSize`| | | | |`hipsolverDnSpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnXgetrf`|11.1| | | | | | | | | | | | | | | |
|`cusolverDnXgetrf_bufferSize`|11.1| | | | | | | | | | | | | | | |
|`cusolverDnXgetrs`|11.1| | | | | | | | | | | | | | | |
Expand All @@ -224,7 +227,8 @@
|`cusolverDnZZgels_bufferSize`|11.0| | | |`hipsolverDnZZgels_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnZZgesv`|10.2| | | |`hipsolverDnZZgesv`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnZZgesv_bufferSize`|10.2| | | |`hipsolverDnZZgesv_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnZpotrf_bufferSize`|10.0| | | |`hipsolverDnZpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |
|`cusolverDnZpotrf`| | | | |`hipsolverDnZpotrf`|5.1.0| | | |6.1.0|`rocsolver_zpotrf`|3.6.0| | | |6.1.0|
|`cusolverDnZpotrf_bufferSize`| | | | |`hipsolverDnZpotrf_bufferSize`|5.1.0| | | |6.1.0| | | | | | |


\*A - Added; D - Deprecated; C - Changed; R - Removed; E - Experimental
12 changes: 8 additions & 4 deletions docs/tables/CUSOLVER_API_supported_by_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
|`cusolverDnCYgels_bufferSize`|11.0| | | | | | | | | |
|`cusolverDnCYgesv`|11.0| | | | | | | | | |
|`cusolverDnCYgesv_bufferSize`|11.0| | | | | | | | | |
|`cusolverDnCpotrf_bufferSize`|10.0| | | | | | | | | |
|`cusolverDnCpotrf`| | | | |`rocsolver_cpotrf`|3.6.0| | | |6.1.0|
|`cusolverDnCpotrf_bufferSize`| | | | | | | | | | |
|`cusolverDnCreate`| | | | |`rocblas_create_handle`| | | | | |
|`cusolverDnCreateParams`|11.0| | | | | | | | | |
|`cusolverDnDBgels`|11.0| | | | | | | | | |
Expand All @@ -151,7 +152,8 @@
|`cusolverDnDgetrf`| | | | | | | | | | |
|`cusolverDnDgetrf_bufferSize`| | | | | | | | | | |
|`cusolverDnDgetrs`| | | | | | | | | | |
|`cusolverDnDpotrf_bufferSize`|10.0| | | | | | | | | |
|`cusolverDnDpotrf`| | | | |`rocsolver_dpotrf`|3.2.0| | | |6.1.0|
|`cusolverDnDpotrf_bufferSize`| | | | | | | | | | |
|`cusolverDnGetDeterministicMode`|12.2| | | | | | | | | |
|`cusolverDnGetStream`| | | | |`rocblas_get_stream`| | | | | |
|`cusolverDnIRSInfosCreate`|10.2| | | | | | | | | |
Expand Down Expand Up @@ -200,7 +202,8 @@
|`cusolverDnSgetrf`| | | | | | | | | | |
|`cusolverDnSgetrf_bufferSize`| | | | | | | | | | |
|`cusolverDnSgetrs`| | | | | | | | | | |
|`cusolverDnSpotrf_bufferSize`|10.0| | | | | | | | | |
|`cusolverDnSpotrf`| | | | |`rocsolver_spotrf`|3.2.0| | | |6.1.0|
|`cusolverDnSpotrf_bufferSize`| | | | | | | | | | |
|`cusolverDnXgetrf`|11.1| | | | | | | | | |
|`cusolverDnXgetrf_bufferSize`|11.1| | | | | | | | | |
|`cusolverDnXgetrs`|11.1| | | | | | | | | |
Expand All @@ -224,7 +227,8 @@
|`cusolverDnZZgels_bufferSize`|11.0| | | | | | | | | |
|`cusolverDnZZgesv`|10.2| | | | | | | | | |
|`cusolverDnZZgesv_bufferSize`|10.2| | | | | | | | | |
|`cusolverDnZpotrf_bufferSize`|10.0| | | | | | | | | |
|`cusolverDnZpotrf`| | | | |`rocsolver_zpotrf`|3.6.0| | | |6.1.0|
|`cusolverDnZpotrf_bufferSize`| | | | | | | | | | |


\*A - Added; D - Deprecated; C - Changed; R - Removed; E - Experimental
18 changes: 14 additions & 4 deletions src/CUDA2HIP_SOLVER_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ const std::map<llvm::StringRef, hipCounter> CUDA_SOLVER_FUNCTION_MAP {
{"cusolverDnCpotrf_bufferSize", {"hipsolverDnCpotrf_bufferSize", "", CONV_LIB_FUNC, API_SOLVER, 2, ROC_UNSUPPORTED | HIP_EXPERIMENTAL}},
// NOTE: rocsolver_zpotrf has a harness of rocblas_start_device_memory_size_query and rocblas_stop_device_memory_size_query
{"cusolverDnZpotrf_bufferSize", {"hipsolverDnZpotrf_bufferSize", "", CONV_LIB_FUNC, API_SOLVER, 2, ROC_UNSUPPORTED | HIP_EXPERIMENTAL}},
// TODO: rocsolver_(s|d|c|z)potrf needs second call to calculate workspaces
{"cusolverDnSpotrf", {"hipsolverDnSpotrf", "rocsolver_spotrf", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}},
{"cusolverDnDpotrf", {"hipsolverDnDpotrf", "rocsolver_dpotrf", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}},
{"cusolverDnCpotrf", {"hipsolverDnCpotrf", "rocsolver_cpotrf", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}},
{"cusolverDnZpotrf", {"hipsolverDnZpotrf", "rocsolver_zpotrf", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}},
};

const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_FUNCTION_VER_MAP {
Expand Down Expand Up @@ -273,10 +278,6 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_FUNCTION_VER_MAP {
{"cusolverDnIRSXgesv_bufferSize", {CUDA_102, CUDA_0, CUDA_0}},
{"cusolverDnIRSXgels", {CUDA_110, CUDA_0, CUDA_0}},
{"cusolverDnIRSXgels_bufferSize", {CUDA_110, CUDA_0, CUDA_0}},
{"cusolverDnSpotrf_bufferSize", {CUDA_100, CUDA_0, CUDA_0}},
{"cusolverDnDpotrf_bufferSize", {CUDA_100, CUDA_0, CUDA_0}},
{"cusolverDnCpotrf_bufferSize", {CUDA_100, CUDA_0, CUDA_0}},
{"cusolverDnZpotrf_bufferSize", {CUDA_100, CUDA_0, CUDA_0}},
};

const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_FUNCTION_VER_MAP {
Expand Down Expand Up @@ -310,6 +311,15 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_FUNCTION_VER_MAP {
{"hipsolverDnDpotrf_bufferSize", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnCpotrf_bufferSize", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnZpotrf_bufferSize", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnSpotrf", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnDpotrf", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnCpotrf", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},
{"hipsolverDnZpotrf", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}},

{"rocsolver_spotrf", {HIP_3020, HIP_0, HIP_0, HIP_LATEST}},
{"rocsolver_dpotrf", {HIP_3020, HIP_0, HIP_0, HIP_LATEST}},
{"rocsolver_cpotrf", {HIP_3060, HIP_0, HIP_0, HIP_LATEST}},
{"rocsolver_zpotrf", {HIP_3060, HIP_0, HIP_0, HIP_LATEST}},
};

const std::map<unsigned int, llvm::StringRef> CUDA_SOLVER_API_SECTION_MAP {
Expand Down
Loading

0 comments on commit 278e834

Please sign in to comment.