-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[microTVM][autoTVM] Follow up fixes to #9003 #9018
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """Defines the test methods used with microTVM.""" | ||
|
|
||
| import pathlib | ||
| import json | ||
| from typing import Union | ||
|
|
||
|
|
||
| def check_tune_log(log_path: Union[pathlib.Path, str]): | ||
| """Read the tuning log and check each result.""" | ||
| with open(log_path, "r") as f: | ||
| lines = f.readlines() | ||
|
|
||
| for line in lines: | ||
| if len(line) > 0: | ||
| tune_result = json.loads(line) | ||
| assert tune_result["result"][0][0] < 1000000000.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,11 @@ CC ?= ${PREFIX}gcc | |
| CXX ?= ${PREFIX}g++ | ||
| RANLIB ?= ${PREFIX}ranlib | ||
|
|
||
| ifeq (${VERBOSE}, 1) | ||
| QUIET ?= | ||
| else | ||
| QUIET ?= @ | ||
| endif | ||
|
|
||
| PWD = $(shell pwd) | ||
| BUILD_DIR = build | ||
|
|
@@ -38,7 +42,7 @@ CRT_LIBS = $(patsubst %, $(BUILD_DIR)/crt/lib%.a, $(CRT_LIB_NAMES)) | |
| CRT_INCLUDES = $(glob crt/include/**) | ||
|
|
||
| $(BUILD_DIR)/crt/lib%.a: $(glob crt/src/runtime/%/*.c) | ||
| ${QUIET}cd crt && $(MAKE) \ | ||
| ${QUIET}cd crt && $(MAKE) -s \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you need this and verbose?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, otherwise you get messages like |
||
| BUILD_DIR=../$(BUILD_DIR)/crt \ | ||
| CRT_CONFIG=$(PWD)/crt_config/crt_config.h \ | ||
| EXTRA_CFLAGS="$(CFLAGS)" \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ | |
|
|
||
| Autotuning with micro TVM | ||
| ========================= | ||
| **Author**: `Andrew Reusch <https://github.com/areusch>`_, `Mehrdad Hessar <https://github.com/mehrdadh>` | ||
| **Authors**: | ||
| `Andrew Reusch <https://github.com/areusch>`_, | ||
| `Mehrdad Hessar <https://github.com/mehrdadh>`_ | ||
|
|
||
| This tutorial explains how to autotune a model using the C runtime. | ||
| """ | ||
|
|
@@ -117,7 +119,7 @@ | |
|
|
||
| module_loader = tvm.micro.AutoTvmModuleLoader( | ||
| template_project_dir=repo_root / "src" / "runtime" / "crt" / "host", | ||
| project_options={}, | ||
| project_options={"verbose": False}, | ||
| ) | ||
| builder = tvm.autotvm.LocalBuilder( | ||
| n_parallel=1, | ||
|
|
@@ -136,7 +138,7 @@ | |
| # project_options={ | ||
| # "zephyr_board": BOARD, | ||
| # "west_cmd": "west", | ||
| # "verbose": 1, | ||
| # "verbose": False, | ||
| # "project_type": "host_driven", | ||
| # }, | ||
| # ) | ||
|
|
@@ -147,8 +149,8 @@ | |
| # build_func=tvm.micro.autotvm_build_func, | ||
| # ) | ||
| # runner = tvm.autotvm.LocalRunner(number=1, repeat=1, timeout=100, module_loader=module_loader) | ||
|
|
||
| # measure_option = tvm.autotvm.measure_option(builder=builder, runner=runner) | ||
| # | ||
| # measure_option = tvm.autotvm.measure_option(builder=builder, runner=runner) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one space?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the tutorial format. Picked it up from other tutorials. |
||
|
|
||
| ################ | ||
| # Run Autotuning | ||
|
|
@@ -181,7 +183,10 @@ | |
| temp_dir = tvm.contrib.utils.tempdir() | ||
|
|
||
| project = tvm.micro.generate_project( | ||
| str(repo_root / "src" / "runtime" / "crt" / "host"), lowered, temp_dir / "project" | ||
| str(repo_root / "src" / "runtime" / "crt" / "host"), | ||
| lowered, | ||
| temp_dir / "project", | ||
| {"verbose": False}, | ||
| ) | ||
|
|
||
| # Compiling for physical hardware | ||
|
|
@@ -193,7 +198,7 @@ | |
| # { | ||
| # "zephyr_board": BOARD, | ||
| # "west_cmd": "west", | ||
| # "verbose": 1, | ||
| # "verbose": False, | ||
| # "project_type": "host_driven", | ||
| # }, | ||
| # ) | ||
|
|
@@ -221,7 +226,10 @@ | |
| temp_dir = tvm.contrib.utils.tempdir() | ||
|
|
||
| project = tvm.micro.generate_project( | ||
| str(repo_root / "src" / "runtime" / "crt" / "host"), lowered_tuned, temp_dir / "project" | ||
| str(repo_root / "src" / "runtime" / "crt" / "host"), | ||
| lowered_tuned, | ||
| temp_dir / "project", | ||
| {"verbose": False}, | ||
| ) | ||
|
|
||
| # Compiling for physical hardware | ||
|
|
@@ -233,7 +241,7 @@ | |
| # { | ||
| # "zephyr_board": BOARD, | ||
| # "west_cmd": "west", | ||
| # "verbose": 1, | ||
| # "verbose": False, | ||
| # "project_type": "host_driven", | ||
| # }, | ||
| # ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.