use of org.apache.sysml.hops.codegen.template.TemplateBase in project incubator-systemml by apache.
the class SpoofCompiler method rExploreCPlans.
// //////////////////
// Codegen plan construction
private static void rExploreCPlans(Hop hop, CPlanMemoTable memo, boolean compileLiterals) {
// top-down memoization of processed dag nodes
if (memo.contains(hop.getHopID()) || memo.containsHop(hop))
return;
// recursive candidate exploration
for (Hop c : hop.getInput()) rExploreCPlans(c, memo, compileLiterals);
// open initial operator plans, if possible
for (TemplateBase tpl : TemplateUtils.TEMPLATES) if (tpl.open(hop))
memo.addAll(hop, enumPlans(hop, null, tpl, memo));
// fuse and merge operator plans
for (Hop c : hop.getInput()) for (TemplateBase tpl : memo.getDistinctTemplates(c.getHopID())) if (tpl.fuse(hop, c))
memo.addAll(hop, enumPlans(hop, c, tpl, memo));
// close operator plans, if required
if (memo.contains(hop.getHopID())) {
Iterator<MemoTableEntry> iter = memo.get(hop.getHopID()).iterator();
while (iter.hasNext()) {
MemoTableEntry me = iter.next();
TemplateBase tpl = TemplateUtils.createTemplate(me.type);
CloseType ccode = tpl.close(hop);
if (ccode == CloseType.CLOSED_INVALID)
iter.remove();
me.ctype = ccode;
}
}
// prune subsumed / redundant plans
if (PRUNE_REDUNDANT_PLANS) {
memo.pruneRedundant(hop.getHopID(), PLAN_SEL_POLICY.isHeuristic(), null);
}
// mark visited even if no plans found (e.g., unsupported ops)
memo.addHop(hop);
}
use of org.apache.sysml.hops.codegen.template.TemplateBase in project systemml by apache.
the class SpoofCompiler method rExploreCPlans.
// //////////////////
// Codegen plan construction
private static void rExploreCPlans(Hop hop, CPlanMemoTable memo, boolean compileLiterals) {
// top-down memoization of processed dag nodes
if (memo.contains(hop.getHopID()) || memo.containsHop(hop))
return;
// recursive candidate exploration
for (Hop c : hop.getInput()) rExploreCPlans(c, memo, compileLiterals);
// open initial operator plans, if possible
for (TemplateBase tpl : TemplateUtils.TEMPLATES) if (tpl.open(hop))
memo.addAll(hop, enumPlans(hop, null, tpl, memo));
// fuse and merge operator plans
for (Hop c : hop.getInput()) for (TemplateBase tpl : memo.getDistinctTemplates(c.getHopID())) if (tpl.fuse(hop, c))
memo.addAll(hop, enumPlans(hop, c, tpl, memo));
// close operator plans, if required
if (memo.contains(hop.getHopID())) {
Iterator<MemoTableEntry> iter = memo.get(hop.getHopID()).iterator();
while (iter.hasNext()) {
MemoTableEntry me = iter.next();
TemplateBase tpl = TemplateUtils.createTemplate(me.type);
CloseType ccode = tpl.close(hop);
if (ccode == CloseType.CLOSED_INVALID)
iter.remove();
me.ctype = ccode;
}
}
// prune subsumed / redundant plans
if (PRUNE_REDUNDANT_PLANS) {
memo.pruneRedundant(hop.getHopID(), PLAN_SEL_POLICY.isHeuristic(), null);
}
// mark visited even if no plans found (e.g., unsupported ops)
memo.addHop(hop);
}
Aggregations