Skip to main content
QUICK REVIEW

[Paper Review] Architecture and performance of Devito, a system for automated stencil computation

Fabio Luporini, Michael Lange|arXiv (Cornell University)|Jul 9, 2018
Computational Physics and Python ApplicationsComputer Science7 citations
TL;DR

Devito is a domain-specific compiler framework that automatically generates highly optimized C++ code from high-level symbolic PDE expressions in Python, targeting stencil computations in scientific computing. It achieves performance competitive with hand-optimized code through advanced optimizations like common subexpression elimination, tiling, and parallelization, demonstrated on seismic imaging operators across modern architectures including Intel Xeon and KNL processors.

ABSTRACT

Stencil computations are a key part of many high-performance computing applications, such as image processing, convolutional neural networks, and finite-difference solvers for partial differential equations. Devito is a framework capable of generating highly-optimized code given symbolic equations expressed in Python, specialized in, but not limited to, affine (stencil) codes. The lowering process---from mathematical equations down to C++ code---is performed by the Devito compiler through a series of intermediate representations. Several performance optimizations are introduced, including advanced common sub-expressions elimination, tiling and parallelization. Some of these are obtained through well-established stencil optimizers, integrated in the back-end of the Devito compiler. The architecture of the Devito compiler, as well as the performance optimizations that are applied when generating code, are presented. The effectiveness of such performance optimizations is demonstrated using operators drawn from seismic imaging applications.

Motivation & Objective

  • To address the complexity and maintenance burden of hand-optimized stencil codes in scientific computing by enabling high-level specification of finite-difference methods.
  • To automate performance-critical optimizations—such as tiling, loop-level parallelization, and common subexpression elimination—through a compiler stack with multiple intermediate representations.
  • To enable performance portability across diverse HPC platforms, including CPUs, GPUs, and many-core systems, via modular code generation and backend integration.
  • To support complex, irregular loop nests and advanced PDE models (e.g., anisotropic wave equations) beyond standard stencil patterns.
  • To provide a productive, Python-based interface that integrates with scientific computing ecosystems while generating production-ready, high-performance code.

Proposed method

  • The Devito compiler uses a multi-layered intermediate representation (IR) stack to lower symbolic mathematical expressions into optimized C++ code.
  • It applies symbolic manipulation to reduce floating-point operations and eliminate redundant computations via advanced common subexpression elimination.
  • The system supports multiple backends, including the YASK stencil compiler and native C++ code generation, enabling portability across CPUs and accelerators.
  • It employs just-in-time (JIT) compilation and dynamic code generation, allowing on-the-fly optimization and runtime execution of generated kernels.
  • The framework supports complex loop structures, including nested and irregular loops, enabling modeling of diverse PDE-based simulations.
  • It integrates with established scientific software stacks, including SymPy for symbolic processing and NumPy for array operations.

Experimental results

Research questions

  • RQ1Can a high-level domain-specific language in Python generate C++ code for stencil computations that matches or exceeds the performance of hand-optimized implementations?
  • RQ2How effective are automated optimizations such as tiling, loop parallelization, and common subexpression elimination in improving performance across diverse HPC architectures?
  • RQ3To what extent can Devito achieve performance portability across CPUs, GPUs, and many-core systems without manual tuning?
  • RQ4What are the runtime and compilation overheads of on-the-fly code generation and auto-tuning in realistic scientific workloads?
  • RQ5How well does Devito scale and perform on complex, real-world seismic imaging operators involving high-order stencils and anisotropic media?

Key findings

  • Devito-generated code achieves performance competitive with hand-optimized implementations on state-of-the-art architectures, including Intel Xeon and KNL processors, as demonstrated on seismic imaging operators.
  • On the skl8180 platform, code generation and compilation for complex high-order TTI operators took less than 7 seconds, with shared object loading and argument validation adding negligible overhead.
  • Auto-tuning for performance configuration took 3 minutes on skl8180 and 15 minutes on knl7250, but these costs are amortized over production runs and are not prohibitive in practice.
  • Compilation times on the yask backend were comparable to the core backend, with similar performance characteristics, though some features like array temporaries remain unsupported.
  • The framework successfully generated optimized code for complex, irregular loop nests and heterogeneous expressions, including those from full-waveform inversion workflows.
  • The system demonstrates strong performance portability, with consistent optimization effectiveness across different backends and target platforms.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.