P4C
The P4 Compiler
Loading...
Searching...
No Matches
dynamic_dep_metrics.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_MAU_DYNAMIC_DEP_METRICS_H_
20#define BACKENDS_TOFINO_BF_P4C_MAU_DYNAMIC_DEP_METRICS_H_
21
22#include <functional>
23
24#include "backends/tofino/bf-p4c/mau/table_dependency_graph.h"
25
26using namespace P4;
27
29 const CalculateNextTableProp &ntp;
30 const ControlPathwaysToTable &con_paths;
31 const DependencyGraph &dg;
32 // FIXME -- not thread safe!
33 std::function<bool(const IR::MAU::Table *)> placed_tables;
34
35 public:
37 const DependencyGraph &d)
38 : ntp(n), con_paths(cp), dg(d) {}
39
40 std::pair<int, int> get_downward_prop_score(const IR::MAU::Table *a,
41 const IR::MAU::Table *b) const;
42
43 void score_on_seq(const IR::MAU::TableSeq *seq, const IR::MAU::Table *tbl, int &max_dep_impact,
44 char type) const;
45 void update_placed_tables(std::function<bool(const IR::MAU::Table *)> pt) {
46 placed_tables = pt;
47 }
48
49 int total_deps_of_dom_frontier(const IR::MAU::Table *a) const;
50 int placeable_cds_count(const IR::MAU::Table *tbl,
51 ordered_set<const IR::MAU::Table *> &already_placed_in_stage) const;
52 bool can_place_cds_in_stage(const IR::MAU::Table *tbl,
53 ordered_set<const IR::MAU::Table *> &already_placed_in_table) const;
54 double average_cds_chain_length(const IR::MAU::Table *tbl) const;
55};
56
57#endif /* BACKENDS_TOFINO_BF_P4C_MAU_DYNAMIC_DEP_METRICS_H_ */
Definition table_dependency_graph.h:938
Definition table_dependency_graph.h:972
Definition dynamic_dep_metrics.h:28
int placeable_cds_count(const IR::MAU::Table *tbl, ordered_set< const IR::MAU::Table * > &already_placed_in_stage) const
Definition mau/dynamic_dep_metrics.cpp:159
bool can_place_cds_in_stage(const IR::MAU::Table *tbl, ordered_set< const IR::MAU::Table * > &already_placed_in_table) const
Definition mau/dynamic_dep_metrics.cpp:144
void score_on_seq(const IR::MAU::TableSeq *seq, const IR::MAU::Table *tbl, int &max_dep_impact, char type) const
Definition mau/dynamic_dep_metrics.cpp:21
int total_deps_of_dom_frontier(const IR::MAU::Table *a) const
Definition mau/dynamic_dep_metrics.cpp:131
std::pair< int, int > get_downward_prop_score(const IR::MAU::Table *a, const IR::MAU::Table *b) const
Definition mau/dynamic_dep_metrics.cpp:80
double average_cds_chain_length(const IR::MAU::Table *tbl) const
Definition mau/dynamic_dep_metrics.cpp:185
Definition ordered_set.h:32
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition table_dependency_graph.h:52