From f7cccb0b4379c2d3b8d086964ee1f16ee08c506b Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Wed, 4 Dec 2024 17:45:04 -0500 Subject: [PATCH] [HIPIFY][Tensor][feature] hipTensor-rocm-6.3.0 support - Data Types --- bin/hipify-perl | 12 ++++-------- docs/tables/CUTENSOR_API_supported_by_HIP.md | 8 ++++---- src/CUDA2HIP_TENSOR_API_types.cpp | 12 ++++++++---- .../synthetic/libraries/cutensor2hiptensor.cu | 8 ++++++++ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index 82e07a26..5d46af43 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -7843,7 +7843,11 @@ sub simpleSubstitutions { subst("CUTENSOR_ALGO_DEFAULT_PATIENT", "HIPTENSOR_ALGO_DEFAULT_PATIENT", "numeric_literal"); subst("CUTENSOR_C_32F", "HIPTENSOR_COMPUTE_C32F", "numeric_literal"); subst("CUTENSOR_C_64F", "HIPTENSOR_COMPUTE_C64F", "numeric_literal"); + subst("CUTENSOR_OP_ADD", "HIPTENSOR_OP_ADD", "numeric_literal"); subst("CUTENSOR_OP_IDENTITY", "HIPTENSOR_OP_IDENTITY", "numeric_literal"); + subst("CUTENSOR_OP_MAX", "HIPTENSOR_OP_MAX", "numeric_literal"); + subst("CUTENSOR_OP_MIN", "HIPTENSOR_OP_MIN", "numeric_literal"); + subst("CUTENSOR_OP_MUL", "HIPTENSOR_OP_MUL", "numeric_literal"); subst("CUTENSOR_OP_SQRT", "HIPTENSOR_OP_SQRT", "numeric_literal"); subst("CUTENSOR_OP_UNKNOWN", "HIPTENSOR_OP_UNKNOWN", "numeric_literal"); subst("CUTENSOR_R_16BF", "HIPTENSOR_COMPUTE_16BF", "numeric_literal"); @@ -12666,10 +12670,7 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_OP_RELU", "CUTENSOR_OP_RCP", "CUTENSOR_OP_NEG", - "CUTENSOR_OP_MUL", "CUTENSOR_OP_MISH", - "CUTENSOR_OP_MIN", - "CUTENSOR_OP_MAX", "CUTENSOR_OP_LOG", "CUTENSOR_OP_FLOOR", "CUTENSOR_OP_EXP", @@ -12681,7 +12682,6 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_OP_ATAN", "CUTENSOR_OP_ASINH", "CUTENSOR_OP_ASIN", - "CUTENSOR_OP_ADD", "CUTENSOR_OP_ACOSH", "CUTENSOR_OP_ACOS", "CUTENSOR_OP_ABS", @@ -14991,10 +14991,7 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_OP_RELU", "CUTENSOR_OP_RCP", "CUTENSOR_OP_NEG", - "CUTENSOR_OP_MUL", "CUTENSOR_OP_MISH", - "CUTENSOR_OP_MIN", - "CUTENSOR_OP_MAX", "CUTENSOR_OP_LOG", "CUTENSOR_OP_FLOOR", "CUTENSOR_OP_EXP", @@ -15006,7 +15003,6 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_OP_ATAN", "CUTENSOR_OP_ASINH", "CUTENSOR_OP_ASIN", - "CUTENSOR_OP_ADD", "CUTENSOR_OP_ACOSH", "CUTENSOR_OP_ACOS", "CUTENSOR_OP_ABS", diff --git a/docs/tables/CUTENSOR_API_supported_by_HIP.md b/docs/tables/CUTENSOR_API_supported_by_HIP.md index 16340522..721cb312 100644 --- a/docs/tables/CUTENSOR_API_supported_by_HIP.md +++ b/docs/tables/CUTENSOR_API_supported_by_HIP.md @@ -39,7 +39,7 @@ |`CUTENSOR_OP_ABS`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ACOS`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ACOSH`|1.0.1.0| | | | | | | | | | -|`CUTENSOR_OP_ADD`|1.0.1.0| | | | | | | | | | +|`CUTENSOR_OP_ADD`|1.0.1.0| | | |`HIPTENSOR_OP_ADD`|6.3.0| | | | | |`CUTENSOR_OP_ASIN`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ASINH`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ATAN`|1.0.1.0| | | | | | | | | | @@ -52,10 +52,10 @@ |`CUTENSOR_OP_FLOOR`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_IDENTITY`|1.0.1.0| | | |`HIPTENSOR_OP_IDENTITY`|5.7.0| | | | | |`CUTENSOR_OP_LOG`|1.0.1.0| | | | | | | | | | -|`CUTENSOR_OP_MAX`|1.0.1.0| | | | | | | | | | -|`CUTENSOR_OP_MIN`|1.0.1.0| | | | | | | | | | +|`CUTENSOR_OP_MAX`|1.0.1.0| | | |`HIPTENSOR_OP_MAX`|6.3.0| | | | | +|`CUTENSOR_OP_MIN`|1.0.1.0| | | |`HIPTENSOR_OP_MIN`|6.3.0| | | | | |`CUTENSOR_OP_MISH`|2.0.0.0| | | | | | | | | | -|`CUTENSOR_OP_MUL`|1.0.1.0| | | | | | | | | | +|`CUTENSOR_OP_MUL`|1.0.1.0| | | |`HIPTENSOR_OP_MUL`|6.3.0| | | | | |`CUTENSOR_OP_NEG`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_RCP`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_RELU`|1.0.1.0| | | | | | | | | | diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index 735a09ce..7ea33c23 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -84,10 +84,10 @@ const std::map CUDA_TENSOR_TYPE_NAME_MAP { {"CUTENSOR_OP_SWISH", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"CUTENSOR_OP_SOFT_PLUS", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"CUTENSOR_OP_SOFT_SIGN", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, - {"CUTENSOR_OP_ADD", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, - {"CUTENSOR_OP_MUL", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, - {"CUTENSOR_OP_MAX", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, - {"CUTENSOR_OP_MIN", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OP_ADD", {"HIPTENSOR_OP_ADD", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_OP_MUL", {"HIPTENSOR_OP_MUL", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_OP_MAX", {"HIPTENSOR_OP_MAX", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_OP_MIN", {"HIPTENSOR_OP_MIN", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, {"CUTENSOR_OP_UNKNOWN", {"HIPTENSOR_OP_UNKNOWN", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, {"cutensorStatus_t", {"hiptensorStatus_t", "", CONV_TYPE, API_TENSOR, 1}}, @@ -274,6 +274,10 @@ const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { {"hiptensorOperator_t", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_OP_IDENTITY", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_OP_SQRT", {HIP_6020, HIP_0, HIP_0, }}, + {"HIPTENSOR_OP_ADD", {HIP_6030, HIP_0, HIP_0, }}, + {"HIPTENSOR_OP_MUL", {HIP_6030, HIP_0, HIP_0, }}, + {"HIPTENSOR_OP_MAX", {HIP_6030, HIP_0, HIP_0, }}, + {"HIPTENSOR_OP_MIN", {HIP_6030, HIP_0, HIP_0, }}, {"HIPTENSOR_OP_UNKNOWN", {HIP_5070, HIP_0, HIP_0, }}, {"hiptensorAlgo_t", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT", {HIP_5070, HIP_0, HIP_0, }}, diff --git a/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu b/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu index 28de4ffe..eb63c13d 100644 --- a/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu +++ b/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu @@ -41,10 +41,18 @@ int main() { // CHECK: hiptensorOperator_t tensorOperator_t; // CHECK-NEXT hiptensorOperator_t TENSOR_OP_IDENTITY = HIPTENSOR_OP_IDENTITY; // CHECK-NEXT hiptensorOperator_t TENSOR_OP_SQRT = HIPTENSOR_OP_SQRT; + // CHECK-NEXT hiptensorOperator_t TENSOR_OP_ADD = HIPTENSOR_OP_ADD; + // CHECK-NEXT hiptensorOperator_t TENSOR_OP_MUL = HIPTENSOR_OP_MUL; + // CHECK-NEXT hiptensorOperator_t TENSOR_OP_MAX = HIPTENSOR_OP_MAX; + // CHECK-NEXT hiptensorOperator_t TENSOR_OP_MIN = HIPTENSOR_OP_MIN; // CHECK-NEXT hiptensorOperator_t TENSOR_OP_UNKNOWN = HIPTENSOR_OP_UNKNOWN; cutensorOperator_t tensorOperator_t; cutensorOperator_t TENSOR_OP_IDENTITY = CUTENSOR_OP_IDENTITY; cutensorOperator_t TENSOR_OP_SQRT = CUTENSOR_OP_SQRT; + cutensorOperator_t TENSOR_OP_ADD = CUTENSOR_OP_ADD; + cutensorOperator_t TENSOR_OP_MUL = CUTENSOR_OP_MUL; + cutensorOperator_t TENSOR_OP_MAX = CUTENSOR_OP_MAX; + cutensorOperator_t TENSOR_OP_MIN = CUTENSOR_OP_MIN; cutensorOperator_t TENSOR_OP_UNKNOWN = CUTENSOR_OP_UNKNOWN; // CHECK: hiptensorStatus_t tensorStatus_t;