pass_info.h 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
/**
 * Copyright 2019 Huawei Technologies Co., Ltd
 *
 * 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.
 */
#ifndef POLY_PASS_INFO_H_
#define POLY_PASS_INFO_H_

#include <vector>
#include <map>
#include <unordered_map>
#include "isl.h"

namespace akg {
namespace ir {
namespace poly {
using ReduceStmtMap = std::unordered_map<isl::id, std::vector<std::string>, isl::IslIdIslHash>;
class Dependency {
 private:
  isl::id start_node_id_;
  isl::id end_node_id_;
  int64_t edge_weight_;

 public:
  Dependency(const isl::id start_node_id, const isl::id end_node_id, const int64_t edge_weight)
      : start_node_id_(start_node_id), end_node_id_(end_node_id), edge_weight_(edge_weight) {}
  ~Dependency() {}

  isl::id GetStartNode() { return start_node_id_; }
  isl::id GetEndNode() { return end_node_id_; }
  int64_t GetEdgeWeight() const { return edge_weight_; }
};

// pass info on schedule transform
class PassInfo {
 public:
  PassInfo() {}
  ~PassInfo() {}

  bool has_grouped_{false};
  bool tile_check_coincident_{false};

  std::unordered_map<isl::id, isl::union_set_list, isl::IslIdIslHash> group_filter_map_;

  std::vector<Dependency> dependency_list_;

  isl::union_pw_multi_aff group_upma_;

  isl::schedule_constraints constraints_;

  bool coincident_{true};

  isl::union_map dependences_;

  isl::union_map orig_dependences_;
  isl::union_set transfer_stmt_;
  ReduceStmtMap reduce_stmts_;
  std::map<std::string, int> invariant_state_;
  bool has_invariant_dependence_{false};

  bool restart_{false};

};

}  // namespace poly
}  // namespace ir
}  // namespace akg

#endif  // POLY_PASS_INFO_H_