Package org.apache.sysds.hops.fedplanner
Class FederatedPlanCostEnumerator
- java.lang.Object
-
- org.apache.sysds.hops.fedplanner.FederatedPlanCostEnumerator
-
public class FederatedPlanCostEnumerator extends Object
-
-
Constructor Summary
Constructors Constructor Description FederatedPlanCostEnumerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
enumerateHopDAG(Hop rootHop, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Map<String,List<Hop>> innerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight, boolean isInnerBlock)
Enumerates the statement hop DAG within a statement block.static void
enumerateProgram(DMLProgram prog, boolean isPrint)
Enumerates the entire DML program to generate federated execution plans.static Map<String,List<Hop>>
enumerateStatementBlock(StatementBlock sb, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight, boolean isInnerBlock)
Enumerates the statement block and updates the transient and memoization tables.static void
enumerateStatementBlockBody(List<StatementBlock> sbList, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Map<String,List<Hop>> innerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight)
Enumerates the statement blocks within a body and updates the transient and memoization tables.
-
-
-
Method Detail
-
enumerateProgram
public static void enumerateProgram(DMLProgram prog, boolean isPrint)
Enumerates the entire DML program to generate federated execution plans. It processes each statement block, computes the optimal federated plan, detects and resolves conflicts, and optionally prints the plan tree.- Parameters:
prog
- The DML program to enumerate.isPrint
- A boolean indicating whether to print the federated plan tree.
-
enumerateStatementBlock
public static Map<String,List<Hop>> enumerateStatementBlock(StatementBlock sb, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight, boolean isInnerBlock)
Enumerates the statement block and updates the transient and memoization tables. This method processes different types of statement blocks such as If, For, While, and Function blocks. It recursively enumerates the Hop DAGs within these blocks and updates the corresponding tables. The method also calculates weights recursively for if-else/loops and handles inner and outer block distinctions.- Parameters:
sb
- The statement block to enumerate.memoTable
- The memoization table to store plan variants.outerTransTable
- The table to track immutable outer transient writes.formerInnerTransTable
- The table to track immutable former inner transient writes.progRootHopSet
- The set of hops to connect to the root dummy node.statRootHopSet
- The set of statement root hops for debugging purposes (check if not referenced).weight
- The weight associated with the current Hop.isInnerBlock
- A boolean indicating if the current block is an inner block.- Returns:
- A map of inner transient writes.
-
enumerateStatementBlockBody
public static void enumerateStatementBlockBody(List<StatementBlock> sbList, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Map<String,List<Hop>> innerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight)
Enumerates the statement blocks within a body and updates the transient and memoization tables.- Parameters:
sbList
- The list of statement blocks to enumerate.memoTable
- The memoization table to store plan variants.outerTransTable
- The table to track immutable outer transient writes.formerInnerTransTable
- The table to track immutable former inner transient writes.innerTransTable
- The table to track inner transient writes.progRootHopSet
- The set of hops to connect to the root dummy node.statRootHopSet
- The set of statement root hops for debugging purposes (check if not referenced).weight
- The weight associated with the current Hop.
-
enumerateHopDAG
public static void enumerateHopDAG(Hop rootHop, FederatedMemoTable memoTable, Map<String,List<Hop>> outerTransTable, Map<String,List<Hop>> formerInnerTransTable, Map<String,List<Hop>> innerTransTable, Set<Hop> progRootHopSet, Set<Hop> statRootHopSet, double weight, boolean isInnerBlock)
Enumerates the statement hop DAG within a statement block. This method recursively enumerates all possible federated execution plans and identifies hops to connect to the root dummy node.- Parameters:
rootHop
- The root Hop of the DAG to enumerate.memoTable
- The memoization table to store plan variants.outerTransTable
- The table to track transient writes.formerInnerTransTable
- The table to track immutable inner transient writes.innerTransTable
- The table to track inner transient writes.progRootHopSet
- The set of hops to connect to the root dummy node.statRootHopSet
- The set of root hops for debugging purposes.weight
- The weight associated with the current Hop.isInnerBlock
- A boolean indicating if the current block is an inner block.
-
-