---
# System prepended metadata

title: Complete fn code generation
tags: [functional cycle 8]

---

# Complete fn code generation

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

appetite: 1 week (Hannes?)

## Progress

- [x] fix don't inline into closure
- [x] CUDA backend
    - [x] allow specification of backend
    - [x] add testing
- [ ] consider generalizing dimensions for Cartesian or add check
- [ ] Temporaries
    - [ ] Consume popped-up temporaries
    - [ ] Generate allocation
- [ ] can_deref vs can_shift: currently a simplified transformation, generalize or restrict input?
- [ ] Scan
    - [ ] Example in gtfn_ir with prologue, epilogue and projector
    - [ ] adapt code generator

## Goal

Complete the code generator such that all valid Iterator IR programs can be generated and executed in the `fn` C++ backend.

## Current state

There is a prototype implementation on GitHub https://github.com/GridTools/gt4py/pull/669 which contains
- a `gtfn_ir` which is a variant if iterator IR
- a code generator with limitations
- testing with driver code in C++

## Steps

- Cleanup and merge the current supported patterns
- Expand `gtfn_ir` and generator to support scans (starting from a gtfn_ir program to decouple from the Scan project).