P4C
The P4 Compiler
Loading...
Searching...
No Matches
PHV Namespace Reference

The namespace encapsulating PHV-related stuff. More...

Classes

class  AbstractField
 
class  ActionPackingValidatorInterface
 
class  ActionSourceTracker
 ActionSourceTracker collects all source-to-destination for all field slices. More...
 
class  AddAliasAllocation
 Create allocation objects (PHV::AllocSlice) for alias source fields in preparation for assembly output. More...
 
class  AlignedCluster
 
class  AllocateTempsAndFinalizeLiverange
 
class  Allocation
 
class  AllocationReport
 
class  AllocContext
 Represents a PHV-allocation context: a parser, a table, or a deparser. More...
 
struct  AllocSetting
 
class  AllocSlice
 
struct  AllocUtils
 
class  ClusterStats
 An interface for gathering statistics common across each kind of cluster. More...
 
class  CollectTableKeys
 
class  ConcreteAllocation
 
class  Constant
 
class  Container
 
class  ContainerEquivalenceTracker
 
class  ContainerGroup
 
class  ContainerOccupancy
 
class  DarkInitEntry
 
class  DarkInitPrimitive
 
class  Error
 
class  Field
 
struct  FieldOperation
 
struct  FieldRange
 
class  FieldSlice
 
class  FieldSliceLiveRangeDB
 
class  FieldUse
 
class  FinalizePhysicalLiverange
 
struct  FreeSlice
 
class  IFieldSliceLiveRangeDB
 
struct  LiveRange
 
class  LiveRangeInfo
 
class  LiveRangeSplit
 
class  LiveRangeSplitOrFail
 
struct  MiniAlloc
 
struct  PackingLayout
 
class  ParserPackingValidatorInterface
 
class  Pragmas
 
class  RotationalCluster
 
struct  SliceResult
 The result of slicing a cluster. More...
 
struct  SourceOp
 SourceOp represents a source operand. More...
 
class  SuperCluster
 
struct  TempVarAllocResult
 
class  Transaction
 
class  Type
 
class  UpdateDeparserStage
 
class  ValidateAllocation
 

Typedefs

using ActionClassifiedSources = ordered_map<const IR::MAU::Action *, safe_vector<SourceOp>>
 A collection of source operands of a field slice, classified by actions.
 
using ActionSet = ordered_set<const IR::MAU::Action *>
 
using AlignmentReason = Constraints::AlignmentConstraint::AlignmentReason
 
using DarkInitMap = std::vector<DarkInitEntry>
 
using DigestType = Constraints::DigestConstraint::DigestType
 
using RefsMap = ordered_map<cstring, FieldUse>
 
using SolitaryReason = Constraints::SolitaryConstraint::SolitaryReason
 
using StageAndAccess = std::pair<int, FieldUse>
 
using UnitSet = ordered_set<const IR::BFN::Unit *>
 

Enumerations

enum class  Context : unsigned short { parde = 0 , ixbar = 1 , vliw = 2 , vliw_set = 3 }
 
enum class  ErrorCode { ok = 0 , unknown , slicelist_sz_mismatch }
 ErrorCode is the specific reason of failure of function invoke.
 
enum class  FieldAccessType { NONE = 0 , R = 1 , W = 2 , RW = 3 }
 
enum class  FieldKind : unsigned short { header = 0 , metadata = 1 , pov = 2 }
 
enum class  Kind : unsigned short { tagalong = 0 , dark = 1 , mocha = 2 , normal = 3 }
 
enum class  Size : unsigned short { null = 0 , b8 = 8 , b16 = 16 , b32 = 32 }
 all possible PHV container sizes in BFN devices
 
enum class  SliceMatch { DFLT = 0 , REF = 1 , REF_DG_LR = 2 , REF_PHYS_LR = 4 }
 

Functions

std::vector< Context > all_contexts (Kind kind)
 
TempVarAllocResult allocate_temp_vars (PhvInfo &phv, const ordered_map< const PHV::Field *, LiveRange > &temp_vars)
 find empty container for temp_vars and allocate them.
 
bool operator< (Kind left, Kind right)
 
bool operator< (PHV::Allocation::ContainerAllocStatus left, PHV::Allocation::ContainerAllocStatus right)
 Partial order for allocation status.
 
P4::JSONGeneratoroperator<< (P4::JSONGenerator &out, const PHV::Container c)
 
std::ostream & operator<< (std::ostream &, const AllocContext &)
 
std::ostream & operator<< (std::ostream &os, const ContainerOccupancy &occ)
 
std::ostream & operator<< (std::ostream &os, const FreeSlice &cs)
 
std::ostream & operator<< (std::ostream &out, const ActionClassifiedSources &sources)
 
std::ostream & operator<< (std::ostream &out, const ActionSourceTracker &tracker)
 
std::ostream & operator<< (std::ostream &out, const AllocSlice &slice)
 
std::ostream & operator<< (std::ostream &out, const AllocSlice *slice)
 
std::ostream & operator<< (std::ostream &out, const DarkInitEntry &entry)
 
std::ostream & operator<< (std::ostream &out, const DarkInitPrimitive &prim)
 
std::ostream & operator<< (std::ostream &out, const Field &field)
 
std::ostream & operator<< (std::ostream &out, const Field *)
 
std::ostream & operator<< (std::ostream &out, const LiveRange &s)
 
std::ostream & operator<< (std::ostream &out, const LiveRangeInfo &info)
 
std::ostream & operator<< (std::ostream &out, const LiveRangeInfo::OpInfo &opinfo)
 
std::ostream & operator<< (std::ostream &out, const PackingLayout &p)
 
std::ostream & operator<< (std::ostream &out, const PackingLayout *p)
 
std::ostream & operator<< (std::ostream &out, const PHV::AlignedCluster &cl)
 
std::ostream & operator<< (std::ostream &out, const PHV::AlignedCluster *cl)
 
std::ostream & operator<< (std::ostream &out, const PHV::Allocation &alloc)
 
std::ostream & operator<< (std::ostream &out, const PHV::Allocation *alloc)
 
std::ostream & operator<< (std::ostream &out, const PHV::Allocation::ExtractSource &source)
 
std::ostream & operator<< (std::ostream &out, const PHV::Container c)
 
std::ostream & operator<< (std::ostream &out, const PHV::ContainerGroup &g)
 
std::ostream & operator<< (std::ostream &out, const PHV::ContainerGroup *g)
 
std::ostream & operator<< (std::ostream &out, const PHV::FieldSlice &fs)
 
std::ostream & operator<< (std::ostream &out, const PHV::FieldSlice *fs)
 
std::ostream & operator<< (std::ostream &out, const PHV::FieldUse u)
 
std::ostream & operator<< (std::ostream &out, const PHV::Kind k)
 
std::ostream & operator<< (std::ostream &out, const PHV::RotationalCluster &cl)
 
std::ostream & operator<< (std::ostream &out, const PHV::RotationalCluster *cl)
 
std::ostream & operator<< (std::ostream &out, const PHV::Size sz)
 
std::ostream & operator<< (std::ostream &out, const PHV::SuperCluster &g)
 
std::ostream & operator<< (std::ostream &out, const PHV::SuperCluster *g)
 
std::ostream & operator<< (std::ostream &out, const SourceOp &src)
 
std::ostream & operator<< (std::ostream &out, const StageAndAccess &s)
 
std::ostream & operator<< (std::ostream &out, const std::vector< AllocSlice > &sl_vec)
 
std::ostream & operator<< (std::ostream &out, const SuperCluster::SliceList &list)
 
std::ostream & operator<< (std::ostream &out, const SuperCluster::SliceList *list)
 
std::ostream & operator<< (std::ostream &out, ordered_set< const PHV::Container * > &c_set)
 
std::ostream & operator<< (std::ostream &out, PHV::Type t)
 
bool operator<= (Kind left, Kind right)
 
bool operator<= (PHV::Allocation::ContainerAllocStatus left, PHV::Allocation::ContainerAllocStatus right)
 
bool operator> (Kind left, Kind right)
 
bool operator> (PHV::Allocation::ContainerAllocStatus left, PHV::Allocation::ContainerAllocStatus right)
 
bool operator>= (Kind left, Kind right)
 
bool operator>= (PHV::Allocation::ContainerAllocStatus left, PHV::Allocation::ContainerAllocStatus right)
 
LiveRangeInfo::OpInfo operator| (const LiveRangeInfo::OpInfo &a, const LiveRangeInfo::OpInfo &b)
 
LiveRangeInfo::OpInfo & operator|= (LiveRangeInfo::OpInfo &a, const LiveRangeInfo::OpInfo &b)
 

Variables

const Kind KINDS [] = {Kind::tagalong, Kind::dark, Kind::mocha, Kind::normal}
 
const Size SIZES [] = {Size::null, Size::b8, Size::b16, Size::b32}
 
const std::map< Kind, cstringSTR_OF_KIND
 

Detailed Description

The namespace encapsulating PHV-related stuff.

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0 This is the file in which we will document all PHV constraints. TODO: Integrate all constraints into this class format.

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0 PHV Slicing Split functions Basic functions to split a supercluster.


Class Documentation

◆ PHV::AllocSetting

struct PHV::AllocSetting
Class Members
bool limit_tmp_creation = false
bool no_code_change = false
bool physical_liverange_overlay = false
bool physical_stage_trivial = false
bool prioritize_ara_inits = false
bool single_gress_parser_group = false
bool trivial_alloc = false

trivial allocation mode that (1) do minimal packing, i.e., pack fieldslices only when unavoidable. (2) assume that there were infinite number of containers. (3) no metadata or dark initialization, as if no_code_change mode is enabled.

◆ PHV::PackingLayout

struct PHV::PackingLayout

PackingLayout represents a packing constraint that specifies slices of fields must be allocated in the specified layout, similar to header layout constraints.

Class Members
typedef pair< const Field *, le_bitrange > FieldRange std::pair<const PHV::Field *, le_bitrange>
Class Members
gress_t gress gress
safe_vector< FieldRangeOrPadding > layout actual layout

◆ PHV::SliceResult

struct PHV::SliceResult
template<typename Cluster>
struct PHV::SliceResult< Cluster >

The result of slicing a cluster.

Class Members
typedef optional< FieldSlice > OptFieldSlice std::optional<PHV::FieldSlice>
Class Members
Cluster * hi A new cluster containing the higher field slices.
Cluster * lo A new cluster containing the lower field slices.
ordered_map< FieldSlice, pair< FieldSlice, OptFieldSlice > > slice_map

Associate original field slices with new field slices. Fields that are smaller than the slice point do not generate a hi slice.

◆ PHV::TempVarAllocResult

struct PHV::TempVarAllocResult
Class Members
stringstream err
bool ok = true

Enumeration Type Documentation

◆ Kind

enum class PHV::Kind : unsigned short
strong

all possible PHV container kinds in BFN devices The values here are used to define operator< on Kinds.

Function Documentation

◆ operator<()

bool PHV::operator< ( Kind left,
Kind right )
inline

Provides a total ordering over PHV container kinds, denoting a refinement of the ordering induced by subset inclusion over the set of capabilities each kind supports. For example, tagalong < normal, because tagalong containers don't support reads/writes in the MAU, whereas normal containers do.

Variable Documentation

◆ STR_OF_KIND

const std::map<Kind, cstring> PHV::STR_OF_KIND
Initial value:
= {{Kind::tagalong, "tagalong"_cs},
{Kind::dark, "dark"_cs},
{Kind::mocha, "mocha"_cs},
{Kind::normal, "normal"_cs}}