---
# System prepended metadata

title: '[GT4Py] Complete first iteration of GTIR-DaCe'
tags: [cycle 26 - 11/24]

---

# [GT4Py] Complete first iteration of GTIR-DaCe

<!-- Add the tag for the current cycle number in the top bar -->

- Shaped by:
- Appetite (FTEs, weeks): full cycle
- Developers: <!-- Filled in at the betting table unless someone is specifically required here -->

## Problem

GTIR fieldview is still missing a few features to fully support ICON4Py:
- scan
- as_offset (dynamic shift)
- concat_where (conditional execution on domain)

The implementation in this cycle aims only on supporting the ICON4Py use-cases. The features will not be conceptually clean, see below.

## Appetite
<!-- Explain how much time we want to spend and how that constrains the solution -->

## Solution

### scan

Scan is lowered to the local (itir-like) structure, support for a field-view like scan is postponed.

DaCe-lowering will implement the same solution as in the dace-itir lowering, based on DaCe LoopRegion construct in SDFG.

### as_offset

We will not solve the conceptual problem of inferring the domain described in https://github.com/GridTools/gt4py/issues/1676.

The solution for now will be inlining expressions below a shift with an `as_offset` field.

The DaCe lowering should be ready to support GTIR that is partially local-view.

### concat_where

The implementation with limited support for domains started in https://github.com/GridTools/gt4py/pull/1713.

Domains will be limited to single Dimension comparisons of the form `I < 5` that do not create non-contiguous Domains.

### Additionaly features to bring GTIR-DaCe to feature parity with Embedded-GTIR

- `index`: the lowering should be straightforward
- fully-symbolic fieldop domain: might require some major refactoring, either we do this at beginning of the cycle or at the end. (review PR [#1735](https://github.com/GridTools/gt4py/pull/1735))


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

## No-gos

As described, the builtins will require more conceptual work in the future, which is explicitly excluded in this project.

## 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. -->

- [x] DaCe lowering
    - [x] [refact] Build on the solution chosen for GTIR Embedded (`offset_type`, see [PR1703](https://github.com/GridTools/gt4py/pull/1703)) to return information about the local dimension.
    - [x] Lowering of field operators with non-zero-aligned domain.
        - In other words, allocate array for field domain range between lower and upper bound (requires alternative solution for array offset)
    - [x] Lowering of `as_offset` (awaiting PR [#1738](https://github.com/GridTools/gt4py/pull/1738))
    - [x] Lowering of `index`
    - [ ] Lowering of `scan`
    - [ ] Lowering of `concat_where` (GTIR not ready)
- [ ] Task 2
    - [x] Subtask H
    - [ ] Subtask J
- [ ] Discovered Task 3
    - [ ] Subtask L
    - [ ] Subtask S
- [ ] Task 4

