diff --git a/docs/tables/CUTENSOR_API_supported_by_HIP.md b/docs/tables/CUTENSOR_API_supported_by_HIP.md new file mode 100644 index 00000000..980d6260 --- /dev/null +++ b/docs/tables/CUTENSOR_API_supported_by_HIP.md @@ -0,0 +1,31 @@ +# CUTENSOR API supported by HIP + +## **1. CUTENSOR Data types** + +|**CUDA**|**A**|**D**|**C**|**R**|**HIP**|**A**|**D**|**C**|**R**|**E**| +|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:| +|`CUTENSOR_STATUS_ALLOC_FAILED`| | | | |`HIPTENSOR_STATUS_ALLOC_FAILED`| | | | | | +|`CUTENSOR_STATUS_ARCH_MISMATCH`| | | | |`HIPTENSOR_STATUS_ARCH_MISMATCH`| | | | | | +|`CUTENSOR_STATUS_CUBLAS_ERROR`| | | | | | | | | | | +|`CUTENSOR_STATUS_CUDA_ERROR`| | | | | | | | | | | +|`CUTENSOR_STATUS_EXECUTION_FAILED`| | | | |`HIPTENSOR_STATUS_EXECUTION_FAILED`| | | | | | +|`CUTENSOR_STATUS_INSUFFICIENT_DRIVER`| | | | |`HIPTENSOR_STATUS_INSUFFICIENT_DRIVER`| | | | | | +|`CUTENSOR_STATUS_INSUFFICIENT_WORKSPACE`| | | | |`HIPTENSOR_STATUS_INSUFFICIENT_WORKSPACE`| | | | | | +|`CUTENSOR_STATUS_INTERNAL_ERROR`| | | | |`HIPTENSOR_STATUS_INTERNAL_ERROR`| | | | | | +|`CUTENSOR_STATUS_INVALID_VALUE`| | | | |`HIPTENSOR_STATUS_INVALID_VALUE`| | | | | | +|`CUTENSOR_STATUS_IO_ERROR`| | | | |`HIPTENSOR_STATUS_IO_ERROR`| | | | | | +|`CUTENSOR_STATUS_LICENSE_ERROR`| | | | | | | | | | | +|`CUTENSOR_STATUS_MAPPING_ERROR`| | | | | | | | | | | +|`CUTENSOR_STATUS_NOT_INITIALIZED`| | | | |`HIPTENSOR_STATUS_NOT_INITIALIZED`| | | | | | +|`CUTENSOR_STATUS_NOT_SUPPORTED`| | | | |`HIPTENSOR_STATUS_NOT_SUPPORTED`| | | | | | +|`CUTENSOR_STATUS_SUCCESS`| | | | |`HIPTENSOR_STATUS_SUCCESS`| | | | | | +|`cutensorDataType_t`| | | | | | | | | | | +|`cutensorOperator_t`| | | | | | | | | | | +|`cutensorStatus_t`| | | | |`hiptensorStatus_t`| | | | | | + +## **2. CUTENSOR Function Reference** + +Unsupported + + +\*A - Added; D - Deprecated; C - Changed; R - Removed; E - Experimental \ No newline at end of file diff --git a/src/CUDA2HIP.cpp b/src/CUDA2HIP.cpp index 074ff2e0..8ea1fd4f 100644 --- a/src/CUDA2HIP.cpp +++ b/src/CUDA2HIP.cpp @@ -165,6 +165,8 @@ const std::map &CUDA_VERSIONS_MAP() { ret.insert(CUDA_RTC_FUNCTION_VER_MAP.begin(), CUDA_RTC_FUNCTION_VER_MAP.end()); ret.insert(CUDA_SOLVER_TYPE_NAME_VER_MAP.begin(), CUDA_SOLVER_TYPE_NAME_VER_MAP.end()); ret.insert(CUDA_SOLVER_FUNCTION_VER_MAP.begin(), CUDA_SOLVER_FUNCTION_VER_MAP.end()); + ret.insert(CUDA_TENSOR_TYPE_NAME_VER_MAP.begin(), CUDA_TENSOR_TYPE_NAME_VER_MAP.end()); + ret.insert(CUDA_TENSOR_FUNCTION_VER_MAP.begin(), CUDA_TENSOR_FUNCTION_VER_MAP.end()); return ret; } @@ -199,5 +201,7 @@ const std::map &HIP_VERSIONS_MAP() { ret.insert(HIP_RTC_FUNCTION_VER_MAP.begin(), HIP_RTC_FUNCTION_VER_MAP.end()); ret.insert(HIP_SOLVER_TYPE_NAME_VER_MAP.begin(), HIP_SOLVER_TYPE_NAME_VER_MAP.end()); ret.insert(HIP_SOLVER_FUNCTION_VER_MAP.begin(), HIP_SOLVER_FUNCTION_VER_MAP.end()); + ret.insert(HIP_TENSOR_TYPE_NAME_VER_MAP.begin(), HIP_TENSOR_TYPE_NAME_VER_MAP.end()); + ret.insert(HIP_TENSOR_FUNCTION_VER_MAP.begin(), HIP_TENSOR_FUNCTION_VER_MAP.end()); return ret; } diff --git a/src/CUDA2HIP.h b/src/CUDA2HIP.h index 382c6c05..bee5e8bf 100644 --- a/src/CUDA2HIP.h +++ b/src/CUDA2HIP.h @@ -126,6 +126,8 @@ extern const std::map CUDA_RTC_TYPE_NAME_VER_M extern const std::map CUDA_RTC_FUNCTION_VER_MAP; extern const std::map CUDA_SOLVER_TYPE_NAME_VER_MAP; extern const std::map CUDA_SOLVER_FUNCTION_VER_MAP; +extern const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP; +extern const std::map CUDA_TENSOR_FUNCTION_VER_MAP; /** * The union of all the above CUDA maps. @@ -166,6 +168,8 @@ extern const std::map HIP_RTC_FUNCTION_VER_MAP; extern const std::map CUDA_RTC_FUNCTION_CHANGED_VER_MAP; extern const std::map HIP_SOLVER_TYPE_NAME_VER_MAP; extern const std::map HIP_SOLVER_FUNCTION_VER_MAP; +extern const std::map HIP_TENSOR_TYPE_NAME_VER_MAP; +extern const std::map HIP_TENSOR_FUNCTION_VER_MAP; /** * The union of all the above HIP maps. @@ -185,6 +189,7 @@ extern const std::map CUDA_DEVICE_FUNCTION_API_SE extern const std::map CUDA_RTC_API_SECTION_MAP; extern const std::map CUDA_CUB_API_SECTION_MAP; extern const std::map CUDA_SOLVER_API_SECTION_MAP; +extern const std::map CUDA_TENSOR_API_SECTION_MAP; namespace driver { enum CUDA_DRIVER_API_SECTIONS { diff --git a/src/CUDA2HIP_Doc.cpp b/src/CUDA2HIP_Doc.cpp index 59f952c5..0017d1c5 100644 --- a/src/CUDA2HIP_Doc.cpp +++ b/src/CUDA2HIP_Doc.cpp @@ -135,6 +135,11 @@ namespace doc { const string sCUB_csv = sCUB + csv_ext; const string sCUCUB = "CUB"; + const string sTENSOR = "CUTENSOR_API_supported_by_HIP"; + const string sTENSOR_md = sTENSOR + md_ext; + const string sTENSOR_csv = sTENSOR + csv_ext; + const string sCUTENSOR = "CUTENSOR"; + const string sAPI_supported_by = "API supported by "; const string sCUDA = "CUDA"; const string sHIP = "HIP"; @@ -855,6 +860,29 @@ namespace doc { } }; + class TENSOR : public DOC { + public: + TENSOR(const string &outDir): DOC(outDir) {} + virtual ~TENSOR() {} + protected: + const sectionMap &getSections() const override { return CUDA_TENSOR_API_SECTION_MAP; } + const functionMap &getFunctions() const override { return CUDA_TENSOR_FUNCTION_MAP; } + const typeMap &getTypes() const override { return CUDA_TENSOR_TYPE_NAME_MAP; } + const versionMap &getFunctionVersions() const override { return CUDA_TENSOR_FUNCTION_VER_MAP; } + const hipVersionMap &getHipFunctionVersions() const override { return HIP_TENSOR_FUNCTION_VER_MAP; } + const versionMap &getTypeVersions() const override { return CUDA_TENSOR_TYPE_NAME_VER_MAP; } + const hipVersionMap &getHipTypeVersions() const override { return HIP_TENSOR_TYPE_NAME_VER_MAP; } + const string &getName() const override { return sCUTENSOR; } + const string &getFileName(docType format) const override { + switch (format) { + case none: + default: return sEmpty; + case md: return sTENSOR_md; + case csv: return sTENSOR_csv; + } + } + }; + bool generate(bool GenerateMD, bool GenerateCSV) { if (!GenerateMD && !GenerateCSV) return true; error_code EC; @@ -921,6 +949,8 @@ namespace doc { docs.addDoc(&rtc); CUB cub(sOut); docs.addDoc(&cub); + TENSOR tensor(sOut); + docs.addDoc(&tensor); return docs.generate(); } diff --git a/src/CUDA2HIP_TENSOR_API_functions.cpp b/src/CUDA2HIP_TENSOR_API_functions.cpp index 4b0b1d10..bd8f8903 100644 --- a/src/CUDA2HIP_TENSOR_API_functions.cpp +++ b/src/CUDA2HIP_TENSOR_API_functions.cpp @@ -24,3 +24,15 @@ THE SOFTWARE. const std::map CUDA_TENSOR_FUNCTION_MAP { }; + + +const std::map CUDA_TENSOR_FUNCTION_VER_MAP { +}; + +const std::map HIP_TENSOR_FUNCTION_VER_MAP { +}; + +const std::map CUDA_TENSOR_API_SECTION_MAP { + {1, "CUTENSOR Data types"}, + {2, "CUTENSOR Function Reference"}, +}; diff --git a/src/CUDA2HIP_TENSOR_API_types.cpp b/src/CUDA2HIP_TENSOR_API_types.cpp index cdd2d387..c51730a8 100644 --- a/src/CUDA2HIP_TENSOR_API_types.cpp +++ b/src/CUDA2HIP_TENSOR_API_types.cpp @@ -51,3 +51,6 @@ const std::map CUDA_TENSOR_TYPE_NAME_MAP { const std::map CUDA_TENSOR_TYPE_NAME_VER_MAP { }; + +const std::map HIP_TENSOR_TYPE_NAME_VER_MAP { +};