From f68d4fb3f17e5089cb6659a1ff8d83426c8e08be Mon Sep 17 00:00:00 2001 From: Zhaolong Xing Date: Fri, 15 May 2020 13:22:06 +0800 Subject: [PATCH] fix bert bug using trt6 when compile with CUDA_ARCH_NAME=All (#24517) test=develop --- .../inference/tensorrt/convert/emb_eltwise_layernorm.cc | 6 +++--- paddle/fluid/inference/tensorrt/op_teller.cc | 1 - .../inference/tests/api/trt_dynamic_shape_ernie_test.cc | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc index 8c0f1896ed..0f2e71cd5b 100644 --- a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc +++ b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc @@ -91,9 +91,9 @@ class EmbEltwiseLayerNormOpConverter : public OpConverter { input_embs, bias, scale, emb_sizes, bias_size, scale_size, hidden, eps); #else - PADDLE_THROW( - platform::errors::Fatal("use EmbEltwiseLayernormPluginDynamic " - "FP16, but GPU doesn't have FP16.")); + plugin = new plugin::EmbEltwiseLayernormPluginDynamic( + input_embs, bias, scale, emb_sizes, bias_size, scale_size, hidden, + eps); #endif } else { plugin = new plugin::EmbEltwiseLayernormPluginDynamic( diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 3ad46d36de..db077ff306 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -29,7 +29,6 @@ struct SimpleOpTypeSetTeller : public Teller { teller_set.insert("fused_embedding_eltwise_layernorm"); teller_set.insert("multihead_matmul"); teller_set.insert("skip_layernorm"); - teller_set.insert("slice"); #endif } diff --git a/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc b/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc index 52b3d2abd3..5fbf0867ba 100644 --- a/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc +++ b/paddle/fluid/inference/tests/api/trt_dynamic_shape_ernie_test.cc @@ -120,7 +120,7 @@ void trt_ernie(bool with_fp16, std::vector result) { if (with_fp16) { precision = AnalysisConfig::Precision::kHalf; } - config.EnableTensorRtEngine(1 << 30, 1, 1, precision, false, true); + config.EnableTensorRtEngine(1 << 30, 1, 5, precision, false, true); config.SetTRTDynamicShapeInfo(min_input_shape, max_input_shape, opt_input_shape); std::vector out_data; -- GitLab