From 6934ae2b2259e2def3812ee661fc8fa43341cd80 Mon Sep 17 00:00:00 2001 From: Wilber Date: Tue, 8 Nov 2022 19:28:02 +0800 Subject: [PATCH] Fix compiler error with_trt (#47716) --- cmake/flags.cmake | 4 +++- paddle/fluid/inference/tensorrt/plugin/common/bertCommon.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 8b8af03744..6e18249b1a 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -257,7 +257,9 @@ if(WITH_ROCM) string(REPLACE "-Werror" "-Wno-error" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) endif() -if(WITH_PSCORE OR WITH_PSLIB) +if(WITH_PSCORE + OR WITH_PSLIB + OR WITH_TENSORRT) string(REPLACE "-Wnon-virtual-dtor" "-Wno-non-virtual-dtor" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) string(REPLACE "-Wnon-virtual-dtor" "-Wno-non-virtual-dtor" CMAKE_C_FLAGS diff --git a/paddle/fluid/inference/tensorrt/plugin/common/bertCommon.h b/paddle/fluid/inference/tensorrt/plugin/common/bertCommon.h index 56d4edd679..c3bdc34100 100644 --- a/paddle/fluid/inference/tensorrt/plugin/common/bertCommon.h +++ b/paddle/fluid/inference/tensorrt/plugin/common/bertCommon.h @@ -82,8 +82,9 @@ inline uint32_t getElementSize(nvinfer1::DataType t) noexcept { case nvinfer1::DataType::kBOOL: case nvinfer1::DataType::kINT8: return 1; + default: + return 0; } - return 0; } inline int64_t getWeightsSize(const nvinfer1::Weights& w, -- GitLab