diff --git a/bin/hipify-perl b/bin/hipify-perl index 9f23985d..f55158f2 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -6139,6 +6139,7 @@ sub simpleSubstitutions { subst("cusparseZsctr", "hipsparseZsctr", "library"); subst("cutensorCreate", "hiptensorCreate", "library"); subst("cutensorDestroy", "hiptensorDestroy", "library"); + subst("cutensorInitTensorDescriptor", "hiptensorInitTensorDescriptor", "library"); subst("nvrtcAddNameExpression", "hiprtcAddNameExpression", "library"); subst("nvrtcCompileProgram", "hiprtcCompileProgram", "library"); subst("nvrtcCreateProgram", "hiprtcCreateProgram", "library"); @@ -7374,6 +7375,7 @@ sub simpleSubstitutions { subst("cutensorHandle_t", "hiptensorHandle_t", "type"); subst("cutensorOperator_t", "hiptensorOperator_t", "type"); subst("cutensorStatus_t", "hiptensorStatus_t", "type"); + subst("cutensorTensorDescriptor", "hiptensorTensorDescriptor_t", "type"); subst("cutensorWorksizePreference_t", "hiptensorWorksizePreference_t", "type"); subst("gesvdjInfo_t", "hipsolverGesvdjInfo_t", "type"); subst("nvrtcProgram", "hiprtcProgram", "type"); @@ -7874,6 +7876,14 @@ sub simpleSubstitutions { subst("CUSPARSE_STATUS_ZERO_PIVOT", "HIPSPARSE_STATUS_ZERO_PIVOT", "numeric_literal"); subst("CUTENSOR_ALGO_DEFAULT", "HIPTENSOR_ALGO_DEFAULT", "numeric_literal"); subst("CUTENSOR_ALGO_DEFAULT_PATIENT", "HIPTENSOR_ALGO_DEFAULT_PATIENT", "numeric_literal"); + subst("CUTENSOR_COMPUTE_16BF", "HIPTENSOR_COMPUTE_16BF", "numeric_literal"); + subst("CUTENSOR_COMPUTE_16F", "HIPTENSOR_COMPUTE_16F", "numeric_literal"); + subst("CUTENSOR_COMPUTE_32F", "HIPTENSOR_COMPUTE_32F", "numeric_literal"); + subst("CUTENSOR_COMPUTE_32I", "HIPTENSOR_COMPUTE_32I", "numeric_literal"); + subst("CUTENSOR_COMPUTE_32U", "HIPTENSOR_COMPUTE_32U", "numeric_literal"); + subst("CUTENSOR_COMPUTE_64F", "HIPTENSOR_COMPUTE_64F", "numeric_literal"); + subst("CUTENSOR_COMPUTE_8I", "HIPTENSOR_COMPUTE_8I", "numeric_literal"); + subst("CUTENSOR_COMPUTE_8U", "HIPTENSOR_COMPUTE_8U", "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"); @@ -8668,6 +8678,7 @@ sub simpleSubstitutions { subst("cudaSuccess", "hipSuccess", "numeric_literal"); subst("cudaUserObjectNoDestructorSync", "hipUserObjectNoDestructorSync", "numeric_literal"); subst("cusolver_int_t", "int", "numeric_literal"); + subst("cutensorComputeType_t", "hiptensorComputeType_t", "numeric_literal"); subst("CUB_MAX", "CUB_MAX", "define"); subst("CUB_MIN", "CUB_MIN", "define"); subst("CUB_NAMESPACE_BEGIN", "BEGIN_HIPCUB_NAMESPACE", "define"); @@ -9867,6 +9878,8 @@ sub warnHipOnlyUnsupportedFunctions { my $line_num = shift; my $k = 0; foreach $func ( + "cutensorWriteKernelCacheToFile", + "cutensorReadKernelCacheFromFile", "cutensorPlanPreferenceAttribute_t", "cutensorPlanAttribute_t", "cutensorOperationDescriptorAttribute_t", @@ -9874,6 +9887,8 @@ sub warnHipOnlyUnsupportedFunctions { "cutensorHandleWritePlanCacheToFile", "cutensorHandleResizePlanCache", "cutensorHandleReadPlanCacheFromFile", + "cutensorDestroyTensorDescriptor", + "cutensorCreateTensorDescriptor", "cutensorCacheMode_t", "cutensorAutotuneMode_t", "cusparseZhybsv_solve", @@ -10190,6 +10205,13 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_STATUS_LICENSE_ERROR", "CUTENSOR_STATUS_CUDA_ERROR", "CUTENSOR_STATUS_CUBLAS_ERROR", + "CUTENSOR_R_MIN_TF32", + "CUTENSOR_R_MIN_8U", + "CUTENSOR_R_MIN_64F", + "CUTENSOR_R_MIN_32U", + "CUTENSOR_R_MIN_32F", + "CUTENSOR_R_MIN_16F", + "CUTENSOR_R_MIN_16BF", "CUTENSOR_R_64U", "CUTENSOR_R_64I", "CUTENSOR_R_4U", @@ -10238,6 +10260,10 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", "CUTENSOR_JIT_MODE_NONE", "CUTENSOR_JIT_MODE_DEFAULT", + "CUTENSOR_C_MIN_TF32", + "CUTENSOR_C_MIN_64F", + "CUTENSOR_C_MIN_32F", + "CUTENSOR_C_MIN_16F", "CUTENSOR_C_8U", "CUTENSOR_C_8I", "CUTENSOR_C_64U", @@ -10250,6 +10276,7 @@ sub warnHipOnlyUnsupportedFunctions { "CUTENSOR_C_16I", "CUTENSOR_C_16F", "CUTENSOR_C_16BF", + "CUTENSOR_COMPUTE_TF32", "CUTENSOR_CACHE_MODE_PEDANTIC", "CUTENSOR_CACHE_MODE_NONE", "CUTENSOR_AUTOTUNE_MODE_NONE", @@ -11190,6 +11217,8 @@ sub warnRocOnlyUnsupportedFunctions { my $line_num = shift; my $k = 0; foreach $func ( + "cutensorWriteKernelCacheToFile", + "cutensorReadKernelCacheFromFile", "cutensorPlanPreferenceAttribute_t", "cutensorPlanAttribute_t", "cutensorOperationDescriptorAttribute_t", @@ -11197,6 +11226,8 @@ sub warnRocOnlyUnsupportedFunctions { "cutensorHandleWritePlanCacheToFile", "cutensorHandleResizePlanCache", "cutensorHandleReadPlanCacheFromFile", + "cutensorDestroyTensorDescriptor", + "cutensorCreateTensorDescriptor", "cutensorCacheMode_t", "cutensorAutotuneMode_t", "cusparseZhybsv_solve", @@ -11603,6 +11634,13 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_STATUS_LICENSE_ERROR", "CUTENSOR_STATUS_CUDA_ERROR", "CUTENSOR_STATUS_CUBLAS_ERROR", + "CUTENSOR_R_MIN_TF32", + "CUTENSOR_R_MIN_8U", + "CUTENSOR_R_MIN_64F", + "CUTENSOR_R_MIN_32U", + "CUTENSOR_R_MIN_32F", + "CUTENSOR_R_MIN_16F", + "CUTENSOR_R_MIN_16BF", "CUTENSOR_R_64U", "CUTENSOR_R_64I", "CUTENSOR_R_4U", @@ -11651,6 +11689,10 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_OPERATION_DESCRIPTOR_FLOPS", "CUTENSOR_JIT_MODE_NONE", "CUTENSOR_JIT_MODE_DEFAULT", + "CUTENSOR_C_MIN_TF32", + "CUTENSOR_C_MIN_64F", + "CUTENSOR_C_MIN_32F", + "CUTENSOR_C_MIN_16F", "CUTENSOR_C_8U", "CUTENSOR_C_8I", "CUTENSOR_C_64U", @@ -11663,6 +11705,7 @@ sub warnRocOnlyUnsupportedFunctions { "CUTENSOR_C_16I", "CUTENSOR_C_16F", "CUTENSOR_C_16BF", + "CUTENSOR_COMPUTE_TF32", "CUTENSOR_CACHE_MODE_PEDANTIC", "CUTENSOR_CACHE_MODE_NONE", "CUTENSOR_AUTOTUNE_MODE_NONE", diff --git a/docs/tables/CUTENSOR_API_supported_by_HIP.md b/docs/tables/CUTENSOR_API_supported_by_HIP.md index 98df7901..0474b407 100644 --- a/docs/tables/CUTENSOR_API_supported_by_HIP.md +++ b/docs/tables/CUTENSOR_API_supported_by_HIP.md @@ -13,6 +13,15 @@ |`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_COMPUTE_16BF`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_16BF`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_16F`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_16F`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_32F`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_32F`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_32I`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_32I`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_32U`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_32U`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_64F`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_64F`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_8I`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_8I`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_8U`|1.0.1.0| | |2.0.0.0|`HIPTENSOR_COMPUTE_8U`|5.7.0| | | | | +|`CUTENSOR_COMPUTE_TF32`|1.0.1.0| | |2.0.0.0| | | | | | | |`CUTENSOR_C_16BF`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_16F`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_16I`|2.0.0.0| | | | | | | | | | @@ -27,6 +36,10 @@ |`CUTENSOR_C_64U`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_8I`|2.0.0.0| | | | | | | | | | |`CUTENSOR_C_8U`|2.0.0.0| | | | | | | | | | +|`CUTENSOR_C_MIN_16F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_C_MIN_32F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_C_MIN_64F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_C_MIN_TF32`|1.0.1.0|1.2.0.0| |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| | | | | | | | | | @@ -90,6 +103,13 @@ |`CUTENSOR_R_64U`|2.0.0.0| | | | | | | | | | |`CUTENSOR_R_8I`|2.0.0.0| | | |`HIPTENSOR_COMPUTE_8I`|5.7.0| | | | | |`CUTENSOR_R_8U`|2.0.0.0| | | |`HIPTENSOR_COMPUTE_8U`|5.7.0| | | | | +|`CUTENSOR_R_MIN_16BF`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_16F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_32F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_32U`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_64F`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_8U`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | +|`CUTENSOR_R_MIN_TF32`|1.0.1.0|1.2.0.0| |2.0.0.0| | | | | | | |`CUTENSOR_STATUS_ALLOC_FAILED`|1.0.1.0| | | |`HIPTENSOR_STATUS_ALLOC_FAILED`|5.7.0| | | | | |`CUTENSOR_STATUS_ARCH_MISMATCH`|1.0.1.0| | | |`HIPTENSOR_STATUS_ARCH_MISMATCH`|5.7.0| | | | | |`CUTENSOR_STATUS_CUBLAS_ERROR`|1.0.1.0| | | | | | | | | | @@ -112,14 +132,16 @@ |`cutensorAlgo_t`|1.0.1.0| | | |`hiptensorAlgo_t`|5.7.0| | | | | |`cutensorAutotuneMode_t`|1.2.0.0| | | | | | | | | | |`cutensorCacheMode_t`|1.2.0.0| | | | | | | | | | +|`cutensorComputeType_t`| | | | |`hiptensorComputeType_t`|5.7.0| | | | | |`cutensorDataType_t`|2.0.0.0| | | |`hiptensorComputeType_t`|5.7.0| | | | | -|`cutensorHandle_t`| | | | |`hiptensorHandle_t`| | | | | | +|`cutensorHandle_t`|1.0.1.0| | | |`hiptensorHandle_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`|1.0.1.0| | | |`hiptensorStatus_t`|5.7.0| | | | | +|`cutensorTensorDescriptor`| | | | |`hiptensorTensorDescriptor_t`|5.7.0| | | | | |`cutensorWorksizePreference_t`|1.0.1.0| | | |`hiptensorWorksizePreference_t`|5.7.0| | | | | ## **2. CUTENSOR Function Reference** @@ -127,10 +149,15 @@ |**CUDA**|**A**|**D**|**C**|**R**|**HIP**|**A**|**D**|**C**|**R**|**E**| |:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:| |`cutensorCreate`|1.7.0.0| | | |`hiptensorCreate`|5.7.0| | | | | +|`cutensorCreateTensorDescriptor`|2.0.0.0| | | | | | | | | | |`cutensorDestroy`|1.7.0.0| | | |`hiptensorDestroy`|5.7.0| | | | | +|`cutensorDestroyTensorDescriptor`|2.0.0.0| | | | | | | | | | |`cutensorHandleReadPlanCacheFromFile`|2.0.0.0| | | | | | | | | | |`cutensorHandleResizePlanCache`|2.0.0.0| | | | | | | | | | |`cutensorHandleWritePlanCacheToFile`|2.0.0.0| | | | | | | | | | +|`cutensorInitTensorDescriptor`|1.0.1.0| | |2.0.0.0|`hiptensorInitTensorDescriptor`|5.7.0| | | | | +|`cutensorReadKernelCacheFromFile`|2.0.0.0| | | | | | | | | | +|`cutensorWriteKernelCacheToFile`|2.0.0.0| | | | | | | | | | \*A - Added; D - Deprecated; C - Changed; R - Removed; E - Experimental \ No newline at end of file diff --git a/src/CUDA2HIP_TENSOR_API_functions.cpp b/src/CUDA2HIP_TENSOR_API_functions.cpp index 476b7311..c862753a 100644 --- a/src/CUDA2HIP_TENSOR_API_functions.cpp +++ b/src/CUDA2HIP_TENSOR_API_functions.cpp @@ -28,6 +28,11 @@ const std::map CUDA_TENSOR_FUNCTION_MAP { {"cutensorHandleResizePlanCache", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, {"cutensorHandleWritePlanCacheToFile", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, {"cutensorHandleReadPlanCacheFromFile", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, + {"cutensorWriteKernelCacheToFile", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, + {"cutensorReadKernelCacheFromFile", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, + {"cutensorCreateTensorDescriptor", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, + {"cutensorInitTensorDescriptor", {"hiptensorInitTensorDescriptor", "", CONV_LIB_FUNC, API_TENSOR, 2}}, + {"cutensorDestroyTensorDescriptor", {"", "", CONV_LIB_FUNC, API_TENSOR, 2, UNSUPPORTED}}, }; @@ -37,11 +42,17 @@ const std::map CUDA_TENSOR_FUNCTION_VER_MAP { {"cutensorHandleResizePlanCache", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, {"cutensorHandleWritePlanCacheToFile", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, {"cutensorHandleReadPlanCacheFromFile", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, + {"cutensorWriteKernelCacheToFile", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, + {"cutensorReadKernelCacheFromFile", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, + {"cutensorCreateTensorDescriptor", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, + {"cutensorInitTensorDescriptor", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000}}, + {"cutensorDestroyTensorDescriptor", {CUTENSOR_2000, CUDA_0, CUDA_0 }}, }; const std::map HIP_TENSOR_FUNCTION_VER_MAP { {"hiptensorCreate", {HIP_5070, HIP_0, HIP_0, }}, {"hiptensorDestroy", {HIP_5070, HIP_0, HIP_0, }}, + {"hiptensorInitTensorDescriptor", {HIP_5070, HIP_0, HIP_0, }}, }; const std::map CUDA_TENSOR_API_SECTION_MAP { diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index b2fc119f..bb13cfcc 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -55,6 +55,28 @@ const std::map CUDA_TENSOR_TYPE_NAME_MAP { {"CUTENSOR_R_64U", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"CUTENSOR_C_64U", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"cutensorComputeType_t", {"hiptensorComputeType_t", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_16F", {"HIPTENSOR_COMPUTE_16F", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_16BF", {"HIPTENSOR_COMPUTE_16BF", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_TF32", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_COMPUTE_32F", {"HIPTENSOR_COMPUTE_32F", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_64F", {"HIPTENSOR_COMPUTE_64F", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_8U", {"HIPTENSOR_COMPUTE_8U", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_8I", {"HIPTENSOR_COMPUTE_8I", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_32U", {"HIPTENSOR_COMPUTE_32U", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_COMPUTE_32I", {"HIPTENSOR_COMPUTE_32I", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, + {"CUTENSOR_R_MIN_16F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_C_MIN_16F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_32F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_C_MIN_32F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_64F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_C_MIN_64F", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_8U", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_32U", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_16BF", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_R_MIN_TF32", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"CUTENSOR_C_MIN_TF32", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, + {"cutensorOperator_t", {"hiptensorOperator_t", "", CONV_TYPE, API_TENSOR, 1}}, {"CUTENSOR_OP_IDENTITY", {"HIPTENSOR_OP_IDENTITY", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, {"CUTENSOR_OP_SQRT", {"HIPTENSOR_OP_SQRT", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1}}, @@ -153,6 +175,7 @@ const std::map CUDA_TENSOR_TYPE_NAME_MAP { {"CUTENSOR_PLAN_REQUIRED_WORKSPACE", {"", "", CONV_NUMERIC_LITERAL, API_TENSOR, 1, UNSUPPORTED}}, {"cutensorHandle_t", {"hiptensorHandle_t", "", CONV_TYPE, API_TENSOR, 1}}, + {"cutensorTensorDescriptor", {"hiptensorTensorDescriptor_t", "", CONV_TYPE, API_TENSOR, 1}}, }; @@ -186,6 +209,26 @@ const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { {"CUTENSOR_C_64I", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, {"CUTENSOR_R_64U", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, {"CUTENSOR_C_64U", {CUTENSOR_2000, CUDA_0, CUDA_0, }}, + {"CUTENSOR_COMPUTE_16F", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_16BF", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_TF32", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_32F", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_64F", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_8U", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_8I", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_32U", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_COMPUTE_32I", {CUTENSOR_1010, CUDA_0, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_16F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_C_MIN_16F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_32F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_C_MIN_32F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_64F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_C_MIN_64F", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_8U", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_32U", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_16BF", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_R_MIN_TF32", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, + {"CUTENSOR_C_MIN_TF32", {CUTENSOR_1010, CUTENSOR_1200, CUTENSOR_2000, }}, {"cutensorOperator_t", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, {"CUTENSOR_OP_IDENTITY", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, {"CUTENSOR_OP_SQRT", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, @@ -275,6 +318,8 @@ const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { {"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, }}, + {"cutensorHandle_t", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, + {"cutensorTensorDescriptor_t", {CUTENSOR_1010, CUDA_0, CUDA_0, }}, }; const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { @@ -316,4 +361,6 @@ const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { {"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, }}, + {"hiptensorHandle_t", {HIP_5070, HIP_0, HIP_0, }}, + {"hiptensorTensorDescriptor_t", {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 18e58f8d..95f4dea5 100644 --- a/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu +++ b/tests/unit_tests/synthetic/libraries/cutensor2hiptensor.cu @@ -9,6 +9,24 @@ int main() { + // CHECK: hiptensorHandle_t handle; + cutensorHandle_t handle; + + //CHECK: hiptensorStatus_t status; + cutensorStatus_t status; + + //CHECK: hiptensorTensorDescriptor_t *tensorDescriptor; + cutensorTensorDescriptor *tensorDescriptor; + + // CHECK: hipDataType dataType_t; + // CHECK-NEXT: hipDataType dataType; + cudaDataType_t dataType_t; + cudaDataType dataType; + + const uint32_t numModes = 0; + const int64_t* extent = nullptr; + const int64_t* stride = nullptr; + #if CUTENSOR_MAJOR >= 2 // CHECK: hiptensorComputeType_t tensorDataType_t; // CHECK-NEXT hiptensorComputeType_t TENSOR_R_16F = HIPTENSOR_COMPUTE_16F; @@ -32,9 +50,11 @@ 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; + #endif #if CUTENSOR_MAJOR >= 1 + // 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; @@ -98,13 +118,35 @@ int main() { #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 - // CHECK: hiptensorHandle_t handle; - cutensorHandle_t handle; + // CHECK: hiptensorComputeType_t tensorComputeType_t; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_16F = HIPTENSOR_COMPUTE_16F; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_16BF = HIPTENSOR_COMPUTE_16BF; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_32F = HIPTENSOR_COMPUTE_32F; + // CHECK-NEXT hiptensorComputeType_t TENSOR_C_32F = HIPTENSOR_COMPUTE_C32F; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_64F = HIPTENSOR_COMPUTE_64F; + // CHECK-NEXT hiptensorComputeType_t TENSOR_C_64F = HIPTENSOR_COMPUTE_C64F; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_8I = HIPTENSOR_COMPUTE_8I; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_8U = HIPTENSOR_COMPUTE_8U; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_32I = HIPTENSOR_COMPUTE_32I; + // CHECK-NEXT hiptensorComputeType_t TENSOR_R_32U = HIPTENSOR_COMPUTE_32U; + cutensorComputeType_t tensorComputeType_t; + cutensorComputeType_t TENSOR_R_16F = CUTENSOR_R_16F; + cutensorComputeType_t TENSOR_R_16BF = CUTENSOR_R_16BF; + cutensorComputeType_t TENSOR_R_32F = CUTENSOR_R_32F; + cutensorComputeType_t TENSOR_C_32F = CUTENSOR_C_32F; + cutensorComputeType_t TENSOR_R_64F = CUTENSOR_R_64F; + cutensorComputeType_t TENSOR_C_64F = CUTENSOR_C_64F; + cutensorComputeType_t TENSOR_R_8I = CUTENSOR_R_8I; + cutensorComputeType_t TENSOR_R_8U = CUTENSOR_R_8U; + cutensorComputeType_t TENSOR_R_32I = CUTENSOR_R_32I; + cutensorComputeType_t TENSOR_R_32U = CUTENSOR_R_32U; - //CHECK: hiptensorStatus_t status; - cutensorStatus_t status; + // CUDA: cutensorStatus_t cutensorInitTensorDescriptor(const cutensorHandle_t* handle, cutensorTensorDescriptor_t* desc, const uint32_t numModes, const int64_t extent[], const int64_t stride[], cudaDataType_t dataType, cutensorOperator_t unaryOp); + // HIP: hiptensorStatus_t hiptensorInitTensorDescriptor(const hiptensorHandle_t* handle, hiptensorTensorDescriptor_t* desc, const uint32_t numModes, const int64_t lens[], const int64_t strides[], hipDataType dataType, hiptensorOperator_t unaryOp); + // CHECK: status = hiptensorInitTensorDescriptor (handle, &tensorDescriptor, numModes, extent, stride, dataType, tensorOperator_t); + status = cutensorInitTensorDescriptor (handle, &tensorDescriptor, numModes, extent, stride, dataType, tensorOperator_t); +#endif #if (CUTENSOR_MAJOR == 1 && CUTENSOR_MINOR >= 7) || CUTENSOR_MAJOR >= 2 // CUDA: cutensorStatus_t cutensorCreate(cutensorHandle_t* handle); @@ -116,6 +158,7 @@ int main() { // HIP: hiptensorStatus_t hiptensorDestroy(hiptensorHandle_t* handle); // CHECK: status = hiptensorDestroy(handle); status = cutensorDestroy(handle); + #endif return 0;