From be9cb946e507832f9c0fe5fc1d0f5343f1da08b9 Mon Sep 17 00:00:00 2001 From: Sonder <55493212+AndSonder@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:26:49 +0800 Subject: [PATCH] Remove has_structed_kerenl and has_fluid_kernel (#56779) * remove has_structed_kerenl and has_fluid_kernel * add test_fused_layernorm_op to STATIC_BUILD_TESTS list * open static_build flag * remove distributed_fused_lamb_init from StaticBuildBlackList * use initialized replacing IsInitialized * recover codes * delete useless codes * close the flag --- .../framework/new_executor/interpreter/static_build.cc | 9 +-------- test/legacy_test/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpreter/static_build.cc b/paddle/fluid/framework/new_executor/interpreter/static_build.cc index a3c9802a7d3..bf9b257c01c 100644 --- a/paddle/fluid/framework/new_executor/interpreter/static_build.cc +++ b/paddle/fluid/framework/new_executor/interpreter/static_build.cc @@ -47,8 +47,6 @@ std::set StaticBuildBlackList = { "cinn_launch" /*: to handle subgraph infermeta*/, "run_program" /*: to handle scope output*/, "sparse_sparse_coo_tensor" /*: to handle sparse output*/, - "shuffle_batch", - "shuffle_batch_grad", "distributed_fused_lamb_init"}; namespace paddle { @@ -60,8 +58,6 @@ bool BlockCanBeStaticBuilt(const framework::BlockDesc& block) { // is_operator_base = (kernelCode >> 6) & 1 // is_custom_op = (kernelCode >> 5) & 1 // use_mkldnn = (kernelCode >> 4) & 1 - // has_fluid_kernel = (kernelCode >> 3) & 1 - // has_structed_kernel = (kernelCode >> 2) & 1 using KernelCode = int8_t; std::set> invalid_ops; for (auto& op : block.AllOps()) { @@ -81,13 +77,11 @@ bool BlockCanBeStaticBuilt(const framework::BlockDesc& block) { use_mkldnn = attr.index() == 1 ? PADDLE_GET_CONST(int, attr) : PADDLE_GET_CONST(bool, attr); } - bool has_fluid_kernel = OperatorWithKernel::AllOpKernels().count(op_type); bool has_structured_kernel = phi::KernelFactory::Instance().HasStructuredKernel(op_type); KernelCode kernel_code = (in_black_list << 7) + (is_operator_base << 6) + (is_custom_op << 5) + (use_mkldnn << 4) + - (has_fluid_kernel << 3) + (has_structured_kernel << 2); if (!OpsCanSkipedFakeAllocInStaticBuild.count(op_type)) { if (in_black_list || @@ -107,8 +101,7 @@ bool BlockCanBeStaticBuilt(const framework::BlockDesc& block) { << ", is_operator_base = " << (item.second >> 6 & 1) << ", is_custom_op = " << (item.second >> 5 & 1) << ", use_mkldnn = " << (item.second >> 4 & 1) - << ", has_fluid_kernel = " << (item.second >> 3 & 1) - << ", has_structed_kerenl = " << (item.second >> 2 & 1) << "]\n"; + << (item.second >> 2 & 1) << "]\n"; } VLOG(1) << ss.str(); } diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index 8e0b9ad91cb..05f30dca257 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1290,6 +1290,7 @@ set(STATIC_BUILD_TESTS test_fuse_bn_act_pass test_fused_feedforward_op test_fused_feedforward_pass + test_fused_layernorm_op test_imperative_optimizer test_lamb_op test_layer_norm_op -- GitLab