Skip to content

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

@github-actions github-actions bot requested review from gromero and mehrdadh June 20, 2022 06:12
@guberti guberti force-pushed the autotuning-perf-tests branch from aeab97c to 19d3e53 Compare June 22, 2022 01:04
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

@guberti guberti force-pushed the autotuning-perf-tests branch 2 times, most recently from c853eb3 to 80d7c76 Compare June 27, 2022 18:40
guberti added 5 commits July 1, 2022 21:41
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
@guberti guberti force-pushed the autotuning-perf-tests branch from 1e0f4ba to acd0b48 Compare July 2, 2022 01:45
Use unsigned integer

Additional logging

Try negation

Try 64 bit timer

Use Zephyr's timing library

Fix linting

Enable timing utilities
@guberti guberti force-pushed the autotuning-perf-tests branch from acd0b48 to aed52f7 Compare July 2, 2022 01:45
@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?

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