Skip to content

Commit

Permalink
Add some docs on downstream consistency (apache#5742)
Browse files Browse the repository at this point in the history
  • Loading branch information
junrushao authored and Trevor Morris committed Jun 18, 2020
1 parent 3c9d909 commit 71ae54d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 14 additions & 4 deletions include/tvm/runtime/c_runtime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,22 @@ typedef enum {
} TVMDeviceExtType;

/*!
* \brief The type code in used in the TVM FFI for argument passing.
* \brief The type code in used and only used in TVM FFI for argument passing.
*
* DLPack consistency:
* 1) kTVMArgInt is compatible with kDLInt
* 2) kTVMArgFloat is compatible with kDLFloat
* 3) kDLUInt is not in ArgTypeCode, but has a spared slot
*
* Downstream consistency:
* The kDLInt, kDLUInt, kDLFloat are kept consistent with the original ArgType code
*
* It is only used in argument passing, and should not be confused with
* DataType::TypeCode, which is DLPack-compatible.
*
* \sa tvm::runtime::DataType::TypeCode
*/
typedef enum {
// The type code of other types are compatible with DLPack.
// The next few fields are extension types
// that is used by TVM API calls.
kTVMArgInt = kDLInt,
kTVMArgFloat = kDLFloat,
kTVMOpaqueHandle = 3U,
Expand Down
9 changes: 8 additions & 1 deletion include/tvm/runtime/data_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ namespace runtime {
*/
class DataType {
public:
/*! \brief Type code for the DataType. */
/*!
* \brief Type code for the DataType.
*
* DLPack consistency:
* 1) kInt is consistent with kDLInt
* 2) kUInt is consistent with kDLUInt
* 3) kFloat is consistent with kDLFloat
*/
enum TypeCode {
kInt = kDLInt,
kUInt = kDLUInt,
Expand Down

0 comments on commit 71ae54d

Please sign in to comment.