Skip to content

Fix QNN type inference - #7074

Merged
masahi merged 3 commits into
apache:mainfrom
mbrookhart:fix_qnn_type_inference
Dec 10, 2020
Merged

masahi merged 3 commits into
apache:mainfrom
mbrookhart:fix_qnn_type_inference

Conversation

@mbrookhart

Copy link
Copy Markdown
Contributor

@masahi

masahi commented Dec 10, 2020

Copy link
Copy Markdown
Member

@anijain2305 So after #6704, it seems type inferencer can pass IncompleteType to QNN type rel functions, which by itself is not wrong. Previously, @mbrookhart applied the same fix to the dynamic op type relation functions to make type inference pass.

@masahi masahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!! @mbrookhart

Comment thread src/relay/qnn/op/op_common.h Outdated
Comment thread src/relay/qnn/op/requantize.cc
Comment thread tests/python/frontend/pytorch/qnn_test.py
@jwfromm

jwfromm commented Dec 10, 2020

Copy link
Copy Markdown
Contributor

I'm a little confused what exactly is being type checked. The comments say its scale and zero points but the number of checked types in the loop don't match up. A little better documentation would go a long way.

Comment thread src/relay/qnn/op/requantize.cc Outdated
@mbrookhart

Copy link
Copy Markdown
Contributor Author

@jwfromm These functions are a little odd, they often check types for some of the scales/zero points and then run assignments on others I would expect to be inputs. I assume there is a reason for this, perhaps @anijain2305 knows? Anyway, to make it work, I only added the return false on those input types we actually end up checking.

I just pushed a bunch of comments for what we expect in the types vector, I hope that helps.

Comment thread src/relay/qnn/op/convolution.cc
Comment thread src/relay/qnn/op/requantize.cc

@jwfromm jwfromm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@masahi
masahi merged commit ffb6029 into apache:main Dec 10, 2020
@masahi

masahi commented Dec 10, 2020

Copy link
Copy Markdown
Member

Thanks @mbrookhart @jwfromm

TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
* check for incomplete types in QNN Relation functions

* add regression test from apache#7067

* respond to review comments
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
* check for incomplete types in QNN Relation functions

* add regression test from apache#7067

* respond to review comments
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* check for incomplete types in QNN Relation functions

* add regression test from apache#7067

* respond to review comments
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.

3 participants