# Nested reductions & compiled backends cleanup ###### tags: `functional cycle 12` In the last cycle many improvements have been implemented to enable the development of the unstructured FVM dycore. This includes support for unstructured using the C++ backend and support for nested reductions. These changes were never merged and live on a seperate [feature branch](https://github.com/GridTools/gt4py/pull/965) in an unclean state. ## Goals - Enable all currently disabled tests for the GTFN backend (merged into functional branch). - Allow API tuple arguments, fields with origin and index_fields (gt::positional) when using the GTFN backend (merged into functional branch). - Fix nested reductions (keep as a separate feature branch, as the approach needs to be revisited). ## Steps - Till: Factor out support for unstructured into a seperate PR and merge it into functional. - Till: Factor out nested reductions and put them into a seperate PR that will live in a feature branch until the design decisions made there are approved. Afterwards cleanup the branch (not meaningful before decision). - Implement support for - API tuple arguments - Fields with origin - index_fields ## Appetite Full cycle. ## What is already there What is already there: 1. Proof of concept implementation that drastically reduces the complexity of the lowering from FOAST to ITIR. 2. Chained remaps `field(Offset1[0])(Offset2[0])` 3. Fix for nested reductions using new `ignore_shift`, `translate_shift` builtins in ITIR. Requires 1. 4. Several improvements to ITIR `apply_common_transforms` pass - Non-recursive option to `InlineLambdas` pass - Non-opcount-preserving option to force inline lift calls in `InlineLambdas` pass - Simplification of `InlineLifts` pass - `RemoveShiftsTransformer` and `PropagateShiftTransformer` passes to remove newly introduced `ignore_shift` and `translate_shift` builtins (such that the lowering continues to work with the C++ backend). - Improvements to `UnrollReduce` pass that supports nested reductions. Requires change `reduce` signature to have an offset label argument over which we reduce. 5. Support for unstructured shifts in the C++ backend (by passing neighbor tables to the generated C++ code). 6. Full support for neighbor fields as program arguments in the C++ backend (requires *3.*). 7. Caching for compiled fencils.