diff --git a/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.cc b/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.cc index 8d8d7feacfb9148a9dd1debf9f6e96b3a4578f47..c966c46e06b16e8e48bd194ba2ffc05d420e2e9a 100644 --- a/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.cc @@ -69,8 +69,24 @@ inline bool FoundPhiOneDNNKernelWithCorrectDataType( bool MKLDNNPlacementPass::IsSupport(const Node* op) const { if (FoundOneDNNKernelWithCorrectDataType(op) || - FoundPhiOneDNNKernelWithCorrectDataType(op)) - return true; + FoundPhiOneDNNKernelWithCorrectDataType(op)) { + // For interpolate ops, there's a little difference between Paddle and + // DNNL. + // If run DNNL interpolate ops, manual set AnalysisConfig and apply + // the corresponding pass. + const std::vector not_default_op_types = {"bilinear_interp", + "nearest_interp", + "trilinear_interp", + "bicubic_interp", + "linear_interp", + "bilinear_interp_v2", + "linear_interp_v2"}; + bool is_interpolate_op = + std::find(not_default_op_types.begin(), + not_default_op_types.end(), + op->Op()->Type()) != not_default_op_types.end(); + return !is_interpolate_op; + } return false; } diff --git a/paddle/fluid/inference/api/paddle_pass_builder.cc b/paddle/fluid/inference/api/paddle_pass_builder.cc index 43d452820e0f42ea9c594099bc4f859ed27f066f..8b1399515eda090e54c982761ed8c1a719c196ff 100644 --- a/paddle/fluid/inference/api/paddle_pass_builder.cc +++ b/paddle/fluid/inference/api/paddle_pass_builder.cc @@ -363,7 +363,6 @@ void CpuPassStrategy::EnableMKLDNN() { "conv_transpose_eltwiseadd_bn_fuse_pass", // "conv_bias_mkldnn_fuse_pass", // "conv_transpose_bias_mkldnn_fuse_pass", - "interpolate_mkldnn_pass", // TODO(baoachun): Need to support 5-dimensional input. // "conv3d_bias_mkldnn_fuse_pass", // "conv_elementwise_add_mkldnn_fuse_pass",