P4C
The P4 Compiler
Loading...
Searching...
No Matches
AllocationStrategy Class Referenceabstract

#include <allocate_phv.h>

Inheritance diagram for AllocationStrategy:
[legend]

Public Member Functions

 AllocationStrategy (cstring name, const PHV::AllocUtils &utils, const CoreAllocation &core)
 
virtual AllocResult tryAllocation (const PHV::Allocation &alloc, const std::list< PHV::SuperCluster * > &cluster_groups_input, const std::list< PHV::ContainerGroup * > &container_groups)=0
 

Protected Attributes

const CoreAllocationcore_alloc_i
 
const cstring name
 
const PHV::AllocUtilsutils_i
 

Detailed Description

The abstract class of Phv allocation strategy. The AllocationStrategy controls the core of PHV allocation: matching SuperClusters to ContainerGroup by tryAllocation function. Strategies can:

  1. make a complete or a partial allocation.
  2. be chained with other strategies.

The result of core function tryAllocation:

  1. status: the result of this strategy.
  2. transaction: allocations had been made.
  3. remaining_clusters: the remaining cluster;

Member Function Documentation

◆ tryAllocation()

virtual AllocResult AllocationStrategy::tryAllocation ( const PHV::Allocation & alloc,
const std::list< PHV::SuperCluster * > & cluster_groups_input,
const std::list< PHV::ContainerGroup * > & container_groups )
pure virtual

Run this strategy Returns: a AllocResult that

  1. status: the result of this strategy.
  2. transaction: allocations had been made.
  3. remaining_clusters: the remaining cluster; Strategies should not changed container_groups, except for sorting it.

Implemented in BruteForceAllocationStrategy.