未验证 提交 3a256637 编写于 作者: 王明冬 提交者: GitHub

[infrt] move pd dialect position. test=develop (#40616)

上级 6849d33b
......@@ -7,7 +7,6 @@ gather_srcs(infrt_src SRCS
dense_tensor.cc
mlir_loader.cc
diagnostic_utils.cc
pd_ops.cc
)
mlir_tablegen_on(tensor_shape DIALECT ts)
......@@ -28,6 +27,7 @@ add_dependencies(print-ir pd_ops_inc)
cc_test_tiny(test_infrt_mlir_loader SRCS mlir_loader_test.cc DEPS infrt ${MLIR_IR_LIBS})
add_subdirectory(infrt)
add_subdirectory(pd)
add_subdirectory(tensorrt)
if (INFRT_WITH_PHI)
......
......@@ -16,7 +16,7 @@
#include <mlir/Transforms/GreedyPatternRewriteDriver.h>
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace {
#include "paddle/infrt/dialect/infrt/pass/infrt_op_fuse.cpp.inc" // NOLINT
......
......@@ -20,7 +20,7 @@
#include "paddle/infrt/dialect/infrt/ir/basic_kernels.h"
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
#include "paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h"
#include "paddle/infrt/dialect/phi/ir/phi_base.h"
#include "paddle/infrt/dialect/phi/ir/phi_kernels.h"
......
add_subdirectory(common)
add_subdirectory(ir)
add_subdirectory(pass)
core_gather_headers()
gather_srcs(infrt_src SRCS
)
core_gather_headers()
gather_srcs(infrt_src SRCS
pd_ops.cc
)
......@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
#include <mlir/IR/Matchers.h>
#include <mlir/IR/PatternMatch.h>
......
core_gather_headers()
gather_srcs(infrt_src SRCS
pd_op_fuse_pass.cc
)
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <mlir/Pass/Pass.h>
#include <mlir/Transforms/GreedyPatternRewriteDriver.h>
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace {
#include "paddle/infrt/dialect/rewrite.cpp.inc" // NOLINT
/*
* PdOpFusePass.
*/
struct PdOpFusePass
: public mlir::PassWrapper<PdOpFusePass, mlir::FunctionPass> {
public:
::llvm::StringRef getName() const override { return "PdOpFusePass"; }
llvm::StringRef getArgument() const override { return "pd-op-fuse"; }
void runOnFunction() override;
};
// Implementation of the PdOpFusePass.
void PdOpFusePass::runOnFunction() {
::mlir::RewritePatternSet patterns(&getContext());
populateWithGenerated(patterns);
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
}
} // namespace
mlir::PassRegistration<PdOpFusePass> infrt_op_fuse_pass;
......@@ -16,7 +16,7 @@ limitations under the License. */
#include <mlir/IR/Operation.h>
#include <unordered_map>
#include "paddle/infrt/dialect/pd_ops_info.h"
#include "paddle/infrt/dialect/pd/common/pd_ops_info.h"
#include "paddle/phi/core/compat/arg_map_context.h"
namespace infrt {
......
......@@ -17,11 +17,12 @@
#include <llvm/ADT/SetVector.h>
#include <mlir/Analysis/SliceAnalysis.h>
#include <mlir/IR/Builders.h>
#include <paddle/infrt/dialect/pd_ops.h>
#include <list>
#include <unordered_set>
#include <vector>
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace infrt {
namespace trt {
namespace {
......
......@@ -15,7 +15,7 @@
#include "paddle/infrt/dialect/tensorrt/trt_graph_split_pass.h"
#include <mlir/IR/Builders.h>
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace infrt {
namespace trt {
......
......@@ -14,7 +14,7 @@
#include "paddle/infrt/dialect/tensorrt/trt_op_converter_pass.h"
#include <mlir/IR/Builders.h>
#include <mlir/Transforms/DialectConversion.h>
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
#include "paddle/infrt/dialect/tensorrt/trt_dialect_types.h"
namespace infrt {
......
......@@ -17,7 +17,7 @@
#include <mlir/IR/Builders.h>
#include "paddle/infrt/dialect/infrt/ir/basic_kernels.h"
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace infrt {
namespace trt {
......
......@@ -30,7 +30,7 @@
#include <mlir/Interfaces/SideEffectInterfaces.h>
#include "paddle/infrt/dialect/infrt/ir/basic_kernels.h"
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
namespace infrt {
namespace trt {
......
......@@ -15,7 +15,7 @@
#include "paddle/infrt/host_context/paddle_mlir.h"
#include "paddle/infrt/dialect/infrt/ir/basic_kernels.h"
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/pd_ops_info.h"
#include "paddle/infrt/dialect/pd/common/pd_ops_info.h"
MLIRModelGenImpl::MLIRModelGenImpl()
: context_(infrt::Global::getMLIRContext()), builder_(context_) {
......
......@@ -29,7 +29,7 @@
#include "paddle/infrt/dialect/infrt/ir/basic_kernels.h"
#include "paddle/infrt/dialect/init_dialects.h"
#include "paddle/infrt/dialect/pd_ops.h"
#include "paddle/infrt/dialect/pd/ir/pd_ops.h"
#include "paddle/infrt/dialect/tensor_shape.h"
#include "paddle/infrt/paddle/model_parser.h"
......
......@@ -186,7 +186,7 @@ def generate_all_ops_inputs_outputs_map(op_descs):
cpp_style_ops_outputs_map_str = start_ + ops_outputs_str + "\n};"
# 3. Write to header file
dst_head_file = "../../paddle/infrt/dialect/pd_ops_info.h"
dst_head_file = "../../paddle/infrt/dialect/pd/common/pd_ops_info.h"
with open(dst_head_file, 'w') as ops_inputs_outputs_head_file:
ops_inputs_outputs_head_file.write(cpp_style_ops_inputs_map_str)
ops_inputs_outputs_head_file.write("\n\n")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册