You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/09/03 10:58:58 UTC

[GitHub] [tvm] grant-arm opened a new pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

grant-arm opened a new pull request #8922:
URL: https://github.com/apache/tvm/pull/8922


   This PR adds a demo application that uses TVM to run a model on bare metal  Arm® Cortex®-M55 CPU and  Arm® Ethos™-U55 NPU
   
   This PR is blocked on merging #8795 , #8806, #8811, #8849 and #8854. Since this is built on top of all those PR branches, this contains the accumulation of contents of the all the PRs.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723163917



##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite
+
+# Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \
+    c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
+    --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
+tar -xvf module.tar
+
+# Get ImageNet labels
+curl -sSL  https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/labels_mobilenet_quant_v1_224.txt \
+    > ./labels_mobilenet_quant_v1_224.txt

Review comment:
       Done.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-948235894


   @grant-arm  
   1. Why you rewrite the functions "TVMPlatformMemoryAllocate" and "TVMPlatformMemoryFree" in tvm_runtime.h?
   2. How to determine the value of WORKSPACE_SIZE?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-945799999


   How to run a model only on bare metal Arm® Cortex®-M55 CPU not Ethos(TM)-U55 NPU ?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-949741138


   > @grant-arm
   > 
   > 1. Why you rewrite the functions "TVMPlatformMemoryAllocate" and "TVMPlatformMemoryFree" in tvm_runtime.h?
   > 2. How to determine the value of WORKSPACE_SIZE?
   
   @JKANG94
   1. We need to provide the platform implementation that uses the stack allocator. In your particular use-case, if malloc is permitted and desired, then you could use that instead.
   2. You can get the value for WORKSPACE_SIZE from metadata.json which is included in the Model Library Format file produced by ```tvmc```. Please see [Model Library Format](http://tvm.apache.org/docs/arch/model_library_format.html) for details . ```workspace_size_bytes``` for the ```main``` function is the "Number of bytes needed in this workspace by this function and all sub-functions invoked"
   
   Hope that helps.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723158003



##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))
+
+
+Running the demo application
+----------------------------
+Type the following command to run the demo application:
+
+```bash
+./run_demo.sh
+```
+
+This will:
+- Download a quantized mobilenet v1 model
+- Use tvmc to compile the model for Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+- Download an image of a kitten to run the model on
+- Create a C header file inputs.c containing the image data as a C array
+- Create a C header file outputs.c containing a C array where the output of inference will be stored
+- Build the Ethos(TM)-U55 core driver
+- Build the demo application
+- Run the demo application on a Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software
+- The application will display what the image has been classified as e.g. "The image has been classified as 'tabby'"
+
+Using your own image
+--------------------
+The create_image.py script takes a single argument on the command line which is the path of the
+image to be converted into an array of bytes for consumption by the model.
+
+The demo can be modified to use an image of your choice by changing the following lines in run_demo.sh
+
+```bash
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg

Review comment:
       Thanks. Changed now.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 removed a comment on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 removed a comment on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-948234119


   @grant-arm  Why you rewrite the functions "TVMPlatformMemoryAllocate" and "TVMPlatformMemoryFree" in tvm_runtime.h?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-946341166


   I just run "run_demo.sh", but there is a error "AttributeError: module 'tvm.relay.backend.contrib.ethosu._ffi_api' has no attribute 'PreprocessExternalFuncIO'".
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-948234119


   @grant-arm  Why you rewrite the functions "TVMPlatformMemoryAllocate" and "TVMPlatformMemoryFree" in tvm_runtime.h?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723417616



##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,88 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')

Review comment:
       @Mousius I made the changes you suggested.

##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,88 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')
+
+
+def create_headers(image_name):
+    """
+    This function generates C header files for the input and output arrays required to run inferences
+    """
+    img_path = os.path.join("./", f"{image_name}")
+
+    # Resize image to 224x224
+    resized_image = Image.open(img_path).resize((224, 224))
+    img_data = np.asarray(resized_image).astype("float32")
+
+    # Convert input to NCHW
+    img_data = np.transpose(img_data, (2, 0, 1))
+
+    # Create input header file
+    input_data = {"input": img_data.astype(np.uint8)}
+    create_header_file("inputs", "ethosu_scratch", input_data, "./include")
+
+    # Create output header file
+    output_data = {"output": np.zeros([1001], np.uint8)}
+    create_header_file(
+        "outputs",
+        "output_data_sec",
+        output_data,
+        "./include",
+    )

Review comment:
       @Mousius I made the changes you suggested.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-936094508


   @areusch Thanks for the comments.
   I've addressed the python dependencies question inline. Hopefully that helps.
   Could you please elaborate on how we would use the Project API with the demo?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-946441386


   I just ran "run_demo.sh", but there was a error "  File "/workcode/tvm/tvm/python/tvm/relay/build_module.py", line 371, in build
       assert False, "Executor " + executor + " not supported"
   AssertionError: Executor aot=True not supported".
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-937463948


   Thanks @grant-arm @Mousius @leandron @areusch . This is merged now.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723157117



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)
+CODEGEN_OBJS = $(subst .c,.o,$(CODEGEN_SRCS))
+CMSIS_STARTUP_SRCS = $(shell find ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/*.c)

Review comment:
       Done.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723154050



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)

Review comment:
       Good catch.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723158665



##########
File path: apps/microtvm/ethosu/include/tvm_runtime.h
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tvm/runtime/c_runtime_api.h>
+#include <tvm/runtime/crt/stack_allocator.h>
+
+#define WORKSPACE_SIZE (16384 * 1024)
+__attribute__((section("ethosu_scratch"))) static uint8_t g_aot_memory[WORKSPACE_SIZE];
+
+tvm_workspace_t app_workspace;
+
+void __attribute__((noreturn)) TVMPlatformAbort(tvm_crt_error_t error_code) {
+  printf("TVMPlatformAbort: %d\n", error_code);
+  printf("EXITTHESIM\n");
+  exit(-1);
+}
+
+tvm_crt_error_t TVMPlatformMemoryAllocate(size_t num_bytes, DLDevice dev, void** out_ptr) {
+  return StackMemoryManager_Allocate(&app_workspace, num_bytes, out_ptr);
+}
+
+tvm_crt_error_t TVMPlatformMemoryFree(void* ptr, DLDevice dev) {
+  return StackMemoryManager_Free(&app_workspace, ptr);
+}
+
+void TVMLogf(const char* msg, ...) {
+  va_list args;
+  va_start(args, msg);
+  vfprintf(stdout, msg, args);
+  va_end(args);
+}
+
+TVM_DLL int TVMFuncRegisterGlobal(const char* name, TVMFunctionHandle f, int override) { return 0; }

Review comment:
       Done.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-936544124


   Thanks for the suggestions @Mousius . Could you please take a look again.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723158225



##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))
+
+
+Running the demo application
+----------------------------
+Type the following command to run the demo application:
+
+```bash
+./run_demo.sh
+```
+
+This will:
+- Download a quantized mobilenet v1 model
+- Use tvmc to compile the model for Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+- Download an image of a kitten to run the model on
+- Create a C header file inputs.c containing the image data as a C array
+- Create a C header file outputs.c containing a C array where the output of inference will be stored
+- Build the Ethos(TM)-U55 core driver
+- Build the demo application
+- Run the demo application on a Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software
+- The application will display what the image has been classified as e.g. "The image has been classified as 'tabby'"
+
+Using your own image
+--------------------
+The create_image.py script takes a single argument on the command line which is the path of the
+image to be converted into an array of bytes for consumption by the model.
+
+The demo can be modified to use an image of your choice by changing the following lines in run_demo.sh
+
+```bash
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg
+python3 ./convert_image.py ./build/kitten.jpg

Review comment:
       Thanks. Changed now.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-940496946


   @grant-arm just to follow-up on my comment, to use the Project API we essentially need to write a `microtvm_api_server.py` which can use this tree as a template in combination with a Model Library Format file to generate a runnable demo app like this. In general we would mainly use this with the full RPC runtime to trial models, so I think it's a bit of a different effort from this demo app.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723156252



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu

Review comment:
       I haven't allowed ETHOSU_PATH to be set because I don't think that makes sense in the context of the other changes I've made. But the user can set where the core driver, core platform and CMSIS code is installed:
   ```
   ETHOSU_DRIVER_PATH ?= ${ETHOSU_PATH}/core_driver
   CMSIS_PATH ?= ${ETHOSU_PATH}/cmsis
   ETHOSU_PLATFORM_PATH ?= ${ETHOSU_PATH}/core_platform
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723156928



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)

Review comment:
       Good point. Changed.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r721415556



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \

Review comment:
       It doesn't work without the `abspath`




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
Mousius commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r721320883



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)
+CODEGEN_OBJS = $(subst .c,.o,$(CODEGEN_SRCS))
+CMSIS_STARTUP_SRCS = $(shell find ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/*.c)

Review comment:
       ```suggestion
   CMSIS_STARTUP_SRCS = $(wildcard ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/*.c)
   ```

##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))
+
+
+Running the demo application
+----------------------------
+Type the following command to run the demo application:
+
+```bash
+./run_demo.sh
+```
+
+This will:
+- Download a quantized mobilenet v1 model
+- Use tvmc to compile the model for Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+- Download an image of a kitten to run the model on
+- Create a C header file inputs.c containing the image data as a C array
+- Create a C header file outputs.c containing a C array where the output of inference will be stored
+- Build the Ethos(TM)-U55 core driver
+- Build the demo application
+- Run the demo application on a Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software
+- The application will display what the image has been classified as e.g. "The image has been classified as 'tabby'"
+
+Using your own image
+--------------------
+The create_image.py script takes a single argument on the command line which is the path of the
+image to be converted into an array of bytes for consumption by the model.
+
+The demo can be modified to use an image of your choice by changing the following lines in run_demo.sh
+
+```bash
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg

Review comment:
       ```suggestion
   curl -sS https://s3.amazonaws.com/model-server/inputs/kitten.jpg -o ./kitten.jpg
   ```
   `-L` is unnessary and can introduce security issues by blindly following redirects
   `-o` is just the `curl` native way of outputting a file rather than piping

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build

Review comment:
       This should be `BUILD_DIR` to match other variables?

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake

Review comment:
       For this to be portable this should be just `cmake`, this path is specific to the TVM containers.

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)

Review comment:
       I don't think we need `CC_OPTS` ? 

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \

Review comment:
       Does this work without `abspath` ? 

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)

Review comment:
       ```suggestion
   CODEGEN_SRCS = $(wildcard ${BUILD_DIR}/codegen/host/src/*.c)
   ```
   To minimise reliance on a specific shell util.

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu

Review comment:
       ```suggestion
   ETHOSU_PATH ?= /opt/arm/ethosu
   ```
   So users can specify the Ethos U path when building the demo.

##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)

Review comment:
       ```suggestion
     - [Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
   ```

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)
+CODEGEN_OBJS = $(subst .c,.o,$(CODEGEN_SRCS))
+CMSIS_STARTUP_SRCS = $(shell find ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/*.c)
+UART_SRCS = $(shell find ${PLATFORM_PATH}/*.c)

Review comment:
       ```suggestion
   UART_SRCS = $(wildcard ${PLATFORM_PATH}/*.c)
   ```

##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))
+
+
+Running the demo application
+----------------------------
+Type the following command to run the demo application:
+
+```bash
+./run_demo.sh
+```
+
+This will:
+- Download a quantized mobilenet v1 model
+- Use tvmc to compile the model for Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+- Download an image of a kitten to run the model on
+- Create a C header file inputs.c containing the image data as a C array
+- Create a C header file outputs.c containing a C array where the output of inference will be stored
+- Build the Ethos(TM)-U55 core driver
+- Build the demo application
+- Run the demo application on a Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software
+- The application will display what the image has been classified as e.g. "The image has been classified as 'tabby'"
+
+Using your own image
+--------------------
+The create_image.py script takes a single argument on the command line which is the path of the
+image to be converted into an array of bytes for consumption by the model.
+
+The demo can be modified to use an image of your choice by changing the following lines in run_demo.sh
+
+```bash
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg
+python3 ./convert_image.py ./build/kitten.jpg

Review comment:
       ```suggestion
   python3 ./convert_image.py ./kitten.jpg
   ```
   To match above download.

##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))

Review comment:
       ```suggestion
     - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
     - Installed from TLCPack (see [TLCPack](https://tlcpack.ai/))
   ```

##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300

Review comment:
       In fact all of these should be specifiable and not rely on a specific set of directories matching a TVM build container?

##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"

Review comment:
       Should be an argument to specify the directories? See https://github.com/apache/tvm/blob/main/docker/bash.sh#L153-L244

##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite
+
+# Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \
+    c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
+    --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
+tar -xvf module.tar
+
+# Get ImageNet labels
+curl -sSL  https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/labels_mobilenet_quant_v1_224.txt \
+    > ./labels_mobilenet_quant_v1_224.txt
+
+# Get input image
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg

Review comment:
       ```suggestion
   curl -sS https://s3.amazonaws.com/model-server/inputs/kitten.jpg -o ./kitten.jpg
   ```

##########
File path: apps/microtvm/ethosu/requirements.txt
##########
@@ -0,0 +1,22 @@
+attrs>=21.2.0

Review comment:
       Can you export this file with hashes to ensure integrity of the packages?

##########
File path: apps/microtvm/ethosu/include/tvm_runtime.h
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tvm/runtime/c_runtime_api.h>
+#include <tvm/runtime/crt/stack_allocator.h>
+
+#define WORKSPACE_SIZE (16384 * 1024)
+__attribute__((section("ethosu_scratch"))) static uint8_t g_aot_memory[WORKSPACE_SIZE];
+
+tvm_workspace_t app_workspace;
+
+void __attribute__((noreturn)) TVMPlatformAbort(tvm_crt_error_t error_code) {
+  printf("TVMPlatformAbort: %d\n", error_code);
+  printf("EXITTHESIM\n");
+  exit(-1);
+}
+
+tvm_crt_error_t TVMPlatformMemoryAllocate(size_t num_bytes, DLDevice dev, void** out_ptr) {
+  return StackMemoryManager_Allocate(&app_workspace, num_bytes, out_ptr);
+}
+
+tvm_crt_error_t TVMPlatformMemoryFree(void* ptr, DLDevice dev) {
+  return StackMemoryManager_Free(&app_workspace, ptr);
+}
+
+void TVMLogf(const char* msg, ...) {
+  va_list args;
+  va_start(args, msg);
+  vfprintf(stdout, msg, args);
+  va_end(args);
+}
+
+TVM_DLL int TVMFuncRegisterGlobal(const char* name, TVMFunctionHandle f, int override) { return 0; }

Review comment:
       Please add some header guards - although I think this could also just be a `.c`

##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,95 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')
+
+        # Generate code to initialize the struct used by the C API
+        header_file.write(f"struct tvmgen_default_{name} {name} = {{")

Review comment:
       We should minimize code generation in the app where possible, we know the inputs to mobilenet ahead of time. It'd be good to only generate out the binary data and everything else be static.

##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite
+
+# Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \
+    c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
+    --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
+tar -xvf module.tar
+
+# Get ImageNet labels
+curl -sSL  https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/labels_mobilenet_quant_v1_224.txt \
+    > ./labels_mobilenet_quant_v1_224.txt

Review comment:
       ```suggestion
   curl -sS https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/labels_mobilenet_quant_v1_224.txt \
       -o ./labels_mobilenet_quant_v1_224.txt
   ```

##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite

Review comment:
       ```suggestion
   curl --retry 64 -sS ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite
   ```
   (Remove `-L` if we can)




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723158516



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300

Review comment:
       Thanks. I've changed this now.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723162813



##########
File path: apps/microtvm/ethosu/requirements.txt
##########
@@ -0,0 +1,22 @@
+attrs>=21.2.0

Review comment:
       Thanks for the comments @areusch. To generate the `requiremenst.txt` file, I followed the procedure below:
   ```
   pip3 freeze > reqs.txt
   pip3 uninstall -r reqs.txt -y
   <Repeatedly remove anything that is a distutils installed project from reqs.txt until uninstall is successful>
   cd /tvm/python
   pip3 install -e .
   cd apps/microtvm/ethosu/
   ./run_demo.sh
   <Repeatedly install missing python packages until demo runs successfully>
   pip3 freeze > requirements.txt
   <Remove anything from requirements.txt that is a distutils installed project>
   ```
   As suggested by @Mousius , I then followed the procedure described [here ](https://www.peterbe.com/plog/bestest-python-dependencies) and ran hashin on each package in `requirements.txt`
   
   If any of the TVM python dependencies changed, it would be a case of doing the same again :)




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] areusch commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
areusch commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r721789482



##########
File path: apps/microtvm/ethosu/requirements.txt
##########
@@ -0,0 +1,22 @@
+attrs>=21.2.0

Review comment:
       could you comment where you get the list of packages from? e.g. how would i rebuild this if i change any TVM python deps?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] leandron commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
leandron commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-932750338


   > PRs #8795 , #8806, #8811, #8849 and #8854 are merged now, so I've updated this PR and set it ready for review.
   > 
   > @areusch @manupa-arm @leandron @Mousius
   
   I’m happy to merge this, just wanted to leave it here for a few more hours to leave the opportunity for other to have a look.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 removed a comment on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 removed a comment on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-946341166


   I just run "run_demo.sh", but there is a error "AttributeError: module 'tvm.relay.backend.contrib.ethosu._ffi_api' has no attribute 'PreprocessExternalFuncIO'".
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-945884573


   @JKANG94 Currently we compile for offloading Conv2D & Depthwise Conv to Ethos(TM)-U55 NPU
   ```
   # Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
   tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \
       c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
       --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
   ```
   In order to compile for Arm(R) Cortex(R)-M55 CPU only, we would use:
   ```
   # Compile model for Arm(R) Cortex(R)-M55 CPU
   tvmc compile --target="c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
       --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
   ```
   Please note though that if you try this with the current demo and MobileNet v1, when you come to building the project, the linker will complain that the ITCM memory region has overflowed. This is due to the generated code not placing params in any specific section and the linker defaulting to placing them in ITCM. We have WIP to address this. (Please refer to the [USMP RFC](https://github.com/apache/tvm-rfcs/pull/9) for pinning constant buffers on different memories)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-937463948


   Thanks @grant-arm @Mousius @leandron @areusch . This is merged now.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-933939581


   neat! :) would be interested to discuss about perhaps creating apps/microtvm/ethosu e.g. project API impl. also have one question about the Python deps.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] JKANG94 commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
JKANG94 commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-947268372


   @grant-arm  Using tvmc, I got operator implementations produced by tvm in codegen folder. I want to deploy these to cortext-m devices standalonely, how to get tvm c runtime static library and tvm c GraphExecutor static library?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm merged pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm merged pull request #8922:
URL: https://github.com/apache/tvm/pull/8922


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723157822



##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)

Review comment:
       Thanks. Fixed.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-936091061


   @Mousius Thanks for all the great comments & suggestions.
   I believe I've addressed them all now.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm edited a comment on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm edited a comment on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-932214391


   PRs #8795 , #8806, #8811, #8849 and #8854 are merged now, so I've updated this PR and set it ready for review.
   
   @areusch @manupa-arm @leandron @Mousius 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-932214391


   PRs #8795 , #8806, #8811, #8849 and #8854 are merged now, so I've updated this PR and set it ready for review.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm merged pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm merged pull request #8922:
URL: https://github.com/apache/tvm/pull/8922


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-936171798


   @Mousius PTAL
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
Mousius commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723446672



##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,73 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, tensor_name, tensor_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write(
+            "#include <tvmgen_default.h>\n"
+            + f"const size_t {tensor_name}_len = {tensor_data.size};\n"
+            + f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'

Review comment:
       
   I don't think you need `+`es here (see: https://github.com/apache/tvm/blob/main/python/tvm/micro/interface_api.py#L59-L66)
   
   ```suggestion
           header_file.write(
               "#include <tvmgen_default.h>\n"
               f"const size_t {tensor_name}_len = {tensor_data.size};\n"
               f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723164048



##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite
+
+# Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \
+    c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \
+    --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf
+tar -xvf module.tar
+
+# Get ImageNet labels
+curl -sSL  https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/lite/java/demo/app/src/main/assets/labels_mobilenet_quant_v1_224.txt \
+    > ./labels_mobilenet_quant_v1_224.txt
+
+# Get input image
+curl -sSL https://s3.amazonaws.com/model-server/inputs/kitten.jpg > ./kitten.jpg

Review comment:
       Done.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723157239



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake
+CC = arm-none-eabi-gcc
+AR = arm-none-eabi-ar
+RANLIB = arm-none-eabi-ranlib
+CC_OPTS = CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
+PKG_CFLAGS = ${PKG_COMPILE_OPTS} \
+	-I${STANDALONE_CRT_PATH}/include \
+	-I${STANDALONE_CRT_PATH}/src/runtime/crt/include \
+	-Iinclude \
+	-I${PLATFORM_PATH} \
+	-I${ETHOSU_PATH}/core_driver/include \
+	-I${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include/ \
+	-I${CMSIS_PATH}/CMSIS/Core/Include \
+	-I$(abspath $(build_dir))/codegen/host/include \
+	-DETHOSU_TEST_RUNNER_TOL=${ETHOSU_TEST_RUNNER_TOL}
+DRIVER_CMAKE_FLAGS = -DCMAKE_TOOLCHAIN_FILE=$(abspath $(build_dir))/../arm-none-eabi-gcc.cmake \
+	-DETHOSU_LOG_SEVERITY=debug \
+	-DCMAKE_SYSTEM_PROCESSOR=cortex-m55
+PKG_LDFLAGS = -lm -specs=nosys.specs -static -T corstone300.ld
+
+$(ifeq VERBOSE,1)
+QUIET ?=
+$(else)
+QUIET ?= @
+$(endif)
+
+CODEGEN_SRCS = $(shell find $(abspath $(build_dir))/codegen/host/src/*.c)
+CODEGEN_OBJS = $(subst .c,.o,$(CODEGEN_SRCS))
+CMSIS_STARTUP_SRCS = $(shell find ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/*.c)
+UART_SRCS = $(shell find ${PLATFORM_PATH}/*.c)

Review comment:
       Done




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-947742864


   Hi @JKANG94 , probably the most useful reference is the Makefile in ```tvm/apps/microtvm/ethosu/```.
   
   Since we compile with ```-executor=aot``` we are using the AOT Executor and it's not necessary to include the Graph Executor.
   The only bits of TVM we need for the runtime are:
   $(STANDALONE_CRT_PATH)/src/runtime/crt/memory/stack_allocator.c
   $(STANDALONE_CRT_PATH)/src/runtime/crt/common/crt_backend_api.c


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723154362



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build

Review comment:
       Agreed. I've changed that now.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723159164



##########
File path: apps/microtvm/ethosu/requirements.txt
##########
@@ -0,0 +1,22 @@
+attrs>=21.2.0

Review comment:
       @Mousius I've changed this as suggested.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723163716



##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"
+
+# Make build directory
+mkdir -p build
+cd build
+
+# Get mobilenet_v1 tflite model
+mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz'
+curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite

Review comment:
       Done.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723164367



##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,95 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')
+
+        # Generate code to initialize the struct used by the C API
+        header_file.write(f"struct tvmgen_default_{name} {name} = {{")

Review comment:
       Agreed, I've moved this to demo.c.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
Mousius commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723303286



##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,88 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')

Review comment:
       OOOOH that `tvmgen_default.h` isn't needed ... yet :wink: 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-932720967


   @Mousius @leandron , could you take a look ?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] manupa-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-936170941


   Lets keep this demo for a user seeking to integrate inference to an already existing project rather than generating a new one. However, that does not preclude us creating another demo using project API for other usecases.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
Mousius commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723298267



##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,88 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')

Review comment:
       We're passing in dicts like `{"input": img_data.astype(np.uint8)}` and `{"output": np.zeros([1001], np.uint8)}`, which leads me to believe we can generate far less of this if we pass them separately and don't treat it as a `dict`:
   
   ```suggestion
   def create_header_file(name, section, tensor_name, tensor_data, output_path):
       """
       This function generates a header file containing the data from the numpy array provided.
       """
       file_path = pathlib.Path(f"{output_path}/" + name).resolve()
   
       # Create header file with npy_data as a C array
       raw_path = file_path.with_suffix(".h").resolve()
       with open(raw_path, "w") as header_file:
           header_file.write(
               "#include <tvmgen_default.h>\n",
               f"const size_t {tensor_name}_len = {npy_data[tensor_data].size};\n"
               f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
           )
           for i in range(0, len(data_hexstr), 2):
               header_file.write(f"\\x{data_hexstr[i:i+2]}")
           header_file.write('";\n\n')
   ```
   
   This would parallel a developer who deploys this model, who would only process the data required as an input.

##########
File path: apps/microtvm/ethosu/convert_image.py
##########
@@ -0,0 +1,88 @@
+# 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 os
+import pathlib
+import re
+import sys
+from PIL import Image
+import numpy as np
+
+
+def create_header_file(name, section, npy_data, output_path):
+    """
+    This function generates a header file containing the data from the numpy array provided.
+    """
+    file_path = pathlib.Path(f"{output_path}/" + name).resolve()
+
+    # Create header file with npy_data as a C array
+    raw_path = file_path.with_suffix(".h").resolve()
+    with open(raw_path, "w") as header_file:
+        header_file.write("#include <tvmgen_default.h>\n")
+        for tensor_name in npy_data.keys():
+            sanitized_tensor_name = re.sub(r"\W+", "_", tensor_name)
+            header_file.write(
+                f"const size_t {sanitized_tensor_name}_len = {npy_data[tensor_name].size};\n"
+            )
+
+            # Convert numpy data type to C data type
+            if npy_data[tensor_name].dtype == np.uint8:
+                c_type = "uint8_t"
+            elif npy_data[tensor_name].dtype == np.int8:
+                c_type = "int8_t"
+            else:
+                raise RuntimeError(f"Data type {str(npy_data[tensor_name].dtype)} not supported")
+
+            header_file.write(
+                f'{c_type} {sanitized_tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "'
+            )
+
+            data_hexstr = npy_data[tensor_name].tobytes().hex()
+            for i in range(0, len(data_hexstr), 2):
+                header_file.write(f"\\x{data_hexstr[i:i+2]}")
+            header_file.write('";\n\n')
+
+
+def create_headers(image_name):
+    """
+    This function generates C header files for the input and output arrays required to run inferences
+    """
+    img_path = os.path.join("./", f"{image_name}")
+
+    # Resize image to 224x224
+    resized_image = Image.open(img_path).resize((224, 224))
+    img_data = np.asarray(resized_image).astype("float32")
+
+    # Convert input to NCHW
+    img_data = np.transpose(img_data, (2, 0, 1))
+
+    # Create input header file
+    input_data = {"input": img_data.astype(np.uint8)}
+    create_header_file("inputs", "ethosu_scratch", input_data, "./include")
+
+    # Create output header file
+    output_data = {"output": np.zeros([1001], np.uint8)}
+    create_header_file(
+        "outputs",
+        "output_data_sec",
+        output_data,
+        "./include",
+    )

Review comment:
       Following from the above.
   
   ```suggestion
       input_data = img_data.astype(np.uint8)
       create_header_file("inputs", "ethosu_scratch", "input", input_data, "./include")
   
       # Create output header file
       output_data = np.zeros([1001], np.uint8)
       create_header_file(
           "outputs",
           "output_data_sec",
           "output",
           output_data,
           "./include",
       )
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723156639



##########
File path: apps/microtvm/ethosu/Makefile
##########
@@ -0,0 +1,110 @@
+# 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.
+
+# Makefile to build demo
+
+# Setup build environment
+build_dir := build
+STANDALONE_CRT_PATH := $(shell python3 -c "import tvm.micro; print(tvm.micro.get_standalone_crt_dir())")
+
+ARM_CPU=ARMCM55
+ETHOSU_PATH=/opt/arm/ethosu
+DRIVER_PATH=${ETHOSU_PATH}/core_driver
+CMSIS_PATH=${ETHOSU_PATH}/cmsis
+PLATFORM_PATH=${ETHOSU_PATH}/core_platform/targets/corstone-300
+PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99
+CMAKE = /opt/arm/cmake/bin/cmake

Review comment:
       Agreed. I've changed this.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723157514



##########
File path: apps/microtvm/ethosu/README.md
##########
@@ -0,0 +1,78 @@
+<!--- 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. -->
+
+
+Running TVM on bare metal Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU
+========================================================================
+
+This folder contains an example of how to use TVM to run a model
+on bare metal Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU.
+
+Prerequisites
+-------------
+If the demo is run in the ci_cpu Docker container provided with TVM, then the following
+software will already be installed.
+
+If the demo is not run in the ci_cpu Docker container, then you will need the following:
+- Software required to build the Ethos(TM)-U driver stack and run the demo (These can all be 
+  installed by running tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh)
+  - [ Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
+  - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
+  - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
+  - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
+  - [CMSIS](https://github.com/ARM-software/CMSIS_5)
+- The python libraries listed in the requirements.txt of this directory
+  - These can be installed by running the following from the current directory:
+    ```bash
+    pip install -r ./requirements.txt
+    ```
+
+You will also need TVM which can either be:
+  - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
+  - Installed from TLCPACK (see [TLCPack](https://tlcpack.ai/))

Review comment:
       Done




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on a change in pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on a change in pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#discussion_r723163536



##########
File path: apps/microtvm/ethosu/run_demo.sh
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+# 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.
+
+set -e
+set -u
+set -o pipefail
+
+# Directories
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+driver_dir="${script_dir}/build/ethosu_core_driver/"
+arm_dir="/opt/arm/"

Review comment:
       Thanks @Mousius . I've made the changes suggested.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] grant-arm commented on pull request #8922: Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App

Posted by GitBox <gi...@apache.org>.
grant-arm commented on pull request #8922:
URL: https://github.com/apache/tvm/pull/8922#issuecomment-946961908


   @JKANG94 thanks for pointing this out. #9218 changes the command line arguments required by tvmc which breaks the existing Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App. https://github.com/apache/tvm/pull/9323 fixes the demo app. In addition, we plan to enable running the demo app on CI so that we can catch these types of problems in future.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org