---
# System prepended metadata

title: '[GT4Py] DaCe backend'
tags: [cycle 18]

---

# [GT4Py] DaCe backend

###### tags: `cycle 18` <!-- Change to the current cycle number -->

- Shaped by: Christos, Edoardo, Peter, Philip
- Appetite (FTEs, weeks): 6 x 3
- Developers: Christos, Edoardo, Philip

## Problem
<!-- The raw idea, a use case, or something we’ve seen that motivates us to work on this -->
In the context of GT4Py/DaCe integration, we have defined a set of tasks in scope for next cycle(s). Some of these tasks have as objective the functional coverage of icon4py stencils in the atmosphere module; other tasks have an eductional objective, to get hands-on experience with DaCe, and are not necessarily related to the GT4Py backend.
- [ITIR pass for field domain offsets](https://hackmd.io/n-uPcaDwTNahIKNwrpZYwQ)
- [ITIR pass to replace invalid identifiers](https://hackmd.io/9aV2DpvKRtKtkOuy_7USKA)
- Support of icon4py stencils but limited to the atmosphere model. Enable DaCe auto-optimize heuristics on fused stencils, with both CPU and GPU targets.
- DaCe feature for SourceLocationGroup: on GT4Py side, add debug information to SDFG; on DaCe side, enable propagation and merge of debug information in SDFG transformations.
- DaCe issue in CPU codegen after auto-optimize in icon4py SDFGs (Edoardo)
- DaCe issue in GPU codegen [#1388](https://github.com/spcl/dace/issues/1388).
- DaCe issue in SDFG transformation [#1272](https://github.com/spcl/dace/issues/1272)
- DaCe issue related to function call [#1389](https://github.com/spcl/dace/issues/1389)
- JAX-to-DaCe, shaped as a CSCS internship proposal [here](https://hackmd.io/84NQjpebS8KXLB9_0PmhIA)

This list of tasks was discussed on 2023-10-31 (see [meeting notes](https://hackmd.io/ffupzhO6TDig7nPU_cJpyQ)). It is not a commitment for cycle 18, but a scope of interesting tasks with respect to the two objectives stated above.


## Appetite
<!-- Explain how much time we want to spend and how that constrains the solution -->
The tasks listed above should keep 3 developers (Christos, Edoardo and Philip) busy for the entire cycle. Additional help is probably needed from Peter for review of PRs in DaCe backend and from Till for review of the ITIR passes.

## Solution
<!-- The core elements we came up with, presented in a form that’s easy for people to immediately understand -->

## Rabbit holes
<!-- Details about the solution worth calling out to avoid problems -->

## No-gos
<!-- Anything specifically excluded from the concept: functionality or use cases we intentionally aren’t covering to fit the ## appetite or make the problem tractable -->

## Progress
<!-- Don't fill during shaping. This area is for collecting TODOs during building. As first task during building add a preliminary list of coarse-grained tasks for the project and refine them with finer-grained items when it makes sense as you work on them. -->
As soon a task from the above list is started, we would like to track its progress in this section.

- [ ] Icon4py stencils in the atmosphere model
    - [x] Enable DaCe auto-optimize heuristics
        - [x] (Edoardo) CPU codegen
            - [x] [GT4Py] ITIR transformation to inline lambda args [#1370](https://github.com/GridTools/gt4py/pull/1370)
            - [x] [GT4Py] Fix to support full-inlined ITIR with unrolled reduce in PR [#1377](https://github.com/GridTools/gt4py/pull/1377), [#1381](https://github.com/GridTools/gt4py/pull/1381), [#1399](https://github.com/GridTools/gt4py/pull/1399)
            - [x] [DaCe] SDFG compile error on DaCe v0.15 addressed in DaCe PR [#1434](https://github.com/spcl/dace/pull/1434) 
        - [x] (Edoardo) GPU codegen
            - [x] [GT4Py] Enable GPU tests with DaCe backend in PR [#1360](https://github.com/GridTools/gt4py/pull/1360)
            - [x] [DaCe] Working on SDFG compile error reported in [#1388](https://github.com/spcl/dace/issues/1388)
    - [ ] Bumb DaCe version from 0.14.4 to 0.15.1
        - [ ] (Edoardo) Need to fix cartesian tests in PR [#1391](https://github.com/GridTools/gt4py/pull/1391)
    - [ ] Support for temporaries
        - [ ] (Edoardo) Update to SDFG generation [#1351](https://github.com/GridTools/gt4py/pull/1351)
        - [ ] [ITIR pass to replace invalid identifiers](https://hackmd.io/9aV2DpvKRtKtkOuy_7USKA)
- [x] DaCe feature for SourceLocationGroup
    - [x] (Christos) on GT4Py side, add debug information to SDFG. WIP: For more info check my branch [here](https://github.com/kotsaloscv/gt4py/tree/more_debinfo).
        - [X] Already added Source Location to ITIR nodes
        - [x] The **Go to source** button in the VS Code Extension now redirects towards the user code.
        - [x] Discuss about multiple source location, i.e. user code & SDFG API. 
    - [x] on DaCe side, enable propagation and merge of debug information in SDFG transformations
- [x] (Philip) DaCe issue related to function call ([issue #1389](https://github.com/spcl/dace/issues/1389) [PR #1420](https://github.com/spcl/dace/pull/1420))
- [ ] JAX-to-DaCe
    - [x] (Christos, Philip) Study of JAX representation
