Skip to content

Commit

Permalink
[HIPIFY][BLAS][6.2.0] cuBLAS support - Step 25 - 64-bit functions
Browse files Browse the repository at this point in the history
+ Updated synthetic tests, the regenerated `hipify-perl`, and `BLAS` `CUDA2HIP` documentation
  • Loading branch information
emankov committed Jul 28, 2024
1 parent a042e2a commit 92c7474
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
6 changes: 4 additions & 2 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,8 @@ my %experimental_funcs = (
"cublasDspmv_64" => "6.2.0",
"cublasDsbmv_v2_64" => "6.2.0",
"cublasDsbmv_64" => "6.2.0",
"cublasDotcEx_64" => "6.2.0",
"cublasDotEx_64" => "6.2.0",
"cublasDger_v2_64" => "6.2.0",
"cublasDger_64" => "6.2.0",
"cublasDgemv_v2_64" => "6.2.0",
Expand Down Expand Up @@ -1832,6 +1834,8 @@ sub experimentalSubstitutions {
subst("cublasDgemv_v2_64", "hipblasDgemv_64", "library");
subst("cublasDger_64", "hipblasDger_64", "library");
subst("cublasDger_v2_64", "hipblasDger_64", "library");
subst("cublasDotEx_64", "hipblasDotEx_v2_64", "library");
subst("cublasDotcEx_64", "hipblasDotcEx_v2_64", "library");
subst("cublasDsbmv_64", "hipblasDsbmv_64", "library");
subst("cublasDsbmv_v2_64", "hipblasDsbmv_64", "library");
subst("cublasDspmv_64", "hipblasDspmv_64", "library");
Expand Down Expand Up @@ -11841,8 +11845,6 @@ sub warnHipOnlyUnsupportedFunctions {
"cublasDsyr2k_64",
"cublasDsymm_v2_64",
"cublasDsymm_64",
"cublasDotcEx_64",
"cublasDotEx_64",
"cublasDmatinvBatched",
"cublasDgemm_v2_64",
"cublasDgemm_64",
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/CUBLAS_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,9 @@
|`cublasDgetrsBatched`| | | | |`hipblasDgetrsBatched`|3.5.0| | | | |
|`cublasDmatinvBatched`| | | | | | | | | | |
|`cublasDotEx`|8.0| | | |`hipblasDotEx_v2`|6.0.0| | | | |
|`cublasDotEx_64`|12.0| | | | | | | | | |
|`cublasDotEx_64`|12.0| | | |`hipblasDotEx_v2_64`|6.2.0| | | |6.2.0|
|`cublasDotcEx`|8.0| | | |`hipblasDotcEx_v2`|6.0.0| | | | |
|`cublasDotcEx_64`|12.0| | | | | | | | | |
|`cublasDotcEx_64`|12.0| | | |`hipblasDotcEx_v2_64`|6.2.0| | | |6.2.0|
|`cublasDtpttr`| | | | | | | | | | |
|`cublasDtrsmBatched`| | | | |`hipblasDtrsmBatched`|3.2.0| | | | |
|`cublasDtrsmBatched_64`|12.0| | | | | | | | | |
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/CUBLAS_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,9 @@
|`cublasDgetrsBatched`| | | | |`hipblasDgetrsBatched`|3.5.0| | | | | | | | | | |
|`cublasDmatinvBatched`| | | | | | | | | | | | | | | | |
|`cublasDotEx`|8.0| | | |`hipblasDotEx_v2`|6.0.0| | | | |`rocblas_dot_ex`|4.1.0| | | | |
|`cublasDotEx_64`|12.0| | | | | | | | | |`rocblas_dot_ex_64`|6.1.0| | | | |
|`cublasDotEx_64`|12.0| | | |`hipblasDotEx_v2_64`|6.2.0| | | |6.2.0|`rocblas_dot_ex_64`|6.1.0| | | | |
|`cublasDotcEx`|8.0| | | |`hipblasDotcEx_v2`|6.0.0| | | | |`rocblas_dotc_ex`|4.1.0| | | | |
|`cublasDotcEx_64`|12.0| | | | | | | | | |`rocblas_dotc_ex_64`|6.1.0| | | | |
|`cublasDotcEx_64`|12.0| | | |`hipblasDotcEx_v2_64`|6.2.0| | | |6.2.0|`rocblas_dotc_ex_64`|6.1.0| | | | |
|`cublasDtpttr`| | | | | | | | | | | | | | | | |
|`cublasDtrsmBatched`| | | | |`hipblasDtrsmBatched`|3.2.0| | | | |`rocblas_dtrsm_batched`|3.5.0| | | | |
|`cublasDtrsmBatched_64`|12.0| | | | | | | | | | | | | | | |
Expand Down
16 changes: 4 additions & 12 deletions src/CUDA2HIP_BLAS_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,9 @@ const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP {

// DOT
{"cublasDotEx", {"hipblasDotEx_v2", "rocblas_dot_ex", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT}},
{"cublasDotEx_64", {"hipblasDotEx_64", "rocblas_dot_ex_64", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT, HIP_UNSUPPORTED}},
{"cublasDotEx_64", {"hipblasDotEx_v2_64", "rocblas_dot_ex_64", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT, HIP_EXPERIMENTAL}},
{"cublasDotcEx", {"hipblasDotcEx_v2", "rocblas_dotc_ex", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT}},
{"cublasDotcEx_64", {"hipblasDotcEx_64", "rocblas_dotc_ex_64", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT, HIP_UNSUPPORTED}},
{"cublasDotcEx_64", {"hipblasDotcEx_v2_64", "rocblas_dotc_ex_64", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_EXT, HIP_EXPERIMENTAL}},

{"cublasSdot_v2", {"hipblasSdot", "rocblas_sdot", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LEVEL_1}},
{"cublasSdot_v2_64", {"hipblasSdot_64", "rocblas_sdot_64", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LEVEL_1}},
Expand Down Expand Up @@ -1704,22 +1704,14 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
{"hipblasDsyr2", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasSspr2", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasDspr2", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasChpr2", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasZhpr2", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasSgemm", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasDgemm", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasCgemm", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasZgemm", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasHgemm", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasSgemmBatched", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasDgemmBatched", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasHgemmBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasSgemmStridedBatched", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasDgemmStridedBatched", {HIP_1082, HIP_0, HIP_0 }},
{"hipblasCgemmBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasZgemmBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasCgemmStridedBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasZgemmStridedBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasHgemmStridedBatched", {HIP_3000, HIP_0, HIP_0 }},
{"hipblasSsyrk", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasDsyrk", {HIP_3050, HIP_0, HIP_0 }},
Expand Down Expand Up @@ -1750,8 +1742,6 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
{"hipblasDgeqrfBatched", {HIP_3050, HIP_0, HIP_0 }},
{"hipblasSdgmm", {HIP_3060, HIP_0, HIP_0 }},
{"hipblasDdgmm", {HIP_3060, HIP_0, HIP_0 }},
{"hipblasDotEx", {HIP_4010, HIP_0, HIP_0 }},
{"hipblasDotcEx", {HIP_4010, HIP_0, HIP_0 }},
{"hipblasRotEx", {HIP_4010, HIP_0, HIP_0 }},
{"hipblasScalEx", {HIP_4010, HIP_0, HIP_0 }},
{"hipblasIcamax_v2", {HIP_6000, HIP_0, HIP_0 }},
Expand Down Expand Up @@ -2033,6 +2023,8 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
{"hipblasCtrsv_v2_64", {HIP_6020, HIP_0, HIP_0, HIP_LATEST}},
{"hipblasZtrsv_v2_64", {HIP_6020, HIP_0, HIP_0, HIP_LATEST}},
{"hipblasAxpyEx_v2_64", {HIP_6020, HIP_0, HIP_0, HIP_LATEST}},
{"hipblasDotEx_v2_64", {HIP_6020, HIP_0, HIP_0, HIP_LATEST}},
{"hipblasDotcEx_v2_64", {HIP_6020, HIP_0, HIP_0, HIP_LATEST}},

{"rocblas_status_to_string", {HIP_3050, HIP_0, HIP_0 }},
{"rocblas_sscal", {HIP_1050, HIP_0, HIP_0 }},
Expand Down
14 changes: 12 additions & 2 deletions tests/unit_tests/synthetic/libraries/cublas2hipblas_v2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2783,8 +2783,18 @@ int main() {

// CUDA: CUBLASAPI cublasStatus_t CUBLASWINAPI cublasAxpyEx_64(cublasHandle_t handle, int64_t n, const void* alpha, cudaDataType alphaType, const void* x, cudaDataType xType, int64_t incx, void* y, cudaDataType yType, int64_t incy, cudaDataType executiontype);
// HIP: HIPBLAS_EXPORT hipblasStatus_t hipblasAxpyEx_v2_64(hipblasHandle_t handle, int64_t n, const void* alpha, hipDataType alphaType, const void* x, hipDataType xType, int64_t incx, void* y, hipDataType yType, int64_t incy, hipDataType executionType);
// CHECK: blasStatus = hipblasAxpyEx_v2_64(blasHandle, n, aptr, Atype, xptr, Xtype, incx_64, yptr, Ytype, incy_64, Executiontype);
blasStatus = cublasAxpyEx_64(blasHandle, n, aptr, Atype, xptr, Xtype, incx_64, yptr, Ytype, incy_64, Executiontype);
// CHECK: blasStatus = hipblasAxpyEx_v2_64(blasHandle, n_64, aptr, Atype, xptr, Xtype, incx_64, yptr, Ytype, incy_64, Executiontype);
blasStatus = cublasAxpyEx_64(blasHandle, n_64, aptr, Atype, xptr, Xtype, incx_64, yptr, Ytype, incy_64, Executiontype);

// CUDA: CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotEx_64(cublasHandle_t handle, int64_t n, const void* x, cudaDataType xType, int64_t incx, const void* y, cudaDataType yType, int64_t incy, void* result, cudaDataType resultType, cudaDataType executionType);
// HIP: HIPBLAS_EXPORT hipblasStatus_t hipblasDotEx_v2_64(hipblasHandle_t handle, int64_t n, const void* x, hipDataType xType, int64_t incx, const void* y, hipDataType yType, int64_t incy, void* result, hipDataType resultType, hipDataType executionType);
// CHECK: blasStatus = hipblasDotEx_v2_64(blasHandle, n_64, xptr, Xtype, incx_64, yptr, Ytype, incy_64, image, DataType, Executiontype);
blasStatus = cublasDotEx_64(blasHandle, n_64, xptr, Xtype, incx_64, yptr, Ytype, incy_64, image, DataType, Executiontype);

// CUDA: CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotcEx_64(cublasHandle_t handle, int64_t n, const void* x, cudaDataType xType, int64_t incx, const void* y, cudaDataType yType, int64_t incy, void* result, cudaDataType resultType, cudaDataType executionType);
// HIP: HIPBLAS_EXPORT hipblasStatus_t hipblasDotcEx_v2_64(hipblasHandle_t handle, int64_t n, const void* x, hipDataType xType, int64_t incx, const void* y, hipDataType yType, int64_t incy, void* result, hipDataType resultType, hipDataType executionType);
// CHECK: blasStatus = hipblasDotcEx_v2_64(blasHandle, n_64, xptr, Xtype, incx_64, yptr, Ytype, incy_64, image, DataType, Executiontype);
blasStatus = cublasDotcEx_64(blasHandle, n_64, xptr, Xtype, incx_64, yptr, Ytype, incy_64, image, DataType, Executiontype);
#endif

return 0;
Expand Down

0 comments on commit 92c7474

Please sign in to comment.