-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[microTVM] AOT Demo #8075
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
[microTVM] AOT Demo #8075
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4d52671
initial
mehrdadh b22bc96
remove compare
mehrdadh b2d5905
temp fix
mehrdadh d02e89f
debugging
mehrdadh 5f2d98e
hack
mehrdadh a4d9508
hack for testing
mehrdadh 8dc9af2
both test pass
mehrdadh 961a279
Merge branch 'main' into aot_zephyr
mehrdadh 5570e0b
cleanup
mehrdadh 0937f3e
fix tests and tutorials
mehrdadh 471d299
Merge branch 'main' into aot_zephyr
mehrdadh d29c43a
restructure
mehrdadh e27bdd7
cleanup
mehrdadh 443ccb2
cleanup
mehrdadh e590c2c
fix check files
mehrdadh 5abde9d
fixed for physical devices
mehrdadh baacb05
address comments
mehrdadh 2d1942f
reduce nrf stack size
mehrdadh 39c7feb
update sample url
mehrdadh d8f839e
format
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <!--- 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. --> | ||
|
|
||
| This directory contains a Zephyr-based ahead of time (AOT) "demo" runtime environment that | ||
| pulls together the microTVM runtime dependencies into a single application | ||
| that can run TVM on a microTVM device without the need to a host. |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
apps/microtvm/zephyr/aot_demo/boards/nrf5340dk_nrf5340_cpuapp.conf
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,31 @@ | ||
| # 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. | ||
| # | ||
| # This file is specific to the nRF5340 DK board. | ||
|
|
||
| # For intrinsics used by generated optimized operators. | ||
| CONFIG_CMSIS_DSP=y | ||
|
|
||
| # For AOT runtime which requires lots of function call. | ||
| CONFIG_MAIN_STACK_SIZE=2000 | ||
|
|
||
| # For random number generation. | ||
| CONFIG_ENTROPY_GENERATOR=y | ||
| CONFIG_TEST_RANDOM_GENERATOR=y | ||
|
|
||
| # For debugging. | ||
| CONFIG_LED=y |
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,25 @@ | ||
| # 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. | ||
|
|
||
| # This file is specific to the QEMU-emulated microTVM board. | ||
|
|
||
| # For TVMPlatformGenerateRandom(). Remember, these values do not need to be truly random. | ||
| CONFIG_TEST_RANDOM_GENERATOR=y | ||
| CONFIG_TIMER_RANDOM_GENERATOR=y | ||
|
|
||
| # Default stack size is 1k, this is required for debug mode. | ||
| CONFIG_MAIN_STACK_SIZE=2000 | ||
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,62 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file tvm/runtime/crt_config.h.template | ||
| * \brief Template for CRT configuration, to be modified on each target. | ||
| */ | ||
| #ifndef TVM_RUNTIME_CRT_CONFIG_H_ | ||
| #define TVM_RUNTIME_CRT_CONFIG_H_ | ||
|
|
||
| #include <tvm/runtime/crt/logging.h> | ||
|
|
||
| /*! Log level of the CRT runtime */ | ||
| #define TVM_CRT_LOG_LEVEL TVM_CRT_LOG_LEVEL_DEBUG | ||
|
|
||
| /*! Maximum supported dimension in NDArray */ | ||
| #define TVM_CRT_MAX_NDIM 6 | ||
|
|
||
| /*! Maximum supported arguments in generated functions */ | ||
| #define TVM_CRT_MAX_ARGS 10 | ||
|
|
||
| /*! Size of the global function registry, in bytes. */ | ||
| #define TVM_CRT_GLOBAL_FUNC_REGISTRY_SIZE_BYTES 200 | ||
|
|
||
| /*! Maximum number of registered modules. */ | ||
| #define TVM_CRT_MAX_REGISTERED_MODULES 2 | ||
|
|
||
| /*! Maximum packet size, in bytes, including the length header. */ | ||
| #define TVM_CRT_MAX_PACKET_SIZE_BYTES (1 * 1024) | ||
|
|
||
| /*! Maximum supported string length in dltype, e.g. "int8", "int16", "float32" */ | ||
| #define TVM_CRT_MAX_STRLEN_DLTYPE 10 | ||
|
|
||
| /*! Maximum supported string length in function names */ | ||
| #define TVM_CRT_MAX_STRLEN_FUNCTION_NAME 80 | ||
|
|
||
| /*! \brief Maximum length of a PackedFunc function name. */ | ||
| #define TVM_CRT_MAX_FUNCTION_NAME_LENGTH_BYTES 30 | ||
|
|
||
| /*! \brief Log2 of the page size (bytes) for a virtual memory page. */ | ||
| #define TVM_CRT_PAGE_BITS 10 // 1 kB | ||
|
|
||
| /*! \brief Number of pages on device. */ | ||
| #define TVM_CRT_MAX_PAGES 300 | ||
|
|
||
| #endif // TVM_RUNTIME_CRT_CONFIG_H_ |
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,50 @@ | ||
| /* | ||
mehrdadh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * 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. | ||
| */ | ||
|
|
||
| #ifndef TVM_APPS_MICROTVM_ZEPHYR_AOT_DEMO_INCLUDE_ZEPHYR_UART_H_ | ||
| #define TVM_APPS_MICROTVM_ZEPHYR_AOT_DEMO_INCLUDE_ZEPHYR_UART_H_ | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| // Used to read data from the UART. | ||
|
|
||
| /*! | ||
| * \brief Read Uart Rx buffer. | ||
| * \param data Pointer to read data. | ||
| * \param data_size_bytes Read request size in bytes. | ||
| * | ||
| * \return Number of data read in bytes. | ||
| */ | ||
| uint32_t TVMPlatformUartRxRead(uint8_t* data, uint32_t data_size_bytes); | ||
|
|
||
| /*! | ||
| * \brief Write data in serial. | ||
| * \param data Pointer to data to write. | ||
| * \param size Size of data in bytes. | ||
| * | ||
| * \return Number of write in bytes. | ||
| */ | ||
| uint32_t TVMPlatformWriteSerial(const char* data, uint32_t size); | ||
|
|
||
| /*! | ||
| * \brief Initialize Uart. | ||
| */ | ||
| void TVMPlatformUARTInit(); | ||
|
|
||
| #endif /* TVM_APPS_MICROTVM_ZEPHYR_AOT_DEMO_INCLUDE_ZEPHYR_UART_H_ */ | ||
File renamed without changes.
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 @@ | ||
| ../qemu-hack |
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.
Uh oh!
There was an error while loading. Please reload this page.