From 278e8349eb9e22dff8ffc9cd27e3e4c61804f446 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Sun, 26 Nov 2023 12:24:39 +0100 Subject: [PATCH] [HIPIFY][#675][#677][SOLVER][feature] `cuSOLVER` support - Step 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 --- bin/hipify-perl | 12 ++++ docs/tables/CUSOLVER_API_supported_by_HIP.md | 12 ++-- .../CUSOLVER_API_supported_by_HIP_and_ROC.md | 12 ++-- docs/tables/CUSOLVER_API_supported_by_ROC.md | 12 ++-- src/CUDA2HIP_SOLVER_API_functions.cpp | 18 +++-- .../synthetic/libraries/cusolver2hipsolver.cu | 70 ++++++++++++------- .../synthetic/libraries/cusolver2rocsolver.cu | 48 +++++++++++++ 7 files changed, 142 insertions(+), 42 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index 20d23881..12e37b6a 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -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", @@ -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", @@ -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", @@ -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"); @@ -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"); @@ -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"); @@ -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"); diff --git a/docs/tables/CUSOLVER_API_supported_by_HIP.md b/docs/tables/CUSOLVER_API_supported_by_HIP.md index 289ec063..0c1cdd52 100644 --- a/docs/tables/CUSOLVER_API_supported_by_HIP.md +++ b/docs/tables/CUSOLVER_API_supported_by_HIP.md @@ -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| | | | | | | | | | @@ -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| | | | | | | | | | @@ -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| | | | | | | | | | @@ -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 \ No newline at end of file diff --git a/docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md b/docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md index 7742d25b..da29b7eb 100644 --- a/docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CUSOLVER_API_supported_by_HIP_and_ROC.md @@ -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| | | | | | | | | | | | | | | | @@ -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| | | | | | | | | | | | | | | | @@ -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| | | | | | | | | | | | | | | | @@ -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 \ No newline at end of file diff --git a/docs/tables/CUSOLVER_API_supported_by_ROC.md b/docs/tables/CUSOLVER_API_supported_by_ROC.md index d6ffd326..b0c30ea3 100644 --- a/docs/tables/CUSOLVER_API_supported_by_ROC.md +++ b/docs/tables/CUSOLVER_API_supported_by_ROC.md @@ -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| | | | | | | | | | @@ -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| | | | | | | | | | @@ -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| | | | | | | | | | @@ -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 \ No newline at end of file diff --git a/src/CUDA2HIP_SOLVER_API_functions.cpp b/src/CUDA2HIP_SOLVER_API_functions.cpp index d4c8c7a3..fd87f93f 100644 --- a/src/CUDA2HIP_SOLVER_API_functions.cpp +++ b/src/CUDA2HIP_SOLVER_API_functions.cpp @@ -167,6 +167,11 @@ const std::map 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 CUDA_SOLVER_FUNCTION_VER_MAP { @@ -273,10 +278,6 @@ const std::map 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 HIP_SOLVER_FUNCTION_VER_MAP { @@ -310,6 +311,15 @@ const std::map 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 CUDA_SOLVER_API_SECTION_MAP { diff --git a/tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu b/tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu index 155abeae..81fd1bf5 100644 --- a/tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu +++ b/tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu @@ -28,11 +28,11 @@ int main() { void *Workspace = nullptr; size_t lwork_bytes = 0; - // CHECK: hipDoubleComplex dComplexA, dComplexB, dComplexX; - cuDoubleComplex dComplexA, dComplexB, dComplexX; + // CHECK: hipDoubleComplex dComplexA, dComplexB, dComplexX, dComplexWorkspace; + cuDoubleComplex dComplexA, dComplexB, dComplexX, dComplexWorkspace; - // CHECK: hipComplex complexA, complexB, complexX; - cuComplex complexA, complexB, complexX; + // CHECK: hipComplex complexA, complexB, complexX, complexWorkspace; + cuComplex complexA, complexB, complexX, complexWorkspace; // CHECK: hipsolverHandle_t handle; cusolverDnHandle_t handle; @@ -119,6 +119,46 @@ int main() { // CHECK: status = hipsolverGetStream(handle, &stream_t); status = cusolverDnGetStream(handle, &stream_t); + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, float * A, int lda, int * Lwork); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnSpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, float* A, int lda, int* lwork); + // CHECK: status = hipsolverDnSpotrf_bufferSize(handle, fillMode, n, &fA, lda, &Lwork); + status = cusolverDnSpotrf_bufferSize(handle, fillMode, n, &fA, lda, &Lwork); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, double * A, int lda, int * Lwork); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnDpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, double* A, int lda, int* lwork); + // CHECK: status = hipsolverDnDpotrf_bufferSize(handle, fillMode, n, &dA, lda, &Lwork); + status = cusolverDnDpotrf_bufferSize(handle, fillMode, n, &dA, lda, &Lwork); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuComplex * A, int lda, int * Lwork); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnCpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipFloatComplex* A, int lda, int* lwork); + // CHECK: status = hipsolverDnCpotrf_bufferSize(handle, fillMode, n, &complexA, lda, &Lwork); + status = cusolverDnCpotrf_bufferSize(handle, fillMode, n, &complexA, lda, &Lwork); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuDoubleComplex * A, int lda, int * Lwork); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnZpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipDoubleComplex* A, int lda, int* lwork); + // CHECK: status = hipsolverDnZpotrf_bufferSize(handle, fillMode, n, &dComplexA, lda, &Lwork); + status = cusolverDnZpotrf_bufferSize(handle, fillMode, n, &dComplexA, lda, &Lwork); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, float * A, int lda, float * Workspace, int Lwork, int * devInfo); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnSpotrf(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, float* A, int lda, float* work, int lwork, int* devInfo); + // CHECK: status = hipsolverDnSpotrf(handle, fillMode, n, &fA, lda, &fWorkspace, Lwork, &devInfo); + status = cusolverDnSpotrf(handle, fillMode, n, &fA, lda, &fWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, double * A, int lda, double * Workspace, int Lwork, int * devInfo); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnDpotrf(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, double* A, int lda, double* work, int lwork, int* devInfo); + // CHECK: status = hipsolverDnDpotrf(handle, fillMode, n, &dA, lda, &dWorkspace, Lwork, &devInfo); + status = cusolverDnDpotrf(handle, fillMode, n, &dA, lda, &dWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuComplex * A, int lda, cuComplex * Workspace, int Lwork, int * devInfo); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnCpotrf(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipFloatComplex* A, int lda, hipFloatComplex* work, int lwork, int* devInfo); + // CHECK: status = hipsolverDnCpotrf(handle, fillMode, n, &complexA, lda, &complexWorkspace, Lwork, &devInfo); + status = cusolverDnCpotrf(handle, fillMode, n, &complexA, lda, &complexWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuDoubleComplex * A, int lda, cuDoubleComplex * Workspace, int Lwork, int * devInfo); + // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnZpotrf(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipDoubleComplex* A, int lda, hipDoubleComplex* work, int lwork, int* devInfo); + // CHECK: status = hipsolverDnZpotrf(handle, fillMode, n, &dComplexA, lda, &dComplexWorkspace, Lwork, &devInfo); + status = cusolverDnZpotrf(handle, fillMode, n, &dComplexA, lda, &dComplexWorkspace, Lwork, &devInfo); + #if CUDA_VERSION >= 8000 // CHECK: hipsolverEigType_t eigType; // CHECK-NEXT: hipsolverEigType_t EIG_TYPE_1 = HIPSOLVER_EIG_TYPE_1; @@ -177,28 +217,6 @@ int main() { cusolverEigRange_t EIG_RANGE_V = CUSOLVER_EIG_RANGE_V; #endif -#if CUDA_VERSION >= 10000 - // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, float * A, int lda, int * Lwork); - // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnSpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, float* A, int lda, int* lwork); - // CHECK: status = hipsolverDnSpotrf_bufferSize(handle, fillMode, n, &fA, lda, &Lwork); - status = cusolverDnSpotrf_bufferSize(handle, fillMode, n, &fA, lda, &Lwork); - - // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, double * A, int lda, int * Lwork); - // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnDpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, double* A, int lda, int* lwork); - // CHECK: status = hipsolverDnDpotrf_bufferSize(handle, fillMode, n, &dA, lda, &Lwork); - status = cusolverDnDpotrf_bufferSize(handle, fillMode, n, &dA, lda, &Lwork); - - // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuComplex * A, int lda, int * Lwork); - // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnCpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipFloatComplex* A, int lda, int* lwork); - // CHECK: status = hipsolverDnCpotrf_bufferSize(handle, fillMode, n, &complexA, lda, &Lwork); - status = cusolverDnCpotrf_bufferSize(handle, fillMode, n, &complexA, lda, &Lwork); - - // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf_bufferSize(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuDoubleComplex * A, int lda, int * Lwork); - // HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnZpotrf_bufferSize(hipsolverHandle_t handle, hipblasFillMode_t uplo, int n, hipDoubleComplex* A, int lda, int* lwork); - // CHECK: status = hipsolverDnZpotrf_bufferSize(handle, fillMode, n, &dComplexA, lda, &Lwork); - status = cusolverDnZpotrf_bufferSize(handle, fillMode, n, &dComplexA, lda, &Lwork); -#endif - #if CUDA_VERSION >= 10020 // CHECK: hipsolverStatus_t STATUS_IRS_PARAMS_INVALID = HIPSOLVER_STATUS_INVALID_VALUE; // CHECK-NEXT: hipsolverStatus_t STATUS_IRS_INTERNAL_ERROR = HIPSOLVER_STATUS_INTERNAL_ERROR; diff --git a/tests/unit_tests/synthetic/libraries/cusolver2rocsolver.cu b/tests/unit_tests/synthetic/libraries/cusolver2rocsolver.cu index 7899f676..b799e35d 100644 --- a/tests/unit_tests/synthetic/libraries/cusolver2rocsolver.cu +++ b/tests/unit_tests/synthetic/libraries/cusolver2rocsolver.cu @@ -9,12 +9,40 @@ int main() { printf("20. cuSOLVER API to rocSOLVER API synthetic test\n"); + int m = 0; + int n = 0; + int nrhs = 0; + int lda = 0; + int ldb = 0; + int Lwork = 0; + int devIpiv = 0; + int devInfo = 0; + float fA = 0.f; + float fB = 0.f; + float fX = 0.f; + double dA = 0.f; + double dB = 0.f; + double dX = 0.f; + float fWorkspace = 0.f; + double dWorkspace = 0.f; + void *Workspace = nullptr; + size_t lwork_bytes = 0; + + // CHECK: rocblas_double_complex dComplexA, dComplexB, dComplexX, dComplexWorkspace; + cuDoubleComplex dComplexA, dComplexB, dComplexX, dComplexWorkspace; + + // CHECK: rocblas_float_complex complexA, complexB, complexX, complexWorkspace; + cuComplex complexA, complexB, complexX, complexWorkspace; + // CHECK: rocblas_handle handle; cusolverDnHandle_t handle; // CHECK: hipStream_t stream_t; cudaStream_t stream_t; + // CHECK: rocblas_fill fillMode; + cublasFillMode_t fillMode; + // CHECK: rocblas_status status; // CHECK-NEXT: rocblas_status STATUS_SUCCESS = rocblas_status_success; // CHECK-NEXT: rocblas_status STATUS_NOT_INITIALIZED = rocblas_status_invalid_handle; @@ -58,6 +86,26 @@ int main() { // CHECK: status = rocblas_get_stream(handle, &stream_t); status = cusolverDnGetStream(handle, &stream_t); + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, float * A, int lda, float * Workspace, int Lwork, int * devInfo); + // ROC: ROCSOLVER_EXPORT rocblas_status rocsolver_spotrf(rocblas_handle handle, const rocblas_fill uplo, const rocblas_int n, float* A, const rocblas_int lda, rocblas_int* info); + // CHECK: status = rocsolver_spotrf(handle, fillMode, n, &fA, lda, &fWorkspace, Lwork, &devInfo); + status = cusolverDnSpotrf(handle, fillMode, n, &fA, lda, &fWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, double * A, int lda, double * Workspace, int Lwork, int * devInfo); + // ROC: ROCSOLVER_EXPORT rocblas_status rocsolver_dpotrf(rocblas_handle handle, const rocblas_fill uplo, const rocblas_int n, double* A, const rocblas_int lda, rocblas_int* info); + // CHECK: status = rocsolver_dpotrf(handle, fillMode, n, &dA, lda, &dWorkspace, Lwork, &devInfo); + status = cusolverDnDpotrf(handle, fillMode, n, &dA, lda, &dWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuComplex * A, int lda, cuComplex * Workspace, int Lwork, int * devInfo); + // ROC: ROCSOLVER_EXPORT rocblas_status rocsolver_cpotrf(rocblas_handle handle, const rocblas_fill uplo, const rocblas_int n, rocblas_float_complex* A, const rocblas_int lda, rocblas_int* info); + // CHECK: status = rocsolver_cpotrf(handle, fillMode, n, &complexA, lda, &complexWorkspace, Lwork, &devInfo); + status = cusolverDnCpotrf(handle, fillMode, n, &complexA, lda, &complexWorkspace, Lwork, &devInfo); + + // CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf(cusolverDnHandle_t handle, cublasFillMode_t uplo, int n, cuDoubleComplex * A, int lda, cuDoubleComplex * Workspace, int Lwork, int * devInfo); + // ROC: ROCSOLVER_EXPORT rocblas_status rocsolver_zpotrf(rocblas_handle handle, const rocblas_fill uplo, const rocblas_int n, rocblas_double_complex* A, const rocblas_int lda, rocblas_int* info); + // CHECK: status = rocsolver_zpotrf(handle, fillMode, n, &dComplexA, lda, &dComplexWorkspace, Lwork, &devInfo); + status = cusolverDnZpotrf(handle, fillMode, n, &dComplexA, lda, &dComplexWorkspace, Lwork, &devInfo); + #if CUDA_VERSION >= 8000 // CHECK: rocblas_eform eigType; // CHECK-NEXT: rocblas_eform EIG_TYPE_1 = rocblas_eform_ax;