devitocodes / devito

DSL and compiler framework for automated finite-differences and stencil computation
http://www.devitoproject.org
MIT License
562 stars 228 forks source link

DSE/DLE with new StencilKernel #218

Closed mloubout closed 7 years ago

mloubout commented 7 years ago

Here is the setup to see the trouble with dse.

All bug can be reproduced by running acoustic_example.py for the adjoint3-0 branch with different parameters as follow.

1- Forward(save=True, dse='advanced'): (basic seems fine, dle OK)

  File "/Users/mloubout/Dropbox/London/CodeGen/devito/devito/dse/graph.py", line 142, in <lambda>
    return tuple(sorted(found, key=lambda i: v.lhs.indices.index(i)))
ValueError: tuple.index(x): x not in tuple

2- Born(legacy=False, dse={'advanced', 'basic'}): (dle OK)

  File "/Users/mloubout/Dropbox/London/CodeGen/devito/devito/dse/graph.py", line 177, in is_index
    queue.extend([self[i] for i in temporary.readby])
KeyError: u[t + 1, x, y, z]

3- Born(dle={'advanced', 'basic'}): Only the stencil in u is using omp/simd, the second stencil is treated as serial

4-Overall If the first stencil's LHS is not TimeData, the time loop limits are incorrect e.g replacing stencils = [eqn] + [gradient_update] + rec_add by stencils = [gradient_update] + [eqn] + rec_add leads to a segfault as the time loop starts at 0.

Let me know if you need more details.

FabioLuporini commented 7 years ago

Thanks, will take a look.

mloubout commented 7 years ago

Anyone looking at it? Let me know if there is something I can do.

mlange05 commented 7 years ago

PR #237 submitted. Can you please verify this solves your cases?

FabioLuporini commented 7 years ago

Can we close this?

mloubout commented 7 years ago

DSE/DLE fixed (seems like it), closing and opening new one on new problem I found :D