Skip to content

Commit

Permalink
compiler: Rework correctness for indirections
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Jan 15, 2024
1 parent e2d6547 commit dd31ca2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 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
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 dd31ca2

Please sign in to comment.