P4C
The P4 Compiler
Loading...
Searching...
No Matches
PHV::AllocUtils Struct Reference

#include <allocate_phv.h>

Public Member Functions

 AllocUtils (const PhvInfo &phv, const ClotInfo &clot, const Clustering &clustering, const PhvUse &uses, const FieldDefUse &defuse, const ActionPhvConstraints &actions, const LiveRangeShrinking &meta_init, const DarkOverlay &dark_init, const MapFieldToParserStates &field_to_parser_states, const CalcParserCriticalPath &parser_critical_path, const CollectParserInfo &parser_info, const CollectStridedHeaders &strided_headers, const PHV::FieldSliceLiveRangeDB &physical_liverange_db, const ActionSourceTracker &source_tracker, const PHV::Pragmas &pragmas, const AllocSetting &settings, const TableFieldPackOptimization &tablePackOpt)
 
bool can_physical_liverange_be_overlaid (const PHV::AllocSlice &a, const PHV::AllocSlice &b) const
 
bool has_pack_conflict (const PHV::FieldSlice &fs1, const PHV::FieldSlice &fs2) const
 
bool is_referenced (const PHV::Field *f) const
 
PHV::Slicing::IteratorInterfacemake_slicing_ctx (const PHV::SuperCluster *sc) const
 
std::list< PHV::SuperCluster * > make_superclusters () const
 
const SymBitMatrixmutex () const
 

Static Public Member Functions

static void bind_slices (const PHV::ConcreteAllocation &alloc, PhvInfo &phv)
 
static void clear_slices (PhvInfo &phv)
 clear alloc_slices allocated in phv, if any.
 
static std::list< PHV::SuperCluster * > create_strided_clusters (const CollectStridedHeaders &strided_headers, const std::list< PHV::SuperCluster * > &cluster_groups)
 
static bool is_clot_allocated (const ClotInfo &clots, const PHV::SuperCluster &sc)
 
static std::list< PHV::ContainerGroup * > make_device_container_groups ()
 
static std::list< PHV::SuperCluster * > remove_clot_allocated_clusters (const ClotInfo &clot, std::list< PHV::SuperCluster * > clusters)
 
static std::list< PHV::SuperCluster * > remove_singleton_metadata_slicelist (const std::list< PHV::SuperCluster * > &cluster_groups)
 
static std::list< PHV::SuperCluster * > remove_unref_clusters (const PhvUse &uses, const std::list< PHV::SuperCluster * > &cluster_groups_input)
 
static void sort_and_merge_alloc_slices (PhvInfo &phv)
 
static bool update_refs (AllocSlice &slc, const PhvInfo &p, const FieldDefUse::LocPairSet &refs, FieldUse fuse)
 
static void update_slice_refs (PhvInfo &phv, const FieldDefUse &defuse)
 

Public Attributes

const ActionPhvConstraintsactions
 
const ClotInfoclot
 
const Clusteringclustering
 
const DarkOverlaydark_init
 
const FieldDefUsedefuse
 
const MapFieldToParserStatesfield_to_parser_states
 
const LiveRangeShrinkingmeta_init
 
const CalcParserCriticalPathparser_critical_path
 
const CollectParserInfoparser_info
 
const PhvInfophv
 
const PHV::FieldSliceLiveRangeDBphysical_liverange_db
 
const PHV::Pragmaspragmas
 
const AllocSettingsettings
 
const ActionSourceTrackersource_tracker
 
const CollectStridedHeadersstrided_headers
 
const TableFieldPackOptimizationtablePackOpt
 
const PhvUseuses
 

Detailed Description

AllocUtils is a collection of const references to misc passes that PHV allocation depends on. It also provides some helper methods that are used by different allocation strategies.

Member Function Documentation

◆ bind_slices()

void PHV::AllocUtils::bind_slices ( const PHV::ConcreteAllocation & alloc,
PhvInfo & phv )
static

Translate each AllocSlice in alloc into a PHV::Field::alloc_slice and attach it to the PHV::Field it slices.

◆ create_strided_clusters()

std::list< PHV::SuperCluster * > PHV::AllocUtils::create_strided_clusters ( const CollectStridedHeaders & strided_headers,
const std::list< PHV::SuperCluster * > & cluster_groups )
static

Check if the supercluster has field slice that requires strided allocation. Merge all related stride superclusters.

◆ is_clot_allocated()

bool PHV::AllocUtils::is_clot_allocated ( const ClotInfo & clots,
const PHV::SuperCluster & sc )
static
Returns
true if super cluster is fully allocated to clot.

◆ make_device_container_groups()

std::list< PHV::ContainerGroup * > PHV::AllocUtils::make_device_container_groups ( )
static
Returns
the container groups available on this Device. All fieldslices in a cluster must be allocated to the same container group.

◆ make_superclusters()

std::list< PHV::SuperCluster * > PHV::AllocUtils::make_superclusters ( ) const
inline
Returns
a copy of all SuperClusters from clustering_i.

◆ remove_clot_allocated_clusters()

std::list< PHV::SuperCluster * > PHV::AllocUtils::remove_clot_allocated_clusters ( const ClotInfo & clot,
std::list< PHV::SuperCluster * > clusters )
static
Returns
super clusters with fully-clotted clusters removed from clusters.

◆ remove_singleton_metadata_slicelist()

std::list< PHV::SuperCluster * > PHV::AllocUtils::remove_singleton_metadata_slicelist ( const std::list< PHV::SuperCluster * > & cluster_groups)
static

remove singleton metadata slice list. This was introduced because some metadata fields are placed in a slice list, but they do not need to be. Removing them from slice list allows allocator to try more possible starting positions. TODO: we should fix this in make_clusters and remove this function.

◆ remove_unref_clusters()

std::list< PHV::SuperCluster * > PHV::AllocUtils::remove_unref_clusters ( const PhvUse & uses,
const std::list< PHV::SuperCluster * > & cluster_groups_input )
static

Remove unreferenced clusters from cluster_groups_input. For example, a singleton super cluster with only one padding field.

◆ sort_and_merge_alloc_slices()

void PHV::AllocUtils::sort_and_merge_alloc_slices ( PhvInfo & phv)
static

Merge Adjacent AllocSlices of the same field into one AllocSlice. MUST run this after allocation because later passes assume that phv alloc info is sorted in field bit order, msb first.

◆ update_refs()

bool PHV::AllocUtils::update_refs ( PHV::AllocSlice & slc,
const PhvInfo & p,
const FieldDefUse::LocPairSet & refs,
PHV::FieldUse fuse )
static

Update table references of AllocSlices by using the FieldDefUse data Table references will be used to replace the static min_stage_i/max_stage_i for determining the AllocSlice liverange in both min-stage and placed-table domain