Skip to content

Commit a8bb0d4

Browse files
committed
Some more cleanup
1 parent 7058b26 commit a8bb0d4

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/java/org/apache/sysds/hops/rewriter/RewriterRuleCreator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ public synchronized void forEachRule(Consumer<RewriterRule> consumer) {
4141
}
4242

4343
public boolean registerRule(RewriterRule rule, Function<RewriterStatement, RewriterStatement> canonicalFormConverter, final RuleContext ctx) {
44-
return registerRule(rule, RewriterCostEstimator.estimateCost(rule.getStmt1(), ctx), RewriterCostEstimator.estimateCost(rule.getStmt2(), ctx), false, canonicalFormConverter);
44+
try {
45+
return registerRule(rule, RewriterCostEstimator.estimateCost(rule.getStmt1(), ctx), RewriterCostEstimator.estimateCost(rule.getStmt2(), ctx), false, canonicalFormConverter);
46+
} catch (Exception e) {
47+
System.err.println("Error while registering a rule: " + rule);
48+
e.printStackTrace();
49+
return false;
50+
}
4551
}
4652

4753
public synchronized boolean registerRule(RewriterRule rule, long preCost, long postCost, boolean validateCorrectness, Function<RewriterStatement, RewriterStatement> canonicalFormCreator) {

src/main/java/org/apache/sysds/hops/rewriter/estimators/RewriterCostEstimator.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,6 @@ private static RewriterStatement propagateCostFunction(RewriterStatement stmt, f
733733
RewriterStatement argList = RewriterStatement.argList(ctx, includedCosts);
734734
RewriterStatement add = new RewriterInstruction().as(UUID.randomUUID().toString()).withInstruction("+").withOps(argList).consolidate(ctx);
735735
add.unsafePutMeta("_assertions", assertions);
736-
737-
//System.out.println("Cost0: " + add.toParsableString(ctx));
738-
//System.out.println("Assertions: " + assertions);
739-
740-
// TODO: Validate that this is not needed
741-
//add = RewriterUtils.buildCanonicalFormConverter(ctx, false).apply(add);
742736
return add;
743737
}
744738

@@ -976,8 +970,6 @@ private static RewriterStatement computeScalarOpCost(RewriterInstruction instr,
976970
case "const(MATRIX,FLOAT)":
977971
case "_nnz(MATRIX)":
978972
return RewriterStatement.literal(ctx, 0L);
979-
case "_EClass(INT)":
980-
throw new IllegalArgumentException();
981973
}
982974

983975
long opCost = atomicOpCost(instr.trueInstruction());

0 commit comments

Comments
 (0)