Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Feature | Orchestration] Optimizated C call overhead away, update pipeline, optimize CPU transient residency#348

Merged
FlorianDeconinck merged 10 commits intoNOAA-GFDL:developfrom
FlorianDeconinck:feat/dace_call_hash
Jan 7, 2026
Merged

[Feature | Orchestration] Optimizated C call overhead away, update pipeline, optimize CPU transient residency#348
FlorianDeconinck merged 10 commits intoNOAA-GFDL:developfrom
FlorianDeconinck:feat/dace_call_hash

Conversation

@FlorianDeconinck
Copy link
Collaborator

@FlorianDeconinck FlorianDeconinck commented Dec 29, 2025

Description

DaCe orchestration was plagued with a slow integration due to the routine marshalling python object (arrays as arguments but also closure) into C-binding ready pointers for calling into the C library

We originally cached everything at first call but that lead to instability: any re-allocation, different argument made to the same program silently fail and we reverted it.

This PR introduces a proper argument hashing that reduces the overhead to being negligible impact on runtime while keeping stability for changing arguments. The hypothesis goes as follows:

  • Closure do not change because we build and run or we expect pipeline to have taken care of this
  • Arguments are either NDSL owned (Quantity, State) or array_interface compatible (no DLPack yet)

This PR also updates the orchestration pipeline:

How has this been tested?

Unit tests and on the microphysics benchmark conducted with GEOS.

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 added the Enhancement New feature or request label Dec 29, 2025
@FlorianDeconinck FlorianDeconinck marked this pull request as draft December 29, 2025 22:50
@FlorianDeconinck
Copy link
Collaborator Author

Bringing back to draft: the hashing system operates under the assumption the types given to are the orchestrated code are NDSL's OR trivially hashable. I'll introduce a system that deactivates the hashing if we encounter none of those and warns once of performance degradation

@FlorianDeconinck FlorianDeconinck marked this pull request as ready for review December 30, 2025 15:41
@FlorianDeconinck
Copy link
Collaborator Author

Bringing back to draft: the hashing system operates under the assumption the types given to are the orchestrated code are NDSL's OR trivially hashable. I'll introduce a system that deactivates the hashing if we encounter none of those and warns once of performance degradation

Done. Ready for review.

Copy link
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.

Nice work! I think your assumptions are sound. Just a couple of nitpicks and questions inline.

stacklevel=2,
)
self.arguments = None # Flush arguments to force recompute
self._skip_hash = True # Skip future checks
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we call it once with non-hashable stuff and afterwards always hashable, _skip_hash never gets reset, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct, you are back to the safe-zone: arguments cached is always None and you go do the marshalling

if config.get_backend() == "dace:cpu_kfirst":
passes.extend(
[
CleanUpScheduleTree(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

at some point it might make sense to write full pipelines for backends that can get fetched from just the backend, but that is not for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I think one of the things a better Backend concept would be doing is carry it's default optimization !

@FlorianDeconinck FlorianDeconinck added this pull request to the merge queue Jan 7, 2026
Merged via the queue into NOAA-GFDL:develop with commit b49e6a0 Jan 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants