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 class
FederatedMemoTable.FedPlan
Represents a single federated execution plan with its associated costs and dependencies.static class
FederatedMemoTable.FedPlanVariants
Represents a collection of federated execution plan variants for a specific Hop and FederatedOutput.static class
FederatedMemoTable.HopCommon
Represents 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.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.boolean
contains(long hopID, FEDInstruction.FederatedOutput fedOutType)
Checks if the memo table contains an entry for a given Hop and fedOutType.FederatedMemoTable.FedPlan
getFedPlanAfterPrune(long hopID, FEDInstruction.FederatedOutput fedOutType)
FederatedMemoTable.FedPlan
getFedPlanAfterPrune(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)
FederatedMemoTable.FedPlanVariants
getFedPlanVariants(long hopID, FEDInstruction.FederatedOutput fedOutType)
FederatedMemoTable.FedPlanVariants
getFedPlanVariants(org.apache.commons.lang3.tuple.Pair<Long,FEDInstruction.FederatedOutput> fedPlanPair)
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.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.
-
-
-
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
-
-