DescriptionThis paper concerns performance optimization in finite-difference solvers found in seismic imaging. We tackle a complicating factor that is arising in seismic inversion problems: the addition of waves injected from sources distributed sparsely over the 2D/3D domain, and the need for receivers that interpolate data measurements at a set of points, again distributed sparsely across the domain. In this work we show how to overcome this limitation. We introduce an algorithm for a loop nest transformation policy applied to wave propagation in order to improve data locality and optimize our cache memory use. Our algorithm uses an inspector/executor scheme capable of inspecting measurement operations at sparse locations and then compute the field updates. The ultimate goal of this ongoing work is to automate this scheme for stencil codes generated by Devito.