Onnxruntime: Build error with TensorRT 6.0 due to deprecations

Created on 18 Sep 2019  Â·  5Comments  Â·  Source: microsoft/onnxruntime

Trying to build from master with TensorRT 6.0 get something like that:

/onnxruntime/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc: In member function ‘SubGraphCollection_t onnxruntime::TensorrtExecutionProvider::GetSupportedList(SubGraphCollection_t, int, int, const onnxruntime::GraphViewer&, bool*) const’: /onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc:213:100: error: ‘virtual nvinfer1::INetworkDefinition* nvinfer1::IBuilder::createNetwork()’ is deprecated [-Werror=deprecated-declarations] auto trt_network = unique_pointer<nvinfer1::INetworkDefinition>(trt_builder->createNetwork()); ^ In file included from /onnxruntime/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h:8:0, from onnxruntime/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc:4: /usr/include/x86_64-linux-gnu/NvInfer.h:5431:58: note: declared here TRT_DEPRECATED virtual nvinfer1::INetworkDefinition* createNetwork() TRTNOEXCEPT = 0;

Now this classes and methods are deprecated :
https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/deprecated.html

However build with add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations") from master with TensorRT 6.0 is successful.

enhancement

Most helpful comment

onnxruntime does not yet support Tensorrt 6
The work is in progress.

All 5 comments

@stevenlix
TensorRT 6.0 integration work is in progress.

Seems the error comes from onnx-tensorrt:

onnx-tensorrt/InstanceNormalization.cpp:45:16: error: ‘nvinfer1::Dims::type’ is deprecated [-Werror=deprecated-declarations]
           dims.type[2] == nvinfer1::DimensionType::kSPATIAL);

But I build onnx-tensorrt from master branch against tensorrt 6.0.1.5, it works fine.

What's the problem?

I build onnxruntime got this issue

onnxruntime does not yet support Tensorrt 6
The work is in progress.

initial integration of TensorRT 6.0 has been done. the build should succeed now.

the build should succeed now

Yes. Thanks. Using gcc and g++ < 8 build succeed.

However, building with gcc and g++ 8.1.0 cause error

[ 50%] Building CXX object CMakeFiles/onnxruntime_optimizer.dir/onnxruntime/onnxruntime/core/optimizer/constant_folding.cc.o
/onnxruntime/cmake/external/onnx-tensorrt/builtin_op_importers.cpp: In function ‘onnx2trt::NodeImportResult onnx2trt::{anonymous}::importGemm(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)’:
onnxruntime/cmake/external/onnx-tensorrt/builtin_op_importers.cpp:873:5: error: the type ‘const onnx2trt::{anonymous}::importGemm(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)::<lambda(const nvinfer1::ITensor&, bool)>’ of ‘constexpr’ variable ‘getMatrixOp’ is not literal
     };
     ^

/onnxruntime/cmake/external/onnx-tensorrt/builtin_op_importers.cpp:863:35: note: ‘onnx2trt::{anonymous}::importGemm(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)::<lambda(const nvinfer1::ITensor&, bool)>’ is not literal because:
     constexpr auto getMatrixOp = [](const nvinfer1::ITensor& input, bool transpose) {
                                   ^

cc1plus: note:   ‘onnx2trt::{anonymous}::importGemm(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)::<lambda(const nvinfer1::ITensor&, bool)>’ is a closure type, which is only literal in C++17 and later
/onnxruntime/cmake/external/onnx-tensorrt/builtin_op_importers.cpp: In function ‘onnx2trt::NodeImportResult onnx2trt::{anonymous}::importMatMul(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)’:
/onnxruntime/cmake/external/onnx-tensorrt/builtin_op_importers.cpp:1305:5: error: the type ‘const onnx2trt::{anonymous}::importMatMul(onnx2trt::IImporterContext*, const onnx::NodeProto&, std::vector<onnx2trt::TensorOrWeights>&)::<lambda(const nvinfer1::ITensor&)>’ of ‘constexpr’ variable ‘getMatrixOp’ is not literal
     };
Was this page helpful?
0 / 5 - 0 ratings