Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion devito/ir/clusters/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,15 @@ def _break_for_parallelism(self, scope, dim, timestamp):
if any(dep.is_carried(i) for i in candidates):
test0 = dep.is_flow and dep.is_lex_negative
test1 = dep.is_anti and dep.is_lex_positive
if test0:
# If the same access pair is not a flow under logical distance,
# the dep is a buffer/modulo-aliasing artifact and fission is OK
ldist = dep.source.distance(dep.sink, logical=True)
real_flow = (ldist > 0) or \
(ldist == 0 and dep.sink.lex_ge(dep.source))
if not real_flow:
test0 = real_flow
if test0 or test1:
# Would break a data dependence
return False

test = test or (bool(dep.cause & candidates) and not dep.is_lex_equal)
Expand Down
1 change: 1 addition & 0 deletions devito/ir/support/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ def d_flow_gen(self):
continue

distance = dependence.distance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover, or apply same style change to the other sibling methods

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually applies the same style as d_anti below that has the blank line but can remove blank line from both too if prefered

try:
is_flow = distance > 0 or (r.lex_ge(w) and distance == 0)
except TypeError:
Expand Down
28 changes: 24 additions & 4 deletions tests/test_dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
get_params, skipif
)
from devito import ( # noqa
NODE, Abs, ConditionalDimension, Constant, DefaultDimension, Derivative, Dimension,
Eq, Function, Ge, Grid, Inc, Lt, Operator, SparseTimeFunction, SubDimension,
TimeFunction, configuration, cos, dimensions, div, exp, first_derivative, floor, grad,
norm, sin, solve, sqrt, switchconfig, transpose
NODE, Abs, Buffer, ConditionalDimension, Constant, DefaultDimension, Derivative,
Dimension, Eq, Function, Ge, Grid, Inc, Lt, Operator, SparseTimeFunction,
SubDimension, TimeFunction, configuration, cos, dimensions, div, exp,
first_derivative, floor, grad, norm, sin, solve, sqrt, switchconfig, transpose
)
from devito.exceptions import InvalidArgument, InvalidOperator
from devito.ir import (
Expand Down Expand Up @@ -58,6 +58,26 @@ def test_scheduling_after_rewrite():
assert all(trees[1].root.dim is tree.root.dim for tree in trees[1:])


def test_scheduling_no_deriv():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe mention "interpolation" in the name, or it may go underestimated

grid = Grid((11, 11, 11))
x, y, z = grid.dimensions

image_vs = Function(name='image_vs', grid=grid, space_order=1, staggered=NODE)
p_back_xy = TimeFunction(name='p_back_xy', grid=grid, staggered=(x, y),
space_order=4, time_order=1, save=Buffer(1))

eqns = [Eq(image_vs, p_back_xy + image_vs),
Eq(p_back_xy.backward, p_back_xy)]

op = Operator(eqns)

assert_structure(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a brief comment explaining why fissioning in x is expected would be useful in the future?

op,
['t,x0_blk0,y0_blk0,x,y,z', 't,x1_blk0,y1_blk0,x,y,z'],
'tx0_blk0y0_blk0xyzx1_blk0y1_blk0xyz'
)


@pytest.mark.parametrize('expr,expected', [
('2*fa[x] + fb[x]', '2*fa[x] + fb[x]'),
('fa[x]**2', 'fa[x]*fa[x]'),
Expand Down
Loading