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

Enable bool type as storage type #1853

Merged
merged 2 commits into from
Oct 7, 2018
Merged

Enable bool type as storage type #1853

merged 2 commits into from
Oct 7, 2018

Conversation

tqchen
Copy link
Member

@tqchen tqchen commented Oct 6, 2018

Previously, the bool type(uint1) cannot be directly stored and have to be explicitly cast to int8 before we store. However, it is still useful to introduce the type bool as it is used extensively in numpy and other languages. This PR enables this

  • bool is stored as int8
  • storage_flatten pass and buffer is updated to specially handle bool, and do type cast after loading, and before we store.
  • The frontend will print uint1 type directly as bool, so the type flag is numpy compatible

@tqchen
Copy link
Member Author

tqchen commented Oct 6, 2018

cc @jroesch @MarisaKirisame

@tqchen
Copy link
Member Author

tqchen commented Oct 6, 2018

This likely also requires us to make followup changes to the relay constant expression to take care of the fact that bool type is stored as int8, while its type fields will read as uint(1)

@MarisaKirisame
Copy link
Contributor

In DCE it is done as such. I think we can move the is_literal function into a common helper if anyone else need it.

@MarisaKirisame
Copy link
Contributor

LGTM

@tqchen tqchen merged commit f1d815c into apache:master Oct 7, 2018
FrozenGene pushed a commit to FrozenGene/tvm that referenced this pull request Dec 27, 2018
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