From 0f91e700293516bbbed41f5dc5dcf11141886e11 Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Tue, 3 Dec 2024 15:07:54 -0500 Subject: [PATCH 1/3] [HIPIFY][Tensor][feature] Introduce cuTensor support - Part 6 --- bin/hipify-perl | 58 ++++++++++++++ docs/tables/CUTENSOR_API_supported_by_HIP.md | 31 ++++++++ src/CUDA2HIP_TENSOR_API_types.cpp | 75 +++++++++++++++++++ .../synthetic/libraries/cutensor2hiptensor.cu | 15 ++++ 4 files changed, 179 insertions(+) diff --git a/bin/hipify-perl b/bin/hipify-perl index 7d474474..6dfe8671 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -7341,6 +7341,7 @@ sub simpleSubstitutions { subst("cutensorDataType_t", "hiptensorComputeType_t", "type"); subst("cutensorOperator_t", "hiptensorOperator_t", "type"); subst("cutensorStatus_t", "hiptensorStatus_t", "type"); + subst("cutensorWorksizePreference_t", "hiptensorWorksizePreference_t", "type"); subst("gesvdjInfo_t", "hipsolverGesvdjInfo_t", "type"); subst("nvrtcProgram", "hiprtcProgram", "type"); subst("nvrtcResult", "hiprtcResult", "type"); @@ -7864,6 +7865,9 @@ sub simpleSubstitutions { 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("CUTENSOR_WORKSPACE_MAX", "HIPTENSOR_WORKSPACE_MAX", "numeric_literal"); + subst("CUTENSOR_WORKSPACE_MIN", "HIPTENSOR_WORKSPACE_MIN", "numeric_literal"); + subst("CUTENSOR_WORKSPACE_RECOMMENDED", "HIPTENSOR_WORKSPACE_RECOMMENDED", "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"); @@ -12056,6 +12060,12 @@ sub warnHipOnlyUnsupportedFunctions { my $line_num = shift; my $k = 0; foreach $func ( + "cutensorPlanPreferenceAttribute_t", + "cutensorPlanAttribute_t", + "cutensorOperationDescriptorAttribute_t", + "cutensorJitMode_t", + "cutensorCacheMode_t", + "cutensorAutotuneMode_t", "cusparseZhybsv_solve", "cusparseZhybsv_analysis", "cusparseZhyb2dense", @@ -12627,6 +12637,7 @@ sub warnHipOnlyUnsupportedFunctions { "csrsv2Info", "csrsm2Info", "__curand_umul", + "CUTENSOR_WORKSPACE_DEFAULT", "CUTENSOR_STATUS_MAPPING_ERROR", "CUTENSOR_STATUS_LICENSE_ERROR", "CUTENSOR_STATUS_CUDA_ERROR", @@ -12637,6 +12648,13 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_R_4I", "CUTENSOR_R_16U", "CUTENSOR_R_16I", + "CUTENSOR_PLAN_REQUIRED_WORKSPACE", + "CUTENSOR_PLAN_PREFERENCE_KERNEL_RANK", + "CUTENSOR_PLAN_PREFERENCE_JIT", + "CUTENSOR_PLAN_PREFERENCE_INCREMENTAL_COUNT", + "CUTENSOR_PLAN_PREFERENCE_CACHE_MODE", + "CUTENSOR_PLAN_PREFERENCE_AUTOTUNE_MODE", + "CUTENSOR_PLAN_PREFERENCE_ALGO", "CUTENSOR_OP_TANH", "CUTENSOR_OP_TAN", "CUTENSOR_OP_SWISH", @@ -12667,6 +12685,15 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_OP_ACOSH", "CUTENSOR_OP_ACOS", "CUTENSOR_OP_ABS", + "CUTENSOR_OPERATION_DESCRIPTOR_TAG", + "CUTENSOR_OPERATION_DESCRIPTOR_SCALAR_TYPE", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_VALUE", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_RIGHT", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_LEFT", + "CUTENSOR_OPERATION_DESCRIPTOR_MOVED_BYTES", + "CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", + "CUTENSOR_JIT_MODE_NONE", + "CUTENSOR_JIT_MODE_DEFAULT", "CUTENSOR_C_8U", "CUTENSOR_C_8I", "CUTENSOR_C_64U", @@ -12679,6 +12706,10 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_C_16I", "CUTENSOR_C_16F", "CUTENSOR_C_16BF", + "CUTENSOR_CACHE_MODE_PEDANTIC", + "CUTENSOR_CACHE_MODE_NONE", + "CUTENSOR_AUTOTUNE_MODE_NONE", + "CUTENSOR_AUTOTUNE_MODE_INCREMENTAL", "CUTENSOR_ALGO_TTGT", "CUTENSOR_ALGO_TGETT", "CUTENSOR_ALGO_GETT", @@ -14246,6 +14277,12 @@ sub warnRocOnlyUnsupportedFunctions { my $line_num = shift; my $k = 0; foreach $func ( + "cutensorPlanPreferenceAttribute_t", + "cutensorPlanAttribute_t", + "cutensorOperationDescriptorAttribute_t", + "cutensorJitMode_t", + "cutensorCacheMode_t", + "cutensorAutotuneMode_t", "cusparseZhybsv_solve", "cusparseZhybsv_analysis", "cusparseZhyb2dense", @@ -14923,6 +14960,7 @@ sub warnRocOnlyUnsupportedFunctions { "csru2csrInfo_t", "csru2csrInfo", "__curand_umul", + "CUTENSOR_WORKSPACE_DEFAULT", "CUTENSOR_STATUS_MAPPING_ERROR", "CUTENSOR_STATUS_LICENSE_ERROR", "CUTENSOR_STATUS_CUDA_ERROR", @@ -14933,6 +14971,13 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_R_4I", "CUTENSOR_R_16U", "CUTENSOR_R_16I", + "CUTENSOR_PLAN_REQUIRED_WORKSPACE", + "CUTENSOR_PLAN_PREFERENCE_KERNEL_RANK", + "CUTENSOR_PLAN_PREFERENCE_JIT", + "CUTENSOR_PLAN_PREFERENCE_INCREMENTAL_COUNT", + "CUTENSOR_PLAN_PREFERENCE_CACHE_MODE", + "CUTENSOR_PLAN_PREFERENCE_AUTOTUNE_MODE", + "CUTENSOR_PLAN_PREFERENCE_ALGO", "CUTENSOR_OP_TANH", "CUTENSOR_OP_TAN", "CUTENSOR_OP_SWISH", @@ -14963,6 +15008,15 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_OP_ACOSH", "CUTENSOR_OP_ACOS", "CUTENSOR_OP_ABS", + "CUTENSOR_OPERATION_DESCRIPTOR_TAG", + "CUTENSOR_OPERATION_DESCRIPTOR_SCALAR_TYPE", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_VALUE", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_RIGHT", + "CUTENSOR_OPERATION_DESCRIPTOR_PADDING_LEFT", + "CUTENSOR_OPERATION_DESCRIPTOR_MOVED_BYTES", + "CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", + "CUTENSOR_JIT_MODE_NONE", + "CUTENSOR_JIT_MODE_DEFAULT", "CUTENSOR_C_8U", "CUTENSOR_C_8I", "CUTENSOR_C_64U", @@ -14975,6 +15029,10 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_C_16I", "CUTENSOR_C_16F", "CUTENSOR_C_16BF", + "CUTENSOR_CACHE_MODE_PEDANTIC", + "CUTENSOR_CACHE_MODE_NONE", + "CUTENSOR_AUTOTUNE_MODE_NONE", + "CUTENSOR_AUTOTUNE_MODE_INCREMENTAL", "CUTENSOR_ALGO_TTGT", "CUTENSOR_ALGO_TGETT", "CUTENSOR_ALGO_GETT", diff --git a/docs/tables/CUTENSOR_API_supported_by_HIP.md b/docs/tables/CUTENSOR_API_supported_by_HIP.md index 82f53da4..2e5494b3 100644 --- a/docs/tables/CUTENSOR_API_supported_by_HIP.md +++ b/docs/tables/CUTENSOR_API_supported_by_HIP.md @@ -9,6 +9,10 @@ |`CUTENSOR_ALGO_GETT`|1.0.1.0| | | | | | | | | | |`CUTENSOR_ALGO_TGETT`|1.0.1.0| | | | | | | | | | |`CUTENSOR_ALGO_TTGT`|1.0.1.0| | | | | | | | | | +|`CUTENSOR_AUTOTUNE_MODE_INCREMENTAL`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_AUTOTUNE_MODE_NONE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_CACHE_MODE_NONE`|1.2.0.0| | | | | | | | | | +|`CUTENSOR_CACHE_MODE_PEDANTIC`|1.2.0.0| | | | | | | | | | |`CUTENSOR_C_16BF`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_16F`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_16I`|2.0.0.0| | | | | | | | | | @@ -23,6 +27,15 @@ |`CUTENSOR_C_64U`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_8I`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_8U`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_JIT_MODE_DEFAULT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_JIT_MODE_NONE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_FLOPS`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_MOVED_BYTES`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_PADDING_LEFT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_PADDING_RIGHT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_PADDING_VALUE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_SCALAR_TYPE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_OPERATION_DESCRIPTOR_TAG`|2.0.0.0| | | | | | | | | | |`CUTENSOR_OP_ABS`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ACOS`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_ACOSH`|1.0.1.0| | | | | | | | | | @@ -56,6 +69,13 @@ |`CUTENSOR_OP_TAN`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_TANH`|1.0.1.0| | | | | | | | | | |`CUTENSOR_OP_UNKNOWN`|1.0.1.0| | | |`HIPTENSOR_OP_UNKNOWN`|5.7.0| | | | | +|`CUTENSOR_PLAN_PREFERENCE_ALGO`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_PREFERENCE_AUTOTUNE_MODE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_PREFERENCE_CACHE_MODE`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_PREFERENCE_INCREMENTAL_COUNT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_PREFERENCE_JIT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_PREFERENCE_KERNEL_RANK`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_PLAN_REQUIRED_WORKSPACE`|2.0.0.0| | | | | | | | | | |`CUTENSOR_R_16BF`|2.0.0.0| | | |`HIPTENSOR_COMPUTE_16BF`|5.7.0| | | | | |`CUTENSOR_R_16F`|2.0.0.0| | | |`HIPTENSOR_COMPUTE_16F`|5.7.0| | | | | |`CUTENSOR_R_16I`|2.0.0.0| | | | | | | | | | @@ -85,10 +105,21 @@ |`CUTENSOR_STATUS_NOT_INITIALIZED`| | | | |`HIPTENSOR_STATUS_NOT_INITIALIZED`| | | | | | |`CUTENSOR_STATUS_NOT_SUPPORTED`| | | | |`HIPTENSOR_STATUS_NOT_SUPPORTED`| | | | | | |`CUTENSOR_STATUS_SUCCESS`| | | | |`HIPTENSOR_STATUS_SUCCESS`| | | | | | +|`CUTENSOR_WORKSPACE_DEFAULT`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_WORKSPACE_MAX`|1.0.1.0| | | |`HIPTENSOR_WORKSPACE_MAX`|5.7.0| | | | | +|`CUTENSOR_WORKSPACE_MIN`|1.0.1.0| | | |`HIPTENSOR_WORKSPACE_MIN`|5.7.0| | | | | +|`CUTENSOR_WORKSPACE_RECOMMENDED`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_WORKSPACE_RECOMMENDED`|5.7.0| | | | | |`cutensorAlgo_t`|1.0.1.0| | | |`hiptensorAlgo_t`|5.7.0| | | | | +|`cutensorAutotuneMode_t`|1.2.0.0| | | | | | | | | | +|`cutensorCacheMode_t`|1.2.0.0| | | | | | | | | | |`cutensorDataType_t`|2.0.0.0| | | |`hiptensorComputeType_t`|5.7.0| | | | | +|`cutensorJitMode_t`|2.0.0.0| | | | | | | | | | +|`cutensorOperationDescriptorAttribute_t`|2.0.0.0| | | | | | | | | | |`cutensorOperator_t`|1.0.1.0| | | |`hiptensorOperator_t`|5.7.0| | | | | +|`cutensorPlanAttribute_t`|2.0.0.0| | | | | | | | | | +|`cutensorPlanPreferenceAttribute_t`|2.0.0.0| | | | | | | | | | |`cutensorStatus_t`| | | | |`hiptensorStatus_t`| | | | | | +|`cutensorWorksizePreference_t`|1.0.1.0| | | |`hiptensorWorksizePreference_t`| | | | | | ## **2. CUTENSOR Function Reference** diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index c162a31b..e4780b8d 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -113,6 +113,45 @@ const std::map CUDA_TENSOR_TYPE_NAME_MAP { {"CUTENSOR_ALGO_TGETT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"CUTENSOR_ALGO_TTGT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"CUTENSOR_ALGO_DEFAULT", {"HIPTENSOR_ALGO_DEFAULT", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + + {"cutensorWorksizePreference_t", {"hiptensorWorksizePreference_t", "", CONV_TYPE, API_TENSOR, 1}}, + {"CUTENSOR_WORKSPACE_MIN", {"HIPTENSOR_WORKSPACE_MIN", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_WORKSPACE_DEFAULT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_WORKSPACE_RECOMMENDED", {"HIPTENSOR_WORKSPACE_RECOMMENDED", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_WORKSPACE_MAX", {"HIPTENSOR_WORKSPACE_MAX", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + + {"cutensorOperationDescriptorAttribute_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_TAG", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_SCALAR_TYPE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_MOVED_BYTES", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_LEFT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_RIGHT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_VALUE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + + {"cutensorPlanPreferenceAttribute_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_AUTOTUNE_MODE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_CACHE_MODE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_INCREMENTAL_COUNT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_ALGO", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_KERNEL_RANK", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_PREFERENCE_JIT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + + {"cutensorAutotuneMode_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_AUTOTUNE_MODE_NONE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_AUTOTUNE_MODE_INCREMENTAL", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + + {"cutensorJitMode_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_JIT_MODE_NONE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_JIT_MODE_DEFAULT", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + + {"cutensorCacheMode_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_CACHE_MODE_NONE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_CACHE_MODE_PEDANTIC", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + + {"cutensorPlanAttribute_t", {"", "", CONV_TYPE, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_PLAN_REQUIRED_WORKSPACE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + }; const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { @@ -185,6 +224,39 @@ const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { {"CUTENSOR_ALGO_TGETT", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, {"CUTENSOR_ALGO_TTGT", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, {"CUTENSOR_ALGO_DEFAULT", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, + {"cutensorWorksizePreference_t", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, + {"CUTENSOR_WORKSPACE_MIN", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, + {"CUTENSOR_WORKSPACE_DEFAULT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_WORKSPACE_RECOMMENDED", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_WORKSPACE_MAX", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, + {"cutensorOperationDescriptorAttribute_t", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_TAG", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_SCALAR_TYPE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_MOVED_BYTES", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_LEFT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_RIGHT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_OPERATION_DESCRIPTOR_PADDING_VALUE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"cutensorPlanPreferenceAttribute_t", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_AUTOTUNE_MODE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_CACHE_MODE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_INCREMENTAL_COUNT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_ALGO", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_KERNEL_RANK", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_PREFERENCE_JIT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"cutensorAutotuneMode_t", {CUTENSOR_1200, CUDA_0, CUDA_0, }}, + {"CUTENSOR_AUTOTUNE_MODE_NONE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_AUTOTUNE_MODE_INCREMENTAL", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_AUTOTUNE_NONE", {CUTENSOR_1200, CUDA_0, CUTENSOR_1700, }}, + {"CUTENSOR_AUTOTUNE_INCREMENTAL", {CUTENSOR_1200, CUDA_0, CUTENSOR_1700, }}, + {"cutensorJitMode_t", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_JIT_MODE_NONE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_JIT_MODE_DEFAULT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"cutensorCacheMode_t", {CUTENSOR_1200, CUDA_0, CUDA_0, }}, + {"CUTENSOR_CACHE_MODE_NONE", {CUTENSOR_1200, CUDA_0, CUDA_0, }}, + {"CUTENSOR_CACHE_MODE_PEDANTIC", {CUTENSOR_1200, CUDA_0, CUDA_0, }}, + {"cutensorPlanAttribute_t", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_PLAN_REQUIRED_WORKSPACE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, }; const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { @@ -206,4 +278,7 @@ const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { {"hiptensorAlgo_t", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT_PATIENT", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MIN", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_RECOMMENDED", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MAX", {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 16289df4..28de4ffe 100644 --- a/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu +++ b/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu @@ -32,6 +32,9 @@ int main() { cutensorDataType_t TENSOR_R_8U = CUTENSOR_R_8U; cutensorDataType_t TENSOR_R_32I = CUTENSOR_R_32I; cutensorDataType_t TENSOR_R_32U = CUTENSOR_R_32U; + + //CHECK: hiptensorWorksizePreference_t TENSOR_WORKSPACE_DEFAULT = HIPTENSOR_WORKSPACE_DEFAULT; + cutensorWorksizePreference_t TENSOR_WORKSPACE_DEFAULT = CUTENSOR_ALGO_DEFAULT_PATIENT; #endif #if CUTENSOR_MAJOR >= 1 @@ -73,6 +76,13 @@ int main() { // CHECK-NEXT hiptensorAlgo_t TENSOR_ALGO_DEFAULT = HIPTENSOR_ALGO_DEFAULT; cutensorAlgo_t tensorAlgo_t; cutensorAlgo_t TENSOR_ALGO_DEFAULT = CUTENSOR_ALGO_DEFAULT; + + // CHECK: hiptensorWorksizePreference_t tensorWorksizePreference_t; + // Check-NEXT TENSOR_WORKSPACE_MIN = HIPTENSOR_WORKSPACE_MIN; + // CHECK-NEXT TENSOR_WORKSPACE_MAX = HIPTENSOR_WORKSPACE_MAX; + cutensorWorksizePreference_t tensorWorksizePreference_t; + cutensorWorksizePreference_t TENSOR_WORKSPACE_MIN = CUTENSOR_WORKSPACE_MIN; + cutensorWorksizePreference_t TENSOR_WORKSPACE_MAX = CUTENSOR_WORKSPACE_MAX; #endif #if (CUTENSOR_MAJOR == 1 && CUTENSOR_MINOR >= 4) || CUTENSOR_MAJOR >= 2 @@ -80,5 +90,10 @@ int main() { cutensorAlgo_t TENSOR_ALGO_DEFAULT_PATIENT = CUTENSOR_ALGO_DEFAULT_PATIENT; #endif +#if (CUTENSOR_MAJOR >= 1 && CUTENSOR_MAJOR < 2) + // CHECK: hiptensorWorksizePreference_t TENSOR_WORKSPACE_RECOMMENDED = HIPTENSOR_WORKSPACE_RECOMMENDED; + cutensorWorksizePreference_t TENSOR_WORKSPACE_RECOMMENDED = CUTENSOR_WORKSPACE_RECOMMENDED; +#endif + return 0; } From d9dd4de33448a11a62432e3c62b3692ca6b76964 Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Wed, 4 Dec 2024 14:13:07 -0500 Subject: [PATCH 2/3] Update the supported version for few APIs --- src/CUDA2HIP_TENSOR_API_types.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index e4780b8d..ce7b2c35 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -247,8 +247,8 @@ const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { {"cutensorAutotuneMode_t", {CUTENSOR_1200, CUDA_0, CUDA_0, }}, {"CUTENSOR_AUTOTUNE_MODE_NONE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, {"CUTENSOR_AUTOTUNE_MODE_INCREMENTAL", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, - {"CUTENSOR_AUTOTUNE_NONE", {CUTENSOR_1200, CUDA_0, CUTENSOR_1700, }}, - {"CUTENSOR_AUTOTUNE_INCREMENTAL", {CUTENSOR_1200, CUDA_0, CUTENSOR_1700, }}, + {"CUTENSOR_AUTOTUNE_NONE", {CUTENSOR_1200, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_AUTOTUNE_INCREMENTAL", {CUTENSOR_1200, CUDA_0, CUTENSOR_2000, }}, {"cutensorJitMode_t", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, {"CUTENSOR_JIT_MODE_NONE", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, {"CUTENSOR_JIT_MODE_DEFAULT", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, @@ -278,7 +278,7 @@ const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { {"hiptensorAlgo_t", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT_PATIENT", {HIP_5070, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_MIN", {HIP_5070, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_RECOMMENDED", {HIP_5070, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_MAX", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MIN", {HIP_5700, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_RECOMMENDED", {HIP_5700, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MAX", {HIP_5700, HIP_0, HIP_0, }}, }; From 3e681ccbf0ea26aacceaa97e6fd1c24a5596a304 Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Wed, 4 Dec 2024 15:00:07 -0500 Subject: [PATCH 3/3] Regenerate hipify docs --- docs/tables/CUTENSOR_API_supported_by_HIP.md | 2 +- src/CUDA2HIP_TENSOR_API_types.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/tables/CUTENSOR_API_supported_by_HIP.md b/docs/tables/CUTENSOR_API_supported_by_HIP.md index 2e5494b3..16340522 100644 --- a/docs/tables/CUTENSOR_API_supported_by_HIP.md +++ b/docs/tables/CUTENSOR_API_supported_by_HIP.md @@ -119,7 +119,7 @@ |`cutensorPlanAttribute_t`|2.0.0.0| | | | | | | | | | |`cutensorPlanPreferenceAttribute_t`|2.0.0.0| | | | | | | | | | |`cutensorStatus_t`| | | | |`hiptensorStatus_t`| | | | | | -|`cutensorWorksizePreference_t`|1.0.1.0| | | |`hiptensorWorksizePreference_t`| | | | | | +|`cutensorWorksizePreference_t`|1.0.1.0| | | |`hiptensorWorksizePreference_t`|5.7.0| | | | | ## **2. CUTENSOR Function Reference** diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index ce7b2c35..735a09ce 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -278,7 +278,8 @@ const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { {"hiptensorAlgo_t", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT", {HIP_5070, HIP_0, HIP_0, }}, {"HIPTENSOR_ALGO_DEFAULT_PATIENT", {HIP_5070, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_MIN", {HIP_5700, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_RECOMMENDED", {HIP_5700, HIP_0, HIP_0, }}, - {"HIPTENSOR_WORKSPACE_MAX", {HIP_5700, HIP_0, HIP_0, }}, + {"hiptensorWorksizePreference_t", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MIN", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_RECOMMENDED", {HIP_5070, HIP_0, HIP_0, }}, + {"HIPTENSOR_WORKSPACE_MAX", {HIP_5070, HIP_0, HIP_0, }}, };