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

[Bug]Build MMDeploy get wrong! #2786

Closed
2 of 3 tasks
KungFuPandaPro opened this issue Jun 26, 2024 · 2 comments
Closed
2 of 3 tasks

[Bug]Build MMDeploy get wrong! #2786

KungFuPandaPro opened this issue Jun 26, 2024 · 2 comments

Comments

@KungFuPandaPro
Copy link

Checklist

  • I have searched related issues but cannot get the expected help.
  • 2. I have read the FAQ documentation but cannot get the expected help.
  • 3. The bug has not been fixed in the latest version.

Describe the bug

When I build ONNXRuntime Custom Ops
according to
cd ${MMDEPLOY_DIR}
mkdir -p build && cd build
cmake -DCMAKE_CXX_COMPILER=g++-7 -DMMDEPLOY_TARGET_BACKENDS=ort -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} ..
make -j$(nproc) && make install

when excute make -j$(nproc) get wrong
image

Reproduction

cd ${MMDEPLOY_DIR}
mkdir -p build && cd build
cmake -DCMAKE_CXX_COMPILER=g++-7 -DMMDEPLOY_TARGET_BACKENDS=ort -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} ..
make -j$(nproc) && make install

Environment

6/26 22:42:23 - mmengine - INFO - **********Environmental information**********
/home/zhanweiwei/miniconda3/lib/python3.12/site-packages/torch/cuda/__init__.py:619: UserWarning: Can't initialize NVML
  warnings.warn("Can't initialize NVML")
06/26 22:42:24 - mmengine - INFO - sys.platform: linux
06/26 22:42:24 - mmengine - INFO - Python: 3.12.3 | packaged by Anaconda, Inc. | (main, May  6 2024, 19:46:43) [GCC 11.2.0]
06/26 22:42:24 - mmengine - INFO - CUDA available: False
06/26 22:42:24 - mmengine - INFO - MUSA available: False
06/26 22:42:24 - mmengine - INFO - numpy_random_seed: 2147483648
06/26 22:42:24 - mmengine - INFO - GCC: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
06/26 22:42:24 - mmengine - INFO - PyTorch: 2.3.1
06/26 22:42:24 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - GCC 9.3
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.3.6 (Git Hash 86e6af5974177e513fd3fee58425e1063e7f1361)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.3.1, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

06/26 22:42:24 - mmengine - INFO - TorchVision: 0.18.1
06/26 22:42:24 - mmengine - INFO - OpenCV: 4.10.0
06/26 22:42:24 - mmengine - INFO - MMEngine: 0.10.4
06/26 22:42:24 - mmengine - INFO - MMCV: 2.1.0
06/26 22:42:24 - mmengine - INFO - MMCV Compiler: GCC 11.4
06/26 22:42:24 - mmengine - INFO - MMCV CUDA Compiler: not available
06/26 22:42:24 - mmengine - INFO - MMDeploy: 1.3.1+bc75c9d
06/26 22:42:24 - mmengine - INFO -

06/26 22:42:24 - mmengine - INFO - **********Backend information**********
06/26 22:42:24 - mmengine - INFO - tensorrt:    None
06/26 22:42:25 - mmengine - INFO - ONNXRuntime: 1.18.0
06/26 22:42:25 - mmengine - INFO - ONNXRuntime-gpu:     None
06/26 22:42:25 - mmengine - INFO - ONNXRuntime custom ops:      Available
06/26 22:42:25 - mmengine - INFO - pplnn:       None
06/26 22:42:25 - mmengine - INFO - ncnn:        None
06/26 22:42:25 - mmengine - INFO - snpe:        None
06/26 22:42:25 - mmengine - INFO - openvino:    None
06/26 22:42:25 - mmengine - INFO - torchscript: 2.3.1
06/26 22:42:25 - mmengine - INFO - torchscript custom ops:      NotAvailable
06/26 22:42:25 - mmengine - INFO - rknn-toolkit:        None
06/26 22:42:25 - mmengine - INFO - rknn-toolkit2:       None
06/26 22:42:25 - mmengine - INFO - ascend:      None
06/26 22:42:25 - mmengine - INFO - coreml:      None
06/26 22:42:25 - mmengine - INFO - tvm: None
06/26 22:42:25 - mmengine - INFO - vacc:        None
06/26 22:42:25 - mmengine - INFO -

06/26 22:42:25 - mmengine - INFO - **********Codebase information**********
06/26 22:42:25 - mmengine - INFO - mmdet:       3.3.0
06/26 22:42:25 - mmengine - INFO - mmseg:       None
06/26 22:42:25 - mmengine - INFO - mmpretrain:  None
06/26 22:42:25 - mmengine - INFO - mmocr:       None
06/26 22:42:25 - mmengine - INFO - mmagic:      None
06/26 22:42:25 - mmengine - INFO - mmdet3d:     None
06/26 22:42:25 - mmengine - INFO - mmpose:      None
06/26 22:42:25 - mmengine - INFO - mmrotate:    None
06/26 22:42:25 - mmengine - INFO - mmaction:    None
06/26 22:42:25 - mmengine - INFO - mmrazor:     None
06/26 22:42:25 - mmengine - INFO - mmyolo:      None

Error traceback

(base) zhanweiwei@DESKTOP-G1IN0OU:~/mmdeploy/build$ make -j$(nproc) && make install
[ 12%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/common/ort_utils.cpp.o
[ 25%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/grid_sample/grid_sample.cpp.o
[ 37%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/modulated_deform_conv/modulated_deform_conv.cpp.o
[ 50%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/nms_match/nms_match.cpp.o
[ 62%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/nms_rotated/nms_rotated.cpp.o
[ 75%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/onnxruntime_register.cpp.o
[ 87%] Building CXX object csrc/mmdeploy/backend_ops/onnxruntime/CMakeFiles/mmdeploy_onnxruntime_ops_obj.dir/roi_align_rotated/roi_align_rotated.cpp.o
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:5:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.h:15:8: error: ‘CustomOpApi’ in namespace ‘Ort’ does not name a type
   Ort::CustomOpApi ort_;
        ^~~~~~~~~~~
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:9:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.h:14:40: error: expected ‘)’ before ‘ort’
   OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) {
                                        ^~~
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:2:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.h:15:8: error: ‘CustomOpApi’ in namespace ‘Ort’ does not name a type
   Ort::CustomOpApi ort_;
        ^~~~~~~~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp: In constructor ‘mmdeploy::GridSampleKernel::GridSampleKernel(const OrtApi&, const OrtKernelInfo*)’:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:17:7: error: class ‘mmdeploy::GridSampleKernel’ does not have any field named ‘ort_’
     : ort_(api), info_(info) {
       ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:18:20: error: ‘ort_’ was not declared in this scope
   align_corners_ = ort_.KernelInfoGetAttribute<int64_t>(info, "align_corners");
                    ^~~~
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.cpp:2:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.h:14:40: error: expected ‘)’ before ‘ort’
   OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) {
                                        ^~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:18:55: error: expected primary-expression before ‘>’ token
   align_corners_ = ort_.KernelInfoGetAttribute<int64_t>(info, "align_corners");
                                                       ^
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/onnxruntime_register.cpp:4:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.h:14:40: error: expected ‘)’ before ‘ort’
   OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) {
                                        ^~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:19:60: error: expected primary-expression before ‘>’ token
   interpolation_mode_ = ort_.KernelInfoGetAttribute<int64_t>(info, "interpolation_mode");
                                                            ^
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:20:54: error: expected primary-expression before ‘>’ token
   padding_mode_ = ort_.KernelInfoGetAttribute<int64_t>(info, "padding_mode");
                                                      ^
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp: In member function ‘void mmdeploy::GridSampleKernel::Compute(OrtKernelContext*)’:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:147:27: error: ‘ort_’ was not declared in this scope
   const OrtValue *input = ort_.KernelContext_GetInput(context, 0);
                           ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:148:80: error: expected primary-expression before ‘float’
   const float *input_data = reinterpret_cast<const float *>(ort_.GetTensorData<float>(input));
                                                                                ^~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:148:80: error: expected ‘)’ before ‘float’
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:151:79: error: expected primary-expression before ‘float’
   const float *grid_data = reinterpret_cast<const float *>(ort_.GetTensorData<float>(grid));
                                                                               ^~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:151:79: error: expected ‘)’ before ‘float’
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:9:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.h:14:40: error: expected ‘)’ before ‘ort’
   OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) {
                                        ^~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/grid_sample/grid_sample.cpp:165:46: error: expected primary-expression before ‘float’
   float *out_ptr = ort_.GetTensorMutableData<float>(output);
                                              ^~~~~
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:2:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.h:20:8: error: ‘CustomOpApi’ in namespace ‘Ort’ does not name a type
   Ort::CustomOpApi ort_;
        ^~~~~~~~~~~
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:14:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/common/ort_utils.h:14:40: error: expected ‘)’ before ‘ort’
   OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) {
                                        ^~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp: In constructor ‘mmdeploy::MMCVModulatedDeformConvKernel::MMCVModulatedDeformConvKernel(const OrtApi&, const OrtKernelInfo*)’:/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:115:7: error: class ‘mmdeploy::MMCVModulatedDeformConvKernel’ does not have any field named ‘ort_’
     : ort_(api), info_(info) {
       ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp: In constructor ‘mmdeploy::NMSMatchKernel::NMSMatchKernel(const OrtApi&, const OrtKernelInfo*)’:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:39:7: error: class ‘mmdeploy::NMSMatchKernel’ does not have any field named ‘ort_’
     : ort_(api), info_(info) {
       ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:116:33:
error: ‘ort_’ was not declared in this scope
   std::vector<int64_t> stride = ort_.KernelInfoGetAttribute<std::vector<int64_t>>(info, "stride");
                                 ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp: In member function ‘void mmdeploy::NMSMatchKernel::Compute(OrtKernelContext*)’:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:45:27: error: ‘ort_’ was not declared in this scope
   const OrtValue* boxes = ort_.KernelContext_GetInput(context, 0);
                           ^~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:116:80:
error: expected primary-expression before ‘>’ token
   std::vector<int64_t> stride = ort_.KernelInfoGetAttribute<std::vector<int64_t>>(info, "stride");
                                                                                ^~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:46:79: error: expected primary-expression before ‘float’
   const float* boxes_data = reinterpret_cast<const float*>(ort_.GetTensorData<float>(boxes));
                                                                               ^~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:119:81:
error: expected primary-expression before ‘>’ token
   std::vector<int64_t> padding = ort_.KernelInfoGetAttribute<std::vector<int64_t>>(info, "padding");
                                                                                 ^~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:46:79: error: expected ‘)’ before ‘float’
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:123:54:
error: expected primary-expression before ‘>’ token
       ort_.KernelInfoGetAttribute<std::vector<int64_t>>(info, "dilation");
                                                      ^~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:48:80: error: expected primary-expression before ‘float’
   const float* scores_data = reinterpret_cast<const float*>(ort_.GetTensorData<float>(scores));
                                                                                ^~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:126:58:
error: expected primary-expression before ‘>’ token
   deformable_group_ = ort_.KernelInfoGetAttribute<int64_t>(info, "deform_groups");
                                                          ^
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:48:80: error: expected ‘)’ before ‘float’
In file included from /home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_rotated/nms_rotated.cpp:2:0:
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_rotated/nms_rotated.h:20:8: error: ‘CustomOpApi’ in namespace ‘Ort’ does not name a type
   Ort::CustomOpApi ort_;
        ^~~~~~~~~~~
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/modulated_deform_conv/modulated_deform_conv.cpp:127:47:
error: expected primary-expression before ‘>’ token
   group_ = ort_.KernelInfoGetAttribute<int64_t>(info, "groups");
                                               ^
/home/zhanweiwei/mmdeploy/csrc/mmdeploy/backend_ops/onnxruntime/nms_match/nms_match.cpp:50:55: error: expected primary-expression before ‘float’
   const float iou_threshold_data = ort_.GetTensorData<float>(iou_threshold_)[0];
@RiverLight4
Copy link

See #2465 and #2779
MMDeploy is now supports onnxruntime <= 1.15.1 because Ort::CustomOpApi is deprecated at onnxruntime == 1.16.0. Try with onnxruntime <= 1.15.1.

I have same issue to use custom ops, but it seems that there is no plan to fix.
Sadly, it also seems that maintainers have not been active recently.

@KungFuPandaPro
Copy link
Author

thank you!

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

2 participants