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

[Unity] Replacing unary ops with LookUpTable and Take op to improve performance. #15614

Closed
wants to merge 4 commits into from

Conversation

sdalvi-quic
Copy link
Contributor

Motivation : Unary ops calculate the value during runtime which is costly. Since we are handling quantized data hence, it is better to pre compute the value during compile time (for 0 -256 value) and store in a Look Up Table which is accessed during the runtime.

Implementation : This pass generates the Look Up Table for each unary op during compile time. It iterates over the original graph and replaces the unary ops call node, (example tanh, sqrt) to a call node that accesses a Look Up Table corresponding to the unary op, and return the value.

Testing : The test_take checks for both value correctness and structural correctness of the output generated after the pass.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Aug 23, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to auto-tag found, no teams are specified in PR title See #10317 for details

Generated by tvm-bot

@sdalvi-quic
Copy link
Contributor Author

sdalvi-quic commented Aug 23, 2023

@jverma-quic @quic-sanirudh @kparzysz-quic
Please review the PR for upstream.

@sdalvi-quic sdalvi-quic changed the title [UPSTREAM] Implementation to replace unary ops with take op Replacing unary ops with LookUpTable and Take op to improve performance. Aug 25, 2023
@quic-sanirudh
Copy link
Contributor

@sdalvi-quic Can you fix the lint errors, and maybe also update the title to add [Unity] tag so that its obvious that this patch goes into unity branch?

@sdalvi-quic sdalvi-quic changed the title Replacing unary ops with LookUpTable and Take op to improve performance. [Unity] Replacing unary ops with LookUpTable and Take op to improve performance. Aug 29, 2023
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.

4 participants