Cannot run ARM Ethosu demo

Hello, I’m now trying to run the demo by Arm below:

As the README suggests, I downloaded

  • FVP
  • cmake v3.22.1(It says 3.19.5 but it doesn’t matter right?)
  • GCC for Arm
  • CMSIS

I’m not sure about * Arm(R) Ethos™-U NPU driver stack but according to the options below:

it means downloading these two below right?

After installing all of these and setring all the argments, --ethosu_driver_path, --ethosu)platform_path and --cmsis_path, to run ./run_demo.sh, I got the error below:

./mobilenet_v1_1.0_224_quant.tflite
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[07:09:43] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/workspace/tvm/python/tvm/driver/tvmc/__main__.py", line 24, in <module>
    tvmc.main.main()
  File "/home/ubuntu/workspace/tvm/python/tvm/driver/tvmc/main.py", line 100, in main
    sys.exit(_main(sys.argv[1:]))
  File "/home/ubuntu/workspace/tvm/python/tvm/driver/tvmc/main.py", line 93, in _main
    return args.func(args)
  File "/home/ubuntu/workspace/tvm/python/tvm/driver/tvmc/compiler.py", line 147, in drive_compile
    compile_model(
  File "/home/ubuntu/workspace/tvm/python/tvm/driver/tvmc/compiler.py", line 253, in compile_model
    with tvm.transform.PassContext(config=config):
  File "/home/ubuntu/workspace/tvm/python/tvm/ir/transform.py", line 96, in __init__
    self.__init_handle_by_constructor__(
  File "/home/ubuntu/workspace/tvm/python/tvm/_ffi/_ctypes/object.py", line 136, in __init_handle_by_constructor__
    handle = __init_by_constructor__(fconstructor, args)
  File "/home/ubuntu/workspace/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 260, in __init_handle_by_constructor__
    raise get_last_ffi_error()
AttributeError: Traceback (most recent call last):
  2: TVMFuncCall
  1: tvm::runtime::TypedPackedFunc<tvm::transform::PassContext (int, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::instrument::PassInstrument, void>, tvm::runtime::Optional<tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void> >)>::AssignTypedLambda<tvm::transform::{lambda(int, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::instrument::PassInstrument, void>, tvm::runtime::Optional<tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void> >)#13}>(tvm::transform::{lambda(int, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::instrument::PassInstrument, void>, tvm::runtime::Optional<tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void> >)#13}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const, tvm::runtime::TVMRetValue) const
  0: tvm::transform::PassConfigManager::Legalize(tvm::runtime::Map<tvm::runtime::String, tvm::runtime::ObjectRef, void, void>*)
  File "/home/ubuntu/workspace/tvm/src/ir/transform.cc", line 128
AttributeError: Invalid config option 'relay.ext.ethos-u.options' candidates are: relay.fallback_device_type ,relay.backend.use_meta_schedule ,tir.noalias ,tir.is_entry_func ,tir.detect_global_barrier ,tir.HoistIfThenElse ,tir.instrument_bound_checkers ,tir.disable_vectorize ,relay.backend.use_auto_scheduler ,tir.add_lower_pass ,tir.debug_keep_trivial_loop ,tir.InjectDoubleBuffer ,tir.UnrollLoop ,tir.disable_assert ,tir.LoopPartition ,relay.FuseOps.max_depth

Could anyone give me any advice on the cause of this error?

Also when is the arm gcc compiler used? I downloaded it because the README says it’s prerequisites, but the README doesn’t say anything about gcc after installation.

Hi @sho ,

It looks like you may have built TVM from source without changing set(USE_ETHOSU OFF) to set(USE_ETHOSU ON) in config.cmake .

I will update the README for the demo to mention that, since it isn’t clear.

It is also necessary to set(USE_MICRO ON) and set(USE_LLVM ON) in config.cmake.

1 Like

Hi @grant-arm, I didn’t know that. Thank you so much.

I got another error, which says arm-none-eabi-gcc: fatal error: no input files

ubuntu@ip-172-31-10-19:~/workspace/tvm/apps/microtvm/ethosu$ ./run_demo.sh --ethosu_driver_path ~/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-driver --ethosu_platform_path ~/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-platform --cmsis_path ~/workspace/tvm/apps/microtvm/ethosu/CMSIS
./mobilenet_v1_1.0_224_quant.tflite
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[16:18:58] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
/home/ubuntu/workspace/tvm/python/tvm/driver/build_module.py:235: UserWarning: Specifying name with IRModule input is useless
  warnings.warn("Specifying name with IRModule input is useless")
./
./codegen/
./codegen/host/
./codegen/host/include/
./codegen/host/include/tvmgen_default.h
./codegen/host/src/
./codegen/host/src/default_lib0.c
./codegen/host/src/default_lib1.c
./codegen/host/src/default_lib2.c
./metadata.json
./parameters/
./parameters/default.params
./src/
./src/relay.txt
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-platform/targets/corstone-300 -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-driver/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/CMSIS/Device/ARM/ARMCM55/Include/ -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/CMSIS/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c
/tmp/ccMK8AYW.s: Assembler messages:
/tmp/ccMK8AYW.s:243: Warning: setting incorrect section attributes for .rodata.tvm
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c: In function 'tvmgen_default_run_model':
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:69:9: warning: implicit declaration of function 'TVMDeviceEthosUActivate' [-Wimplicit-function-declaration]
   69 |   (void)TVMDeviceEthosUActivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:70:9: warning: implicit declaration of function 'TVMDeviceEthosUOpen' [-Wimplicit-function-declaration]
   70 |   (void)TVMDeviceEthosUOpen(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:71:9: warning: implicit declaration of function 'tvmgen_default_ethos_u_main_0' [-Wimplicit-function-declaration]
   71 |   (void)tvmgen_default_ethos_u_main_0(input, sid_3, device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:72:9: warning: implicit declaration of function 'TVMDeviceEthosUClose' [-Wimplicit-function-declaration]
   72 |   (void)TVMDeviceEthosUClose(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:75:9: warning: implicit declaration of function 'TVMDeviceEthosUDeactivate' [-Wimplicit-function-declaration]
   75 |   (void)TVMDeviceEthosUDeactivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
arm-none-eabi-ar -cr /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.o
arm-none-eabi-ranlib /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a
mkdir -p /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-platform/targets/corstone-300 -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/ethos-u-core-driver/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/CMSIS/Device/ARM/ARMCM55/Include/ -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/CMSIS/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -DARMCM55
arm-none-eabi-gcc: fatal error: no input files
compilation terminated.
make: *** [Makefile:81: build/libcmsis_startup.a] Error 1

It literally means make tries to compile or build nothing. Could you help me find the cause of this?

Hi @sho ,

That error means gcc can’t find any files in your ~/workspace/tvm/apps/microtvm/ethosu/CMSIS directory. Could you please check that you are passing in the correct path to CMSIS with the --cmsis_path parameter?

I think it might be useful to look at the script that is run when we build the ci_cpu docker image.

You should be able to run that script locally, changing only the 3 directories at the top of the script. That should make things simpler, and will also ensure that you have the correctly tagged versions of CMSIS and the Ethos-U55 driver.

@grant-arm I just hit this on one of my PRs–I wonder if we are busted at main.

Interesting. I think we got already a few changes today and build/tests seem OK at the moment.

This one is an example:

It looks like a change in that PR is generating code that looks like this:

int32_t tvmgen_default_run(struct tvmgen_default_inputs* inputs,struct tvmgen_default_outputs* outputs,struct tvmgen_default_devices* devices) {return tvmgen_default_run_model(inputs->input,outputs->output,devices->);}

with a missing identifier after devices->

oh yep sorry, that’s my poor reading. ignore.

Hi @grant-arm,

As you said, I used the script you refered to install everything I need in /opt/arm. However, I still got the error that says it cannot find the def or declaration of ethosu_drv.

ubuntu@ip-172-31-10-19:~/workspace/tvm/apps/microtvm/ethosu$ ./run_demo.sh --ethosu_driver_path /opt/arm/ethosu/core_driver --cmsis_path /opt/arm/ethosu/cmsis --ethosu_platform_path /opt/arm/ethosu/core_platform
./mobilenet_v1_1.0_224_quant.tflite
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[08:45:37] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[08:45:38] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[08:45:38] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[08:45:38] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[08:45:38] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
/home/ubuntu/workspace/tvm/python/tvm/driver/build_module.py:235: UserWarning: Specifying name with IRModule input is useless
  warnings.warn("Specifying name with IRModule input is useless")
./
./codegen/
./codegen/host/
./codegen/host/include/
./codegen/host/include/tvmgen_default.h
./codegen/host/src/
./codegen/host/src/default_lib0.c
./codegen/host/src/default_lib1.c
./codegen/host/src/default_lib2.c
./metadata.json
./parameters/
./parameters/default.params
./src/
./src/relay.txt
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c
/tmp/cc7Wnaik.s: Assembler messages:
/tmp/cc7Wnaik.s:243: Warning: setting incorrect section attributes for .rodata.tvm
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c: In function 'tvmgen_default_run_model':
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:69:9: warning: implicit declaration of function 'TVMDeviceEthosUActivate' [-Wimplicit-function-declaration]
   69 |   (void)TVMDeviceEthosUActivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:70:9: warning: implicit declaration of function 'TVMDeviceEthosUOpen' [-Wimplicit-function-declaration]
   70 |   (void)TVMDeviceEthosUOpen(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:71:9: warning: implicit declaration of function 'tvmgen_default_ethos_u_main_0' [-Wimplicit-function-declaration]
   71 |   (void)tvmgen_default_ethos_u_main_0(input, sid_3, device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:72:9: warning: implicit declaration of function 'TVMDeviceEthosUClose' [-Wimplicit-function-declaration]
   72 |   (void)TVMDeviceEthosUClose(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:75:9: warning: implicit declaration of function 'TVMDeviceEthosUDeactivate' [-Wimplicit-function-declaration]
   75 |   (void)TVMDeviceEthosUDeactivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
arm-none-eabi-ar -cr /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.o
arm-none-eabi-ranlib /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a
mkdir -p build
arm-none-eabi-gcc -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -o build/demo src/demo.c src/tvm_ethosu_runtime.c build/stack_allocator.o build/crt_backend_api.o build/libcodegen.a build/libcmsis_startup.a build/ethosu_core_driver/libethosu_core_driver.a build/libuart.a -lm -specs=nosys.specs -static -T corstone300.ld
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUActivate':
src/tvm_ethosu_runtime.c:37:65: warning: control reaches end of non-void function [-Wreturn-type]
   37 | int32_t TVMDeviceEthosUActivate(tvm_device_ethos_u_t* context) {}
      |                                                                 ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUOpen':
src/tvm_ethosu_runtime.c:38:61: warning: control reaches end of non-void function [-Wreturn-type]
   38 | int32_t TVMDeviceEthosUOpen(tvm_device_ethos_u_t* context) {}
      |                                                             ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUClose':
src/tvm_ethosu_runtime.c:39:62: warning: control reaches end of non-void function [-Wreturn-type]
   39 | int32_t TVMDeviceEthosUClose(tvm_device_ethos_u_t* context) {}
      |                                                              ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUDeactivate':
src/tvm_ethosu_runtime.c:40:67: warning: control reaches end of non-void function [-Wreturn-type]
   40 | int32_t TVMDeviceEthosUDeactivate(tvm_device_ethos_u_t* context) {}
      |                                                                   ^
/opt/arm/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/cck7eQr2.o:/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include/ethosu_mod.h:29: undefined reference to `ethosu_drv'
collect2: error: ld returned 1 exit status
make: *** [Makefile:100: build/demo] Error 1

I have no idea why this error occurs since the path option -I/opt/arm/ethosu/core_driver/include is there so ethosu_mod.h should be able to find the declaration of ethosu_drv in /opt/arm/ethosu/core_driver/include/ethosu_driver.h.

Could you help me on this?

Hi @sho ,

It seems strange that you would get that error.

Could you please run make cleanall from the apps/microtvm/ethosu directory and then try to run ./run_demo.sh --ethosu_driver_path /opt/arm/ethosu/core_driver --cmsis_path /opt/arm/ethosu/cmsis --ethosu_platform_path /opt/arm/ethosu/core_platform again

Also, since everything is now installed in the /opt/arm folder, it shouldn’t be necessary to specify the paths, so just ./run_demo.sh should work for you.

Hi @grant-arm,

Oh I should’ve cleaned all the past outputs. Thanks to your support so far, it looks like just one more step…

ubuntu@ip-172-31-10-19:~/workspace/tvm/apps/microtvm/ethosu$ make cleanall
rm -rf build
ubuntu@ip-172-31-10-19:~/workspace/tvm/apps/microtvm/ethosu$ ./run_demo.sh
./mobilenet_v1_1.0_224_quant.tflite
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:191: Warning: Unable to detect CUDA version, default to "-mcpu=sm_20" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:217: Warning: Unable to detect ROCm compute arch, default to "-mcpu=gfx900" instead
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:231: Warning: Unable to detect ROCm version, assuming >= 3.5
[19:05:42] /home/ubuntu/workspace/tvm/src/target/target_kind.cc:163: Warning: Unable to detect CUDA version, default to "-arch=sm_20" instead
/home/ubuntu/workspace/tvm/python/tvm/driver/build_module.py:235: UserWarning: Specifying name with IRModule input is useless
  warnings.warn("Specifying name with IRModule input is useless")
./
./codegen/
./codegen/host/
./codegen/host/include/
./codegen/host/include/tvmgen_default.h
./codegen/host/src/
./codegen/host/src/default_lib0.c
./codegen/host/src/default_lib1.c
./codegen/host/src/default_lib2.c
./metadata.json
./parameters/
./parameters/default.params
./src/
./src/relay.txt
mkdir -p build
arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -o build/stack_allocator.o  /home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/memory/stack_allocator.c
mkdir -p build
arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -o build/crt_backend_api.o  /home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/common/crt_backend_api.c
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.c /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c
/tmp/ccFfAPQg.s: Assembler messages:
/tmp/ccFfAPQg.s:243: Warning: setting incorrect section attributes for .rodata.tvm
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c: In function 'tvmgen_default_run_model':
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:69:9: warning: implicit declaration of function 'TVMDeviceEthosUActivate' [-Wimplicit-function-declaration]
   69 |   (void)TVMDeviceEthosUActivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:70:9: warning: implicit declaration of function 'TVMDeviceEthosUOpen' [-Wimplicit-function-declaration]
   70 |   (void)TVMDeviceEthosUOpen(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:71:9: warning: implicit declaration of function 'tvmgen_default_ethos_u_main_0' [-Wimplicit-function-declaration]
   71 |   (void)tvmgen_default_ethos_u_main_0(input, sid_3, device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:72:9: warning: implicit declaration of function 'TVMDeviceEthosUClose' [-Wimplicit-function-declaration]
   72 |   (void)TVMDeviceEthosUClose(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~
/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.c:75:9: warning: implicit declaration of function 'TVMDeviceEthosUDeactivate' [-Wimplicit-function-declaration]
   75 |   (void)TVMDeviceEthosUDeactivate(device_context_ethos_u);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
arm-none-eabi-ar -cr /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib2.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib0.o /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/src/default_lib1.o
arm-none-eabi-ranlib /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcodegen.a
mkdir -p /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -DARMCM55 /opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Source/startup_ARMCM55.c /opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Source/system_ARMCM55.c
arm-none-eabi-ar -cr /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup.a /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup/*.o
arm-none-eabi-ranlib /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libcmsis_startup.a
mkdir -p build/ethosu_core_driver
cd /opt/arm/ethosu/core_driver && cmake -B /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/../arm-none-eabi-gcc.cmake -DETHOSU_LOG_SEVERITY=debug -DCMAKE_SYSTEM_PROCESSOR=cortex-m55
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Check for working C compiler: /opt/arm/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
-- Check for working C compiler: /opt/arm/gcc-arm-none-eabi/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/arm/gcc-arm-none-eabi/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /opt/arm/gcc-arm-none-eabi/bin/arm-none-eabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *******************************************************
-- PROJECT_NAME                           : ethosu_core_driver
-- CMAKE_SYSTEM_PROCESSOR                 : cortex-m55
-- CMSIS_PATH                             : /opt/arm/ethosu/core_driver/../cmsis
-- ETHOSU_LOG_SEVERITY                    : debug
-- *******************************************************
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver && make
make[1]: Entering directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
make[2]: Entering directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
make[3]: Entering directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
Scanning dependencies of target ethosu_core_driver
make[3]: Leaving directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
make[3]: Entering directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
[ 25%] Building C object CMakeFiles/ethosu_core_driver.dir/src/ethosu_driver.c.obj
[ 50%] Building C object CMakeFiles/ethosu_core_driver.dir/src/ethosu_device.c.obj
[ 75%] Building C object CMakeFiles/ethosu_core_driver.dir/src/ethosu_pmu.c.obj
[100%] Linking C static library libethosu_core_driver.a
make[3]: Leaving directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
[100%] Built target ethosu_core_driver
make[2]: Leaving directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
make[1]: Leaving directory '/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/ethosu_core_driver'
mkdir -p /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libuart
cd /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libuart && arm-none-eabi-gcc -c -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= /opt/arm/ethosu/core_platform/targets/corstone-300/retarget.c /opt/arm/ethosu/core_platform/targets/corstone-300/uart.c
arm-none-eabi-ar -cr /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libuart.a /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libuart/*.o
arm-none-eabi-ranlib /home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/libuart.a
mkdir -p build
arm-none-eabi-gcc -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -I/home/ubuntu/workspace/tvm/build/standalone_crt/include -I/home/ubuntu/workspace/tvm/build/standalone_crt/src/runtime/crt/include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/include -I/opt/arm/ethosu/core_platform/targets/corstone-300 -I/opt/arm/ethosu/core_driver/include -I/opt/arm/ethosu/cmsis/Device/ARM/ARMCM55/Include/ -I/opt/arm/ethosu/cmsis/CMSIS/Core/Include -I/home/ubuntu/workspace/tvm/apps/microtvm/ethosu/build/codegen/host/include -DETHOSU_TEST_RUNNER_TOL= -o build/demo src/demo.c src/tvm_ethosu_runtime.c build/stack_allocator.o build/crt_backend_api.o build/libcodegen.a build/libcmsis_startup.a build/ethosu_core_driver/libethosu_core_driver.a build/libuart.a -lm -specs=nosys.specs -static -T corstone300.ld
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUActivate':
src/tvm_ethosu_runtime.c:37:65: warning: control reaches end of non-void function [-Wreturn-type]
   37 | int32_t TVMDeviceEthosUActivate(tvm_device_ethos_u_t* context) {}
      |                                                                 ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUOpen':
src/tvm_ethosu_runtime.c:38:61: warning: control reaches end of non-void function [-Wreturn-type]
   38 | int32_t TVMDeviceEthosUOpen(tvm_device_ethos_u_t* context) {}
      |                                                             ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUClose':
src/tvm_ethosu_runtime.c:39:62: warning: control reaches end of non-void function [-Wreturn-type]
   39 | int32_t TVMDeviceEthosUClose(tvm_device_ethos_u_t* context) {}
      |                                                              ^
src/tvm_ethosu_runtime.c: In function 'TVMDeviceEthosUDeactivate':
src/tvm_ethosu_runtime.c:40:67: warning: control reaches end of non-void function [-Wreturn-type]
   40 | int32_t TVMDeviceEthosUDeactivate(tvm_device_ethos_u_t* context) {}
      |                                                                   ^
./run_demo.sh: line 159: FVP_Corstone_SSE-300_Ethos-U55: command not found

I don’t think FVP_Corstone_SSE-300_Ethos-U55 itself is a command.

Is it an alias or something of a command?

Hi @sho ,

Have you set your PATH correctly as indicated in the README.md?

export PATH=/opt/arm/FVP_Corstone_SSE-300/models/Linux64_GCC-6.4:/opt/arm/cmake/bin:$PATH

If you used the ubuntu_install_ethosu_driver_stack.sh script to install everything, then FVP_Corstone_SSE-300_Ethos-U55 should be in /opt/arm/FVP_Corstone_SSE-300/models/Linux64_GCC-6.4

Hi @grant-arm,

Thank you very much for your suggestion. I found the cause of the error.

When you run this script, FVP_Corstone_SSE-300_Ethos-U55 is installed instead of FVP_Corstone_SSE-300.

So I should’ve run export PATH=/opt/arm/FVP_Corstone_SSE-300_Ethos-U55/models/Linux64_GCC-6.4:/opt/arm/cmake/bin:$PATH instead of export PATH=/opt/arm/FVP_Corstone_SSE-300/models/Linux64_GCC-6.4:/opt/arm/cmake/bin:$PATH.

You let me notice that.

Finally I was able to run the demo!

Thank you very much for your elaborate support so far!

Hi @grant-arm,

This might not be related to TVM but is related to the demo.

I think if the demo is successful, there should be some information on NPU cycles.

I know on FVP you can’t get CPU cycles, but you can get NPU cycles. How can I get the cycle information?

Hi @sho ,

Thanks for the feedback - it isn’t possible with the current demo but it is something we are considering for the future and it would be a bit more relevant once more of the optimizations for Ethos-U like memory planning and Cascading are landed.

Hi @grant-arm, thank you for your reply. I recently bought Arm MPS3 board. Is it possible to run the demo on this board at the moment?