onnxruntime
onnxruntime copied to clipboard
Failed to build with ACL(and ARMnn)
Describe the bug Error during build onnxruntime with ARM Compute Library, as well as ARM Compute Library + ArmNN
Urgency Runtime is quite useless on Edge devices otherwise
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux
- ONNX Runtime installed from (source or binary): source, master (6bb807ef74252d1cca1d69c0ec7680972ff5ff6f)
- Python version: 3.9.2
- GCC/Compiler version (if compiling from source): 10.2.1
To Reproduce These manuals: https://onnxruntime.ai/docs/build/inferencing.html#native-compiling-on-linux-arm-device https://onnxruntime.ai/docs/build/eps.html#native-build-instructions https://onnxruntime.ai/docs/build/eps.html#armnn
Additional context error log
[ 15%] Building CXX object CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o
In file included from /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:16:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:29:32: error: ‘Tensor’ is not a member of ‘arm_compute’; did you mean ‘ITensor’?
29 | std::shared_ptr<arm_compute::Tensor> in;
| ^~~~~~
| ITensor
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:29:38: error: template argument 1 is invalid
29 | std::shared_ptr<arm_compute::Tensor> in;
| ^
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:30:32: error: ‘Tensor’ is not a member of ‘arm_compute’; did you mean ‘ITensor’?
30 | std::shared_ptr<arm_compute::Tensor> k;
| ^~~~~~
| ITensor
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:30:38: error: template argument 1 is invalid
30 | std::shared_ptr<arm_compute::Tensor> k;
| ^
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:31:32: error: ‘Tensor’ is not a member of ‘arm_compute’; did you mean ‘ITensor’?
31 | std::shared_ptr<arm_compute::Tensor> b;
| ^~~~~~
| ITensor
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:31:38: error: template argument 1 is invalid
31 | std::shared_ptr<arm_compute::Tensor> b;
| ^
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:32:32: error: ‘Tensor’ is not a member of ‘arm_compute’; did you mean ‘ITensor’?
32 | std::shared_ptr<arm_compute::Tensor> out;
| ^~~~~~
| ITensor
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:32:38: error: template argument 1 is invalid
32 | std::shared_ptr<arm_compute::Tensor> out;
| ^
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:58:55: error: ‘arm_compute::Tensor’ has not been declared
58 | arm_compute::TensorShape ACLReshapeWeightsDepthwise(arm_compute::Tensor* kernel) const;
| ^~~~~~~~~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:46:26: error: no declaration matches ‘arm_compute::TensorShape onnxruntime::acl::Conv<T>::ACLReshapeWeightsDepthwise(arm_compute::Tensor*) const’
46 | arm_compute::TensorShape Conv<T>::ACLReshapeWeightsDepthwise(arm_compute::Tensor* kernel) const {
| ^~~~~~~
In file included from /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:16:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:58:28: note: candidate is: ‘arm_compute::TensorShape onnxruntime::acl::Conv<T>::ACLReshapeWeightsDepthwise(int*) const’
58 | arm_compute::TensorShape ACLReshapeWeightsDepthwise(arm_compute::Tensor* kernel) const;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.h:39:7: note: ‘class onnxruntime::acl::Conv<T>’ defined here
39 | class Conv : public onnxruntime::Conv<T> {
| ^~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In member function ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const’:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:79:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
79 | if (B != nullptr) LOGS_DEFAULT(VERBOSE) << "B " << B->Shape().ToString().c_str();
| ^
In file included from /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:11:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:35: error: ‘const struct onnxruntime::ConvAttributes’ has no member named ‘InferOutputShape’; did you mean ‘InferPadsAndOutputShape’?
108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims));
| ^~~~~~~~~~~~~~~~
/code/onnxruntime/include/onnxruntime/core/common/common.h:231:21: note: in definition of macro ‘ORT_RETURN_IF_ERROR_SESSIONID’
231 | auto _status = (expr); \
| ^~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:3: note: in expansion of macro ‘ORT_RETURN_IF_ERROR’
108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims));
| ^~~~~~~~~~~~~~~~~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:148:13: error: base operand of ‘->’ is not a pointer
148 | tconv.in->allocator()->init(arm_compute::TensorInfo(ACLTensorShape(X->Shape(), PREF_DIM), arm_compute::Format::F32));
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:149:12: error: base operand of ‘->’ is not a pointer
149 | tconv.k->allocator()->init(arm_compute::TensorInfo(ACLTensorShape(W->Shape()), arm_compute::Format::F32));
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:151:14: error: base operand of ‘->’ is not a pointer
151 | tconv.b->allocator()->init(arm_compute::TensorInfo(ACLTensorShape(B->Shape()), arm_compute::Format::F32));
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:153:14: error: base operand of ‘->’ is not a pointer
153 | tconv.out->allocator()->init(arm_compute::TensorInfo(ACLTensorShape(Y->Shape(), PREF_DIM), arm_compute::Format::F32));
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:155:57: error: base operand of ‘->’ is not a pointer
155 | const arm_compute::DataLayout data_layout = tconv.in->info()->data_layout();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:157:79: error: base operand of ‘->’ is not a pointer
157 | bool isDepthwise = (conv_attrs_.group > 1 && conv_attrs_.group == tconv.in->info()->tensor_shape()[idx_channel]);
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:201:14: error: base operand of ‘->’ is not a pointer
201 | tconv.k->info()->set_tensor_shape(ACLReshapeWeightsDepthwise(tconv.k.get()));
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:201:76: error: request for member ‘get’ in ‘tconv.k’, which is of non-class type ‘int’
201 | tconv.k->info()->set_tensor_shape(ACLReshapeWeightsDepthwise(tconv.k.get()));
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:219:44: error: ‘NEDepthwiseConvolutionLayerOptimized’ is not a member of ‘arm_compute’; did you mean ‘NEDepthwiseConvolutionLayer’?
219 | bool optimizable = bool(arm_compute::NEDepthwiseConvolutionLayerOptimized::validate(tconv.in->info(),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NEDepthwiseConvolutionLayer
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:246:35: error: request for member ‘get’ in ‘tconv.in’, which is of non-class type ‘int’
246 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:246:50: error: request for member ‘get’ in ‘tconv.k’, which is of non-class type ‘int’
246 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:246:82: error: request for member ‘get’ in ‘tconv.b’, which is of non-class type ‘int’
246 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:246:109: error: request for member ‘get’ in ‘tconv.out’, which is of non-class type ‘int’
246 | tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:262:17: error: base operand of ‘->’ is not a pointer
262 | if(tconv.k->info()->tensor_shape()[0] == 1 && tconv.k->info()->tensor_shape()[1] == 1) {
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:262:60: error: base operand of ‘->’ is not a pointer
262 | if(tconv.k->info()->tensor_shape()[0] == 1 && tconv.k->info()->tensor_shape()[1] == 1) {
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:267:19: error: base operand of ‘->’ is not a pointer
267 | if(tconv.k->info()->tensor_shape()[0] == 9 && tconv.k->info()->tensor_shape()[1] == 9) {
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:267:62: error: base operand of ‘->’ is not a pointer
267 | if(tconv.k->info()->tensor_shape()[0] == 9 && tconv.k->info()->tensor_shape()[1] == 9) {
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:274:35: error: request for member ‘get’ in ‘tconv.in’, which is of non-class type ‘int’
274 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:274:50: error: request for member ‘get’ in ‘tconv.k’, which is of non-class type ‘int’
274 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:274:82: error: request for member ‘get’ in ‘tconv.b’, which is of non-class type ‘int’
274 | layer->configure(tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:274:109: error: request for member ‘get’ in ‘tconv.out’, which is of non-class type ‘int’
274 | tconv.in.get(), tconv.k.get(), (B != nullptr) ? tconv.b.get() : nullptr, tconv.out.get(),
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:283:14: error: base operand of ‘->’ is not a pointer
283 | tconv.out->info()->set_format(tconv.in->info()->format());
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:283:43: error: base operand of ‘->’ is not a pointer
283 | tconv.out->info()->set_format(tconv.in->info()->format());
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:289:40: error: request for member ‘get’ in ‘tconv.in’, which is of non-class type ‘int’
289 | ACLPrintTensorShape("X", *tconv.in.get());
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:290:41: error: request for member ‘get’ in ‘tconv.out’, which is of non-class type ‘int’
290 | ACLPrintTensorShape("Y", *tconv.out.get());
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:298:41: error: base operand of ‘->’ is not a pointer
298 | if(X->Shape().Size() != 0 && pConv->in->info()->has_padding() ){
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:299:14: error: base operand of ‘->’ is not a pointer
299 | pConv->in->allocator()->allocate();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:300:37: error: request for member ‘get’ in ‘pConv->in’, which is of non-class type ‘int’
300 | importDataToTensor<T>(pConv->in.get(), x_data);
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:302:30: error: base operand of ‘->’ is not a pointer
302 | ACLImportMemory(pConv->in->allocator(), (void*)x_data, X->Shape().Size() * 4);
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:306:27: error: base operand of ‘->’ is not a pointer
306 | ACLImportMemory(pConv->k->allocator(), (void*)k_data, W->Shape().Size() * 4);
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:310:29: error: base operand of ‘->’ is not a pointer
310 | ACLImportMemory(pConv->b->allocator(), (void*)b_data, B->Shape().Size() * 4);
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:314:42: error: base operand of ‘->’ is not a pointer
314 | if(Y->Shape().Size() != 0 && pConv->out->info()->has_padding() ){
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:315:15: error: base operand of ‘->’ is not a pointer
315 | pConv->out->allocator()->allocate();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:317:31: error: base operand of ‘->’ is not a pointer
317 | ACLImportMemory(pConv->out->allocator(), (void*)y_data, Y->Shape().Size() * 4);
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:325:42: error: base operand of ‘->’ is not a pointer
325 | if(Y->Shape().Size() != 0 && pConv->out->info()->has_padding() ){
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:326:40: error: request for member ‘get’ in ‘pConv->out’, which is of non-class type ‘int’
326 | importDataFromTensor<T>(pConv->out.get(), y_data);
| ^~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:329:12: error: base operand of ‘->’ is not a pointer
329 | pConv->in->allocator()->free();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:330:11: error: base operand of ‘->’ is not a pointer
330 | pConv->k->allocator()->free();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:332:13: error: base operand of ‘->’ is not a pointer
332 | pConv->b->allocator()->free();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:333:13: error: base operand of ‘->’ is not a pointer
333 | pConv->out->allocator()->free();
| ^~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In instantiation of ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const [with T = float]’:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:56:8: required from here
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:142:53: error: cannot convert ‘std::shared_ptr<arm_compute::Tensor>’ to ‘int’ in assignment
142 | tconv.in = std::make_shared<arm_compute::Tensor>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::shared_ptr<arm_compute::Tensor>
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:143:52: error: cannot convert ‘std::shared_ptr<arm_compute::Tensor>’ to ‘int’ in assignment
143 | tconv.k = std::make_shared<arm_compute::Tensor>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::shared_ptr<arm_compute::Tensor>
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:145:54: error: cannot convert ‘std::shared_ptr<arm_compute::Tensor>’ to ‘int’ in assignment
145 | tconv.b = std::make_shared<arm_compute::Tensor>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::shared_ptr<arm_compute::Tensor>
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:146:54: error: cannot convert ‘std::shared_ptr<arm_compute::Tensor>’ to ‘int’ in assignment
146 | tconv.out = std::make_shared<arm_compute::Tensor>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::shared_ptr<arm_compute::Tensor>
gmake[2]: *** [CMakeFiles/onnxruntime_providers_acl.dir/build.make:160: CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1078: CMakeFiles/onnxruntime_providers_acl.dir/all] Error 2
gmake: *** [Makefile:182: all] Error 2
Traceback (most recent call last):
File "/code/onnxruntime/tools/ci_build/build.py", line 2744, in <module>
sys.exit(main())
File "/code/onnxruntime/tools/ci_build/build.py", line 2663, in main
build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
File "/code/onnxruntime/tools/ci_build/build.py", line 1301, in build_targets
run_subprocess(cmd_args, env=env)
File "/code/onnxruntime/tools/ci_build/build.py", line 714, in run_subprocess
return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
File "/code/onnxruntime/tools/python/util/run.py", line 49, in run
completed_process = subprocess.run(
File "/usr/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '--build', '/code/onnxruntime/build/Linux/MinSizeRel', '--config', 'MinSizeRel']' returned non-zero exit status 2.
I wonder if the arm_compute headers changed, can you try making this change to see if these errors go away:
https://github.com/microsoft/onnxruntime/blob/315e00653211b81129b4a8718f74d35afd4a2aaf/onnxruntime/core/providers/acl/nn/conv.cc#L21
After that line, add:
#include "arm_compute/runtime/tensor.h"
nice, i added it to conv.cc
and conv.h
. got a different error now :)
Building CXX object CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In member function ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const’:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:79:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
79 | if (B != nullptr) LOGS_DEFAULT(VERBOSE) << "B " << B->Shape().ToString().c_str();
| ^
In file included from /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:11:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:35: error: ‘const struct onnxruntime::ConvAttributes’ has no member named ‘InferOutputShape’; did you mean ‘InferPadsAndOutputShape’?
108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims));
| ^~~~~~~~~~~~~~~~
/code/onnxruntime/include/onnxruntime/core/common/common.h:231:21: note: in definition of macro ‘ORT_RETURN_IF_ERROR_SESSIONID’
231 | auto _status = (expr); \
| ^~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:3: note: in expansion of macro ‘ORT_RETURN_IF_ERROR’
108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims));
| ^~~~~~~~~~~~~~~~~~~
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:219:44: error: ‘NEDepthwiseConvolutionLayerOptimized’ is not a member of ‘arm_compute’; did you mean ‘NEDepthwiseConvolutionLayer’?
219 | bool optimizable = bool(arm_compute::NEDepthwiseConvolutionLayerOptimized::validate(tconv.in->info(),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NEDepthwiseConvolutionLayer
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In instantiation of ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const [with T = float]’:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:56:8: required from here
/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:157:68: warning: comparison of integer expressions of different signedness: ‘const int64_t’ {aka ‘const long int’} and ‘const long unsigned int’ [-Wsign-compare]
157 | bool isDepthwise = (conv_attrs_.group > 1 && conv_attrs_.group == tconv.in->info()->tensor_shape()[idx_channel]);
gmake[2]: *** [CMakeFiles/onnxruntime_providers_acl.dir/build.make:160: CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:958: CMakeFiles/onnxruntime_providers_acl.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
Yep, that error makes sense. There was a recent change to conv_attributes.h renaming the InferOutputShape method to InferPadsAndOutputShape. So just change InferOutputShape to InferPadsAndOutputShape in conv.cc line 108
Looks like NEDepthwiseConvolutionLayerOptimized was removed in the recent arm library also. Try the suggested rename there of NEDepthwiseConvolutionLayer?
hi, sorry for delay, i made these replacements and got one build step further 😁
/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc: In instantiation of ‘onnxruntime::acl::ACLNEPool onnxruntime::acl::PoolOperation(onnxruntime::OpKernelContext*, arm_compute::PoolingType, onnxruntime::PoolAttributes, onnxruntime::acl::PoolLayersIterator, bool) [with T = float; onnxruntime::acl::PoolLayersIterator = std::_Rb_tree<onnxruntime::OpKernel*, std::pair<onnxruntime::OpKernel* const, onnxruntime::acl::ACLNEPool>, std::_Select1st<std::pair<onnxruntime::OpKernel* const, onnxruntime::acl::ACLNEPool> >, std::less<onnxruntime::OpKernel*>, std::allocator<std::pair<onnxruntime::OpKernel* const, onnxruntime::acl::ACLNEPool> > >::iterator]’:
/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:216:37: required from ‘onnxruntime::common::Status onnxruntime::acl::MaxPoolV8<T>::Compute(onnxruntime::OpKernelContext*) const [with T = float]’
/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:192:8: required from here
/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:65:70: error: no matching function for call to ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType&)’
65 | layer->configure(tpool.in.get(), tpool.out.get(), arm_compute::PoolingLayerInfo(pool_type));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/ComputeLibrary/arm_compute/core/ITensorInfo.h:30,
from /home/pi/ComputeLibrary/arm_compute/core/ITensor.h:27,
from /home/pi/ComputeLibrary/arm_compute/runtime/Tensor.h:27,
from /code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.h:11,
from /code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:13:
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1260:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, arm_compute::DataLayout)’
1260 | explicit PoolingLayerInfo(PoolingType pool_type, DataLayout data_layout)
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1260:14: note: candidate expects 2 arguments, 1 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1237:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, arm_compute::Size2D, arm_compute::DataLayout, arm_compute::PadStrideInfo, bool, bool)’
1237 | explicit PoolingLayerInfo(PoolingType pool_type,
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1237:14: note: candidate expects 6 arguments, 1 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1210:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, unsigned int, arm_compute::DataLayout, arm_compute::PadStrideInfo, bool, bool)’
1210 | explicit PoolingLayerInfo(PoolingType pool_type,
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1210:14: note: candidate expects 6 arguments, 1 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1189:5: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo()’
1189 | PoolingLayerInfo()
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1189:5: note: candidate expects 0 arguments, 1 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate: ‘constexpr arm_compute::PoolingLayerInfo::PoolingLayerInfo(const arm_compute::PoolingLayerInfo&)’
1186 | struct PoolingLayerInfo
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: no known conversion for argument 1 from ‘arm_compute::PoolingType’ to ‘const arm_compute::PoolingLayerInfo&’
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate: ‘constexpr arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingLayerInfo&&)’
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: no known conversion for argument 1 from ‘arm_compute::PoolingType’ to ‘arm_compute::PoolingLayerInfo&&’
/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:108:37: error: no matching function for call to ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType&, arm_compute::Size2D&, arm_compute::PadStrideInfo&, bool&)’
108 | arm_compute::PoolingLayerInfo pool_info(pool_type, aclSize, aclPadStride, excludePadding);
| ^~~~~~~~~
In file included from /home/pi/ComputeLibrary/arm_compute/core/ITensorInfo.h:30,
from /home/pi/ComputeLibrary/arm_compute/core/ITensor.h:27,
from /home/pi/ComputeLibrary/arm_compute/runtime/Tensor.h:27,
from /code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.h:11,
from /code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc:13:
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1260:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, arm_compute::DataLayout)’
1260 | explicit PoolingLayerInfo(PoolingType pool_type, DataLayout data_layout)
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1260:14: note: candidate expects 2 arguments, 4 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1237:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, arm_compute::Size2D, arm_compute::DataLayout, arm_compute::PadStrideInfo, bool, bool)’
1237 | explicit PoolingLayerInfo(PoolingType pool_type,
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1239:45: note: no known conversion for argument 3 from ‘arm_compute::PadStrideInfo’ to ‘arm_compute::DataLayout’
1239 | DataLayout data_layout,
| ~~~~~~~~~~~~~~^~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1210:14: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingType, unsigned int, arm_compute::DataLayout, arm_compute::PadStrideInfo, bool, bool)’
1210 | explicit PoolingLayerInfo(PoolingType pool_type,
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1211:45: note: no known conversion for argument 2 from ‘arm_compute::Size2D’ to ‘unsigned int’
1211 | unsigned int pool_size,
| ~~~~~~~~~~~~~~^~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1189:5: note: candidate: ‘arm_compute::PoolingLayerInfo::PoolingLayerInfo()’
1189 | PoolingLayerInfo()
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1189:5: note: candidate expects 0 arguments, 4 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate: ‘constexpr arm_compute::PoolingLayerInfo::PoolingLayerInfo(const arm_compute::PoolingLayerInfo&)’
1186 | struct PoolingLayerInfo
| ^~~~~~~~~~~~~~~~
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate expects 1 argument, 4 provided
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate: ‘constexpr arm_compute::PoolingLayerInfo::PoolingLayerInfo(arm_compute::PoolingLayerInfo&&)’
/home/pi/ComputeLibrary/arm_compute/core/Types.h:1186:8: note: candidate expects 1 argument, 4 provided
gmake[2]: *** [CMakeFiles/onnxruntime_providers_acl.dir/build.make:188: CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/pool.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:958: CMakeFiles/onnxruntime_providers_acl.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
Looks like the latest armnn libraries had non trivial changes. You're welcome to keep investigating, but it'd be faster for you use a previous version of their library that works. Looks like it was added in 2020 by @Andrews548
Could you tell what tag would work like certainly?😁
I'd guess one from 2020? I don't know if they guarantee non breaking API changes within a version but I'd guess v20.11 could work. https://github.com/ARM-software/ComputeLibrary/releases/tag/v20.11
From: https://github.com/ARM-software/ComputeLibrary/tags
I tried each version from 2020(starting from even 19.08) but everything is failing with the same error
It looks like the original owners of that provider are not maintaining it (it was submitted by outsiders). We have added a bunch of similar Arm CPU specific improvements to the core CPU code, so this specific provider is less useful than it was originally. Is the performance acceptable on ARM today? Or you just wanted to use this provider since it sounded like it was the fastest option?
Well, PyTorch and TF(not lite) compiled for aarch64 are slightly faster than such onnxruntime. They don't mention anything about using NEON and simillar instructions which are provided on ARM, so yeah, i was wondering wether ACL/ArmNN could be bit or much faster.
Yet wondering about MNN, but didn't get to test it yet.
Are you able to share the model? Interested in the operators is uses and the data type. If the input data is float we have a new execution provider that may be able to help if the operators in your model are supported by that.
Unfortunately i can't share the model, but i can tell that's just GPT-2 based model.
Would it be possible to dump the model out as text? That would just list the nodes and initializers and not include any values. Or if that is too much could you run the tool to convert to ORT format and provide the config file that generates as that will only list the operators and types (no info on the nodes or initializers at all)?
Dumping to text via python. Needs the onnx python module:
filename = 'model.onnx'
model = onnx.load_model(filename)
output_filename = os.path.splitext(filename)[0] + ".txt"
with open(output_filename, "w", encoding="utf-8") as ofile:
ofile.write(onnx.helper.printable_graph(model.graph))
Or conversion to ORT format. Needs the onnxruntime python module:
python -m onnxruntime.tools.convert_onnx_models_to_ort --enable_type_reduction <path to model>
You can delete the .ort files that creates. We're just after the
here it is
ai.onnx;1;LayerNormalization
ai.onnx;9;Where{"inputs": {"1": ["float"]}}
ai.onnx;11;Range{"inputs": {"0": ["int64_t"]}}
ai.onnx;13;Add{"inputs": {"0": ["float"]}},Cast{"inputs": {"0": ["int64_t", "uint8_t"]}, "outputs": {"0": ["bool", "float"]}},Concat{"inputs": {"0": ["int64_t"]}},Div{"inputs": {"0": ["float"]}},Gather{"inputs": {"0": ["float", "int64_t"], "1": ["int64_t"]}},MatMul{"inputs": {"0": ["float"]}},Mul{"inputs": {"0": ["float"]}},Pow{"inputs": {"0": ["float"], "1": ["float"]}},Reshape,Shape,Slice{"inputs": {"0": ["uint8_t"], "1": ["int64_t"]}},Softmax{"inputs": {"0": ["float"]}},Split{"inputs": {"0": ["float"]}},Sub{"inputs": {"0": ["float", "int64_t"]}},Transpose{"inputs": {"0": ["float"]}},Unsqueeze
com.microsoft;1;DynamicQuantizeMatMul,FastGelu
How many nodes are MatMul vs DynamicQuantizeMatMul?
Is the model quantized? Most of the operators seem to be working with float data so maybe there aren't many DynamicQuantizeMatMul nodes.
The new XNNPACK EP might be able to help with performance but would need support for one or both of these operators to be added.
Unfortunately i can't share the model, but i can tell that's just GPT-2 based model
nice, i added it to
conv.cc
andconv.h
. got a different error now :)Building CXX object CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In member function ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const’: /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:79:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 79 | if (B != nullptr) LOGS_DEFAULT(VERBOSE) << "B " << B->Shape().ToString().c_str(); | ^ In file included from /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:11: /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:35: error: ‘const struct onnxruntime::ConvAttributes’ has no member named ‘InferOutputShape’; did you mean ‘InferPadsAndOutputShape’? 108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims)); | ^~~~~~~~~~~~~~~~ /code/onnxruntime/include/onnxruntime/core/common/common.h:231:21: note: in definition of macro ‘ORT_RETURN_IF_ERROR_SESSIONID’ 231 | auto _status = (expr); \ | ^~~~ /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:108:3: note: in expansion of macro ‘ORT_RETURN_IF_ERROR’ 108 | ORT_RETURN_IF_ERROR(conv_attrs_.InferOutputShape(input_shape, kernel_shape, strides, dilations, pads, Y_dims)); | ^~~~~~~~~~~~~~~~~~~ /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:219:44: error: ‘NEDepthwiseConvolutionLayerOptimized’ is not a member of ‘arm_compute’; did you mean ‘NEDepthwiseConvolutionLayer’? 219 | bool optimizable = bool(arm_compute::NEDepthwiseConvolutionLayerOptimized::validate(tconv.in->info(), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | NEDepthwiseConvolutionLayer /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc: In instantiation of ‘onnxruntime::common::Status onnxruntime::acl::Conv<T>::Compute(onnxruntime::OpKernelContext*) const [with T = float]’: /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:56:8: required from here /code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc:157:68: warning: comparison of integer expressions of different signedness: ‘const int64_t’ {aka ‘const long int’} and ‘const long unsigned int’ [-Wsign-compare] 157 | bool isDepthwise = (conv_attrs_.group > 1 && conv_attrs_.group == tconv.in->info()->tensor_shape()[idx_channel]); gmake[2]: *** [CMakeFiles/onnxruntime_providers_acl.dir/build.make:160: CMakeFiles/onnxruntime_providers_acl.dir/code/onnxruntime/onnxruntime/core/providers/acl/nn/conv.cc.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:958: CMakeFiles/onnxruntime_providers_acl.dir/all] Error 2 gmake: *** [Makefile:166: all] Error 2
Experiencing the same issue. Any luck at the end with it?