未验证 提交 4e23af72 编写于 作者: W Wangzheee 提交者: GitHub

[Paddle-TRT] fix skiplayernorm, add trt_version check (#52342)

* fix skiplayernorm, add trt_version check
上级 74d87a61
......@@ -18,6 +18,9 @@ limitations under the License. */
#include "paddle/fluid/framework/ir/graph_pattern_detector.h"
#include "paddle/fluid/framework/op_version_registry.h"
#ifdef PADDLE_WITH_TENSORRT
#include "paddle/fluid/inference/tensorrt/helper.h"
#endif
namespace paddle {
namespace framework {
......@@ -105,6 +108,20 @@ void TrtSkipLayerNormFusePass::ApplyImpl(ir::Graph *graph) const {
PADDLE_ENFORCE_NOT_NULL(
graph, platform::errors::PreconditionNotMet("graph should not be null."));
FusePassBase::Init("skip_layernorm_fuse", graph);
#ifdef PADDLE_WITH_TENSORRT
auto trt_version = paddle::inference::tensorrt::GetTrtRuntimeVersion();
if (std::get<0>(trt_version) * 1000 + std::get<1>(trt_version) * 100 +
std::get<2>(trt_version) * 10 <
7200) {
VLOG(3) << "skip_layernorm oss plugin only available for trt version >= "
"7.2 Stop this pass";
return;
}
#else
// if no tensorrt, early stop
return;
#endif
int found_subgraph_count = 0;
GraphPatternDetector gpd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册