Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npir backend #300

Merged
merged 136 commits into from
Jul 13, 2021
Merged

Npir backend #300

merged 136 commits into from
Jul 13, 2021

Conversation

DropD
Copy link
Contributor

@DropD DropD commented Jan 5, 2021

Description

Numpy backend for the gtc pipeline. Supports all features up to and including lower dimensional fields.

Rico Häuselmann and others added 30 commits October 1, 2020 14:42
- switched to the existing DebugModuleGenerator
- implemented codegen with python for loops
- ranges are aalways the full domain
- lap codegen working, need to check loop bounds
* split stencil and computation modules
* add file info pass
* make gtir nodes immutable
* update unit tests for stencil object snippet generators
* naive python ir and translator from gtir
* pnir -> python ast
* [wip/exp] stencil module via AST
* [wip] code generator wiring & fix linter errors

Co-authored-by: Rico Häuselmann <ricoh@cscs.ch>
* complete python code generation path
* move `gtc` related modules into `gt4py.gtc` subpackage
* move `gtc` related tests into `tests/unittests/test_gtc`

Co-authored-by: Rico Häuselmann <ricoh@cscs.ch>
Co-authored-by: Rico Häuselmann <ricoh@cscs.ch>
- Replace horizontal loop by ParAssignStmt (parallel model)
- Remove stencil indirection (as unused in current GT4Py)
- Add IfStmt, ScalarAccess
- introduce dtype propagation
- add logical, comparison and better type propagation
- scalar vars and keyword args in defir
- use SymbolName/SymbolRef

Co-authored-by: Johann Dahm <johann.dahm@gmail.com>
Move common nodes to common module and introduce generics for Exprs and Stmts.

Unrelated change:
- Add expr_kind to each node which is either `FIELD` or `SCALAR` to distinguish between scalar and field `if`s because of their different semantics and limitations in the GTScript parallel model.

Co-authored-by: Rico Haeuselmann <r.haeuselmann@gmx.ch>
As discussed, the extra nesting of `Stmt`s in `VerticalInterval` in `VerticalLoop` doesn't provide extra semantic information. Simplifies the IR and makes it compatible with the current Definition IR.
add type inferral pass for field access in GTIR
NPIR and generator: copy and simple arithmetic stencils.
use textwrap.dedent to represent multiline template strings.
GTC: introduce NativeFuncCall
GTC: Add cast node

Co-authored-by: Rico Haeuselmann <r.haeuselmann@gmx.ch>
Adds the GridTools C++ 2.x IR and codegenerator.
@DropD
Copy link
Contributor Author

DropD commented Jul 6, 2021

It seems all tests pass except in the regression test for vertical advection dycore for gtc:dace there is a numerical drift introduced, slightly larger than tolerance. I assume it has something to do with the OIR optimizations code reuse, but I can't tell why or even if it may just be acceptable.

edit: The problem was an incompatible version of dace. Has been pinned to an older commit by #456.

Comment on lines +52 to +54
oir = OirPipeline(gtir_to_oir.GTIRToOIR().visit(gtir)).full(
skip=[GreedyMerging().visit, NoFieldAccessPruning().visit]
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DropD DropD requested a review from jdahm July 9, 2021 15:36
@DropD
Copy link
Contributor Author

DropD commented Jul 12, 2021

bors try

bors bot added a commit that referenced this pull request Jul 12, 2021
@DropD DropD removed the request for review from havogt July 12, 2021 14:10
@bors
Copy link

bors bot commented Jul 12, 2021

try

Build failed:

Copy link
Contributor

@jdahm jdahm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@DropD DropD merged commit 5e96af0 into GridTools:master Jul 13, 2021
egparedes pushed a commit that referenced this pull request Sep 4, 2024
`MaskInlining` will be a key feature of the improved gt4py / DaCe bridge
as envisioned in GEOS-ESM/NDSL#53, which will
propagate more control flow elements from gt4py to DaCe. We thus want to
make sure if `MaskInlining` itself is posing any problems. We tracked
the git history of this explicit exclude back to PR
#300, which not only added the
npir backend, but also refactored how pipeline stages are defined.
Previous to this PR optimization passes to be specified explicitly and
the PR changed this to an exclude list. It looks like the `MaskInlining`
pass was added after the list of optimization passes was formed and thus
excluded (to keep the list constant). From this history we thus don't
expect `MaskInlining` to break anything.

Co-authored-by: Roman Cattaneo <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants