P4C
The P4 Compiler
|
Public Member Functions | |
DynamicDependencyMetrics (const CalculateNextTableProp &n, const ControlPathwaysToTable &cp, const DependencyGraph &d) | |
double | average_cds_chain_length (const IR::MAU::Table *tbl) const |
bool | can_place_cds_in_stage (const IR::MAU::Table *tbl, ordered_set< const IR::MAU::Table * > &already_placed_in_table) const |
std::pair< int, int > | get_downward_prop_score (const IR::MAU::Table *a, const IR::MAU::Table *b) const |
int | placeable_cds_count (const IR::MAU::Table *tbl, ordered_set< const IR::MAU::Table * > &already_placed_in_stage) const |
void | score_on_seq (const IR::MAU::TableSeq *seq, const IR::MAU::Table *tbl, int &max_dep_impact, char type) const |
int | total_deps_of_dom_frontier (const IR::MAU::Table *a) const |
void | update_placed_tables (std::function< bool(const IR::MAU::Table *)> pt) |
double DynamicDependencyMetrics::average_cds_chain_length | ( | const IR::MAU::Table * | tbl | ) | const |
Return the average chain length of every table in the control dominating set
bool DynamicDependencyMetrics::can_place_cds_in_stage | ( | const IR::MAU::Table * | tbl, |
ordered_set< const IR::MAU::Table * > & | already_placed_in_stage ) const |
Given what has already been placed within a stage, return if the table, and any table that the next table has to be propagated into can be placed in this stage due to dependencies. Relevant for Tofino.
std::pair< int, int > DynamicDependencyMetrics::get_downward_prop_score | ( | const IR::MAU::Table * | a, |
const IR::MAU::Table * | b ) const |
So in Tofino specifically, this is to help place tables in sequences due to the other tables. Let's look at the following example:
apply() { t1.apply(); if (t2.apply().hit) { t3.apply(); } t4.apply(); }
The sequence nodes in this case will be:
[ t1, t2, t4 ] | | $hit | V [ t3 ]
Now I'm going to assign dependency chains, though let's say that these have no direct dependencies with each other:
t1 - 7 t2 - 9 t3 - 0 t4 - 8
When we place table t2, t3 must be placed before any other tables hit. However, t3 will not be favored directly. But in this case, because t4 is waiting, the metrics for t3 must see this function.
The purpose of this function is to compare two tables, specifically the different tables that they affect until they get placed, and get the max dependency chain from all tables that this particular table is waiting on. This is called a downward propagation score as we are propagating dependency information down from a control flow dominator.
TODO: Eventually instead of the top TableSequence, all table sequences leading up to that table should be analyzedj
This constraint is completely voided in Tofino2
int DynamicDependencyMetrics::placeable_cds_count | ( | const IR::MAU::Table * | tbl, |
ordered_set< const IR::MAU::Table * > & | already_placed_in_stage ) const |
Given what has already been placed within a stage, return the number of tables that can be placed of this table next table dominating set
void DynamicDependencyMetrics::score_on_seq | ( | const IR::MAU::TableSeq * | seq, |
const IR::MAU::Table * | tbl, | ||
int & | max_dep_impact, | ||
char | type ) const |
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
int DynamicDependencyMetrics::total_deps_of_dom_frontier | ( | const IR::MAU::Table * | a | ) | const |
Based on how many dependencies are within the control dominating set.