alibaba / heterogeneity-aware-lowering-and-optimization

heterogeneity-aware-lowering-and-optimization
Apache License 2.0
253 stars 76 forks source link

'cortex-a77' is not a recognized processor for this target (ignoring processor) #944

Open wx5391805 opened 2 years ago

wx5391805 commented 2 years ago

在Ubuntu+arm64上编译出halo,转模型报上述错误。 'cortex-a77' is not a recognized processor for this target (ignoring processor)

link阶段, bin文件不认 /usr/bin/ld: unknown architecture of input file `yolo.bin' is incompatible with aarch64 output

halo支持arm64吗

tianboh commented 2 years ago

可以提供一下编译指令吗?

wx5391805 commented 2 years ago

可以提供一下编译指令吗? 编译吗?halo的编译没啥问题,按照doc里的从源码编译,只编eigen,如下: cmake -G Ninja -DDEST_DIR=/home/wx/halo_inst .. -L -DDNNL_COMPILER=gcc-10 -DODLA_BUILD_QAIC=OFF \ -DODLA_BUILD_HGAI=OFF \ -DODLA_BUILD_OPENVINO=OFF \ -DODLA_BUILD_MAGICMIND=OFF \ -DODLA_BUILD_DNNL=OFF \ -DODLA_BUILD_POPART=OFF \ -DODLA_BUILD_TRT=OFF \ -DODLA_BUILD_OPENVINO=OFF \ -DODLA_BUILD_Profiler=OFF \ -DODLA_BUILD_XNNPACK=OFF \ -DODLA_BUILD_ASCEND=OFF \ -DODLA_BUILD_VODLA=OFF

在转yolov3模型的时候报上述错误,指令如下: ./halo -target cxx -exec-mode=interpret -emit-value-id-as-int -reorder-data-layout=channel-last -remove-input-transpose -remove-output-transpose -o out/yolo.c /zhome/wangxin/halo/yolov3-10.onnx --disable-broadcasting -outputs conv2d_59 -outputs conv2d_67 -outputs conv2d_75 -input-shape=input_1:1x3x416x416 -entry-func-name=yolo_v3

weimingzha0 commented 2 years ago

有两种办法:

  1. ./bin/halo -target aarch64-cxx mnist_simple.pb -o a.cc file a.bin 应该显示 a.bin: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped

  2. ./bin/halo -target cxx mnist_simple.pb -emit-data-as-c -o a.cc 这时候会产生 a.data.cc , 这是一个纯C的文件,可以直接用gcc编译出weight

wx5391805 commented 2 years ago

谢谢,1方法貌似有点问题,2成功了

  1. 用aarch64-cxx编mnist没有产生输出(在x86上用0.7.9的最新发布包对照实验也是一样的情况),log如下: root@localhost:/home/wx/HALO-0.8.0-Linux/bin# ./halo -target cxx mnist_simple.pb -o mnist/model.cc --print-all Module: halo_module Function: mnist_simple(x[FLOAT32: -1x784]) Constant Variable([FLOAT32: 784x10]) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...] Constant Variable_1([FLOAT32: 10]) = [-0.349356, 0.340445, 0.129372, -0.265863, 0.00953579, 1.30408, -0.103605, 0.605276, -1.44135, -0.228528] BasicBlock: bb0() Inst: MatMul([invalid: ]) = matmul(<x, 0>:[FLOAT32: -1x784], <Variable, 0>:[FLOAT32: 784x10]) {Attrs: <transpose_a: 0>, <transpose_b: 0>} Inst: add([invalid: ]) = add(<MatMul, 0>:[invalid: ], <Variable_1, 0>:[FLOAT32: 10]) Inst: y([invalid: ]) = softmax(<add, 0>:[invalid: ]) {Attrs: <axis: -1>}

'cortex-a77' is not a recognized processor for this target (ignoring processor) 'cortex-a77' is not a recognized processor for this target (ignoring processor) FunctionPassManager Legalize inputs BasicBlockPassManager TF Extension Legalizer Dead Code Elimination Type Legalizer Instruction Simplification Instruction Fusion Convert TF CFG Quantize Weights X86 Constant Writer Generic CXX Compilation code format Module: halo_module Function: mnist_simple(x[FLOAT32: 1x784]) Constant Variable_1([FLOAT32: 10]) = [-0.349356, 0.340445, 0.129372, -0.265863, 0.00953579, 1.30408, -0.103605, 0.605276, -1.44135, -0.228528] Constant Variable_T([FLOAT32: 10x784]) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3.45072e-06, -8.78636e-06, -1.36928e-06, -5.70532e-08, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...] BasicBlock: bb0() Inst: add_fused([FLOAT32: 1x10]) = gemm(<x, 0>:[FLOAT32: 1x784], <Variable_T, 0>:[FLOAT32: 10x784], <Variable_1, 0>:[FLOAT32: 10]) {Attrs: <alpha: 1>, <beta: 1>, <transpose_a: 0>, <transpose_b: 1>} Inst: y([FLOAT32: 1x10]) = softmax(<add_fused, 0>:[FLOAT32: 1x10]) {Attrs: <axis: -1>} Inst: output([FLOAT32: 1x10]) = return(<y, 0>:[FLOAT32: 1x10])

root@localhost:/home/wx/HALO-0.8.0-Linux/bin# ls mnist model.bin model.cc model.h root@localhost:/home/wx/HALO-0.8.0-Linux/bin# file mnist/model.bin mnist/model.bin: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped root@localhost:/home/wx/HALO-0.8.0-Linux/bin# rm mnist/* root@localhost:/home/wx/HALO-0.8.0-Linux/bin# ./halo -target aarch64-cxx mnist_simple.pb -o mnist/model.cc --print-all Module: halo_module Function: mnist_simple(x[FLOAT32: -1x784]) Constant Variable([FLOAT32: 784x10]) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...] Constant Variable_1([FLOAT32: 10]) = [-0.349356, 0.340445, 0.129372, -0.265863, 0.00953579, 1.30408, -0.103605, 0.605276, -1.44135, -0.228528] BasicBlock: bb0() Inst: MatMul([invalid: ]) = matmul(<x, 0>:[FLOAT32: -1x784], <Variable, 0>:[FLOAT32: 784x10]) {Attrs: <transpose_a: 0>, <transpose_b: 0>} Inst: add([invalid: ]) = add(<MatMul, 0>:[invalid: ], <Variable_1, 0>:[FLOAT32: 10]) Inst: y([invalid: ]) = softmax(<add, 0>:[invalid: ]) {Attrs: <axis: -1>}

root@localhost:/home/wx/HALO-0.8.0-Linux/bin# ls mnist root@localhost:/home/wx/HALO-0.8.0-Linux/bin#

2.可以成功

weimingzha0 commented 2 years ago

方法1: ./halo -target aarch64-cxx 我看你贴的log 里是 ./halo -target cxx mnist_simple.pb

wx5391805 commented 2 years ago

看后面,前面是对比,后面没产生文件

weimingzha0 commented 2 years ago

奇怪,我是可以产生的。

wx5391805 commented 2 years ago

好吧~两个的打印在BasicBlock后面有点不一样,不知道是否正常?

weimingzha0 commented 2 years ago

应该没关系