Dawn: a High-level Domain-Specific Language Compiler Toolchain for Weather and Climate Applications

Carlos Osuna, Tobias Wicky, Fabian Thuering, Torsten Hoefler, Oliver FuhrerSupercomput. Front. Innov 2020 · DOI

Introduction

Weather and climate simulations are critical for understanding our planet, yet they face a "performance portability" crisis. As scientists strive for higher horizontal resolutions—moving from 50km to 1km—computational demands increase eightfold. Simultaneously, the end of simple CPU scaling has led to a fragmented hardware landscape of many-core processors and GPUs. The Dawn toolchain addresses this by decoupling numerical algorithms from their parallel implementations, enabling high performance across diverse architectures without sacrificing code maintainability.

The Challenge of Hardware Divergence

Traditionally, domain scientists have had to manually annotate code with parallel directives like OpenMP or OpenACC. This approach leads to "millions of lines of code" that are hardware-specific, error-prone, and difficult to maintain. While existing Domain-Specific Languages (DSLs) offer some relief, many still require scientists to manage low-level concerns like data races and memory layouts.

The Dawn Toolchain Architecture

Dawn introduces a modular compiler architecture that allows scientists to write numerical methods in a descriptive, sequential manner.

The Dawn toolchain architecture, showing the flow from multiple frontends through the High-Level Intermediate Representation (HIR) to the Dawn compiler and final code generation.

The workflow consists of four primary stages:

  1. Frontends: Scientists use tools like GTClang to write "stencils" in C++. The code is written as if it were executing on a single point, abstracting away parallelism.
  2. High-Level Intermediate Representation (HIR): This language-agnostic format captures the mathematical intent of the stencil.
  3. The Dawn Compiler: The core of the system, which analyzes the HIR for data dependencies and transforms it into a Parallel IR. It applies sophisticated optimizations such as stage splitting, field versioning to prevent data races, and vertical register caching.
  4. Code Generation: The final stage produces optimized CUDA or GridTools code.

Sequential Semantics and Parallel Optimization

A key innovation in Dawn is the use of sequential semantics. By requiring users to write sequential code, the compiler gains the freedom to reorder, fuse, or split computation "stages" based on a global understanding of the dependency graph.

An example of the Parallel IR structure, illustrating how sequential statements are organized into Stages, IntervalComputations, and MultiStages.

As shown in the Parallel IR example, the compiler organizes computations into a hierarchy that maximizes data locality. For instance, "Stage Reordering" groups computations to keep data in fast caches, a task that would be prohibitively complex for a human to manage manually across a large codebase.

Performance and Maintainability Results

Dawn was evaluated using the COSMO model on the Piz Daint supercomputer. Compared to the previous state-of-the-art STELLA DSL:

  • Speedup: Dawn-generated CUDA code achieved up to a 2.62x speedup for specific operators like HoriAdvPPTP.
  • Complexity Reduction: The "fast waves" solver, which required 4,200 lines in STELLA, was reduced to just 800 lines in Dawn—a 5x improvement in maintainability.
  • Optimization Efficacy: Disabling automated compiler passes led to significant performance degradation, confirming that the toolchain's automated logic outperforms manual tuning.

Future Directions

While currently optimized for Cartesian grids, the Dawn team is expanding support to include cube-sphere and triangular grids used in global models like FV3 and ICON. Future iterations will also incorporate formal performance models to further refine memory access patterns across evolving hardware architectures.

Summary updated

BibTeX
@article{osuna2020dawn,
  author = {Carlos Osuna and Tobias Wicky and Fabian Thuering and Torsten Hoefler and Oliver Fuhrer},
  title = {{Dawn: a High-level Domain-Specific Language Compiler Toolchain for Weather and Climate Applications}},
  journal = {Supercomput. Front. Innov.},
  year = {2020},
  doi = {10.14529/jsfi200205},
}
Figure