Skip to content

Commit

Permalink
[HIPIFY][ROCm#936][BLASLT] cublasLt -> hipblalLt hipification sup…
Browse files Browse the repository at this point in the history
…port - Step 19

+ Updated synthetic tests, the regenerated `hipify-perl`, and `BLAS` `CUDA2HIP` documentation
  • Loading branch information
emankov committed May 27, 2024
1 parent f29d5f9 commit 3dc7bdd
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -3870,10 +3870,15 @@ sub simpleSubstitutions {
subst("cublasLtCreate", "hipblasLtCreate", "library");
subst("cublasLtDestroy", "hipblasLtDestroy", "library");
subst("cublasLtMatmul", "hipblasLtMatmul", "library");
subst("cublasLtMatmulAlgoGetHeuristic", "hipblasLtMatmulAlgoGetHeuristic", "library");
subst("cublasLtMatmulDescCreate", "hipblasLtMatmulDescCreate", "library");
subst("cublasLtMatmulDescDestroy", "hipblasLtMatmulDescDestroy", "library");
subst("cublasLtMatmulDescGetAttribute", "hipblasLtMatmulDescGetAttribute", "library");
subst("cublasLtMatmulDescSetAttribute", "hipblasLtMatmulDescSetAttribute", "library");
subst("cublasLtMatmulPreferenceCreate", "hipblasLtMatmulPreferenceCreate", "library");
subst("cublasLtMatmulPreferenceDestroy", "hipblasLtMatmulPreferenceDestroy", "library");
subst("cublasLtMatmulPreferenceGetAttribute", "hipblasLtMatmulPreferenceGetAttribute", "library");
subst("cublasLtMatmulPreferenceSetAttribute", "hipblasLtMatmulPreferenceSetAttribute", "library");
subst("cublasLtMatrixLayoutCreate", "hipblasLtMatrixLayoutCreate", "library");
subst("cublasLtMatrixLayoutDestroy", "hipblasLtMatrixLayoutDestroy", "library");
subst("cublasLtMatrixLayoutGetAttribute", "hipblasLtMatrixLayoutGetAttribute", "library");
Expand Down Expand Up @@ -5469,6 +5474,7 @@ sub simpleSubstitutions {
subst("cublasLtMatmulDescAttributes_t", "hipblasLtMatmulDescAttributes_t", "type");
subst("cublasLtMatmulDescOpaque_t", "hipblasLtMatmulDescOpaque_t", "type");
subst("cublasLtMatmulDesc_t", "hipblasLtMatmulDesc_t", "type");
subst("cublasLtMatmulHeuristicResult_t", "hipblasLtMatmulHeuristicResult_t", "type");
subst("cublasLtMatmulPreferenceAttributes_t", "hipblasLtMatmulPreferenceAttributes_t", "type");
subst("cublasLtMatmulPreferenceOpaque_t", "hipblasLtMatmulPreferenceOpaque_t", "type");
subst("cublasLtMatmulPreference_t", "hipblasLtMatmulPreference_t", "type");
Expand Down Expand Up @@ -11308,6 +11314,7 @@ sub warnHipOnlyUnsupportedFunctions {
"cublasLtMatmulTile_t",
"cublasLtMatmulStages_t",
"cublasLtMatmulSearch_t",
"cublasLtMatmulPreferenceInit",
"cublasLtMatmulInnerShape_t",
"cublasLtMatmulDescInit",
"cublasLtHeuristicsCacheSetCapacity",
Expand Down Expand Up @@ -11968,14 +11975,21 @@ sub warnRocOnlyUnsupportedFunctions {
"cublasLtMatmulTile_t",
"cublasLtMatmulStages_t",
"cublasLtMatmulSearch_t",
"cublasLtMatmulPreferenceSetAttribute",
"cublasLtMatmulPreferenceInit",
"cublasLtMatmulPreferenceGetAttribute",
"cublasLtMatmulPreferenceDestroy",
"cublasLtMatmulPreferenceCreate",
"cublasLtMatmulPreferenceAttributes_t",
"cublasLtMatmulInnerShape_t",
"cublasLtMatmulHeuristicResult_t",
"cublasLtMatmulDescSetAttribute",
"cublasLtMatmulDescInit",
"cublasLtMatmulDescGetAttribute",
"cublasLtMatmulDescDestroy",
"cublasLtMatmulDescCreate",
"cublasLtMatmulDescAttributes_t",
"cublasLtMatmulAlgoGetHeuristic",
"cublasLtMatmul",
"cublasLtHeuristicsCacheSetCapacity",
"cublasLtHeuristicsCacheGetCapacity",
Expand Down
7 changes: 7 additions & 0 deletions docs/tables/CUBLAS_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
|`cublasLtMatmulDescAttributes_t`|10.1| | | |`hipblasLtMatmulDescAttributes_t`|5.5.0| | | | |
|`cublasLtMatmulDescOpaque_t`|11.0| | | |`hipblasLtMatmulDescOpaque_t`|5.5.0| | | | |
|`cublasLtMatmulDesc_t`|10.1| | | |`hipblasLtMatmulDesc_t`|5.5.0| | | | |
|`cublasLtMatmulHeuristicResult_t`|10.1| | | |`hipblasLtMatmulHeuristicResult_t`|5.5.0| | | | |
|`cublasLtMatmulInnerShape_t`|11.8| | | | | | | | | |
|`cublasLtMatmulPreferenceAttributes_t`|10.1| | | |`hipblasLtMatmulPreferenceAttributes_t`|5.5.0| | | | |
|`cublasLtMatmulPreferenceOpaque_t`|11.0| | | |`hipblasLtMatmulPreferenceOpaque_t`|5.5.0| | | | |
Expand Down Expand Up @@ -1303,11 +1304,17 @@
|`cublasLtHeuristicsCacheGetCapacity`|11.8| | | | | | | | | |
|`cublasLtHeuristicsCacheSetCapacity`|11.8| | | | | | | | | |
|`cublasLtMatmul`|10.1| | | |`hipblasLtMatmul`|5.5.0| | | | |
|`cublasLtMatmulAlgoGetHeuristic`|10.1| | | |`hipblasLtMatmulAlgoGetHeuristic`|5.5.0| | | | |
|`cublasLtMatmulDescCreate`|10.1| |11.0| |`hipblasLtMatmulDescCreate`|5.5.0| | | | |
|`cublasLtMatmulDescDestroy`|10.1| | | |`hipblasLtMatmulDescDestroy`|5.5.0| | | | |
|`cublasLtMatmulDescGetAttribute`|10.1| | | |`hipblasLtMatmulDescGetAttribute`|5.5.0| | | | |
|`cublasLtMatmulDescInit`|11.0| | | | | | | | | |
|`cublasLtMatmulDescSetAttribute`|10.1| | | |`hipblasLtMatmulDescSetAttribute`|5.5.0| | | | |
|`cublasLtMatmulPreferenceCreate`|10.1| | | |`hipblasLtMatmulPreferenceCreate`|5.5.0| | | | |
|`cublasLtMatmulPreferenceDestroy`|10.1| | | |`hipblasLtMatmulPreferenceDestroy`|5.5.0| | | | |
|`cublasLtMatmulPreferenceGetAttribute`|10.1| | | |`hipblasLtMatmulPreferenceGetAttribute`|5.5.0| | | | |
|`cublasLtMatmulPreferenceInit`|11.0| | | | | | | | | |
|`cublasLtMatmulPreferenceSetAttribute`|10.1| | | |`hipblasLtMatmulPreferenceSetAttribute`|5.5.0| | | | |
|`cublasLtMatrixLayoutCreate`|10.1| | | |`hipblasLtMatrixLayoutCreate`|5.5.0| | | | |
|`cublasLtMatrixLayoutDestroy`|10.1| | | |`hipblasLtMatrixLayoutDestroy`|5.5.0| | | | |
|`cublasLtMatrixLayoutGetAttribute`|10.1| | | |`hipblasLtMatrixLayoutGetAttribute`|5.5.0| | | | |
Expand Down
7 changes: 7 additions & 0 deletions docs/tables/CUBLAS_API_supported_by_HIP_and_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
|`cublasLtMatmulDescAttributes_t`|10.1| | | |`hipblasLtMatmulDescAttributes_t`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDescOpaque_t`|11.0| | | |`hipblasLtMatmulDescOpaque_t`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDesc_t`|10.1| | | |`hipblasLtMatmulDesc_t`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulHeuristicResult_t`|10.1| | | |`hipblasLtMatmulHeuristicResult_t`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulInnerShape_t`|11.8| | | | | | | | | | | | | | | |
|`cublasLtMatmulPreferenceAttributes_t`|10.1| | | |`hipblasLtMatmulPreferenceAttributes_t`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulPreferenceOpaque_t`|11.0| | | |`hipblasLtMatmulPreferenceOpaque_t`|5.5.0| | | | | | | | | | |
Expand Down Expand Up @@ -1303,11 +1304,17 @@
|`cublasLtHeuristicsCacheGetCapacity`|11.8| | | | | | | | | | | | | | | |
|`cublasLtHeuristicsCacheSetCapacity`|11.8| | | | | | | | | | | | | | | |
|`cublasLtMatmul`|10.1| | | |`hipblasLtMatmul`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulAlgoGetHeuristic`|10.1| | | |`hipblasLtMatmulAlgoGetHeuristic`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDescCreate`|10.1| |11.0| |`hipblasLtMatmulDescCreate`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDescDestroy`|10.1| | | |`hipblasLtMatmulDescDestroy`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDescGetAttribute`|10.1| | | |`hipblasLtMatmulDescGetAttribute`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulDescInit`|11.0| | | | | | | | | | | | | | | |
|`cublasLtMatmulDescSetAttribute`|10.1| | | |`hipblasLtMatmulDescSetAttribute`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulPreferenceCreate`|10.1| | | |`hipblasLtMatmulPreferenceCreate`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulPreferenceDestroy`|10.1| | | |`hipblasLtMatmulPreferenceDestroy`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulPreferenceGetAttribute`|10.1| | | |`hipblasLtMatmulPreferenceGetAttribute`|5.5.0| | | | | | | | | | |
|`cublasLtMatmulPreferenceInit`|11.0| | | | | | | | | | | | | | | |
|`cublasLtMatmulPreferenceSetAttribute`|10.1| | | |`hipblasLtMatmulPreferenceSetAttribute`|5.5.0| | | | | | | | | | |
|`cublasLtMatrixLayoutCreate`|10.1| | | |`hipblasLtMatrixLayoutCreate`|5.5.0| | | | | | | | | | |
|`cublasLtMatrixLayoutDestroy`|10.1| | | |`hipblasLtMatrixLayoutDestroy`|5.5.0| | | | | | | | | | |
|`cublasLtMatrixLayoutGetAttribute`|10.1| | | |`hipblasLtMatrixLayoutGetAttribute`|5.5.0| | | | | | | | | | |
Expand Down
7 changes: 7 additions & 0 deletions docs/tables/CUBLAS_API_supported_by_ROC.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
|`cublasLtMatmulDescAttributes_t`|10.1| | | | | | | | | |
|`cublasLtMatmulDescOpaque_t`|11.0| | | | | | | | | |
|`cublasLtMatmulDesc_t`|10.1| | | | | | | | | |
|`cublasLtMatmulHeuristicResult_t`|10.1| | | | | | | | | |
|`cublasLtMatmulInnerShape_t`|11.8| | | | | | | | | |
|`cublasLtMatmulPreferenceAttributes_t`|10.1| | | | | | | | | |
|`cublasLtMatmulPreferenceOpaque_t`|11.0| | | | | | | | | |
Expand Down Expand Up @@ -1303,11 +1304,17 @@
|`cublasLtHeuristicsCacheGetCapacity`|11.8| | | | | | | | | |
|`cublasLtHeuristicsCacheSetCapacity`|11.8| | | | | | | | | |
|`cublasLtMatmul`|10.1| | | | | | | | | |
|`cublasLtMatmulAlgoGetHeuristic`|10.1| | | | | | | | | |
|`cublasLtMatmulDescCreate`|10.1| |11.0| | | | | | | |
|`cublasLtMatmulDescDestroy`|10.1| | | | | | | | | |
|`cublasLtMatmulDescGetAttribute`|10.1| | | | | | | | | |
|`cublasLtMatmulDescInit`|11.0| | | | | | | | | |
|`cublasLtMatmulDescSetAttribute`|10.1| | | | | | | | | |
|`cublasLtMatmulPreferenceCreate`|10.1| | | | | | | | | |
|`cublasLtMatmulPreferenceDestroy`|10.1| | | | | | | | | |
|`cublasLtMatmulPreferenceGetAttribute`|10.1| | | | | | | | | |
|`cublasLtMatmulPreferenceInit`|11.0| | | | | | | | | |
|`cublasLtMatmulPreferenceSetAttribute`|10.1| | | | | | | | | |
|`cublasLtMatrixLayoutCreate`|10.1| | | | | | | | | |
|`cublasLtMatrixLayoutDestroy`|10.1| | | | | | | | | |
|`cublasLtMatrixLayoutGetAttribute`|10.1| | | | | | | | | |
Expand Down
17 changes: 17 additions & 0 deletions src/CUDA2HIP_BLAS_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,12 @@ const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP {
{"cublasLtMatrixTransformDescDestroy", {"hipblasLtMatrixTransformDescDestroy", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatrixTransformDescSetAttribute", {"hipblasLtMatrixTransformDescSetAttribute", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatrixTransformDescGetAttribute", {"hipblasLtMatrixTransformDescGetAttribute", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatmulPreferenceInit", {"hipblasLtMatmulPreferenceInit", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, UNSUPPORTED}},
{"cublasLtMatmulPreferenceCreate", {"hipblasLtMatmulPreferenceCreate", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatmulPreferenceDestroy", {"hipblasLtMatmulPreferenceDestroy", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatmulPreferenceSetAttribute", {"hipblasLtMatmulPreferenceSetAttribute", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatmulPreferenceGetAttribute", {"hipblasLtMatmulPreferenceGetAttribute", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
{"cublasLtMatmulAlgoGetHeuristic", {"hipblasLtMatmulAlgoGetHeuristic", "", CONV_LIB_FUNC, API_BLAS, SEC::BLAS_LT, ROC_UNSUPPORTED}},
};

const std::map<llvm::StringRef, cudaAPIversions> CUDA_BLAS_FUNCTION_VER_MAP {
Expand Down Expand Up @@ -1587,6 +1593,12 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_BLAS_FUNCTION_VER_MAP {
{"cublasLtMatrixTransformDescDestroy", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatrixTransformDescSetAttribute", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatrixTransformDescGetAttribute", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatmulPreferenceInit", {CUDA_110, CUDA_0, CUDA_0 }}, // A: CUDA_VERSION 11001, CUBLAS_VERSION 11000, CUBLAS_VER_MAJOR 11 CUBLAS_VER_MINOR 0
{"cublasLtMatmulPreferenceCreate", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatmulPreferenceDestroy", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatmulPreferenceSetAttribute", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatmulPreferenceGetAttribute", {CUDA_101, CUDA_0, CUDA_0 }},
{"cublasLtMatmulAlgoGetHeuristic", {CUDA_101, CUDA_0, CUDA_0 }},
};

const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
Expand Down Expand Up @@ -2005,6 +2017,11 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_FUNCTION_VER_MAP {
{"hipblasLtMatrixTransformDescDestroy", {HIP_6000, HIP_0, HIP_0 }},
{"hipblasLtMatrixTransformDescSetAttribute", {HIP_6000, HIP_0, HIP_0 }},
{"hipblasLtMatrixTransformDescGetAttribute", {HIP_6000, HIP_0, HIP_0 }},
{"hipblasLtMatmulPreferenceCreate", {HIP_5050, HIP_0, HIP_0 }},
{"hipblasLtMatmulPreferenceDestroy", {HIP_5050, HIP_0, HIP_0 }},
{"hipblasLtMatmulPreferenceSetAttribute", {HIP_5050, HIP_0, HIP_0 }},
{"hipblasLtMatmulPreferenceGetAttribute", {HIP_5050, HIP_0, HIP_0 }},
{"hipblasLtMatmulAlgoGetHeuristic", {HIP_5050, HIP_0, HIP_0 }},

{"rocblas_status_to_string", {HIP_3050, HIP_0, HIP_0 }},
{"rocblas_sscal", {HIP_1050, HIP_0, HIP_0 }},
Expand Down
3 changes: 3 additions & 0 deletions src/CUDA2HIP_BLAS_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_TYPE_NAME_MAP {
{"CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_D_BYTES", {"HIPBLASLT_MATMUL_PREF_MIN_ALIGNMENT_D_BYTES", "", CONV_TYPE, API_BLAS, SEC::BLAS_LT_DATA_TYPES, UNSUPPORTED}},
{"CUBLASLT_MATMUL_PREF_MAX_WAVES_COUNT", {"HIPBLASLT_MATMUL_PREF_MAX_WAVES_COUNT", "", CONV_TYPE, API_BLAS, SEC::BLAS_LT_DATA_TYPES, UNSUPPORTED}},
{"CUBLASLT_MATMUL_PREF_IMPL_MASK", {"HIPBLASLT_MATMUL_PREF_IMPL_MASK", "", CONV_TYPE, API_BLAS, SEC::BLAS_LT_DATA_TYPES, UNSUPPORTED}},
{"cublasLtMatmulHeuristicResult_t", {"hipblasLtMatmulHeuristicResult_t", "", CONV_TYPE, API_BLAS, SEC::BLAS_LT_DATA_TYPES, ROC_UNSUPPORTED}},
};

const std::map<llvm::StringRef, cudaAPIversions> CUDA_BLAS_TYPE_NAME_VER_MAP {
Expand Down Expand Up @@ -833,6 +834,7 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_BLAS_TYPE_NAME_VER_MAP {
{"CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_D_BYTES", {CUDA_101, CUDA_0, CUDA_0 }},
{"CUBLASLT_MATMUL_PREF_MAX_WAVES_COUNT", {CUDA_101, CUDA_0, CUDA_0 }},
{"CUBLASLT_MATMUL_PREF_IMPL_MASK", {CUDA_110, CUDA_0, CUDA_0 }}, // A: CUDA_VERSION 11001, CUBLAS_VERSION 11000, CUBLAS_VER_MAJOR 11 CUBLAS_VER_MINOR 0
{"cublasLtMatmulHeuristicResult_t", {CUDA_101, CUDA_0, CUDA_0 }},
};

const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_TYPE_NAME_VER_MAP {
Expand Down Expand Up @@ -980,6 +982,7 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_BLAS_TYPE_NAME_VER_MAP {
{"hipblasLtMatmulPreferenceAttributes_t", {HIP_5050, HIP_0, HIP_0 }},
{"HIPBLASLT_MATMUL_PREF_SEARCH_MODE", {HIP_5050, HIP_0, HIP_0 }},
{"HIPBLASLT_MATMUL_PREF_MAX_WORKSPACE_BYTES", {HIP_5050, HIP_0, HIP_0 }},
{"hipblasLtMatmulHeuristicResult_t", {HIP_5050, HIP_0, HIP_0 }},

{"rocblas_handle", {HIP_1050, HIP_0, HIP_0 }},
{"_rocblas_handle", {HIP_1050, HIP_0, HIP_0 }},
Expand Down
Loading

0 comments on commit 3dc7bdd

Please sign in to comment.