areusch commented on a change in pull request #7804: URL: https://github.com/apache/tvm/pull/7804#discussion_r608276212
########## File path: apps/microtvm/zephyr/demo_runtime/boards/qemu_riscv32.conf ########## @@ -0,0 +1,28 @@ +# 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 RISCV32 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 512, for operations with large floating point data. +CONFIG_MAIN_STACK_SIZE=2048 + +# For floating point operations. Review comment: could you add a note to explain which error you'll see if you don't include this? ########## File path: apps/microtvm/reference-vm/base-box-tool.py ########## @@ -358,14 +358,18 @@ def test_command(args): def release_command(args): + vm_name = f"mehrdadh/microtvm-{args.platform}" + if args.platform == "zephyr": + vm_name = f"{vm_name}-{args.zephyr_version}" Review comment: can you ensure `args.zephyr_version` is not `None`, else it will release microtvm-None, I think? ########## File path: python/tvm/micro/contrib/zephyr.py ########## @@ -571,33 +605,49 @@ def write(self, data, timeout_sec): class ZephyrQemuTransport(Transport): """The user-facing Zephyr QEMU transport class.""" - def __init__(self, base_dir, startup_timeout_sec=5.0, **kwargs): + def __init__(self, base_dir, startup_timeout_sec=5.0, debugger=None, **kwargs): self.base_dir = base_dir self.startup_timeout_sec = startup_timeout_sec self.kwargs = kwargs self.proc = None self.fd_transport = None self.pipe_dir = None + self.debugger = debugger def timeouts(self): return TransportTimeouts( session_start_retry_timeout_sec=2.0, session_start_timeout_sec=self.startup_timeout_sec, - session_established_timeout_sec=5.0, + session_established_timeout_sec=5.0 if self.debugger is None else 0, ) def open(self): self.pipe_dir = tempfile.mkdtemp() self.pipe = os.path.join(self.pipe_dir, "fifo") self.write_pipe = os.path.join(self.pipe_dir, "fifo.in") self.read_pipe = os.path.join(self.pipe_dir, "fifo.out") + os.mkfifo(self.write_pipe) os.mkfifo(self.read_pipe) + if self.debugger is not None: + if 'env' in self.kwargs: + self.kwargs["env"] = copy.copy(self.kwargs["env"]) + else: + self.kwargs["env"] = copy.copy(os.environ) + + self.kwargs["env"]["TVM_QEMU_DEBUG"] = "1" + self.proc = subprocess.Popen( - ["make", "run", f"QEMU_PIPE={self.pipe}"], + ["make", + "run", + f"QEMU_PIPE={self.pipe}"], cwd=self.base_dir, **self.kwargs, ) + print('START DEBUG', self.debugger) Review comment: delete this line ########## File path: apps/microtvm/zephyr/demo_runtime/qemu-hack/qemu-system-riscv64 ########## @@ -0,0 +1,38 @@ +#!/bin/bash -e Review comment: I thiiiink you can just checkin a symlink here and `$(basename $0)` will take care of this. could you try it out? e.g. `ln -s qemu-system-i386 qemu-system-riscv64` in this dir. ########## File path: apps/microtvm/reference-vm/base-box-tool.py ########## @@ -358,14 +358,18 @@ def test_command(args): def release_command(args): + vm_name = f"mehrdadh/microtvm-{args.platform}" Review comment: can you remove `mehrdadh/`? ########## File path: apps/microtvm/zephyr/demo_runtime/src/main.c ########## @@ -265,6 +265,10 @@ static uint8_t main_rx_buf[RING_BUF_SIZE_BYTES]; // The main function of this application. extern void __stdout_hook_install(int (*hook)(int)); void main(void) { + // TODO (mehrdadh): Update this when zephyr version was updated to 2.6. + // Uncomment this for qemu_riscv32, also update zephyr to latest version. Review comment: Actually, can you just use the `#ifdef CONFIG_BOARD_QEMU_RISCV32`? ########## File path: apps/microtvm/zephyr/demo_runtime/boards/qemu_riscv32.conf ########## @@ -0,0 +1,28 @@ +# 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 RISCV32 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 512, for operations with large floating point data. Review comment: why 512? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
