Skip to content

Commit

Permalink
Merge pull request #119 from coneoproject/fix-issue-118
Browse files Browse the repository at this point in the history
Deterministically collect loop nests
  • Loading branch information
miklos1 authored Apr 11, 2017
2 parents 50a0f59 + ef0f7f4 commit bdbc5fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions coffee/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from .logger import log, warn, PERF_OK, PERF_WARN
from coffee.visitors import Find, EstimateFlops

from collections import defaultdict, OrderedDict
from collections import OrderedDict
import time


Expand Down Expand Up @@ -88,7 +88,7 @@ def plan_cpu(self, opts):

info = visit(kernel, info_items=['decls', 'exprs'])
# Collect expressions and related metadata
nests = defaultdict(OrderedDict)
nests = OrderedDict()
for stmt, expr_info in info['exprs'].items():
parent, nest = expr_info
if not nest:
Expand All @@ -98,7 +98,7 @@ def plan_cpu(self, opts):
else:
typ = check_type(stmt, info['decls'])
metaexpr = MetaExpr(typ, parent, nest)
nests[nest[0]].update({stmt: metaexpr})
nests.setdefault(nest[0], OrderedDict()).update({stmt: metaexpr})
loop_opts = [CPULoopOptimizer(loop, header, exprs)
for (loop, header), exprs in nests.items()]

Expand Down Expand Up @@ -185,7 +185,7 @@ def plan_gpu(self):
for kernel in kernels:
info = visit(kernel, info_items=['decls', 'exprs'])
# Collect expressions and related metadata
nests = defaultdict(OrderedDict)
nests = OrderedDict()
for stmt, expr_info in info['exprs'].items():
parent, nest = expr_info
if not nest:
Expand All @@ -195,7 +195,7 @@ def plan_gpu(self):
else:
typ = check_type(stmt, info['decls'])
metaexpr = MetaExpr(typ, parent, nest)
nests[nest[0]].update({stmt: metaexpr})
nests.setdefault(nest[0], OrderedDict()).update({stmt: metaexpr})
loop_opts = [GPULoopOptimizer(loop, header, exprs)
for (loop, header), exprs in nests.items()]

Expand Down

0 comments on commit bdbc5fc

Please sign in to comment.