19#ifndef SMART_PACKING_H_
20#define SMART_PACKING_H_
22#include "backends/tofino/bf-p4c/common/field_defuse.h"
23#include "backends/tofino/bf-p4c/ir/bitrange.h"
24#include "backends/tofino/bf-p4c/mau/table_dependency_graph.h"
25#include "backends/tofino/bf-p4c/mau/table_mutex.h"
26#include "backends/tofino/bf-p4c/phv/collect_table_keys.h"
27#include "backends/tofino/bf-p4c/phv/mau_backtracker.h"
28#include "backends/tofino/bf-p4c/phv/phv_fields.h"
29#include "backends/tofino/bf-p4c/phv/utils/utils.h"
30#include "backends/tofino/bf-p4c/phv/v2/allocator_metrics.h"
31#include "backends/tofino/bf-p4c/phv/v2/parser_packing_validator.h"
32#include "backends/tofino/bf-p4c/phv/v2/types.h"
44 const HasPackConflict has_pack_conflict_i;
46 const AllocVerifier &can_alloc_i;
50 bool can_pack(
const std::vector<FieldSlice> &slices,
const FieldSlice &fs)
const;
52 struct MergedCluster {
57 MergedCluster merge_by_packing(
const std::vector<FieldSlice> &packing,
62 std::vector<std::pair<const IR::MAU::Table *, std::vector<FieldSlice>>>
63 make_table_key_candidates(
const std::list<SuperCluster *> &clusters)
const;
74 table_mutex_i(table_mutex),
77 has_pack_conflict_i(has_pc),
78 parser_packing_validator_i(parser_packing_validator),
79 can_alloc_i(can_alloc),
81 alloc_metrics(alloc_metrics) {}
83 std::list<SuperCluster *>
pack(
const std::list<SuperCluster *> &clusters);
Definition mau_backtracker.h:29
Definition ordered_map.h:32
Definition ordered_set.h:32
Definition collect_table_keys.h:27
Definition phv_fields.h:898
Definition phv/utils/utils.h:1049
AllocatorMetrics contains metrics useful in tracking Allocator efficiency and debug.
Definition allocator_metrics.h:30
Definition smart_packing.h:38
static bool may_create_container_conflict(const FieldSlice &a, const FieldSlice &b, const FieldDefUse &defuse, const DependencyGraph &deps, const TablesMutuallyExclusive &table_mutex, int n_stages, const MauBacktracker *mau)
Definition smart_packing.cpp:37
std::list< SuperCluster * > pack(const std::list< SuperCluster * > &clusters)
Definition smart_packing.cpp:375
Definition parser_packing_validator.h:42
Definition phv_fields.h:1095
Definition mau/table_mutex.h:110
Definition field_defuse.h:77
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32
Definition table_dependency_graph.h:52