Skip to content

[caffe2] Broken TensorRT support #54321

@n-v-k

Description

@n-v-k

🐛 Bug

Building Caffe2 with TensorRT support ends with an error:

[ 83%] Building CXX object caffe2/CMakeFiles/torch_cuda.dir/contrib/tensorrt/tensorrt_op_trt.cc.o
/home/user/Documents/Eclipse/workspace/PyTorch/caffe2/contrib/tensorrt/tensorrt_op_trt.cc: In member function ’void caffe2::TensorRTOp::MaybeAdjustOutputShape(int, std::vector<long int, std::allocator<long int> >*)’:
/home/user/Documents/Eclipse/workspace/PyTorch/caffe2/contrib/tensorrt/tensorrt_op_trt.cc:139:50: error: no match for ’operator*’ (operand type is ’const std::vector<long int, std::allocator<long int> >’)
     const auto total_c2 = c10::multiply_integers(*dims_hint);
                                                  ^~~~~~~~~~

It happens because of trying to dereference not a pointer but a reference to a collection element of
std::unordered_map<int, std::vector<int64_t>> output_size_hints_;

The bug was introduced with switch from std:: to c10:: accumulators.
I will do PR with fix.

To Reproduce

Configure and build Caffe2 with TensorRT support (-D USE_TENSORRT=ON)

Environment

  • PyTorch Version (e.g., 1.0): current master
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): source
  • CUDA/cuDNN version: 11.1 / 8.1 (TensorRT 7.2.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    caffe2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions