Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Clarify downstream consistency of TVMArgTypeCode #5742

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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