Skip to content

Commit 35dfdae

Browse files
committed
compiler: Update Specializer with handler for BlockGrid
1 parent cc27a34 commit 35dfdae

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

devito/ir/iet/visitors.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,31 @@ def __init__(self, mapper, nested=False):
15251525
f"specialization. Value {v} was supplied for symbol "
15261526
f"{k}, but is of type {type(v)}.")
15271527

1528+
def _visit(self, o, *args, **kwargs):
1529+
retval = super()._visit(o, *args, **kwargs)
1530+
# print(f"Visiting {o.__class__}")
1531+
# print(retval)
1532+
# print("--------------------------------------------")
1533+
return retval
1534+
1535+
# TODO: Should probably be moved to Uxreplace at least (as should some of these
1536+
# others I think?)
1537+
def visit_DifferentiableFunction(self, o):
1538+
return uxreplace(o, self.mapper)
1539+
1540+
def visit_Definition(self, o):
1541+
try:
1542+
function = self._visit(o.function)
1543+
return o._rebuild(function=function)
1544+
except KeyError:
1545+
return o
1546+
1547+
def visit_BlockGrid(self, o):
1548+
# TODO: Should probably be made into a uxreplace handler of some description
1549+
cargs = self._visit(o.cargs)
1550+
shape = self._visit(o.shape)
1551+
return o._rebuild(cargs=cargs, shape=shape)
1552+
15281553
def visit_OrderedDict(self, o):
15291554
return OrderedDict((k, self._visit(v)) for k, v in o.items())
15301555

0 commit comments

Comments
 (0)