Skip to content

Commit

Permalink
update trt engine addplugin name. (#32018)
Browse files Browse the repository at this point in the history
* update trt engine addplugin name.

* update
  • Loading branch information
jiweibo authored Apr 2, 2021
1 parent 94736d6 commit d918786
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/elementwise_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class ElementwiseTensorOpConverter : public OpConverter {
#if IS_TRT_VERSION_GE(6000)
plugin::ElementwisePluginDynamic* plugin =
new plugin::ElementwisePluginDynamic(op_type_, axis);
layer = engine_->AddPluginV2(itensors.data(), 2, plugin);
layer = engine_->AddDynamicPlugin(itensors.data(), 2, plugin);
#else
PADDLE_THROW(platform::errors::Fatal(
"You are running the TRT Dynamic Shape mode, need to confirm that "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class EmbEltwiseLayerNormOpConverter : public OpConverter {
plugin = new plugin::EmbEltwiseLayernormPluginDynamic(
input_embs, bias, scale, emb_sizes, bias_size, scale_size, hidden,
eps, with_fp16);
layer = engine_->AddPluginV2(input_ids.data(), input_num, plugin);
layer = engine_->AddDynamicPlugin(input_ids.data(), input_num, plugin);
auto output_name = op_desc.Output("Out")[0];
RreplenishLayerAndOutput(layer, "emb_eltwise_layernorm", {output_name},
test_mode);
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/gelu_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class GeluOpConverter : public OpConverter {
engine_->WithFp16() && !engine_->disable_trt_plugin_fp16();
plugin::GeluPluginDynamic* plugin =
new plugin::GeluPluginDynamic(with_fp16);
layer = engine_->AddPluginV2(&input, input_num, plugin);
layer = engine_->AddDynamicPlugin(&input, input_num, plugin);
#else
PADDLE_THROW(platform::errors::Fatal(
"You are running the TRT Dynamic Shape mode, need to confirm that "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class MultiheadMatMulOpConverter : public OpConverter {
plugin::DynamicPluginTensorRT* plugin =
new plugin::QkvToContextPluginDynamic(hidden_in, head_number,
head_size, scale, with_fp16);
layer = engine_->AddPluginV2(plugin_inputs.data(), 2, plugin);
layer = engine_->AddDynamicPlugin(plugin_inputs.data(), 2, plugin);
}
} else {
PADDLE_THROW(platform::errors::Fatal(
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/pool2d_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Pool2dOpConverter : public OpConverter {
plugin::PoolPluginDynamic *plugin =
new plugin::PoolPluginDynamic(ceil_mode, pool_type, adaptive, ksize,
strides, paddings, global_pooling);
layer = engine_->AddPluginV2(&input1, 1, plugin);
layer = engine_->AddDynamicPlugin(&input1, 1, plugin);
#endif
}
auto output_name = op_desc.Output("Out")[0];
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/prelu_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class PReluOpConverter : public OpConverter {
#if IS_TRT_VERSION_GE(6000)
plugin::PReluPluginDynamic* plugin = new plugin::PReluPluginDynamic(
alpha_data, alpha_tensor_temp->numel(), mode);
layer = engine_->AddPluginV2(&input, input_num, plugin);
layer = engine_->AddDynamicPlugin(&input, input_num, plugin);
#else
PADDLE_THROW(platform::errors::Fatal(
"You are running the TRT Dynamic Shape mode, need to confirm that "
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/skip_layernorm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SkipLayerNormOpConverter : public OpConverter {
plugin::SkipLayerNormPluginDynamic* plugin =
new plugin::SkipLayerNormPluginDynamic(bias, scale, bias_size,
scale_size, eps, with_fp16);
layer = engine_->AddPluginV2(inputs.data(), 2, plugin);
layer = engine_->AddDynamicPlugin(inputs.data(), 2, plugin);
}
} else {
PADDLE_THROW(platform::errors::Fatal(
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/inference/tensorrt/convert/slice_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ class SliceOpConverter : public OpConverter {
// bool ban_fp16 = engine_->disable_trt_plugin_fp16();
plugin::SpecialSlicePluginDynamic* plugin =
new plugin::SpecialSlicePluginDynamic();
layer = engine_->AddPluginV2(plugin_inputs.data(), plugin_inputs.size(),
plugin);
layer = engine_->AddDynamicPlugin(plugin_inputs.data(),
plugin_inputs.size(), plugin);
} else {
bool with_fp16 =
engine_->WithFp16() && !engine_->disable_trt_plugin_fp16();
plugin::SlicePluginDynamic* plugin =
new plugin::SlicePluginDynamic(starts, ends, axes, with_fp16);
layer = engine_->AddPluginV2(&input, 1, plugin);
layer = engine_->AddDynamicPlugin(&input, 1, plugin);
}
#else
PADDLE_THROW(platform::errors::Fatal(
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/split_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SplitOpConverter : public OpConverter {
engine_->WithFp16() && !engine_->disable_trt_plugin_fp16();
plugin::SplitPluginDynamic* plugin =
new plugin::SplitPluginDynamic(axis, output_lengths, with_fp16);
layer = engine_->AddPluginV2(&input, input_num, plugin);
layer = engine_->AddDynamicPlugin(&input, input_num, plugin);
#else
PADDLE_THROW(platform::errors::Fatal(
"You are running the TRT Dynamic Shape mode, need to confirm that "
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/stack_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class StackOpConverter : public OpConverter {
engine_->WithFp16() && !engine_->disable_trt_plugin_fp16();
plugin::StackPluginDynamic* plugin =
new plugin::StackPluginDynamic(axis, input_num, with_fp16);
layer = engine_->AddPluginV2(inputs, input_num, plugin);
layer = engine_->AddDynamicPlugin(inputs, input_num, plugin);
assert(layer != nullptr);
#else
PADDLE_THROW(platform::errors::Fatal(
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/convert/swish_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SwishOpConverter : public OpConverter {
engine_->WithFp16() && !engine_->disable_trt_plugin_fp16();
plugin::SwishPluginDynamic* plugin =
new plugin::SwishPluginDynamic(beta, with_fp16);
layer = engine_->AddPluginV2(&input, input_num, plugin);
layer = engine_->AddDynamicPlugin(&input, input_num, plugin);
#else
PADDLE_THROW(platform::errors::Fatal(
"You are running the TRT Dynamic Shape mode, need to confirm that "
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/inference/tensorrt/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ class TensorRTEngine {
bool with_dynamic_shape() { return with_dynamic_shape_; }

#if IS_TRT_VERSION_GE(6000)
nvinfer1::IPluginV2Layer* AddPluginV2(nvinfer1::ITensor* const* inputs,
int num_inputs,
plugin::DynamicPluginTensorRT* plugin) {
nvinfer1::IPluginV2Layer* AddDynamicPlugin(
nvinfer1::ITensor* const* inputs, int num_inputs,
plugin::DynamicPluginTensorRT* plugin) {
owned_pluginv2_.emplace_back(plugin);
return network()->addPluginV2(inputs, num_inputs, *plugin);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ RoiAlignPluginDynamicCreator::getFieldNames() {
nvinfer1::IPluginV2Ext* RoiAlignPluginDynamicCreator::createPlugin(
const char* name, const nvinfer1::PluginFieldCollection* fc) {
const nvinfer1::PluginField* fields = fc->fields;
return nullptr;
}

nvinfer1::IPluginV2Ext* RoiAlignPluginDynamicCreator::deserializePlugin(
Expand Down

0 comments on commit d918786

Please sign in to comment.