Skip to content

Commit

Permalink
Merge pull request #1755 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][Tensor][feature][hipify] Enable hipify-perl support for `cuTensor`
  • Loading branch information
emankov authored Nov 18, 2024
2 parents d73d7bc + 00918ed commit 1496b69
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
21 changes: 21 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -6193,6 +6193,7 @@ sub simpleSubstitutions {
subst("cusolverSp_LOWLEVEL_PREVIEW.h", "hipsolver.h", "include_cuda_main_header");
subst("cusolver_common.h", "hipsolver.h", "include_cuda_main_header");
subst("cusparse.h", "hipsparse.h", "include_cuda_main_header");
subst("cutensor.h", "hiptensor.h", "include_cuda_main_header");
subst("nvrtc.h", "hiprtc.h", "include_cuda_main_header");
subst("cublas_v2.h", "hipblas.h", "include_cuda_main_header_v2");
subst("cusparse_v2.h", "hipsparse.h", "include_cuda_main_header_v2");
Expand Down Expand Up @@ -6782,6 +6783,7 @@ sub simpleSubstitutions {
subst("cusparseSpVecDescr_t", "hipsparseSpVecDescr_t", "type");
subst("cusparseSparseToDenseAlg_t", "hipsparseSparseToDenseAlg_t", "type");
subst("cusparseStatus_t", "hipsparseStatus_t", "type");
subst("cutensorStatus_t", "hiptensorStatus_t", "type");
subst("gesvdjInfo_t", "hipsolverGesvdjInfo_t", "type");
subst("nvrtcProgram", "hiprtcProgram", "type");
subst("nvrtcResult", "hiprtcResult", "type");
Expand Down Expand Up @@ -7279,6 +7281,21 @@ sub simpleSubstitutions {
subst("CUSPARSE_STATUS_NOT_SUPPORTED", "HIPSPARSE_STATUS_NOT_SUPPORTED", "numeric_literal");
subst("CUSPARSE_STATUS_SUCCESS", "HIPSPARSE_STATUS_SUCCESS", "numeric_literal");
subst("CUSPARSE_STATUS_ZERO_PIVOT", "HIPSPARSE_STATUS_ZERO_PIVOT", "numeric_literal");
subst("CUTENSOR_STATUS_ALLOC_FAILED", "HIPTENSOR_STATUS_ALLOC_FAILED", "numeric_literal");
subst("CUTENSOR_STATUS_ARCH_MISMATCH", "HIPTENSOR_STATUS_ARCH_MISMATCH", "numeric_literal");
subst("CUTENSOR_STATUS_CUBLAS_ERROR", "", "numeric_literal");
subst("CUTENSOR_STATUS_CUDA_ERROR", "", "numeric_literal");
subst("CUTENSOR_STATUS_EXECUTION_FAILED", "HIPTENSOR_STATUS_EXECUTION_FAILED", "numeric_literal");
subst("CUTENSOR_STATUS_INSUFFICIENT_DRIVER", "HIPTENSOR_STATUS_INSUFFICIENT_DRIVER", "numeric_literal");
subst("CUTENSOR_STATUS_INSUFFICIENT_WORKSPACE", "HIPTENSOR_STATUS_INSUFFICIENT_WORKSPACE", "numeric_literal");
subst("CUTENSOR_STATUS_INTERNAL_ERROR", "HIPTENSOR_STATUS_INTERNAL_ERROR", "numeric_literal");
subst("CUTENSOR_STATUS_INVALID_VALUE", "HIPTENSOR_STATUS_INVALID_VALUE", "numeric_literal");
subst("CUTENSOR_STATUS_IO_ERROR", "HIPTENSOR_STATUS_IO_ERROR", "numeric_literal");
subst("CUTENSOR_STATUS_LICENSE_ERROR", "", "numeric_literal");
subst("CUTENSOR_STATUS_MAPPING_ERROR", "", "numeric_literal");
subst("CUTENSOR_STATUS_NOT_INITIALIZED", "HIPTENSOR_STATUS_NOT_INITIALIZED", "numeric_literal");
subst("CUTENSOR_STATUS_NOT_SUPPORTED", "HIPTENSOR_STATUS_NOT_SUPPORTED", "numeric_literal");
subst("CUTENSOR_STATUS_SUCCESS", "HIPTENSOR_STATUS_SUCCESS", "numeric_literal");
subst("CU_ACCESS_PROPERTY_NORMAL", "hipAccessPropertyNormal", "numeric_literal");
subst("CU_ACCESS_PROPERTY_PERSISTING", "hipAccessPropertyPersisting", "numeric_literal");
subst("CU_ACCESS_PROPERTY_STREAMING", "hipAccessPropertyStreaming", "numeric_literal");
Expand Down Expand Up @@ -11219,6 +11236,8 @@ sub warnHipOnlyUnsupportedFunctions {
my $line_num = shift;
my $k = 0;
foreach $func (
"cutensorOperator_t",
"cutensorDataType_t",
"cusparseZhybsv_solve",
"cusparseZhybsv_analysis",
"cusparseZhyb2dense",
Expand Down Expand Up @@ -13354,6 +13373,8 @@ sub warnRocOnlyUnsupportedFunctions {
my $line_num = shift;
my $k = 0;
foreach $func (
"cutensorOperator_t",
"cutensorDataType_t",
"cusparseZhybsv_solve",
"cusparseZhybsv_analysis",
"cusparseZhyb2dense",
Expand Down
4 changes: 2 additions & 2 deletions src/CUDA2HIP_Perl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ namespace perl {
for (auto ma = CUDA_RENAMES_MAP().rbegin(); ma != CUDA_RENAMES_MAP().rend(); ++ma) {
TranslateToRoc = false;
if (Statistics::isUnsupported(ma->second)) {
if (ma->second.apiType == API_BLAS || ma->second.apiType == API_SPARSE || ma->second.apiType == API_RAND || ma->second.apiType == API_DNN) {
if (ma->second.apiType == API_BLAS || ma->second.apiType == API_SPARSE || ma->second.apiType == API_RAND || ma->second.apiType == API_DNN || ma->second.apiType == API_TENSOR) {
sHipUnsupported << (countHipOnlyUnsupported ? ",\n" : "") << tab_2 << "\"" << ma->first.str() << "\"";
countHipOnlyUnsupported++;
} else {
Expand All @@ -607,7 +607,7 @@ namespace perl {
}
TranslateToRoc = true;
if (Statistics::isUnsupported(ma->second)) {
if (ma->second.apiType == API_BLAS || ma->second.apiType == API_SPARSE || ma->second.apiType == API_RAND || ma->second.apiType == API_DNN) {
if (ma->second.apiType == API_BLAS || ma->second.apiType == API_SPARSE || ma->second.apiType == API_RAND || ma->second.apiType == API_DNN || ma->second.apiType == API_TENSOR) {
sRocUnsupported << (countRocOnlyUnsupported ? ",\n" : "") << tab_2 << "\"" << ma->first.str() << "\"";
countRocOnlyUnsupported++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/CUDA2HIP_TENSOR_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_TENSOR_TYPE_NAME_MAP {


// cuTENSOR enums
{"cutensorDataType_t", {"", "", CONV_TYPE, API_TENSOR, 1, HIP_UNSUPPORTED}},
{"cutensorOperator_t", {"", "", CONV_TYPE, API_TENSOR, 1, HIP_UNSUPPORTED}},
{"cutensorDataType_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}},
{"cutensorOperator_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}},

{"cutensorStatus_t", {"hiptensorStatus_t", "", CONV_TYPE, API_TENSOR, 1}},
{"CUTENSOR_STATUS_SUCCESS", {"HIPTENSOR_STATUS_SUCCESS", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}},
Expand Down

0 comments on commit 1496b69

Please sign in to comment.