-
Notifications
You must be signed in to change notification settings - Fork 147
Syntax support for Structures, refactor C argument construction
#2185
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Structures, refactor C argument construction
phschaad
approved these changes
Oct 29, 2025
Collaborator
phschaad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced Oct 30, 2025
philip-paul-mueller
added a commit
to GridTools/gt4py
that referenced
this pull request
Nov 4, 2025
This PR changes how calls to the underlying `CompiledSDFG` objects are carried out. Before, the implementation heavily relied on the internal data format of the DaCe class. However a recent [change in DaCe](spcl/dace#2185) changed this internal data leading to errors, that had to [be patched](GridTools/dace#9). This PR introduces a more stable fix and builds upon a [refactoring in DaCe](spcl/dace#2206) that beside other things, exposes the tools that were needed by GT4Py to work independently of the internals. For that reason this PR also updates the DaCe dependency to `2025.11.04`. The main change is, that the argument vector, i.e. the C representation of the arguments used for the call, are no longer managed by `CompiledSDFG` but instead by GT4Py's `CompiledDaceProgram`. Co-authored-by: edopao <[email protected]>
sophieblock
pushed a commit
to sophieblock/dace
that referenced
this pull request
Nov 18, 2025
…cl#2185) Refactors C argument construction outside of the CompiledSDFG module. Cleans up the code and additionally enables easy Python structure construction via the following syntax: ```python # Create data structure CSR = dace.data.Structure(dict(indptr=dace.int32[M + 1], indices=dace.int32[nnz], data=dace.float32[nnz]), name='CSRMatrix') # Create a usable argument in calling generated code s = CSR.make_argument(indptr=arr1, indices=arr2, data=arr3) # Or from a live object s = CSR.make_argument_from_object(a) # DaCe programs can be called directly dace_program(s) ``` Syntactic sugar for creating `Structure`s from `dataclass`es is also supported: ```python @DataClass class Inner: a: dace.float32[20] b: dace.int32 @DataClass class Outer: x: Inner y: dace.float64[10, 10] Struct = dace.data.Structure.from_dataclass(Outer) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors C argument construction outside of the CompiledSDFG module. Cleans up the code and additionally enables easy Python structure construction via the following syntax:
Syntactic sugar for creating
Structures fromdataclasses is also supported: