You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by me...@apache.org on 2022/09/07 14:26:20 UTC

[tvm] branch main updated: [microTVM][Zephyr] Enable -O2 optimization on build by default (#12718)

This is an automated email from the ASF dual-hosted git repository.

mehrdadh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new ff9a5309ec [microTVM][Zephyr] Enable -O2 optimization on build by default (#12718)
ff9a5309ec is described below

commit ff9a5309ecd713214a61e9e848c90289831f70c5
Author: Mehrdad Hessar <mh...@octoml.ai>
AuthorDate: Wed Sep 7 07:26:09 2022 -0700

    [microTVM][Zephyr] Enable -O2 optimization on build by default (#12718)
    
    * add spped optimization flag
    
    * trigger
    
    * add exception for qemu_riscv64
---
 apps/microtvm/zephyr/template_project/microtvm_api_server.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/apps/microtvm/zephyr/template_project/microtvm_api_server.py b/apps/microtvm/zephyr/template_project/microtvm_api_server.py
index 76895c430b..b73779f681 100644
--- a/apps/microtvm/zephyr/template_project/microtvm_api_server.py
+++ b/apps/microtvm/zephyr/template_project/microtvm_api_server.py
@@ -456,6 +456,7 @@ class Handler(server.ProjectAPIHandler):
     }
 
     def _create_prj_conf(self, project_dir, options):
+        zephyr_board = options["zephyr_board"]
         with open(project_dir / "prj.conf", "w") as f:
             f.write(
                 "# For UART used from main().\n"
@@ -477,7 +478,7 @@ class Handler(server.ProjectAPIHandler):
 
             f.write("# For math routines\n" "CONFIG_NEWLIB_LIBC=y\n" "\n")
 
-            if self._has_fpu(options["zephyr_board"]):
+            if self._has_fpu(zephyr_board):
                 f.write("# For models with floating point.\n" "CONFIG_FPU=y\n" "\n")
 
             # Set main stack size, if needed.
@@ -488,9 +489,13 @@ class Handler(server.ProjectAPIHandler):
 
             f.write("\n# Extra prj.conf directives\n")
             for line, board_list in self.EXTRA_PRJ_CONF_DIRECTIVES.items():
-                if options["zephyr_board"] in board_list:
+                if zephyr_board in board_list:
                     f.write(f"{line}\n")
 
+            # TODO(mehrdadh): due to https://github.com/apache/tvm/issues/12721
+            if zephyr_board not in ["qemu_riscv64"]:
+                f.write("# For setting -O2 in compiler.\n" "CONFIG_SPEED_OPTIMIZATIONS=y\n")
+
             f.write("\n")
 
     API_SERVER_CRT_LIBS_TOKEN = "<API_SERVER_CRT_LIBS>"