-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[microTVM][ARM] Add Relay tests for conv2d registered schedules #11250
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
43ccb85
Added conv2d relay test for each schedule
mehrdadh cd00f7b
split aot test utils
mehrdadh 531bd2c
fix split imports
mehrdadh d2e2cec
add else case
mehrdadh 76c44fd
address comments
mehrdadh 6b25e19
remove comments
mehrdadh a740fc2
lint
mehrdadh 17fac28
fix import errors
mehrdadh 3a42844
fix error
mehrdadh 002682f
fix imports
mehrdadh 0c879e3
fix import
mehrdadh bd6efeb
Address comments
mehrdadh ab94634
Merge branch 'main' into microtvm/add_conv2d_tests
mehrdadh 70dadcd
fix import
mehrdadh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # 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. | ||
|
|
||
| import logging | ||
| import itertools | ||
| import shutil | ||
|
|
||
| import pytest | ||
|
|
||
| pytest.importorskip("tvm.micro") | ||
|
|
||
| import tvm | ||
| from tvm.testing.aot import AOTTestRunner | ||
|
|
||
| _LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| AOT_DEFAULT_RUNNER = AOTTestRunner() | ||
|
|
||
| # AOT Test Runner using the Arm® Corstone™-300 Reference Systems | ||
| # see: https://developer.arm.com/ip-products/subsystem/corstone/corstone-300 | ||
| AOT_CORSTONE300_RUNNER = AOTTestRunner( | ||
| makefile="corstone300", | ||
| prologue=""" | ||
| uart_init(); | ||
| """, | ||
| includes=["uart.h"], | ||
| pass_config={ | ||
| "relay.ext.cmsisnn.options": { | ||
| "mcpu": "cortex-m55", | ||
| } | ||
| }, | ||
| ) | ||
|
|
||
| AOT_USMP_CORSTONE300_RUNNER = AOTTestRunner( | ||
| makefile="corstone300", | ||
| prologue=""" | ||
| uart_init(); | ||
| """, | ||
| includes=["uart.h"], | ||
| pass_config={ | ||
| "relay.ext.cmsisnn.options": { | ||
| "mcpu": "cortex-m55", | ||
| }, | ||
| "tir.usmp.enable": True, | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| def parametrize_aot_options(test): | ||
| """Parametrize over valid option combinations""" | ||
|
|
||
| requires_arm_eabi = pytest.mark.skipif( | ||
| shutil.which("arm-none-eabi-gcc") is None, reason="ARM embedded toolchain unavailable" | ||
| ) | ||
|
|
||
| interface_api = ["packed", "c"] | ||
| use_unpacked_api = [True, False] | ||
| test_runner = [AOT_DEFAULT_RUNNER, AOT_CORSTONE300_RUNNER] | ||
|
|
||
| all_combinations = itertools.product(interface_api, use_unpacked_api, test_runner) | ||
|
|
||
| # Filter out packed operators with c interface | ||
| valid_combinations = filter( | ||
| lambda parameters: not (parameters[0] == "c" and not parameters[1]), | ||
| all_combinations, | ||
| ) | ||
|
|
||
| # Only use reference system for C interface and unpacked API calls | ||
| valid_combinations = filter( | ||
| lambda parameters: not ( | ||
| parameters[2] == AOT_CORSTONE300_RUNNER | ||
| and (parameters[0] == "packed" or not parameters[1]) | ||
| ), | ||
| valid_combinations, | ||
| ) | ||
|
|
||
| # Skip reference system tests if running in i386 container | ||
| marked_combinations = map( | ||
| lambda parameters: pytest.param(*parameters, marks=[requires_arm_eabi]) | ||
| if parameters[2] == AOT_CORSTONE300_RUNNER | ||
| else parameters, | ||
| valid_combinations, | ||
| ) | ||
|
|
||
| fn = pytest.mark.parametrize( | ||
| ["interface_api", "use_unpacked_api", "test_runner"], | ||
| marked_combinations, | ||
| )(test) | ||
|
|
||
| return tvm.testing.skip_if_32bit(reason="Reference system unavailable in i386 container")(fn) |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain why this is different from ApplyConfig here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the comment no longer makes sense now that we are accepting an array of schedule names, but can fix that in a follow-on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix that in a follow up PR.