Skip to content

Commit

Permalink
remove OperationInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanlehome committed Aug 9, 2023
1 parent a1c1e3f commit 43e1f02
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 38 deletions.
3 changes: 2 additions & 1 deletion paddle/ir/pattern_rewrite/drr/api/match_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include "paddle/ir/pattern_rewrite/drr/api/match_context.h"
#include "paddle/ir/pattern_rewrite/drr/ir_operation.h"
#include "paddle/ir/pattern_rewrite/drr/match_context_impl.h"

namespace ir {
Expand All @@ -26,7 +27,7 @@ const TensorInterface& MatchContext::Tensor(
return impl_->Tensor(tensor_name);
}

const OperationInterface& MatchContext::Operation(
const IrOperation& MatchContext::Operation(
const std::string& op_name) const {
return impl_->Operation(op_name);
}
Expand Down
4 changes: 2 additions & 2 deletions paddle/ir/pattern_rewrite/drr/api/match_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <string>

#include "paddle/ir/pattern_rewrite/drr/api/tensor_interface.h"
#include "paddle/ir/pattern_rewrite/drr/api/operation_interface.h"
#include "paddle/ir/pattern_rewrite/drr/ir_operation.h"

namespace ir {
namespace drr {
Expand All @@ -32,7 +32,7 @@ class MatchContext final {

const TensorInterface& Tensor(const std::string& tensor_name) const;

const OperationInterface& Operation(const std::string& op_name) const;
const IrOperation& Operation(const std::string& op_name) const;

template <typename T>
T Attr(const std::string& attr_name) const;
Expand Down
30 changes: 0 additions & 30 deletions paddle/ir/pattern_rewrite/drr/api/operation_interface.h

This file was deleted.

5 changes: 2 additions & 3 deletions paddle/ir/pattern_rewrite/drr/ir_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
#pragma once

#include "paddle/ir/core/operation.h"
#include "paddle/ir/pattern_rewrite/drr/api/operation_interface.h"

namespace ir {
namespace drr {

class IrOperation : public OperationInterface {
class IrOperation {
public:
explicit IrOperation(ir::Operation* op) : op_(op) {}

ir::Operation* Operation() const override { return op_; }
ir::Operation* get() const { return op_; }

private:
ir::Operation* op_;
Expand Down
3 changes: 1 addition & 2 deletions paddle/ir/pattern_rewrite/drr/match_context_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <unordered_map>

#include "paddle/ir/core/builtin_attribute.h"
#include "paddle/ir/pattern_rewrite/drr/api/operation_interface.h"
#include "paddle/ir/pattern_rewrite/drr/api/tensor_interface.h"
#include "paddle/ir/pattern_rewrite/drr/ir_operation.h"
#include "paddle/ir/pattern_rewrite/drr/ir_tensor.h"
Expand Down Expand Up @@ -49,7 +48,7 @@ class MatchContextImpl final {
return *tensor_map_.at(tensor_name);
}

const OperationInterface& Operation(const std::string& op_name) const {
const IrOperation& Operation(const std::string& op_name) const {
return *operation_map_.at(op_name);
}

Expand Down

0 comments on commit 43e1f02

Please sign in to comment.