-
Notifications
You must be signed in to change notification settings - Fork 49
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
refactor[cartesian]: unexpanded sdfg cleanups #1843
Open
romanc
wants to merge
5
commits into
GridTools:main
Choose a base branch
from
romanc:romanc/unexpanded-sdfg-cleanups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
0b75c61
to
e6798c9
Compare
Forward debug info from gt4py to dace if we know it. If we don't know, just don't specify instead of setting `DebugInfo(0)`. Moved `get_dace_debuginfo()` one folder higher from expansion utils into "general" dace utils because its not only used in expansion.
Transients are added in OirSDFGBuilder, where no array lifetime is configured. After building that SDFG, the lifetime of all transients is manually set to `Persistent` (which is an optimization leading to less frequent memory allocation in case a kernel is called multiple times). In this commit we directly specify the transient's lifetime when building the SDFG.
76c47ad
to
c7aba86
Compare
For GPU targets, we have to configure the `storage_type` for transient arrays. In addition, we have to set the library node's `device` property. We can do both while building the SDFG instead of separate passes afterwards.
romanc
commented
Feb 3, 2025
Comment on lines
+36
to
+44
transient_storage_per_device: Dict[Literal["cpu", "gpu"], dace.StorageType] = { | ||
"cpu": dace.StorageType.Default, | ||
"gpu": dace.StorageType.GPU_Global, | ||
} | ||
|
||
device_type_per_device: Dict[Literal["cpu", "gpu"], dace.DeviceType] = { | ||
"cpu": dace.DeviceType.CPU, | ||
"gpu": dace.DeviceType.GPU, | ||
} |
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.
Should we have a named type for Literal["cpu", "gpu"]
? I found it typed like in the LayoutInfo
gt4py/src/gt4py/storage/cartesian/layout.py
Lines 33 to 37 in ac253b6
class LayoutInfo(TypedDict): | |
alignment: int # measured in bytes | |
device: Literal["cpu", "gpu"] | |
layout_map: Callable[[Tuple[str, ...]], Tuple[Optional[int], ...]] | |
is_optimal_layout: Callable[[Any, Tuple[str, ...]], bool] |
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.
Description
Refactors from recent debugging sessions around transient arrays in the "unexpanded SDFG" (the one with the library nodes):
**kwargs
fromOirSDFGBuilder
OirSDFGBuilder
OirSDFGBuilder
(for GPU targets)LibraryNode
's device type directly inOirSDFGBuilder
(for GPU targets)Sidenote on the allocation lifetime: In the orchestrated code path, we reset the allocation lifetime of transients to
SDFG
when we freeze the stencil with origin/domaingt4py/src/gt4py/cartesian/backend/dace_backend.py
Lines 270 to 317 in ac253b6
This might be relevant when tracking down orchestration performance. Seems odd at least.
Requirements
Covered by existing tests
N/A