-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Make "none" DataType explicit #5491
Conversation
The None data type is created when converting an empty string to DataType. Add functions to create it and recognize it. Convert it to the "void" LLVM type in LLVM codegen.
include/tvm/runtime/data_type.h
Outdated
* \brief Construct a None type. | ||
* \return The constructed data type. | ||
*/ | ||
static DataType None() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be consistent with the VoidType, perhaps we can use Void here? See also https://github.com/apache/incubator-tvm/blob/master/include/tvm/ir/type.h#L375
Also need to update GetRuntimeType and GetType here https://github.com/apache/incubator-tvm/blob/master/include/tvm/tir/op.h#L60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to do in GetType
. It checks for a pointer type, and for other expressions it just returns the DataType member, so it seems like there is no extra handling needed.
Btw, the if statement doesn't seem to be doing anything, since it's followed by the exact same return statement:
https://github.com/apache/incubator-tvm/blob/master/src/tir/ir/op.cc#L61
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have a single VoidType, so GetType(DataType::Void()) better returns VoidType() and GetRuntimeType(VoidType()) returns the DataType variant.
The main reason of the additional return is that we suppose to add an WARNING if the check does not pass, see also the relations between runtime type and type in https://github.com/apache/incubator-tvm/blob/master/include/tvm/ir/type.h#L29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, of course. I didn't notice that GetType
returned Type
.
Thanks @kparzysz-quic ! |
* Make "none" DataType explicit The None data type is created when converting an empty string to DataType. Add functions to create it and recognize it. Convert it to the "void" LLVM type in LLVM codegen. * Rename "none" to "void" * Map VoidType:Type -> Void:DataType in GetRuntimeDataType * Map Void:DataType -> VoidType:Type in GetType
* Make "none" DataType explicit The None data type is created when converting an empty string to DataType. Add functions to create it and recognize it. Convert it to the "void" LLVM type in LLVM codegen. * Rename "none" to "void" * Map VoidType:Type -> Void:DataType in GetRuntimeDataType * Map Void:DataType -> VoidType:Type in GetType
* Make "none" DataType explicit The None data type is created when converting an empty string to DataType. Add functions to create it and recognize it. Convert it to the "void" LLVM type in LLVM codegen. * Rename "none" to "void" * Map VoidType:Type -> Void:DataType in GetRuntimeDataType * Map Void:DataType -> VoidType:Type in GetType
* Make "none" DataType explicit The None data type is created when converting an empty string to DataType. Add functions to create it and recognize it. Convert it to the "void" LLVM type in LLVM codegen. * Rename "none" to "void" * Map VoidType:Type -> Void:DataType in GetRuntimeDataType * Map Void:DataType -> VoidType:Type in GetType
The
None
data type is created when converting an empty string toDataType
.Add functions to create it and recognize it. Convert it to the
void
LLVM type in LLVM codegen (it was not handled).