microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.05k stars 2.83k forks source link

Build fails with --use_rknpu #7614

Open lipo5476 opened 3 years ago

lipo5476 commented 3 years ago

Hi,

I'm trying to cross-compile ONNX RT 1.7.1 with --use_rknpu for Rockchip Cortex-A7 platform with , but it fails with following errors:

/onnxruntime/core/providers/rknpu/onnx_converter.cc:109:16: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'const std::vector<unsigned int ')
   attr->dims = dims;

/onnxruntime/core/providers/rknpu/onnx_converter.cc:29:45: error: no matching function for call to 'onnxruntime::rknpu::Shaper::AddShape(const string&, std::vector<int>)'
     shaper_.AddShape(name, tensor->GetDims()); \

/onnxruntime/core/providers/rknpu/onnx_converter.cc:938:51: error: no match for 'operator=' (operand types are 'std::vector<unsigned int>' and 'std::vector<int>')
     weight_dims = rk_tensors_.at(weight)->GetDims();

I also tried ONNX RT 1.6.0 - same problem.

Without --use_rknpu I'm able to cross-compile ONNX RT library using the same toolchain without any issues.

Thank in advance for you help

lipo5476 commented 3 years ago

also other errors appear:

/onnxruntime/core/providers/rknpu/rknpu_execution_provider.cc:553:5: error: invalid use of incomplete type 'class onnxruntime::KernelRegistry'
     kernel_registry.Register(function_table_entry());
jywu-msft commented 3 years ago

@airockchip FYI

lipo5476 commented 3 years ago

@airockchip @jywu-msft do you have any suggestion please?

mkwml commented 2 years ago

@airockchip @jywu-msft do you have any suggestion please?

this error is caused by the different data types. you can edit this file https://github.com/airockchip/rknpu_ddk/blob/master/include/rknpu/tensor.h. modify lines 96 and 112, change int32_t to unit32_t.

XiaotaoChen commented 2 years ago

also other errors appear:

/onnxruntime/core/providers/rknpu/rknpu_execution_provider.cc:553:5: error: invalid use of incomplete type 'class onnxruntime::KernelRegistry'
     kernel_registry.Register(function_table_entry());

Hi, i also met the error, Did you solve it ? details to see: https://github.com/microsoft/onnxruntime/issues/11738#issue-1261042018

tyrius02 commented 2 months ago

I've managed to get the EP to build correctly again, see tyrius02/onnxruntime@118cbc627c2f49d3561ce4ad408a8114cf3a6a95.

A couple of notes. First, the four shared libraries from the RKNPU DDK must be present in the LD_LIBRARY_PATH. I've yet to figure out how to copy these libraries to the destination (I think this'll be easy enough), and even if I can copy the libraries to the right place(s) the embedded rpaths, if any, don't help. Second, after addressing the LD_LIBRARY_PATH the EP crashes with a segmentation fault. So time to debug.

DummyTitan commented 4 days ago

I know that this might not be the area to ask, but I was wondering if anyone is able to work with the device tree for Orange Pi 5 Max. I've been trying to fix it since it has an issue where the &av1d is not mentioned in the nodes, causing jellyfin to not be able to transcode av1 video. Every time I try to add it to the device tree, it just gives me a syntax error even though everything is in order that I know of.