Package org.apache.sysds.hops.fedplanner
Class FederatedMemoTable
- java.lang.Object
-
- org.apache.sysds.hops.fedplanner.FederatedMemoTable
-
public class FederatedMemoTable extends Object
A Memoization Table for managing federated plans (FedPlan) based on combinations of Hops and fedOutTypes. This table stores and manages different execution plan variants for each Hop and fedOutType combination, facilitating the optimization of federated execution plans.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFederatedMemoTable.FedPlanRepresents a single federated execution plan with its associated costs and dependencies.static classFederatedMemoTable.FedPlanVariantsRepresents a collection of federated execution plan variants for a specific Hop and FederatedOutput.static classFederatedMemoTable.HopCommonRepresents common properties and costs associated with a Hop.
-
Constructor Summary
Constructors Constructor Description FederatedMemoTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FederatedMemoTable.FedPlanaddFedPlan(Hop hop, FEDInstruction.FederatedOutput fedOutType, List<org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput>> planChilds)Adds a new federated plan to the memo table.booleancontains(long hopID, FEDInstruction.FederatedOutput fedOutType)Checks if the memo table contains an entry for a given Hop and fedOutType.FederatedMemoTable.FedPlangetFedPlanAfterPrune(long hopID, FEDInstruction.FederatedOutput fedOutType)FederatedMemoTable.FedPlangetFedPlanAfterPrune(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)FederatedMemoTable.FedPlanVariantsgetFedPlanVariants(long hopID, FEDInstruction.FederatedOutput fedOutType)FederatedMemoTable.FedPlanVariantsgetFedPlanVariants(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)FederatedMemoTable.FedPlangetMinCostFedPlan(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)Retrieves the minimum cost child plan considering the parent's output type.voidpruneFedPlan(long hopID, FEDInstruction.FederatedOutput federatedOutput)Prunes the specified entry in the memo table, retaining only the minimum-cost FedPlan for the given Hop ID and federated output type.
-
-
-
Method Detail
-
addFedPlan
public FederatedMemoTable.FedPlan addFedPlan(Hop hop, FEDInstruction.FederatedOutput fedOutType, List<org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput>> planChilds)
Adds a new federated plan to the memo table. Creates a new variant list if none exists for the given Hop and fedOutType.- Parameters:
hop- The Hop nodefedOutType- The federated output typeplanChilds- List of child plan references- Returns:
- The newly created FedPlan
-
getMinCostFedPlan
public FederatedMemoTable.FedPlan getMinCostFedPlan(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)
Retrieves the minimum cost child plan considering the parent's output type. The cost is calculated using getParentViewCost to account for potential type mismatches.- Parameters:
fedPlanPair- ???- Returns:
- min cost fed plan
-
getFedPlanVariants
public FederatedMemoTable.FedPlanVariants getFedPlanVariants(long hopID, FEDInstruction.FederatedOutput fedOutType)
-
getFedPlanVariants
public FederatedMemoTable.FedPlanVariants getFedPlanVariants(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)
-
getFedPlanAfterPrune
public FederatedMemoTable.FedPlan getFedPlanAfterPrune(long hopID, FEDInstruction.FederatedOutput fedOutType)
-
getFedPlanAfterPrune
public FederatedMemoTable.FedPlan getFedPlanAfterPrune(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)
-
contains
public boolean contains(long hopID, FEDInstruction.FederatedOutput fedOutType)Checks if the memo table contains an entry for a given Hop and fedOutType.- Parameters:
hopID- The Hop ID.fedOutType- The associated fedOutType.- Returns:
- True if the entry exists, false otherwise.
-
pruneFedPlan
public void pruneFedPlan(long hopID, FEDInstruction.FederatedOutput federatedOutput)Prunes the specified entry in the memo table, retaining only the minimum-cost FedPlan for the given Hop ID and federated output type.- Parameters:
hopID- The ID of the Hop to prunefederatedOutput- The federated output type associated with the Hop
-
-