Skip to content

Commit

Permalink
[HIPIFY][Tensor][feature] Introduce cuTensor support - Part 2 - doc…
Browse files Browse the repository at this point in the history
…umentation

+ [ToDo] API versioning
  • Loading branch information
emankov committed Nov 18, 2024
1 parent d579f14 commit 2a6d494
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/tables/CUTENSOR_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/CUDA2HIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ const std::map<llvm::StringRef, cudaAPIversions> &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;
}

Expand Down Expand Up @@ -199,5 +201,7 @@ const std::map<llvm::StringRef, hipAPIversions> &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;
}
5 changes: 5 additions & 0 deletions src/CUDA2HIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_RTC_TYPE_NAME_VER_M
extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_RTC_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_TENSOR_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIversions> CUDA_TENSOR_FUNCTION_VER_MAP;

/**
* The union of all the above CUDA maps.
Expand Down Expand Up @@ -166,6 +168,8 @@ extern const std::map<llvm::StringRef, hipAPIversions> HIP_RTC_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_RTC_FUNCTION_CHANGED_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_TENSOR_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_TENSOR_FUNCTION_VER_MAP;

/**
* The union of all the above HIP maps.
Expand All @@ -185,6 +189,7 @@ extern const std::map<unsigned int, llvm::StringRef> CUDA_DEVICE_FUNCTION_API_SE
extern const std::map<unsigned int, llvm::StringRef> CUDA_RTC_API_SECTION_MAP;
extern const std::map<unsigned int, llvm::StringRef> CUDA_CUB_API_SECTION_MAP;
extern const std::map<unsigned int, llvm::StringRef> CUDA_SOLVER_API_SECTION_MAP;
extern const std::map<unsigned int, llvm::StringRef> CUDA_TENSOR_API_SECTION_MAP;

namespace driver {
enum CUDA_DRIVER_API_SECTIONS {
Expand Down
30 changes: 30 additions & 0 deletions src/CUDA2HIP_Doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -921,6 +949,8 @@ namespace doc {
docs.addDoc(&rtc);
CUB cub(sOut);
docs.addDoc(&cub);
TENSOR tensor(sOut);
docs.addDoc(&tensor);
return docs.generate();
}

Expand Down
12 changes: 12 additions & 0 deletions src/CUDA2HIP_TENSOR_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ THE SOFTWARE.

const std::map<llvm::StringRef, hipCounter> CUDA_TENSOR_FUNCTION_MAP {
};


const std::map<llvm::StringRef, cudaAPIversions> CUDA_TENSOR_FUNCTION_VER_MAP {
};

const std::map<llvm::StringRef, hipAPIversions> HIP_TENSOR_FUNCTION_VER_MAP {
};

const std::map<unsigned int, llvm::StringRef> CUDA_TENSOR_API_SECTION_MAP {
{1, "CUTENSOR Data types"},
{2, "CUTENSOR Function Reference"},
};
3 changes: 3 additions & 0 deletions src/CUDA2HIP_TENSOR_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ const std::map<llvm::StringRef, hipCounter> CUDA_TENSOR_TYPE_NAME_MAP {

const std::map<llvm::StringRef, cudaAPIversions> CUDA_TENSOR_TYPE_NAME_VER_MAP {
};

const std::map<llvm::StringRef, hipAPIversions> HIP_TENSOR_TYPE_NAME_VER_MAP {
};

0 comments on commit 2a6d494

Please sign in to comment.