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

[microTVM] Autotuning performance tests #11782

Merged
merged 6 commits into from
Jul 5, 2022

Conversation

guberti
Copy link
Member

@guberti guberti commented Jun 20, 2022

This PR adds utilities for autotuning with microTVM and evaluating the subsequently generated AOT-compiled model to tvm.micro.testing. A example end-to-end autotuning test is also added to tests/micro/common/test_autotune.py, which works for Arduino and Zephyr. This will be the only working autotuning test for microTVM, but it will not be run on the CI, as @tvm.testing.requires_micro is set (it requires physical hardware). The test takes about three minutes to run on the Sony Spresense.

A few other changes in this PR:

  • A fetch_model_from_url function is added to reduce redundant logic for importing models
  • The tests in tests/micro/common are changed to be parameterized with the platform as well as the board. This eliminates the need for tests to decide whether a board is an Arduino or Zephyr board, and allows us to support boards that are compatible with both.
  • The yes_no.tflite model has been removed, and been replaced by using fetch_model_from_url to download it. This is the same model downloaded by test_tvmc.py.
  • The timing utilites for Zephyr have been changed to use the timing/timing.h, as our previous implementation was complicated and had bugs.

cc @alanmacd @gromero @mehrdadh

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

thanks @guberti just a couple comments here

python/tvm/testing/utils.py Outdated Show resolved Hide resolved
@guberti guberti force-pushed the autotuning-perf-tests branch 2 times, most recently from c853eb3 to 80d7c76 Compare June 27, 2022 18:40
Bugfixes to get tests passing

Refactor to remove tflite model for consistency

Black formatting

Linting and bugfixes

Add Apache license header

Use larger chunk size to read files

Explicitly specify LRU cache size for compatibility with Python 3.7

Pass platform to microTVM common tests

Better comment for runtime bound

Stop directory from being removed after session creation
Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
@guberti
Copy link
Member Author

guberti commented Jul 2, 2022

@areusch @alanmacd I've gotten the tests passing - mind taking a final look so I can merge?

@@ -1661,6 +1663,47 @@ def install_request_hook(depth: int) -> None:
request_hook.init()


def fetch_model_from_url(
Copy link
Contributor

Choose a reason for hiding this comment

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

cc @driazati for context in case this overlaps with work related to #11839.

@areusch
Copy link
Contributor

areusch commented Jul 5, 2022

looks like @alanmacd 's comment was addressed, so i'll merge. thanks @guberti !

@areusch areusch merged commit 3cca646 into apache:main Jul 5, 2022
blackkker pushed a commit to blackkker/tvm that referenced this pull request Jul 7, 2022
* Common autotuning test

* Autotuned model evaluation utilities

* Bugfixes and more enablement

* Working autotune profiling test

* Refactoring based on PR comments

Bugfixes to get tests passing

Refactor to remove tflite model for consistency

Black formatting

Linting and bugfixes

Add Apache license header

Use larger chunk size to read files

Explicitly specify LRU cache size for compatibility with Python 3.7

Pass platform to microTVM common tests

Better comment for runtime bound

Stop directory from being removed after session creation

* Use the actual Zephyr timing library

Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
masahi pushed a commit to masahi/tvm that referenced this pull request Jul 15, 2022
* Common autotuning test

* Autotuned model evaluation utilities

* Bugfixes and more enablement

* Working autotune profiling test

* Refactoring based on PR comments

Bugfixes to get tests passing

Refactor to remove tflite model for consistency

Black formatting

Linting and bugfixes

Add Apache license header

Use larger chunk size to read files

Explicitly specify LRU cache size for compatibility with Python 3.7

Pass platform to microTVM common tests

Better comment for runtime bound

Stop directory from being removed after session creation

* Use the actual Zephyr timing library

Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
* Common autotuning test

* Autotuned model evaluation utilities

* Bugfixes and more enablement

* Working autotune profiling test

* Refactoring based on PR comments

Bugfixes to get tests passing

Refactor to remove tflite model for consistency

Black formatting

Linting and bugfixes

Add Apache license header

Use larger chunk size to read files

Explicitly specify LRU cache size for compatibility with Python 3.7

Pass platform to microTVM common tests

Better comment for runtime bound

Stop directory from being removed after session creation

* Use the actual Zephyr timing library

Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
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