Skip to content

Commit

Permalink
compiler: regain correctness for indirections
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Nov 23, 2023
1 parent b656400 commit 62c4caa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion devito/ir/clusters/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@ def dspace(self):
for f, v in parts.items():
for i in v:
if i.dim in oobs:
intervals = intervals.ceil(v[i.dim])
try:
if intervals[i.dim].upper > v[i.dim].upper and \
bool(i.dim in f.dimensions):
intervals = intervals.ceil(v[i.dim])
except AttributeError:
pass

return DataSpace(intervals, parts)

Expand Down
1 change: 0 additions & 1 deletion devito/ir/support/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def detect_accesses(exprs):
mapper = defaultdict(Stencil)
for e in retrieve_indexed(exprs, deep=True):
f = e.function

for a, d0 in zip(e.indices, f.dimensions):
if isinstance(a, Indirection):
a = a.mapped
Expand Down
2 changes: 1 addition & 1 deletion devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _arg_check(self, args, size, interval):
# Autopadding causes non-integer upper limit
from devito.symbolics import normalize_args
upper = interval.upper.subs(normalize_args(args))
if args[self.max_name] + upper > size:
if args[self.max_name] + upper >= size:
raise InvalidArgument("OOB detected due to %s=%d" % (self.max_name,
args[self.max_name]))

Expand Down
4 changes: 2 additions & 2 deletions examples/userapi/02_apply.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"OOB detected due to time_M=3\n"
"OOB detected due to time_M=2\n"
]
}
],
"source": [
"from devito.exceptions import InvalidArgument\n",
"try:\n",
" op.apply(time_M=3)\n",
" op.apply(time_M=2)\n",
"except InvalidArgument as e:\n",
" print(e)"
]
Expand Down

0 comments on commit 62c4caa

Please sign in to comment.