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

#include <phv_kit.h>

Public Member Functions

 PhvKit (const PhvInfo &phv, const ClotInfo &clot, const Clustering &clustering, const PhvUse &uses, const FieldDefUse &defuse, const ActionPhvConstraints &actions, const MapFieldToParserStates &field_to_parser_states, const CalcParserCriticalPath &parser_critical_path, const CollectParserInfo &parser_info, const CollectStridedHeaders &strided_headers, const FieldSliceLiveRangeDB &physical_liverange_db, const ActionSourceTracker &source_tracker, const CollectTableKeys &tb_keys, const TablesMutuallyExclusive &table_mutex, const DependencyGraph &deps, std::set< PHV::FieldRange > &mauInitFields, const Pragmas &pragmas, const AllocSetting &settings, const MauBacktracker &mau)
 
bool can_logical_liverange_be_overlaid (const PHV::AllocSlice &a, const PHV::AllocSlice &b) const
 
bool can_physical_liverange_be_overlaid (const PHV::AllocSlice &a, const PHV::AllocSlice &b) const
 
HasPackConflict get_has_pack_conflict () 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 bool is_ternary (const IR::MAU::Table *tbl)
 
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)
 

Public Attributes

const ActionPhvConstraintsactions
 
const ClotInfoclot
 
const Clusteringclustering
 
const FieldDefUsedefuse
 
const DependencyGraphdeps
 
const MapFieldToParserStatesfield_to_parser_states
 
const MauBacktrackermau
 
std::set< PHV::FieldRange > & mauInitFields
 
const ActionPackingValidatorpacking_validator
 
const CalcParserCriticalPathparser_critical_path
 
const CollectParserInfoparser_info
 
const ParserPackingValidatorparser_packing_validator
 parser packing validator checks whether a packing would break parser constraints.
 
const PhvInfophv
 
const PHV::FieldSliceLiveRangeDBphysical_liverange_db
 
const PHV::Pragmaspragmas
 
const AllocSettingsettings
 
const ActionSourceTrackersource_tracker
 
const CollectStridedHeadersstrided_headers
 
const TablesMutuallyExclusivetable_mutex
 
const CollectTableKeystb_keys
 
const PhvUseuses
 

Detailed Description

PhvKit is a collection of const references to misc passes that PHV allocation depends on. It also provides some helper methods.

Member Function Documentation

◆ bind_slices()

void PHV::v2::PhvKit::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::v2::PhvKit::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::v2::PhvKit::is_clot_allocated ( const ClotInfo & clots,
const PHV::SuperCluster & sc )
static
Returns
true if super cluster is fully allocated to clot.

◆ is_ternary()

bool PHV::v2::PhvKit::is_ternary ( const IR::MAU::Table * tbl)
static
Returns
true is tbl is a ternary match.

◆ make_device_container_groups()

std::list< PHV::ContainerGroup * > PHV::v2::PhvKit::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::v2::PhvKit::make_superclusters ( ) const
inline
Returns
a copy of all SuperClusters from clustering_i.

◆ remove_clot_allocated_clusters()

std::list< PHV::SuperCluster * > PHV::v2::PhvKit::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::v2::PhvKit::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::v2::PhvKit::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::v2::PhvKit::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.