Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uTVM fails to build runtime for Arm Target #6954

Closed
tom-gall opened this issue Nov 23, 2020 · 0 comments
Closed

uTVM fails to build runtime for Arm Target #6954

tom-gall opened this issue Nov 23, 2020 · 0 comments

Comments

@tom-gall
Copy link
Contributor

tom-gall commented Nov 23, 2020

given:

TARGET = tvm.target.target.micro("stm32f746xx")

with tvm.transform.PassContext(
opt_level=3, config={"tir.disable_vectorize": True}, disabled_pass=["FuseOps"]
):
graph, c_mod, c_params = relay.build(mod, target=TARGET, params=params)

workspace = tvm.micro.Workspace()

compiler = tvm.micro.DefaultCompiler(target=TARGET)
opts = tvm.micro.default_options(os.path.join(tvm.micro.CRT_ROOT_DIR, "stm32f746xx"))

micro_binary = tvm.micro.build_static_runtime(
workspace,
compiler,
c_mod,
lib_opts=opts["bin_opts"],
bin_opts=opts["bin_opts"],
)

Creating the runtime will fail with

arm-none-eabi-g++: error: missing argument to '-march='

It's not exactly surprising since
RuntimeError: error while running command "arm-none-eabi-g++ -g -march=cortex-m7 -std=c++11 -Wall -Werror -I /home/tgall/tvm/tvm/include -I /home/tgall/tvm/tvm/3rdparty/dlpack/include -I /home/tgall/tvm/tvm/3rdparty/libcrc/include -I /home/tgall/tvm/tvm/3rdparty/dmlc-core/include -I /home/tgall/tvm/tvm/src/runtime/crt/include -I /home/tgall/tvm/tvm/src/runtime/crt/stm32f746xx -c -o /tmp/tmpv6j60fia/build/utvm_rpc_server/rpc_server.o /home/tgall/tvm/tvm/src/runtime/crt/utvm_rpc_server/rpc_server.cc":
arm-none-eabi-g++: error: unrecognized -march target: cortex-m7

So what is the fix?

cortex-m7 is an -mcpu setting.

Instead
-march=armv7-m when targeting and m3
-march=armv7e-m when targeting an m4, m7 (like the discovery)
-march=armv8-m when targeting an m33

Patch incoming.

@areusch

tom-gall added a commit to tom-gall/tvm that referenced this issue Nov 23, 2020
…ails

with -march= is missing.

This fix:
1) adds support for march
2) picks a senable setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>
tom-gall added a commit to tom-gall/tvm that referenced this issue Nov 23, 2020
…ails

with -march= is missing.

This fix:
1) adds support for march
2) picks a senible setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>
@tqchen tqchen closed this as completed in 0c92772 Nov 24, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this issue Dec 2, 2020
…re (apache#6957)

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senable setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senible setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this issue Dec 4, 2020
…re (apache#6957)

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senable setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senible setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this issue Dec 4, 2020
…re (apache#6957)

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senable setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>

* Fix apache#6954 which when building the runtime for native hardware fails
with -march= is missing.

This fix:
1) adds support for march
2) picks a senible setting for f746 discovery

There is an interesting downside to this fix involving scheduling that likely needs discussion.
In the microcontroller world we really should be setting ex: -march=armv7e-m depending on what
cortex-m is being used.

-mcpu isn't as important when it comes to a command line compiler.

Signed-off-by: Tom Gall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant