Skip to content

Commit d9ca141

Browse files
committed
compiler: Pull some aspects of DAG construction out and cache
1 parent 1119a63 commit d9ca141

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

devito/ir/support/basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,10 @@ def __init__(self, exprs, rules=None):
830830
self.rules = as_tuple(rules)
831831
assert all(callable(i) for i in self.rules)
832832

833+
@cached_property
834+
def thingy(self):
835+
return any(i.cause for i in self.d_anti_gen())
836+
833837
@memoized_generator
834838
def writes_gen(self):
835839
"""

devito/passes/clusters/misc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,9 @@ def is_cross(source, sink):
362362
# (intuitively, "the loop nests are to be kept separated")
363363
# * All ClusterGroups between `cg0` and `cg1` must precede `cg1`
364364
# * All ClusterGroups after `cg1` cannot precede `cg1`
365-
if any(i.cause & prefix for i in scope.d_anti_gen()):
365+
# FIXME: Attach to the scope
366+
# if any(i.cause & prefix for i in scope.d_anti_gen()):
367+
if prefix and scope.thingy:
366368
for cg2 in cgroups[n:cgroups.index(cg1)]:
367369
dag.add_edge(cg2, cg1)
368370
for cg2 in cgroups[cgroups.index(cg1)+1:]:

0 commit comments

Comments
 (0)