Skip to content

[Refactor | Feature] Introducing NDSL backend#370

Merged
romanc merged 51 commits into
NOAA-GFDL:developfrom
FlorianDeconinck:feature/NDSL_Backend
Mar 4, 2026
Merged

[Refactor | Feature] Introducing NDSL backend#370
romanc merged 51 commits into
NOAA-GFDL:developfrom
FlorianDeconinck:feature/NDSL_Backend

Conversation

@FlorianDeconinck
Copy link
Copy Markdown
Collaborator

@FlorianDeconinck FlorianDeconinck commented Jan 26, 2026

🚀 BREAKING CHANGE - Scheduled for 2026.02.00

Description

Historically backend argument has always directly related to gt4py's backend. But with time and more and more usage of dace, we have added orchestration, leading to a split in the concept.

Also, we are more and more specializing code/optimizations by backend which calls for centralization.

Lastly, the backend naming scheme makes sense for the framework developer (of gt4py or dace) but not for the ndsl user.

This PR aims at introducing a NDSL backend concept solving all the above:

  • unified gt4py/dace entry point
  • simplified naming scheme
  • shortcuts to common used backend both by naming scheme and via API
  • extensible class to embed future optimization pipeline and/or key specific code

Also:

  • deprecate gt4py_utils.is_gpu_backend in favor of inlined Backend.is_gpu_backend
  • deprecate gt4py_utils.is_fortran_aligned in favor of inlined Backend.is_fortran_aligned

How has this been tested?

Unit tests will run and decide it's fate.

pyFV3 update PR | pySHiELD update PR | pace update PR

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. add new modules to docs/docstrings/)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included

@FlorianDeconinck FlorianDeconinck changed the title [Refactor | NDSL] Introducing NDSL backend [Refactor | Feature] Introducing NDSL backend Jan 26, 2026
@FlorianDeconinck FlorianDeconinck added Refactor Technical internal work to improve systems Scheduled for next Release To be merged before the next release labels Jan 26, 2026
@FlorianDeconinck
Copy link
Copy Markdown
Collaborator Author

FlorianDeconinck commented Jan 27, 2026

This is ready for a first review @twicki / @romanc

It's MASSIVE change, focus on config/backend.py which is the true change that gets propagated everywhere.

ToDo:

  • A unit tests (?)
  • Branch out pyFV3, pySHiELD, Pace with a "2026.02.00" update and tests further with backend properly swapped

Copy link
Copy Markdown
Collaborator

@romanc romanc left a comment

Choose a reason for hiding this comment

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

This refactor is so overdue - thanks digging in!

Two general comments w.r.t. the planned API refactor #243

  1. Where does ndsl/config/backend.py fit into the newly thought directory structure?
  2. Is it possible to avoid from ndsl import Backend inside NDSL? Might not be possible, but if we can avoid it now, we have less work later. I've only seen two of these imports: in dace_config.py and refine_transients.py.

For docs, the entry in mkdocs.yaml and the "corresponding md file" are missing. We need to automate / tool this up in the future ... it's too much manual work and easily forgotten.

Comment thread ndsl/config/__init__.py Outdated
Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/config/backend.py Outdated
Comment thread tests/test_g2g_communication.py Outdated
Comment thread tests/test_g2g_communication.py Outdated
Comment thread tests/test_g2g_communication.py Outdated
Comment thread tests/test_g2g_communication.py Outdated
Comment thread tests/test_g2g_communication.py Outdated
Copy link
Copy Markdown
Collaborator

@romanc romanc left a comment

Choose a reason for hiding this comment

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

Thanks for all the changes. I was starting to think how we are going to merge this PR with as little CI disruption as possible. I'd propose the following process

  • with this PR, we skip the CI hooks to pyFV3, pySHiELD, and pace
  • we prepare PRs in pyFV3, pySHiELD, and pace to update to NDSL 2026.02.00 (those could be used1 to check that this PR doesn't break anything after updating)
  • we merge this PR as the last one before the February release
  • we release NDSL 2026.02.00
  • we update pyFV3, pySHiELD, and pace to 2026.02.00
  • we re-enable the CI hooks in NDSL as the first PR after the release

What do you think? Too much over-engineering and -thinking?

Footnotes

  1. by temporarily pointing the CI hooks of NDSL towards these branches instead of skipping them.

Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/config/backend.py
Comment thread ndsl/config/backend.py
Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/config/backend.py Outdated
Comment thread ndsl/quantity/quantity.py
Comment thread tests/dsl/dace/stree/optimizations/test_merge.py Outdated
Comment thread tests/dsl/dace/stree/optimizations/test_merge.py Outdated
Comment thread tests/dsl/test_compilation_config.py Outdated
Comment thread tests/config/test_backend.py
@FlorianDeconinck
Copy link
Copy Markdown
Collaborator Author

pyFV3 PR testing this PR

@FlorianDeconinck
Copy link
Copy Markdown
Collaborator Author

pySHiELD testing branch

@FlorianDeconinck
Copy link
Copy Markdown
Collaborator Author

PR ready for show.

⚠️ BEFORE MERGE TURN THE CI BACK ONTO develop, THEN FORCE MERGE ⚠️

Copy link
Copy Markdown
Collaborator

@romanc romanc left a comment

Choose a reason for hiding this comment

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

Looking good 🥳

Comment thread tests/dsl/test_stencil_wrapper.py Outdated
@romanc romanc force-pushed the feature/NDSL_Backend branch 3 times, most recently from 8889d58 to f252102 Compare March 4, 2026 10:39
Required status checks require us to run these exact hooks (admins might
have powers that I don't have). However, what we can is to point to any
fork and just have a noop workflow there. This way we can merge and
release. Once released and updated, we can restore the default hooks.
@romanc romanc force-pushed the feature/NDSL_Backend branch from f252102 to 01e8717 Compare March 4, 2026 10:44
@romanc romanc enabled auto-merge March 4, 2026 10:46
@romanc romanc added this pull request to the merge queue Mar 4, 2026
Merged via the queue into NOAA-GFDL:develop with commit d896a9d Mar 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Technical internal work to improve systems Scheduled for next Release To be merged before the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants