Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paddle/fluid/eager/to_static/run_program_op_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "paddle/pir/include/core/value.h"

#ifdef PADDLE_WITH_DNNL
#include "paddle/fluid/platform/mkldnn_helper.h"
#include "paddle/fluid/platform/onednn_helper.h"
#endif

COMMON_DECLARE_bool(enable_pir_with_pt_in_dy2st);
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/data_transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Variable;
} // namespace paddle

#ifdef PADDLE_WITH_DNNL
#include "paddle/fluid/platform/mkldnn_helper.h"
#include "paddle/fluid/platform/onednn_helper.h"
#endif

namespace paddle {
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/details/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ cc_library(
DEPS pass_builder ${IR_PASS_DEPS})

if(WITH_MKLDNN)
target_link_libraries(build_strategy mkldnn_placement_pass)
target_link_libraries(build_strategy onednn_placement_pass)
endif()
8 changes: 4 additions & 4 deletions paddle/fluid/framework/details/build_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
AppendMultiDevPass();
AppendMultiGraphOptPasses();

AppendPassToSetMkldnnAttr("mkldnn_placement_pass");
AppendPassToSetMkldnnAttr("onednn_placement_pass");
// runtime_context_cache pass should be the last pass to enable the attr of
// all original and fused operators. But no operators can be enabled this
// attr if putting it after MultiDevPass.
Expand Down Expand Up @@ -179,7 +179,7 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
"delete_dropout_op_x_pass");
AppendPassWithCheck(
strategy_.enable_inference_pass_ && strategy_.use_mkldnn_,
"mkldnn_placement_pass");
"onednn_placement_pass");

// 2. trainning pass
#ifdef PADDLE_WITH_CUDNN_FRONTEND
Expand Down Expand Up @@ -480,7 +480,7 @@ ir::Graph *BuildStrategy::Apply(ir::Graph *graph,
"GPU, skipped.";
continue;
}
} else if (pass->Type() == "mkldnn_placement_pass") {
} else if (pass->Type() == "onednn_placement_pass") {
pass->Set("mkldnn_enabled_op_types",
new std::unordered_set<std::string>(mkldnn_enabled_op_types_));
} else if (pass->Type() == "backward_optimizer_op_deps_pass") {
Expand Down Expand Up @@ -548,7 +548,7 @@ USE_PASS(build_cinn_pass);
USE_PASS(fused_feedforward_pass);
#endif
#ifdef PADDLE_WITH_DNNL
USE_PASS(mkldnn_placement_pass);
USE_PASS(onednn_placement_pass);
#endif
#if (defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)) && \
!defined(_WIN32) && !defined(__APPLE__)
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License. */
#include "paddle/fluid/platform/profiler.h"
#include "paddle/fluid/platform/profiler/event_tracing.h"
#ifdef PADDLE_WITH_DNNL
#include "paddle/fluid/platform/mkldnn_helper.h"
#include "paddle/fluid/platform/onednn_helper.h"
#endif
#include "paddle/common/flags.h"
#include "paddle/fluid/framework/executor_gc_helper.h"
Expand Down
118 changes: 59 additions & 59 deletions paddle/fluid/framework/ir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,41 +175,41 @@ if(WITH_GPU OR WITH_ROCM)
endif()

if(WITH_MKLDNN)
pass_library(mkldnn_placement_pass base DEPS placement_pass_base DIR mkldnn)
pass_library(depthwise_conv_mkldnn_pass base DIR mkldnn)
pass_library(conv_affine_channel_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(conv_bias_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(conv_activation_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(conv_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(int8_scale_calculation_mkldnn_pass inference DIR mkldnn)
pass_library(params_quantization_mkldnn_pass inference DIR mkldnn)
pass_library(scale_matmul_fuse_pass inference DIR mkldnn)
pass_library(cpu_bfloat16_placement_pass inference DIR mkldnn)
pass_library(cpu_bfloat16_pass inference DIR mkldnn)
pass_library(fc_mkldnn_pass inference DIR mkldnn)
pass_library(interpolate_mkldnn_pass inference DIR mkldnn)
pass_library(softplus_activation_onednn_fuse_pass inference DIR mkldnn)
pass_library(shuffle_channel_mkldnn_detect_pass inference DIR mkldnn)
pass_library(fc_act_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(elementwise_act_onednn_fuse_pass inference DIR mkldnn)
pass_library(matmul_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(matmul_activation_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(operator_scale_onednn_fuse_pass inference DIR mkldnn)
pass_library(quant_transpose2_dequant_onednn_fuse_pass inference DIR mkldnn)
pass_library(squeeze2_transpose2_onednn_fuse_pass inference DIR mkldnn)
pass_library(operator_unsqueeze2_onednn_fuse_pass inference DIR mkldnn)
pass_library(operator_reshape2_onednn_fuse_pass inference DIR mkldnn)
pass_library(cpu_quantize_placement_pass base DIR mkldnn)
pass_library(cpu_quantize_pass inference DIR mkldnn)
pass_library(cpu_quantize_squash_pass inference DIR mkldnn)
pass_library(reshape_transpose_matmul_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(matmul_transpose_reshape_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(batch_norm_act_fuse_pass inference DIR mkldnn)
pass_library(multi_gru_fuse_pass inference DIR mkldnn)
pass_library(multi_gru_seq_fuse_pass inference DIR mkldnn)
pass_library(quant_dequant_mkldnn_pass inference DIR mkldnn)
pass_library(compute_propagate_scales_mkldnn_pass inference DIR mkldnn)
pass_library(self_attention_fuse_pass inference DIR mkldnn)
pass_library(onednn_placement_pass base DEPS placement_pass_base DIR onednn)
pass_library(depthwise_conv_onednn_pass base DIR onednn)
pass_library(conv_affine_channel_onednn_fuse_pass inference DIR onednn)
pass_library(conv_bias_onednn_fuse_pass inference DIR onednn)
pass_library(conv_activation_onednn_fuse_pass inference DIR onednn)
pass_library(conv_elementwise_add_onednn_fuse_pass inference DIR onednn)
pass_library(int8_scale_calculation_onednn_pass inference DIR onednn)
pass_library(params_quantization_onednn_pass inference DIR onednn)
pass_library(scale_matmul_fuse_pass inference DIR onednn)
pass_library(cpu_bfloat16_placement_pass inference DIR onednn)
pass_library(cpu_bfloat16_pass inference DIR onednn)
pass_library(fc_onednn_pass inference DIR onednn)
pass_library(interpolate_onednn_pass inference DIR onednn)
pass_library(softplus_activation_onednn_fuse_pass inference DIR onednn)
pass_library(shuffle_channel_onednn_detect_pass inference DIR onednn)
pass_library(fc_act_onednn_fuse_pass inference DIR onednn)
pass_library(elementwise_act_onednn_fuse_pass inference DIR onednn)
pass_library(matmul_elementwise_add_onednn_fuse_pass inference DIR onednn)
pass_library(matmul_activation_onednn_fuse_pass inference DIR onednn)
pass_library(operator_scale_onednn_fuse_pass inference DIR onednn)
pass_library(quant_transpose2_dequant_onednn_fuse_pass inference DIR onednn)
pass_library(squeeze2_transpose2_onednn_fuse_pass inference DIR onednn)
pass_library(operator_unsqueeze2_onednn_fuse_pass inference DIR onednn)
pass_library(operator_reshape2_onednn_fuse_pass inference DIR onednn)
pass_library(cpu_quantize_placement_pass base DIR onednn)
pass_library(cpu_quantize_pass inference DIR onednn)
pass_library(cpu_quantize_squash_pass inference DIR onednn)
pass_library(reshape_transpose_matmul_onednn_fuse_pass inference DIR onednn)
pass_library(matmul_transpose_reshape_onednn_fuse_pass inference DIR onednn)
pass_library(batch_norm_act_fuse_pass inference DIR onednn)
pass_library(multi_gru_fuse_pass inference DIR onednn)
pass_library(multi_gru_seq_fuse_pass inference DIR onednn)
pass_library(quant_dequant_onednn_pass inference DIR onednn)
pass_library(compute_propagate_scales_onednn_pass inference DIR onednn)
pass_library(self_attention_fuse_pass inference DIR onednn)
if(WITH_AVX
AND AVX512F_FOUND
AND AVX512F_FLAG)
Expand Down Expand Up @@ -538,17 +538,17 @@ if(NOT WIN32)
endif()
if(WITH_MKLDNN)
cc_test(
test_depthwise_conv_mkldnn_pass
SRCS mkldnn/depthwise_conv_mkldnn_pass_tester.cc
DEPS depthwise_conv_mkldnn_pass)
test_depthwise_conv_onednn_pass
SRCS onednn/depthwise_conv_onednn_pass_tester.cc
DEPS depthwise_conv_onednn_pass)
cc_test(
test_int8_scale_calculation_mkldnn_pass
SRCS mkldnn/int8_scale_calculation_mkldnn_pass_tester.cc
DEPS int8_scale_calculation_mkldnn_pass pass_test_util)
test_int8_scale_calculation_onednn_pass
SRCS onednn/int8_scale_calculation_onednn_pass_tester.cc
DEPS int8_scale_calculation_onednn_pass pass_test_util)
cc_test(
test_params_quantization_mkldnn_pass
SRCS mkldnn/params_quantization_mkldnn_pass_tester.cc
DEPS params_quantization_mkldnn_pass)
test_params_quantization_onednn_pass
SRCS onednn/params_quantization_onednn_pass_tester.cc
DEPS params_quantization_onednn_pass)
set(TEST_CONV_BN_PASS_DEPS
conv_bn_fuse_pass
graph_to_program_pass
Expand All @@ -566,43 +566,43 @@ if(WITH_MKLDNN)
set(TEST_CONV_BN_PASS_DEPS ${TEST_CONV_BN_PASS_DEPS} depthwise_conv)
endif()
cc_test(
test_mkldnn_placement_pass
SRCS mkldnn/mkldnn_placement_pass_tester.cc
DEPS mkldnn_placement_pass)
test_onednn_placement_pass
SRCS onednn/onednn_placement_pass_tester.cc
DEPS onednn_placement_pass)
cc_test(
test_compute_propagate_scales_mkldnn_pass
SRCS mkldnn/compute_propagate_scales_mkldnn_pass_tester.cc
DEPS compute_propagate_scales_mkldnn_pass naive_executor)
test_compute_propagate_scales_onednn_pass
SRCS onednn/compute_propagate_scales_onednn_pass_tester.cc
DEPS compute_propagate_scales_onednn_pass naive_executor)

if(WITH_ONNXRUNTIME AND WIN32)
# Copy onnxruntime for some c++ test in Windows, since the test will
# be build only in CI, so suppose the generator in Windows is Ninja.
copy_onnx(test_compute_propagate_scales_mkldnn_pass)
copy_onnx(test_compute_propagate_scales_onednn_pass)
endif()

cc_test(
test_cpu_quantize_placement_pass
SRCS mkldnn/cpu_quantize_placement_pass_tester.cc
SRCS onednn/cpu_quantize_placement_pass_tester.cc
DEPS cpu_quantize_placement_pass)
cc_test(
test_cpu_quantize_pass
SRCS mkldnn/cpu_quantize_pass_tester.cc
SRCS onednn/cpu_quantize_pass_tester.cc
DEPS cpu_quantize_pass naive_executor)
cc_test(
test_cpu_quantize_squash_pass
SRCS mkldnn/cpu_quantize_squash_pass_tester.cc
SRCS onednn/cpu_quantize_squash_pass_tester.cc
DEPS cpu_quantize_squash_pass naive_executor)
cc_test(
test_shuffle_channel_mkldnn_detect_pass
SRCS mkldnn/shuffle_channel_mkldnn_detect_pass_tester.cc
DEPS shuffle_channel_mkldnn_detect_pass)
test_shuffle_channel_onednn_detect_pass
SRCS onednn/shuffle_channel_onednn_detect_pass_tester.cc
DEPS shuffle_channel_onednn_detect_pass)
cc_test(
test_cpu_bfloat16_placement_pass
SRCS mkldnn/cpu_bfloat16_placement_pass_tester.cc
SRCS onednn/cpu_bfloat16_placement_pass_tester.cc
DEPS cpu_bfloat16_placement_pass)
cc_test(
test_cpu_bfloat16_pass
SRCS mkldnn/cpu_bfloat16_pass_tester.cc
SRCS onednn/cpu_bfloat16_pass_tester.cc
DEPS cpu_bfloat16_pass)
endif()

Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/conv_bn_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "paddle/fluid/framework/convert_utils.h"
#include "paddle/fluid/framework/eigen.h"
#include "paddle/fluid/framework/ir/mkldnn/mkldnn_pass_util.h"
#include "paddle/fluid/framework/ir/onednn/onednn_pass_util.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/op_version_registry.h"
#include "paddle/fluid/framework/tensor.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#pragma once
#include "paddle/fluid/framework/ir/mkldnn/mkldnn_pass_util.h"
#include "paddle/fluid/framework/ir/onednn/onednn_pass_util.h"
#include "paddle/fluid/framework/op_desc.h"

namespace paddle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/fluid/framework/ir/mkldnn/batch_norm_act_fuse_pass.h"
#include "paddle/fluid/framework/ir/onednn/batch_norm_act_fuse_pass.h"

#include "paddle/fluid/framework/ir/graph_pattern_detector.h"
#include "paddle/fluid/framework/op_version_registry.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/fluid/framework/ir/mkldnn/compute_propagate_scales_mkldnn_pass.h"
#include "paddle/fluid/framework/ir/onednn/compute_propagate_scales_onednn_pass.h"

#include <cfloat>

Expand Down Expand Up @@ -487,8 +487,8 @@ void ComputePropagateScalesMkldnnPass::PropagateScales(
}

void ComputePropagateScalesMkldnnPass::ApplyImpl(ir::Graph* graph) const {
VLOG(3) << "Convert paddle model to mkldnn quantized model.";
const std::string pattern_name = "compute_propagate_scales_mkldnn_pass";
VLOG(3) << "Convert paddle model to onednn quantized model.";
const std::string pattern_name = "compute_propagate_scales_onednn_pass";
FusePassBase::Init(pattern_name, graph);

const std::unordered_set<std::string> scale_immutable_ops = {
Expand Down Expand Up @@ -520,10 +520,10 @@ void ComputePropagateScalesMkldnnPass::ApplyImpl(ir::Graph* graph) const {
} // namespace framework
} // namespace paddle

REGISTER_PASS(compute_propagate_scales_mkldnn_pass,
REGISTER_PASS(compute_propagate_scales_onednn_pass,
paddle::framework::ir::ComputePropagateScalesMkldnnPass);

REGISTER_PASS_CAPABILITY(compute_propagate_scales_mkldnn_pass)
REGISTER_PASS_CAPABILITY(compute_propagate_scales_onednn_pass)
.AddCombination(
paddle::framework::compatible::OpVersionComparatorCombination()
.LE("conv2d", 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <string>

#include "paddle/fluid/framework/ir/fuse_pass_base.h"
#include "paddle/fluid/framework/ir/mkldnn/mkldnn_pass_util.h"
#include "paddle/fluid/framework/ir/onednn/onednn_pass_util.h"

namespace paddle {
namespace framework {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <gtest/gtest.h>
#include <unordered_map>

#include "paddle/fluid/framework/ir/mkldnn/compute_propagate_scales_mkldnn_pass.h"
#include "paddle/fluid/framework/ir/onednn/compute_propagate_scales_onednn_pass.h"
#include "paddle/fluid/framework/naive_executor.h"
#include "paddle/phi/common/place.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h"
#include "paddle/fluid/framework/ir/mkldnn/activation_onednn_fuse_pass.h"
#include "paddle/fluid/framework/ir/onednn/conv_activation_onednn_fuse_pass.h"
#include "paddle/fluid/framework/ir/onednn/activation_onednn_fuse_pass.h"
#include "paddle/fluid/framework/op_version_registry.h"
#include "paddle/utils/string/pretty_log.h"

Expand Down Expand Up @@ -42,18 +42,18 @@ void ConvActivationMkldnnFusePass::FuseConvAct(Graph* graph,
std::string& act_type) const {
PADDLE_ENFORCE_NOT_NULL(
graph, phi::errors::InvalidArgument("Graph cannot be nullptr."));
FusePassBase::Init(conv_type + "_" + act_type + "_mkldnn_fuse_pass", graph);
FusePassBase::Init(conv_type + "_" + act_type + "_onednn_fuse_pass", graph);

GraphPatternDetector gpd;
patterns::OperatorActivation conv_act_pattern(gpd.mutable_pattern(),
"conv_activation_mkldnn_fuse");
"conv_activation_onednn_fuse");
conv_act_pattern(conv_type, act_type);

int found_conv_activation_count = 0;
auto handler = [&](const GraphPatternDetector::subgraph_t& subgraph,
Graph* g) {
if (!IsCompat(subgraph, g)) {
LOG(WARNING) << "conv_activation_mkldnn_fuse_pass op compat failed.";
LOG(WARNING) << "conv_activation_onednn_fuse_pass op compat failed.";
return;
}

Expand Down Expand Up @@ -92,20 +92,20 @@ void ConvActivationMkldnnFusePass::FuseConvConcatAct(
Graph* graph, std::string& act_type) const {
PADDLE_ENFORCE_NOT_NULL(
graph, phi::errors::InvalidArgument("Graph cannot be nullptr."));
FusePassBase::Init("conv2d_concat_" + act_type + "_mkldnn_fuse_pass", graph);
FusePassBase::Init("conv2d_concat_" + act_type + "_onednn_fuse_pass", graph);

GraphPatternDetector gpd;
auto pattern = gpd.mutable_pattern();
patterns::OperatorActivation conv_concat_act(
pattern, "conv2d_concat_" + act_type + "_mkldnn_fuse_pass");
pattern, "conv2d_concat_" + act_type + "_onednn_fuse_pass");
conv_concat_act("concat", act_type);

int found_conv_concat_activation_count = 0;
auto handler = [&](const GraphPatternDetector::subgraph_t& subgraph,
Graph* g) {
if (!IsCompat(subgraph, g)) {
LOG(WARNING)
<< "conv_concat_activation_mkldnn_fuse_pass op compat failed.";
<< "conv_concat_activation_onednn_fuse_pass op compat failed.";
return;
}

Expand Down Expand Up @@ -377,10 +377,10 @@ ConvActivationMkldnnFusePass::ConvActivationMkldnnFusePass() {
} // namespace framework
} // namespace paddle

REGISTER_PASS(conv_activation_mkldnn_fuse_pass,
REGISTER_PASS(conv_activation_onednn_fuse_pass,
paddle::framework::ir::ConvActivationMkldnnFusePass);

REGISTER_PASS_CAPABILITY(conv_activation_mkldnn_fuse_pass)
REGISTER_PASS_CAPABILITY(conv_activation_onednn_fuse_pass)
.AddCombination(
paddle::framework::compatible::OpVersionComparatorCombination()
.LE("conv2d", 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class ConvActivationMkldnnFusePass : public FusePassBase {

void FuseConvAct(Graph *graph,
const std::string &conv_type,
std::string &act_type) const;
std::string &act_type) const; // NOLINT

void FuseConvConcatAct(Graph *graph, std::string &act_type) const;
void FuseConvConcatAct(Graph *graph, std::string &act_type) const; // NOLINT
};

} // namespace ir
Expand Down
Loading