Skip to content

Commit a9e79b1

Browse files
committed
Fixed incorrect JavaDoc annotations for method input parameters in FederatedPlanCostEnumerator.
1 parent 6de3cb7 commit a9e79b1

File tree

1 file changed

+29
-62
lines changed

1 file changed

+29
-62
lines changed

src/main/java/org/apache/sysds/hops/fedplanner/FederatedPlanCostEnumerator.java

Lines changed: 29 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ public static FedPlan enumerateFunctionDynamic(FunctionStatementBlock function,
156156
* corresponding tables.
157157
* The method also calculates weights recursively for if-else/loops and handles
158158
* inner and outer block distinctions.
159-
*
160-
* @param sb The statement block to enumerate.
161-
* @param memoTable The memoization table to store plan variants.
162-
* @param parentLoopStack The context of parent loops for loop-level context
163-
* tracking.
164-
* @return A map of inner transient writes.
165159
*/
166160
public static void enumerateStatementBlock(StatementBlock sb, DMLProgram prog, FederatedMemoTable memoTable,
167161
Map<Long, HopCommon> hopCommonTable, Map<Long, List<Hop>> rewireTable,
@@ -228,10 +222,6 @@ public static void enumerateStatementBlock(StatementBlock sb, DMLProgram prog, F
228222
* Rewires and enumerates federated execution plans for a given Hop.
229223
* This method processes all input nodes, rewires TWrite and TRead operations,
230224
* and generates federated plan variants for both inner and outer code blocks.
231-
*
232-
* @param hop The Hop for which to rewire and enumerate federated plans.
233-
* @param memoTable The memoization table to store plan variants.
234-
* @param loopStack The context of parent loops for loop-level context tracking.
235225
*/
236226
private static void enumerateHopDAG(Hop hop, DMLProgram prog, FederatedMemoTable memoTable,
237227
Map<Long, HopCommon> hopCommonTable, Map<Long, List<Hop>> rewireTable,
@@ -280,7 +270,7 @@ private static void enumerateHopDAG(Hop hop, DMLProgram prog, FederatedMemoTable
280270

281271
// Enumerate the federated plan for the current Hop
282272
enumerateHop(hop, memoTable, hopCommonTable, rewireTable, privacyConstraintMap,
283-
fTypeMap, unRefTwriteSet, fnStack, numOfWorkers);
273+
fTypeMap, unRefTwriteSet, numOfWorkers);
284274

285275
// FederatedPlanRewireTransTable.logHopInfo(hop, privacyConstraintMap, fTypeMap, "enumerateHopDAG");
286276

@@ -291,24 +281,18 @@ private static void enumerateHopDAG(Hop hop, DMLProgram prog, FederatedMemoTable
291281
* This method calculates the self cost and child costs for the Hop,
292282
* generates federated plan variants for both LOUT and FOUT output types,
293283
* and prunes redundant plans before adding them to the memo table.
294-
*
295-
* @param hop The Hop for which to enumerate federated plans.
296-
* @param memoTable The memoization table to store plan variants.
297-
* @param loopStack The context of parent loops for loop-level context tracking.
298284
*/
299285
private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long, HopCommon> hopCommonTable,
300286
Map<Long, List<Hop>> rewireTable, Map<Long, Privacy> privacyConstraintMap,
301-
Map<Long, FType> fTypeMap, Set<Long> unRefTwriteSet, Set<String> fnStack, int numOfWorkers) {
287+
Map<Long, FType> fTypeMap, Set<Long> unRefTwriteSet, int numOfWorkers) {
302288
long hopID = hop.getHopID();
303289
List<Hop> childHops = new ArrayList<>(hop.getInput());
304290
int numParentHops = hop.getParent().size();
305291
boolean isTrans = false;
306292

307-
if ((hop instanceof DataOp) &&
308-
(((DataOp) hop).getOp() == Types.OpOpData.TRANSIENTWRITE && !hop.getName().equals("__pred")
309-
|| (((DataOp) hop).getOp() == Types.OpOpData.TRANSIENTREAD))) {
293+
if (hop instanceof DataOp){
310294
Types.OpOpData opType = ((DataOp) hop).getOp();
311-
if (opType == Types.OpOpData.TRANSIENTWRITE) {
295+
if (opType == Types.OpOpData.TRANSIENTWRITE && !hop.getName().equals("__pred")) {
312296
List<Hop> transParentHops = rewireTable.get(hop.getHopID());
313297
if (transParentHops != null) {
314298
numParentHops += transParentHops.size();
@@ -322,11 +306,8 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
322306
isTrans = true;
323307
}
324308
} else {
325-
// Todo: Cannot understand this code
326309
for (Hop parentHop : hop.getParent()) {
327310
if (parentHop instanceof DataOp
328-
&& ((DataOp) parentHop).getOp() == Types.OpOpData.TRANSIENTWRITE
329-
&& !parentHop.getName().equals("__pred")
330311
&& unRefTwriteSet.contains(parentHop.getHopID())) {
331312
numParentHops--;
332313
}
@@ -336,10 +317,6 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
336317
HopCommon hopCommon = hopCommonTable.get(hopID);
337318
hopCommon.setNumOfParentHops(numParentHops);
338319
double selfCost = FederatedPlanCostEstimator.computeHopCost(hopCommon);
339-
340-
FedPlanVariants lOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.LOUT);
341-
FedPlanVariants fOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.FOUT);
342-
343320
int numInputs = childHops.size();
344321

345322
double[][] childCumulativeCost = new double[numInputs][2]; // # of child, LOUT/FOUT of child
@@ -362,19 +339,25 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
362339
Privacy privacyConstraint = privacyConstraintMap.get(hopID);
363340
FType fType = fTypeMap.get(hopID);
364341

365-
if (isTrans) {
366-
// TODO: If any child is LOUT/FOUT only, create transHop as LOUT/FOUT only as well. Need to verify if this is correct.
367-
enumerateTransChildFedPlan(lOutFedPlanVariants, fOutFedPlanVariants, childHops, childCumulativeCost,
368-
lOUTOnlyinputHops, lOUTOnlychildCumulativeCost, fOUTOnlyinputHops, fOUTOnlychildCumulativeCost,
369-
selfCost, numOfWorkers);
370-
371-
if (lOutFedPlanVariants.pruneFedPlans()){
372-
memoTable.addFedPlanVariants(hopID, FederatedOutput.LOUT, lOutFedPlanVariants);
373-
};
374-
if (fOutFedPlanVariants.pruneFedPlans()){
375-
memoTable.addFedPlanVariants(hopID, FederatedOutput.FOUT, fOutFedPlanVariants);
376-
}
377-
} else if (fType == null) {
342+
// if (isTrans) {
343+
// FedPlanVariants lOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.LOUT);
344+
// FedPlanVariants fOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.FOUT);
345+
//
346+
// // TODO: If any child is LOUT/FOUT only, create transHop as LOUT/FOUT only as well. Need to verify if this is correct.
347+
// enumerateTransChildFedPlan(lOutFedPlanVariants, fOutFedPlanVariants, childHops, childCumulativeCost,
348+
// lOUTOnlyinputHops, lOUTOnlychildCumulativeCost, fOUTOnlyinputHops, fOUTOnlychildCumulativeCost,
349+
// selfCost, numOfWorkers);
350+
//
351+
// if (lOutFedPlanVariants.pruneFedPlans()){
352+
// memoTable.addFedPlanVariants(hopID, FederatedOutput.LOUT, lOutFedPlanVariants);
353+
// }
354+
// if (fOutFedPlanVariants.pruneFedPlans()){
355+
// memoTable.addFedPlanVariants(hopID, FederatedOutput.FOUT, fOutFedPlanVariants);
356+
// }
357+
// } else
358+
if (fType == null) {
359+
FedPlanVariants lOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.LOUT);
360+
378361
singleTypeEnumerateChildFedPlan(lOutFedPlanVariants, FederatedOutput.LOUT, childHops,
379362
childCumulativeCost, childForwardingCost, lOUTOnlyinputHops, lOUTOnlychildCumulativeCost,
380363
lOUTOnlychildForwardingCost, fOUTOnlyinputHops, fOUTOnlychildCumulativeCost,
@@ -383,6 +366,8 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
383366
lOutFedPlanVariants.pruneFedPlans();
384367
memoTable.addFedPlanVariants(hopID, FederatedOutput.LOUT, lOutFedPlanVariants);
385368
} else if (privacyConstraint == Privacy.PRIVATE || privacyConstraint == Privacy.PRIVATE_AGGREGATE){
369+
FedPlanVariants fOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.FOUT);
370+
386371
singleTypeEnumerateChildFedPlan(fOutFedPlanVariants, FederatedOutput.FOUT, childHops,
387372
childCumulativeCost, childForwardingCost, lOUTOnlyinputHops, lOUTOnlychildCumulativeCost,
388373
lOUTOnlychildForwardingCost, fOUTOnlyinputHops, fOUTOnlychildCumulativeCost,
@@ -391,6 +376,9 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
391376
fOutFedPlanVariants.pruneFedPlans();
392377
memoTable.addFedPlanVariants(hopID, FederatedOutput.FOUT, fOutFedPlanVariants);
393378
} else { // privacyConstraint == PUBLIC, fType != null >> both LOUT/FOUT are possible
379+
FedPlanVariants lOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.LOUT);
380+
FedPlanVariants fOutFedPlanVariants = new FedPlanVariants(hopCommon, FederatedOutput.FOUT);
381+
394382
enumerateChildFedPlan(lOutFedPlanVariants, fOutFedPlanVariants, childHops, childCumulativeCost,
395383
childForwardingCost, lOUTOnlyinputHops, lOUTOnlychildCumulativeCost,
396384
lOUTOnlychildForwardingCost,
@@ -409,14 +397,7 @@ private static void enumerateHop(Hop hop, FederatedMemoTable memoTable, Map<Long
409397
* Enumerates federated execution plans for initial child hops only.
410398
* This method generates all possible combinations of federated output types
411399
* (LOUT and FOUT)
412-
* for the initial child hops and calculates their cumulative costs.
413-
*
414-
* @param lOutFedPlanVariants The FedPlanVariants object for LOUT output type.
415-
* @param fOutFedPlanVariants The FedPlanVariants object for FOUT output type.
416-
* @param childHops The list of child hops.
417-
* @param childCumulativeCost The cumulative costs for each child hop.
418-
* @param childForwardingCost The forwarding costs for each child hop.
419-
* @param selfCost The self cost of the current hop.
400+
* for the initial child hops and calculates their cumulative costs
420401
*/
421402
private static void enumerateChildFedPlan(FedPlanVariants lOutFedPlanVariants, FedPlanVariants fOutFedPlanVariants,
422403
List<Hop> childHops, double[][] childCumulativeCost, double[] childForwardingCost,
@@ -528,14 +509,6 @@ private static void singleTypeEnumerateChildFedPlan(FedPlanVariants fedPlanVaria
528509
* Since TRead, TWrite and Child of TWrite have the same federated output type,
529510
* it generates only
530511
* a single plan for each output type
531-
*
532-
* @param lOutFedPlanVariants The FedPlanVariants object for LOUT output type.
533-
* @param fOutFedPlanVariants The FedPlanVariants object for FOUT output type.
534-
* @param numInputs The total number of input hops, including
535-
* additional TWrite hops.
536-
* @param childHops The list of child hops.
537-
* @param childCumulativeCost The cumulative costs for each child hop.
538-
* @param selfCost The self cost of the current hop.
539512
*/
540513
private static void enumerateTransChildFedPlan(FedPlanVariants lOutFedPlanVariants,
541514
FedPlanVariants fOutFedPlanVariants,
@@ -673,12 +646,6 @@ private static FedPlan getMinCostRootFedPlan(Set<Hop> progRootHopSet, FederatedM
673646
* the plan.
674647
* - Re-running BFS with resolved conflicts to ensure all inconsistencies are
675648
* addressed.
676-
*
677-
* @param rootPlan The root federated plan from which to start the conflict
678-
* detection.
679-
* @param memoTable The memoization table used to retrieve pruned federated
680-
* plans.
681-
* @return The cumulative additional cost for resolving conflicts.
682649
*/
683650
private static double detectAndResolveConflictFedPlan(FedPlan rootPlan, FederatedMemoTable memoTable) {
684651
// Map to track conflicts: maps a plan ID to its federated output type and list

0 commit comments

Comments
 (0)