Skip to content

Commit

Permalink
Merge pull request #958 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][rocBLAS][5.7.0] Sync with `rocBLAS` 5.7.0
  • Loading branch information
emankov authored Jul 17, 2023
2 parents 4580f50 + 8ed6d8a commit 6eccfb7
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 31 deletions.
13 changes: 7 additions & 6 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ sub rocSubstitutions {
subst("cublasGemmEx", "rocblas_gemm_ex", "library");
subst("cublasGemmStridedBatchedEx", "rocblas_gemm_strided_batched_ex", "library");
subst("cublasGetAtomicsMode", "rocblas_get_atomics_mode", "library");
subst("cublasGetMathMode", "rocblas_get_math_mode", "library");
subst("cublasGetMatrix", "rocblas_get_matrix", "library");
subst("cublasGetMatrixAsync", "rocblas_get_matrix_async", "library");
subst("cublasGetPointerMode", "rocblas_get_pointer_mode", "library");
Expand Down Expand Up @@ -1219,6 +1220,7 @@ sub rocSubstitutions {
subst("cublasSdot", "rocblas_sdot", "library");
subst("cublasSdot_v2", "rocblas_sdot", "library");
subst("cublasSetAtomicsMode", "rocblas_set_atomics_mode", "library");
subst("cublasSetMathMode", "rocblas_set_math_mode", "library");
subst("cublasSetMatrix", "rocblas_set_matrix", "library");
subst("cublasSetMatrixAsync", "rocblas_set_matrix_async", "library");
subst("cublasSetPointerMode", "rocblas_set_pointer_mode", "library");
Expand Down Expand Up @@ -1563,12 +1565,14 @@ sub rocSubstitutions {
subst("cuDoubleComplex", "rocblas_double_complex", "type");
subst("cuFloatComplex", "rocblas_float_complex", "type");
subst("cublasAtomicsMode_t", "rocblas_atomics_mode", "type");
subst("cublasComputeType_t", "rocblas_computetype", "type");
subst("cublasContext", "_rocblas_handle", "type");
subst("cublasDataType_t", "rocblas_datatype", "type");
subst("cublasDiagType_t", "rocblas_diagonal", "type");
subst("cublasFillMode_t", "rocblas_fill", "type");
subst("cublasGemmAlgo_t", "rocblas_gemm_algo", "type");
subst("cublasHandle_t", "rocblas_handle", "type");
subst("cublasMath_t", "rocblas_math_mode", "type");
subst("cublasOperation_t", "rocblas_operation", "type");
subst("cublasPointerMode_t", "rocblas_pointer_mode", "type");
subst("cublasSideMode_t", "rocblas_side", "type");
Expand Down Expand Up @@ -1656,6 +1660,8 @@ sub rocSubstitutions {
subst("pruneInfo_t", "rocsparse_mat_info", "type");
subst("CUBLAS_ATOMICS_ALLOWED", "rocblas_atomics_allowed", "numeric_literal");
subst("CUBLAS_ATOMICS_NOT_ALLOWED", "rocblas_atomics_not_allowed", "numeric_literal");
subst("CUBLAS_COMPUTE_32F", "rocblas_compute_type_f32", "numeric_literal");
subst("CUBLAS_DEFAULT_MATH", "rocblas_default_math", "numeric_literal");
subst("CUBLAS_DIAG_NON_UNIT", "rocblas_diagonal_non_unit", "numeric_literal");
subst("CUBLAS_DIAG_UNIT", "rocblas_diagonal_unit", "numeric_literal");
subst("CUBLAS_FILL_MODE_FULL", "rocblas_fill_full", "numeric_literal");
Expand All @@ -1680,6 +1686,7 @@ sub rocSubstitutions {
subst("CUBLAS_STATUS_NOT_INITIALIZED", "rocblas_status_invalid_handle", "numeric_literal");
subst("CUBLAS_STATUS_NOT_SUPPORTED", "rocblas_status_perf_degraded", "numeric_literal");
subst("CUBLAS_STATUS_SUCCESS", "rocblas_status_success", "numeric_literal");
subst("CUBLAS_TF32_TENSOR_OP_MATH", "rocblas_xf32_xdl_math_op", "numeric_literal");
subst("CUDA_C_16BF", "rocblas_datatype_bf16_c", "numeric_literal");
subst("CUDA_C_16F", "rocblas_datatype_f16_c", "numeric_literal");
subst("CUDA_C_32F", "rocblas_datatype_f32_c", "numeric_literal");
Expand Down Expand Up @@ -9578,7 +9585,6 @@ sub warnRocOnlyUnsupportedFunctions {
"cublasSetSmCountTarget",
"cublasSetMatrix_64",
"cublasSetMatrixAsync_64",
"cublasSetMathMode",
"cublasSetLoggerCallback",
"cublasSetKernelStream",
"cublasSdot_v2_64",
Expand All @@ -9602,7 +9608,6 @@ sub warnRocOnlyUnsupportedFunctions {
"cublasRotEx_64",
"cublasNrm2Ex_64",
"cublasMigrateComputeType",
"cublasMath_t",
"cublasLoggerConfigure",
"cublasLogCallback",
"cublasIzamin_v2_64",
Expand Down Expand Up @@ -9645,7 +9650,6 @@ sub warnRocOnlyUnsupportedFunctions {
"cublasGetProperty",
"cublasGetMatrix_64",
"cublasGetMatrixAsync_64",
"cublasGetMathMode",
"cublasGetLoggerCallback",
"cublasGetError",
"cublasGetCudartVersion",
Expand Down Expand Up @@ -9872,7 +9876,6 @@ sub warnRocOnlyUnsupportedFunctions {
"CUDA_C_4I",
"CUDA_C_16U",
"CUDA_C_16I",
"CUBLAS_TF32_TENSOR_OP_MATH",
"CUBLAS_TENSOR_OP_MATH",
"CUBLAS_STATUS_LICENSE_ERROR",
"CUBLAS_PEDANTIC_MATH",
Expand Down Expand Up @@ -9920,7 +9923,6 @@ sub warnRocOnlyUnsupportedFunctions {
"CUBLAS_GEMM_ALGO1",
"CUBLAS_GEMM_ALGO0_TENSOR_OP",
"CUBLAS_GEMM_ALGO0",
"CUBLAS_DEFAULT_MATH",
"CUBLAS_COMPUTE_64F_PEDANTIC",
"CUBLAS_COMPUTE_64F",
"CUBLAS_COMPUTE_32I_PEDANTIC",
Expand All @@ -9929,7 +9931,6 @@ sub warnRocOnlyUnsupportedFunctions {
"CUBLAS_COMPUTE_32F_FAST_TF32",
"CUBLAS_COMPUTE_32F_FAST_16F",
"CUBLAS_COMPUTE_32F_FAST_16BF",
"CUBLAS_COMPUTE_32F",
"CUBLAS_COMPUTE_16F_PEDANTIC",
"CUBLAS_COMPUTE_16F"
)
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/CUBLAS_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
|`cublasSetAtomicsMode`| | | |`hipblasSetAtomicsMode`|3.10.0| | | |
|`cublasSetKernelStream`| | | | | | | | |
|`cublasSetLoggerCallback`|9.2| | | | | | | |
|`cublasSetMathMode`| | | | | | | | |
|`cublasSetMathMode`|9.0| | | | | | | |
|`cublasSetMatrix`| | | |`hipblasSetMatrix`|1.8.2| | | |
|`cublasSetMatrixAsync`| | | |`hipblasSetMatrixAsync`|3.7.0| | | |
|`cublasSetMatrixAsync_64`|12.0| | | | | | | |
Expand Down
14 changes: 7 additions & 7 deletions docs/tables/CUBLAS_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
|`CUBLAS_ATOMICS_NOT_ALLOWED`| | | |`HIPBLAS_ATOMICS_NOT_ALLOWED`|3.10.0| | | |`rocblas_atomics_not_allowed`|3.8.0| | | |
|`CUBLAS_COMPUTE_16F`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_16F_PEDANTIC`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_32F`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_32F`|11.0| | | | | | | |`rocblas_compute_type_f32`|5.7.0| | | |
|`CUBLAS_COMPUTE_32F_FAST_16BF`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_32F_FAST_16F`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_32F_FAST_TF32`|11.0| | | | | | | | | | | | |
Expand All @@ -17,7 +17,7 @@
|`CUBLAS_COMPUTE_32I_PEDANTIC`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_64F`|11.0| | | | | | | | | | | | |
|`CUBLAS_COMPUTE_64F_PEDANTIC`|11.0| | | | | | | | | | | | |
|`CUBLAS_DEFAULT_MATH`|9.0| | | | | | | | | | | | |
|`CUBLAS_DEFAULT_MATH`|9.0| | | | | | | |`rocblas_default_math`|5.7.0| | | |
|`CUBLAS_DIAG_NON_UNIT`| | | |`HIPBLAS_DIAG_NON_UNIT`|1.8.2| | | |`rocblas_diagonal_non_unit`|1.5.0| | | |
|`CUBLAS_DIAG_UNIT`| | | |`HIPBLAS_DIAG_UNIT`|1.8.2| | | |`rocblas_diagonal_unit`|1.5.0| | | |
|`CUBLAS_FILL_MODE_FULL`|10.1| | |`HIPBLAS_FILL_MODE_FULL`|1.8.2| | | |`rocblas_fill_full`|1.5.0| | | |
Expand Down Expand Up @@ -89,16 +89,16 @@
|`CUBLAS_STATUS_NOT_SUPPORTED`| | | |`HIPBLAS_STATUS_NOT_SUPPORTED`|1.8.2| | | |`rocblas_status_perf_degraded`|3.5.0| | | |
|`CUBLAS_STATUS_SUCCESS`| | | |`HIPBLAS_STATUS_SUCCESS`|1.8.2| | | |`rocblas_status_success`|1.5.0| | | |
|`CUBLAS_TENSOR_OP_MATH`|9.0|11.0| | | | | | | | | | | |
|`CUBLAS_TF32_TENSOR_OP_MATH`|11.0| | | | | | | | | | | | |
|`CUBLAS_TF32_TENSOR_OP_MATH`|11.0| | | | | | | |`rocblas_xf32_xdl_math_op`|5.7.0| | | |
|`cublasAtomicsMode_t`| | | |`hipblasAtomicsMode_t`|3.10.0| | | |`rocblas_atomics_mode`|3.8.0| | | |
|`cublasComputeType_t`|11.0| | |`hipblasDatatype_t`|1.8.2| | | | | | | | |
|`cublasComputeType_t`|11.0| | |`hipblasDatatype_t`|1.8.2| | | |`rocblas_computetype`|5.7.0| | | |
|`cublasContext`| | | | | | | | |`_rocblas_handle`|1.5.0| | | |
|`cublasDataType_t`|7.5| | |`hipblasDatatype_t`|1.8.2| | | |`rocblas_datatype`|1.8.2| | | |
|`cublasDiagType_t`| | | |`hipblasDiagType_t`|1.8.2| | | |`rocblas_diagonal`|1.5.0| | | |
|`cublasFillMode_t`| | | |`hipblasFillMode_t`|1.8.2| | | |`rocblas_fill`|1.5.0| | | |
|`cublasGemmAlgo_t`|8.0| | |`hipblasGemmAlgo_t`|1.8.2| | | |`rocblas_gemm_algo`|1.8.2| | | |
|`cublasHandle_t`| | | |`hipblasHandle_t`|3.0.0| | | |`rocblas_handle`|1.5.0| | | |
|`cublasMath_t`|9.0| | | | | | | | | | | | |
|`cublasMath_t`|9.0| | | | | | | |`rocblas_math_mode`|5.7.0| | | |
|`cublasOperation_t`| | | |`hipblasOperation_t`|1.8.2| | | |`rocblas_operation`|1.5.0| | | |
|`cublasPointerMode_t`| | | |`hipblasPointerMode_t`|1.8.2| | | |`rocblas_pointer_mode`|1.6.0| | | |
|`cublasSideMode_t`| | | |`hipblasSideMode_t`|1.8.2| | | |`rocblas_side`|1.5.0| | | |
Expand Down Expand Up @@ -156,7 +156,7 @@
|`cublasGetCudartVersion`|10.1| | | | | | | | | | | | |
|`cublasGetError`| | | | | | | | | | | | | |
|`cublasGetLoggerCallback`|9.2| | | | | | | | | | | | |
|`cublasGetMathMode`|9.0| | | | | | | | | | | | |
|`cublasGetMathMode`|9.0| | | | | | | |`rocblas_get_math_mode`|5.7.0| | | |
|`cublasGetMatrix`| | | |`hipblasGetMatrix`|1.8.2| | | |`rocblas_get_matrix`|1.6.0| | | |
|`cublasGetMatrixAsync`| | | |`hipblasGetMatrixAsync`|3.7.0| | | |`rocblas_get_matrix_async`|3.5.0| | | |
|`cublasGetMatrixAsync_64`|12.0| | | | | | | | | | | | |
Expand All @@ -182,7 +182,7 @@
|`cublasSetAtomicsMode`| | | |`hipblasSetAtomicsMode`|3.10.0| | | |`rocblas_set_atomics_mode`|3.8.0| | | |
|`cublasSetKernelStream`| | | | | | | | | | | | | |
|`cublasSetLoggerCallback`|9.2| | | | | | | | | | | | |
|`cublasSetMathMode`| | | | | | | | | | | | | |
|`cublasSetMathMode`|9.0| | | | | | | |`rocblas_set_math_mode`|5.7.0| | | |
|`cublasSetMatrix`| | | |`hipblasSetMatrix`|1.8.2| | | |`rocblas_set_matrix`|1.6.0| | | |
|`cublasSetMatrixAsync`| | | |`hipblasSetMatrixAsync`|3.7.0| | | |`rocblas_set_matrix_async`|3.5.0| | | |
|`cublasSetMatrixAsync_64`|12.0| | | | | | | | | | | | |
Expand Down
14 changes: 7 additions & 7 deletions docs/tables/CUBLAS_API_supported_by_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
|`CUBLAS_ATOMICS_NOT_ALLOWED`| | | |`rocblas_atomics_not_allowed`|3.8.0| | | |
|`CUBLAS_COMPUTE_16F`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_16F_PEDANTIC`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_32F`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_32F`|11.0| | |`rocblas_compute_type_f32`|5.7.0| | | |
|`CUBLAS_COMPUTE_32F_FAST_16BF`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_32F_FAST_16F`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_32F_FAST_TF32`|11.0| | | | | | | |
Expand All @@ -17,7 +17,7 @@
|`CUBLAS_COMPUTE_32I_PEDANTIC`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_64F`|11.0| | | | | | | |
|`CUBLAS_COMPUTE_64F_PEDANTIC`|11.0| | | | | | | |
|`CUBLAS_DEFAULT_MATH`|9.0| | | | | | | |
|`CUBLAS_DEFAULT_MATH`|9.0| | |`rocblas_default_math`|5.7.0| | | |
|`CUBLAS_DIAG_NON_UNIT`| | | |`rocblas_diagonal_non_unit`|1.5.0| | | |
|`CUBLAS_DIAG_UNIT`| | | |`rocblas_diagonal_unit`|1.5.0| | | |
|`CUBLAS_FILL_MODE_FULL`|10.1| | |`rocblas_fill_full`|1.5.0| | | |
Expand Down Expand Up @@ -89,16 +89,16 @@
|`CUBLAS_STATUS_NOT_SUPPORTED`| | | |`rocblas_status_perf_degraded`|3.5.0| | | |
|`CUBLAS_STATUS_SUCCESS`| | | |`rocblas_status_success`|1.5.0| | | |
|`CUBLAS_TENSOR_OP_MATH`|9.0|11.0| | | | | | |
|`CUBLAS_TF32_TENSOR_OP_MATH`|11.0| | | | | | | |
|`CUBLAS_TF32_TENSOR_OP_MATH`|11.0| | |`rocblas_xf32_xdl_math_op`|5.7.0| | | |
|`cublasAtomicsMode_t`| | | |`rocblas_atomics_mode`|3.8.0| | | |
|`cublasComputeType_t`|11.0| | | | | | | |
|`cublasComputeType_t`|11.0| | |`rocblas_computetype`|5.7.0| | | |
|`cublasContext`| | | |`_rocblas_handle`|1.5.0| | | |
|`cublasDataType_t`|7.5| | |`rocblas_datatype`|1.8.2| | | |
|`cublasDiagType_t`| | | |`rocblas_diagonal`|1.5.0| | | |
|`cublasFillMode_t`| | | |`rocblas_fill`|1.5.0| | | |
|`cublasGemmAlgo_t`|8.0| | |`rocblas_gemm_algo`|1.8.2| | | |
|`cublasHandle_t`| | | |`rocblas_handle`|1.5.0| | | |
|`cublasMath_t`|9.0| | | | | | | |
|`cublasMath_t`|9.0| | |`rocblas_math_mode`|5.7.0| | | |
|`cublasOperation_t`| | | |`rocblas_operation`|1.5.0| | | |
|`cublasPointerMode_t`| | | |`rocblas_pointer_mode`|1.6.0| | | |
|`cublasSideMode_t`| | | |`rocblas_side`|1.5.0| | | |
Expand Down Expand Up @@ -156,7 +156,7 @@
|`cublasGetCudartVersion`|10.1| | | | | | | |
|`cublasGetError`| | | | | | | | |
|`cublasGetLoggerCallback`|9.2| | | | | | | |
|`cublasGetMathMode`|9.0| | | | | | | |
|`cublasGetMathMode`|9.0| | |`rocblas_get_math_mode`|5.7.0| | | |
|`cublasGetMatrix`| | | |`rocblas_get_matrix`|1.6.0| | | |
|`cublasGetMatrixAsync`| | | |`rocblas_get_matrix_async`|3.5.0| | | |
|`cublasGetMatrixAsync_64`|12.0| | | | | | | |
Expand All @@ -182,7 +182,7 @@
|`cublasSetAtomicsMode`| | | |`rocblas_set_atomics_mode`|3.8.0| | | |
|`cublasSetKernelStream`| | | | | | | | |
|`cublasSetLoggerCallback`|9.2| | | | | | | |
|`cublasSetMathMode`| | | | | | | | |
|`cublasSetMathMode`|9.0| | |`rocblas_set_math_mode`|5.7.0| | | |
|`cublasSetMatrix`| | | |`rocblas_set_matrix`|1.6.0| | | |
|`cublasSetMatrixAsync`| | | |`rocblas_set_matrix_async`|3.5.0| | | |
|`cublasSetMatrixAsync_64`|12.0| | | | | | | |
Expand Down
7 changes: 5 additions & 2 deletions src/CUDA2HIP_BLAS_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP {
{"cublasSetKernelStream", {"hipblasSetKernelStream", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
{"cublasGetAtomicsMode", {"hipblasGetAtomicsMode", "rocblas_get_atomics_mode", CONV_LIB_FUNC, API_BLAS, 4}},
{"cublasSetAtomicsMode", {"hipblasSetAtomicsMode", "rocblas_set_atomics_mode", CONV_LIB_FUNC, API_BLAS, 4}},
{"cublasGetMathMode", {"hipblasGetMathMode", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
{"cublasSetMathMode", {"hipblasSetMathMode", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
{"cublasGetMathMode", {"hipblasGetMathMode", "rocblas_get_math_mode", CONV_LIB_FUNC, API_BLAS, 4, HIP_UNSUPPORTED}},
{"cublasSetMathMode", {"hipblasSetMathMode", "rocblas_set_math_mode", CONV_LIB_FUNC, API_BLAS, 4, HIP_UNSUPPORTED}},
{"cublasMigrateComputeType", {"hipblasMigrateComputeType", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
{"cublasGetSmCountTarget", {"hipblasGetSmCountTarget", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
{"cublasSetSmCountTarget", {"hipblasSetSmCountTarget", "", CONV_LIB_FUNC, API_BLAS, 4, UNSUPPORTED}},
Expand Down Expand Up @@ -1075,6 +1075,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP {

const std::map<llvm::StringRef, cudaAPIversions> CUDA_BLAS_FUNCTION_VER_MAP {
{"cublasGetMathMode", {CUDA_90, CUDA_0, CUDA_0}},
{"cublasSetMathMode", {CUDA_90, CUDA_0, CUDA_0}},
{"cublasMigrateComputeType", {CUDA_110, CUDA_0, CUDA_0}},
{"cublasLogCallback", {CUDA_92, CUDA_0, CUDA_0}},
{"cublasLoggerConfigure", {CUDA_92, CUDA_0, CUDA_0}},
Expand Down Expand Up @@ -1962,6 +1963,8 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
{"hipblasDgelsBatched", {HIP_5040, HIP_0, HIP_0 }},
{"hipblasCgelsBatched", {HIP_5040, HIP_0, HIP_0 }},
{"hipblasZgelsBatched", {HIP_5040, HIP_0, HIP_0 }},
{"rocblas_get_math_mode", {HIP_5070, HIP_0, HIP_0 }},
{"rocblas_set_math_mode", {HIP_5070, HIP_0, HIP_0 }},
};

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

0 comments on commit 6eccfb7

Please sign in to comment.