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

[Hexagon] Add scripts for e2e MetaSchedule tuning demonstration #13135

Merged
merged 5 commits into from
Oct 20, 2022

Conversation

masahi
Copy link
Member

@masahi masahi commented Oct 19, 2022

I've worked on a series of PRs to enable e2e MS tuning on Hexagon (mostly for supporting link-params = True in MS). Now that all the pieces have been upstreamed, I'm adding demo tuning scripts under test_hexagon/metaschedule_e2e.

They are not run on CI, and running it locally requires PyTorch to generate fp16 and int8 resnet50.

The scripts use a small number of tuning trials and replay-trace search strategy instead of the evolutionary search, to finish tuning quickly. Those interested in MS tuning can tweak these settings for better performance at the cost of more tuning times.

@csullivan @kparzysz-quic @farshidsp

@tvm-bot
Copy link
Collaborator

tvm-bot commented Oct 19, 2022

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.

Generated by tvm-bot

@areusch areusch added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Oct 19, 2022
Copy link
Contributor

@csullivan csullivan left a comment

Choose a reason for hiding this comment

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

Thank you for these intrins and tests @masahi! It is invaluable to have these early demonstrations of the impact metaschedule has for Hexagon.

Comment on lines +113 to +117
print(
"max and mean abs difference with the reference:",
np.max(np.abs(ref_result - hexagon_output)),
np.mean(np.abs(ref_result - hexagon_output)),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there accuracy issues with tuning the fp16 variant that prevent an assert_allclose with the reference?

Copy link
Member Author

@masahi masahi Oct 20, 2022

Choose a reason for hiding this comment

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

There is non-trivial accuracy difference between x86 and HVX fp16. Added a sample output and assert check with a fairly loose bound.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @masahi!

@csullivan csullivan merged commit 57b9988 into apache:main Oct 20, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 10, 2022
…he#13135)

I've worked on a series of PRs to enable e2e MS tuning on Hexagon (mostly for supporting link-params = True in MS). Now that all the pieces have been upstreamed, I'm adding demo tuning scripts under test_hexagon/metaschedule_e2e.

They are not run on CI, and running it locally requires PyTorch to generate fp16 and int8 resnet50.

The scripts use a small number of tuning trials and replay-trace search strategy instead of the evolutionary search, to finish tuning quickly. Those interested in MS tuning can tweak these settings for better performance at the cost of more tuning times.

* change dtype in tvmscript roundtrip test to avoid int printing error

* allow printing non int8 array

* Revert "change dtype in tvmscript roundtrip test to avoid int printing error"

* add loose assert check on fp16 result
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
…he#13135)

I've worked on a series of PRs to enable e2e MS tuning on Hexagon (mostly for supporting link-params = True in MS). Now that all the pieces have been upstreamed, I'm adding demo tuning scripts under test_hexagon/metaschedule_e2e.

They are not run on CI, and running it locally requires PyTorch to generate fp16 and int8 resnet50.

The scripts use a small number of tuning trials and replay-trace search strategy instead of the evolutionary search, to finish tuning quickly. Those interested in MS tuning can tweak these settings for better performance at the cost of more tuning times.

* change dtype in tvmscript roundtrip test to avoid int printing error

* allow printing non int8 array

* Revert "change dtype in tvmscript roundtrip test to avoid int printing error"

* add loose assert check on fp16 result
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