From 4114c4a11c082352288828cbb9bd3b31392093dc Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 8 Dec 2021 20:21:03 +0800 Subject: [PATCH] fix ernie (#37839) (#37960) --- .../fluid/inference/tensorrt/plugin/stack_op_plugin.cu | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/plugin/stack_op_plugin.cu b/paddle/fluid/inference/tensorrt/plugin/stack_op_plugin.cu index c3b4a6ff4af..74a6c3cdf3e 100644 --- a/paddle/fluid/inference/tensorrt/plugin/stack_op_plugin.cu +++ b/paddle/fluid/inference/tensorrt/plugin/stack_op_plugin.cu @@ -107,8 +107,13 @@ bool StackPluginDynamic::supportsFormatCombination( const nvinfer1::PluginTensorDesc& in = in_out[pos]; if (pos == 0) { if (with_fp16_) { - return (in.type == nvinfer1::DataType::kFLOAT || - in.type == nvinfer1::DataType::kHALF) && + return ( +// It's workaround for ernie fix len model. +// Enabling float, half on the same time will cause trt hang. +#if IS_TRT_VERSION_LT(8000) + in.type == nvinfer1::DataType::kFLOAT || +#endif + in.type == nvinfer1::DataType::kHALF) && (in.format == nvinfer1::TensorFormat::kLINEAR); } else { return (in.type == nvinfer1::DataType::kFLOAT) && -- GitLab