---
# System prepended metadata

title: Scan Canonicalization & Lowering
tags: [functional cycle 8]

---

# Scan Canonicalization & Lowering

###### tags: `functional cycle 8`

shaped by: Felix

appetite: see below, 1 developer (Felix) + support for design

## Canonicalization of Iterator IR and Lowering for Simple Case

appetite: rest of cycle

### Motivation

The C++ backend knows how to deal with stencil-like computations and how to deal with vertical sweeps (scans and folds). However, there is no mixed execution strategy; that is, each fencil has to be canonicalized into a form where each closure is representing either a stencil-like or a scan-like computation.

### Steps

1. Defining the required canonical form
2. Finding a transformation that can put any valid IR into this form (probably similar to the lifts-to-temporary transform)
3. Implementing and testing the transformation
4. Lowering to the C++ backend: only support special case of single prologue
5. Optional: Expand special lowering to the general case.

### Status

Core work done, some open questions with respect to IR.