19#ifndef BF_P4C_PHV_V2_TRIVIAL_ALLOCATOR_H_
20#define BF_P4C_PHV_V2_TRIVIAL_ALLOCATOR_H_
22#include "backends/tofino/bf-p4c/phv/utils/utils.h"
23#include "backends/tofino/bf-p4c/phv/v2/allocator_base.h"
24#include "backends/tofino/bf-p4c/phv/v2/kind_size_indexed_map.h"
25#include "backends/tofino/bf-p4c/phv/v2/phv_kit.h"
26#include "backends/tofino/bf-p4c/phv/v2/utils_v2.h"
38 std::unordered_map<PHV::Size, int> next_container_idx;
50 std::vector<AllocSlice> alloc_slices;
52 bool ok()
const {
return err ==
nullptr; };
54 : alloc_slices(alloc_slices), phv_status(phv_status) {}
64 ContainerGroupsBySize make_container_groups_merged_by_size()
const;
69 std::vector<PHV::AllocSlice> gen_alloc_slices_from_tx(
const PHV::Transaction &tx,
75 void bind_alloc_slices(
const std::vector<PHV::AllocSlice> &slices);
81 const ContainerGroupsBySize &container_groups,
95 const ContainerGroupsBySize &container_groups,
AllocatorMetrics &alloc_metrics,
96 bool homogeneous_sizes =
false,
bool minimal_packing_slicing =
true,
97 const int max_slicings = 128, std::ostream *history =
nullptr)
const;
111 std::list<SuperCluster *> sliced;
124 bool baseline_mode =
false)
const;
Definition ordered_map.h:32
Definition phv/utils/utils.h:117
Definition phv/utils/utils.h:1049
Definition phv/utils/utils.h:561
Definition allocator_base.h:77
AllocatorMetrics contains metrics useful in tracking Allocator efficiency and debug.
Definition allocator_metrics.h:30
PhvStatus bookkeeper for containers.
Definition trivial_allocator.h:37
Definition trivial_allocator.h:34
bool can_be_allocated(const Allocation &empty_alloc, const PHV::SuperCluster *sc, AllocatorMetrics &alloc_metrics, const int max_slicings=128) const
Definition trivial_allocator.cpp:436
bool allocate(const std::list< PHV::SuperCluster * > &clusters, AllocatorMetrics &alloc_metrics)
run trivial PHV allocator to allocate all clusters and update phv_i.
Definition trivial_allocator.cpp:339
const PartialAllocResult * slice_and_allocate_sc(const Allocation &empty_alloc, const PHV::SuperCluster *sc, PhvStatus phv_status, const ContainerGroupsBySize &container_groups, AllocatorMetrics &alloc_metrics, bool homogeneous_sizes=false, bool minimal_packing_slicing=true, const int max_slicings=128, std::ostream *history=nullptr) const
Definition trivial_allocator.cpp:253
PreSlicingResult pre_slice(const Allocation &empty_alloc, SuperCluster *sc, AllocatorMetrics &alloc_metrics, const int n_max_slicing=128, bool baseline_mode=false) const
Definition trivial_allocator.cpp:142
Definition trivial_allocator.h:110
Definition phv_fields.h:1095
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32
Size
all possible PHV container sizes in BFN devices
Definition phv.h:110
Definition trivial_allocator.h:48