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

Add qnn batch_matmul operator #8401

Merged
merged 7 commits into from
Jul 13, 2021
Merged

Conversation

elvin-n
Copy link
Contributor

@elvin-n elvin-n commented Jul 4, 2021

  • added support of the different out type for x86 batch_matmul

elvin-n added 3 commits July 4, 2021 21:18
Copy link
Contributor

@jwfromm jwfromm left a comment

Choose a reason for hiding this comment

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

These changes look excellent, I really like how you've minimized code duplication in the shape functions. I'm not quite sure why CI is failing, the error message is saying that Relay expects the output shape to be [16, 32] instead of [16, 16] like its supposed to be. I couldn't find any change in the shape functions that would make relay think that but there must be something subtle.

@elvin-n
Copy link
Contributor Author

elvin-n commented Jul 8, 2021

@jwfromm @masahi Could you please review?


Parameters
----------
x : tvm.relay.Expr
Copy link
Member

Choose a reason for hiding this comment

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

x, y

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

if yzero_point_zero == True:
y_zero_point = 0
else:
y_zero_point = -1
Copy link
Member

Choose a reason for hiding this comment

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

Should test on more non-zero zero points.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@masahi just curious if changing -1 to other value would be enough or you propose to add other tests.
Currently there are 5 test cases:
x zp =0, y zp = 0
x zp = -1, y zp = 0
x zp = 0, y zp = -1
x zp =-1, y zp =-1
that covers all flows in QnnBatchMatmulCanonicalize

Copy link
Member

Choose a reason for hiding this comment

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

I think we should test on larger non-zero zero points, to verify the accuracy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

modified zp to 123

@masahi
Copy link
Member

masahi commented Jul 8, 2021

@elvin-n Thanks. This is going to be useful for quantized transformers.

cc @anijain2305

@masahi masahi merged commit 807373c into apache:main Jul 13, 2021
@masahi
Copy link
Member

masahi commented Jul 13, 2021

Thanks @elvin-n @jwfromm

ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* Add qnn batch_matmul operator

- add support of the different out type for x86 batch_matmul

* Fix code style

* Add out_dtype to generic batch_matmul

* Restore fixe in batch_matmul for dynamic shapes

* Fix documentation for qnn.batch_matmul

* Remove debug code

* Modify zero point for qnn batch_matmul test
zxy844288792 pushed a commit to zxy844288792/tvm that referenced this pull request Mar 4, 2022
* Add qnn batch_matmul operator

- add support of the different out type for x86 batch_matmul

* Fix code style

* Add out_dtype to generic batch_matmul

* Restore fixe in batch_matmul for dynamic shapes

* Fix documentation for qnn.batch_matmul

* Remove debug code

* Modify zero point for qnn batch_matmul test
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