Skip to content

Commit

Permalink
[REFACTOR] Remove old Low-level Visitor/Mutator (apache#4612)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored and alexwong committed Feb 28, 2020
1 parent 8bb4314 commit a0f51fe
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 1,162 deletions.
127 changes: 0 additions & 127 deletions include/tvm/ir_mutator.h

This file was deleted.

151 changes: 0 additions & 151 deletions include/tvm/ir_visitor.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/autotvm/feature_visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ enum AnnotationType {
class FeatureVisitor : public StmtExprVisitor {
public:
// for loop
void VisitStmt_(const For *op);
void VisitStmt_(const AttrStmt *op);
void VisitStmt_(const For* op) final;
void VisitStmt_(const AttrStmt* op) final;

// memory access
void VisitExpr_(const Load *op);
void VisitStmt_(const Store *op);
void VisitExpr_(const Load* op) final;
void VisitStmt_(const Store* op) final;

using StmtExprVisitor::VisitStmt_;
using StmtExprVisitor::VisitExpr_;
Expand Down
4 changes: 2 additions & 2 deletions src/autotvm/touch_extractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class IndexParser: public ExprVisitor {
this->VisitExpr(expr);
}

void VisitExpr_(const Variable *op) {
void VisitExpr_(const Variable* op) final {
// TODO(lmzheng): handle more index types (multiple occurrence)
if (pattern_map.count(op) == 0) {
pattern_map[op] = TouchPattern();
Expand All @@ -60,7 +60,7 @@ class IndexParser: public ExprVisitor {
}
}

void VisitExpr_(const Mul *op) {
void VisitExpr_(const Mul* op) final {
if (op->a.as<Variable>()) {
if (const auto stride = op->b.as<IntImm>()) {
next_stride_ = stride->value;
Expand Down
10 changes: 5 additions & 5 deletions src/autotvm/touch_extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,31 @@ class TouchExtractor : public FeatureVisitor {
}

// arithmetic stats
void VisitExpr_(const Add *op) {
void VisitExpr_(const Add* op) final {
if (op->dtype.is_float())
itervar_map[itervar_stack_.back()].add_ct++;
FeatureVisitor::VisitExpr_(op);
}

void VisitExpr_(const Sub *op) {
void VisitExpr_(const Sub* op) final {
if (op->dtype.is_float())
itervar_map[itervar_stack_.back()].add_ct++;
FeatureVisitor::VisitExpr_(op);
}

void VisitExpr_(const Mul *op) {
void VisitExpr_(const Mul* op) final {
if (op->dtype.is_float())
itervar_map[itervar_stack_.back()].mul_ct++;
FeatureVisitor::VisitExpr_(op);
}

void VisitExpr_(const Div *op) {
void VisitExpr_(const Div* op) final {
if (op->dtype.is_float())
itervar_map[itervar_stack_.back()].div_ct++;
FeatureVisitor::VisitExpr_(op);
}

void VisitExpr_(const Mod *op) {
void VisitExpr_(const Mod* op) final {
if (op->dtype.is_float())
itervar_map[itervar_stack_.back()].div_ct++;
FeatureVisitor::VisitExpr_(op);
Expand Down
Loading

0 comments on commit a0f51fe

Please sign in to comment.