Skip to content

Conversation

@Aleksei-grovety
Copy link
Contributor

@Aleksei-grovety Aleksei-grovety commented Jan 15, 2024

Added support for calculation matmul with 16 bits fixed point. Added legalization of non-quantized dense operation with quantization by fixed point multiplication.
cc @lhutton1, @ekalda, @leandron

@github-actions github-actions bot requested a review from lhutton1 January 15, 2024 10:42
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Aleksei-grovety, I had a couple of questions about the implementation

@Aleksei-grovety Aleksei-grovety force-pushed the ethosu-matmul-fixed-point branch from 2983626 to cb2faa8 Compare January 16, 2024 17:27
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks for the responses @Aleksei-grovety. My main concern is that we need to expose an option to the user, rather than encapsulating this information as part of a relay operator. Are you able to share any more context about where this type of operation comes from?

@Aleksei-grovety
Copy link
Contributor Author

Are you able to share any more context about where this type of operation comes from?

One of the earliest uses of fixed-point arithmetic was in digital signal processing (DSP) applications, where it was used to perform high-speed and high-precision calculations on audio and video signals. Fixed-point arithmetic was well-suited for these applications because it could provide the necessary precision and speed while minimizing the resources required to perform the calculations.
Here is article Introduction to Fixed Point Number Representation.

@Aleksei-grovety Aleksei-grovety force-pushed the ethosu-matmul-fixed-point branch from 69f3b37 to 53d7a2d Compare February 2, 2024 14:11
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup @Aleksei-grovety. I think overall I'm still a bit unsure why fixed_point_fraction_size needs to be exposed from the microNPU compiler attrs, rather than the data being encoded in the Relay graph. For example, is it possible to insert relay.fixed_point_multiply operators on the inputs/outputs of the graph in between the matmul? Apologies if I'm still missing something here

@Aleksei-grovety Aleksei-grovety force-pushed the ethosu-matmul-fixed-point branch from 53d7a2d to a23e8fc Compare February 9, 2024 15:59
@Aleksei-grovety
Copy link
Contributor Author

For example, is it possible to insert relay.fixed_point_multiply operators on the inputs/outputs of the graph in between the matmul

Yes, it's possible, I've updated the code.

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks @Aleksei-grovety, LGTM!

@Aleksei-grovety Aleksei-grovety force-pushed the ethosu-matmul-fixed-point branch from a23e8fc to 5e9e432 Compare February 13, 2024 18:49
@lhutton1 lhutton1 merged commit 07ecb34 into apache:main Feb 14, 2024
@lhutton1
Copy link
Contributor

Thanks @Aleksei-grovety!

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