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

Make "none" DataType explicit #5491

Merged
merged 4 commits into from
May 1, 2020
Merged

Make "none" DataType explicit #5491

merged 4 commits into from
May 1, 2020

Conversation

kparzysz-quic
Copy link
Contributor

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 (it was not handled).

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.
* \brief Construct a None type.
* \return The constructed data type.
*/
static DataType None() {
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Contributor Author

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.

@tqchen tqchen merged commit 12e737f into apache:master May 1, 2020
@tqchen
Copy link
Member

tqchen commented May 1, 2020

Thanks @kparzysz-quic !

@kparzysz-quic kparzysz-quic deleted the none-type branch May 1, 2020 12:39
Laurawly pushed a commit to Laurawly/tvm-1 that referenced this pull request May 9, 2020
* 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
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 9, 2020
* 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
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 18, 2020
* 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
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 18, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants