Skip to content

Commit 5125201

Browse files
FabioLuporinimloubout
authored andcommitted
compiler: Improve data dependence analysis
1 parent 2c23cb8 commit 5125201

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

devito/ir/support/basic.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class IterationInstance(LabeledVector):
6161
x, y, z : findices
6262
w : a generic Dimension
6363
64-
| x+1 | | x | | x | | w | | x+y |
65-
obj1 = | y+2 | , obj2 = | 4 | , obj3 = | x | , obj4 = | y | , obj5 = | y |
66-
| z-3 | | z+1 | | y | | z | | z |
64+
| x+1 | | x | | x | | w | | x+y |
65+
obj1 | y+2 |, obj2 = | 4 |, obj3 = | x |, obj4 = | y |, obj5 = | y |
66+
| z-3 | | z+1 | | y | | z | | z |
6767
6868
We have that:
6969
@@ -371,7 +371,8 @@ def distance(self, other):
371371
# symbolic Lt or Gt operations,
372372
# Note: Boolean is split to make the conditional short
373373
# circuit more frequently for mild speedup.
374-
if smart_lt(v, sit.symbolic_min) or smart_gt(v, sit.symbolic_max):
374+
if smart_lt(v, sit.symbolic_min) or \
375+
smart_gt(v, sit.symbolic_max):
375376
return Vector(S.ImaginaryUnit)
376377

377378
# Case 2: `sit` is an IterationInterval over a local SubDimension
@@ -403,22 +404,24 @@ def distance(self, other):
403404
ret.append(other[n] - self[n])
404405
else:
405406
ret.append(self[n] - other[n])
407+
elif sai in self.ispace and oai in other.ispace:
408+
# E.g., `self=R<f,[x, y]>`, `sai=time`,
409+
# `self.itintervals=(time, x, y)`, `n=0`
410+
continue
406411
elif not sai and not oai:
407-
# E.g., `self=R<a,[3]>` and `other=W<a,[4]>`
408412
if self[n] - other[n] == 0:
413+
# E.g., `self=R<a,[4]>` and `other=W<a,[4]>`
409414
ret.append(S.Zero)
410415
else:
416+
# E.g., `self=R<a,[3]>` and `other=W<a,[4]>`
411417
break
412-
elif sai in self.ispace and oai in other.ispace:
413-
# E.g., `self=R<f,[x, y]>`, `sai=time`,
414-
# `self.itintervals=(time, x, y)`, `n=0`
415-
continue
416-
elif not sai or not oai:
417-
# E.g sai=time, oai=None
418+
elif any(i is S.Infinity for i in (self[n], other[n])):
419+
# E.g., `self=R<f,[oo, oo]>` (due to `self.access=f_vec->size[1]`)
420+
# and `other=W<f,[t - 1, x + 1]>`
418421
ret.append(S.Zero)
419422
else:
420-
# E.g., `self=R<u,[t+1, ii_src_0+1, ii_src_1+2]>`, `fi=p_src`,
421-
# and `n=1`
423+
# E.g., `self=R<u,[t+1, ii_src_0+1]>`, `fi=p_src`, `n=1`
424+
# E.g., `self=R<a,[time,x]>`, `other=W<a,[time,4]>`, `n=1`
422425
return vinf(ret)
423426

424427
n = len(ret)

0 commit comments

Comments
 (0)