---
# System prepended metadata

title: GT4Py Declarative DaCe backend
tags: [functional cycle 13]

---

# GT4Py Declarative DaCe backend 

###### tags: `functional cycle 13`


* Developers: Peter + Linus' supervision
* Appetite: Full cycle

## Background

The `gt4py.cartesian` toolchain has two backends that are based on DaCe, one for CPU (`dace:cpu`) and one for GPU (`dace:gpu`). Further, stencils were `SDFGConvertible`. Since the Cartesian functionality is now only maintained but not further developed by CSCS, and the interest of development is exclusively on a new frontend and toolchain, it will be of interest to be able to continue the success that the DaCe orchestration has brought, especially in light of the ICON application that is the main driver for the current development of GT4Py. 

## Implementation Details

In `gt4py.declarative` there are stencils and there are more procedural codes with assigning stencils to a computation domain. Building on the approach we took in `gt4py.cartesian`, stencils would become library nodes, that can be annotated to specify their expansion strategy, such as loop orders, tiling schemes, software caching etc. 

## Expected steps
This is considered a "research" project in ShapeUp terminology. It is more important to learn about possibilities and design choices than to reach a certain state or product. A natural order, if things go well is as follows
 
1. Implement support for simple expansions for simple (pointwise) stencils such as a copy stencil.
   This includes calling SDFGs seamlessly through the same frontend and API as other existing backends. 
1. Simple Cartesian stencils (using the `gt4py.declarative` toolchain). 
1. Adding lookup table based neighbor access.

## Rabbit Holes and Non-Goals
* A shippable product is not the goal
* While ultimately, this should enable DaCe orchestration, and as such an evaluation of the feasibility of achieving that in the current state of the `gt4py.declarative` toolchain is desirable, the focus here is not on orchestration.

### comments / meeting notes 18/01/2023
* Onboarding: Without guidance 4-6 weeks, with crash course: faster
* Onboarding plan
    1. Use docs as teaching materials (couple of days):
        * https://spcldace.readthedocs.io/en/latest
        * https://github.com/spcl/npbench
    2. Last years work: FV3+Library nodes
    3. Start design, get something basic working, like copy stencil or laplace
    4. 

### comments / meeting notes 12/01/2023
* Interest for SPCL: How to get from a CPU graph to a GPU graph. Propose to show 2 graphs for some supported applications: 
    * stencil_benchmarks
    * GTBench
    * FV3: The partial expansion problem:
        * d_sw or fvtp2d: k outermost
        * rieman solver: j outermost
    * Set up meeting @ ETH Zentrum to discuss
* Wednesday 4pm renewed

