-
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
Storage reduction pass #203
Closed
Closed
Changes from 96 commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
4ac03ef
Fix CuPy invalid argument error in 'GPUStorage' class
51a06bb
Merge branch 'gpu_storage_fix' into storage_reduction
7584678
Add initial ReduceTemporaryStoragesPass
1cb1a94
Implement ReduceTemporaryStoragesPass.StorageReducer inner class
b98eba0
Implementing 2D fields in 'numpy' backend
ea5e01f
Comment some code
37fbb54
Modify StorageReducer to skip 3D->2D reductions for parallel multistages
e887464
Merge with master
d2a57ca
Implement I-J storage in numpy backend
d33068f
Implement IJ storages in 'debug' backend
7ecb778
Add tests to reproduce FORWARD bug in 'DemoteLocalTemporariesToVariab…
5f55d19
Merge branch 'master' into forward_loop_fixes
4478e9b
Modify NormalizeBlocksPass to put each statement in own stage for all…
944bc5c
Apply pre-commit formatting
2a5ce47
Revert "Apply pre-commit formatting"
51ab61c
Apply pre-commit formatting
914c7bc
Merge branch 'forward_loop_fixes' into storage_reduction
456caf9
Add NumpyBackend.range_args to track when new K loops need to be gene…
d44d7e9
Add 'axes' to 'field_attributes'
84abff0
Merge from master
39832d4
Add support for 2D storages to GT backends
c55fcf8
Merge branch 'master' into storage_reduction
daaa8bc
Merge from master
502f413
Collect fields to reduce before applying reductions
32f7631
Mark parallel fields so they will not be reduced
8ca99c0
Refactor to include all parallel fields
d2b42bd
Only reduce fields that do not span multiple multistages
32dcd27
Tracking full fields not necessary if multi_stage spanning fields are…
1e9f336
Revert last commit
7101d61
Clear 'range_args' between parallel regions
0c22b62
Add 'test_reduce_temporary_storages_pass' test
f1c0094
Refactor lower dim storages to use gt::selector
f30f7b3
Update field extents from accessors
09c042d
Merge branch 'master' into storage_reduction
352fdac
Merge from master
1f4e761
Fix merge_blocks_pass
jdahm 987d9cc
Fix StageMergingWrapper.has_incompatible_intervals_with to return Tru…
020b4b2
Merge branch 'master' into storage_reduction
34e42a0
[wip]: more general definition setup
ac208f6
Add asserts to test
jdahm 12c312a
Merge branch 'bugfix/multistage-data-dependencies' of github.com:jdah…
jdahm 0303cbc
Use itertools.chain.from_iterable
jdahm 4655ea3
Merge branch 'bugfix/multistage-data-dependencies' of https://github.…
db914b8
Assert statement order in 'test_no_merge_with_overlapping_intervals'
babf61d
generalize test setup for stencil definitions
1efd90f
Merge remote-tracking branch 'jdahm/bugfix/multistage-data-dependenci…
9865c2a
Check data dependencies for parallel loops only
5192ac3
Revert previous change as too invasive
0c488ca
Merge branch 'bugfix/multistage-data-dependencies' of https://github.…
f67ab96
Do not reduce 3D to 2D temp field if k-intervals vary
6efa4f2
add ir_maker AugAssign test
083b66b
Merge remote-tracking branch 'jdahm/bugfix/multistage-data-dependenci…
8015f11
fix the ir maker AugAssign test
c3f3a55
fix IRMaker.visit_AugAssign
cc8f557
Merge branch 'master' into storage_reduction
65b4fa7
Apply pre-commit changes
d8962c8
Merge pull request #2 from DropD/bugfix/multistage-data-dependencies
jdahm 39a41d4
Rename PassType to AnalysisPass
jdahm 39cbd2a
Merge branch 'master' of https://github.com/GridTools/gt4py
5b39500
Merge branch 'master' into storage_reduction
605992f
Merge branch 'master' into bugfix/multistage-data-dependencies
jdahm 90caa58
Cleanup before PR
9e68fc5
Merge branch 'master' of https://github.com/GridTools/gt4py
8b1aafe
Merge branch 'master' into storage_reduction
d9af5aa
Merge branch 'bugfix/multistage-data-dependencies' of https://github.…
9e585fd
Merge branch 'master' of https://github.com/GridTools/gt4py
790e90d
Merge branch 'master' of https://github.com/GridTools/gt4py
d5258bc
Fix merge issue in 'definition_setup.py'
0a10344
Merge branch 'master' of https://github.com/eddie-c-davis/gt4py
882c114
Merge branch 'master' into storage_reduction
76042e5
Merge branch 'master' into storage_reduction
f754919
Merge branch 'master' of https://github.com/GridTools/gt4py
c78ff8b
Fix bad merge conflict resolution
3e6c8ab
Refactor 'ReduceTemporaryStoragesPass'
51ed63c
Merge branch 'master' of https://github.com/GridTools/gt4py
35cad3d
Merge branch 'master' into storage_reduction
74fd684
Commit correct version of passes.py
38e3fec
Expand 'test_reduce_temporary_storages_pass'
b07ef9a
Apply formatting
0540ca5
Merge branch 'master' of https://github.com/GridTools/gt4py
7a23e5a
Merge branch 'master' into storage_reduction
af9c25b
Replace '_reduce_fields' method with 'StorageReducer' visitor
c9ee5e0
Merge branch 'master' of https://github.com/GridTools/gt4py
f3523a5
Merge branch 'master' into storage_reduction
26a81f4
Fixes for 2D storages in numpy backend
d225e49
Enable lower dim data stores in GT backends
0c408e4
Merge branch 'master' of https://github.com/GridTools/gt4py
ec00dcd
Merge branch 'master' of https://github.com/GridTools/gt4py
806ef89
Merge branch 'master' into storage_reduction
53a60b9
Merge branch 'master' of https://github.com/GridTools/gt4py
b520408
Merge branch 'master' into storage_reduction
e5834e2
Fuse eligible k-loops in 'debug' backend
ad19e9e
Apply formatting
de4792b
Merge branch 'master' of https://github.com/GridTools/gt4py
3b8cb77
Add multi-stage constraint, documentation, and codegen test
a9435d5
Merge branch 'master' into storage_reduction
96e3ca2
Merge branch 'master' of https://github.com/GridTools/gt4py
b0cd02c
Merge branch 'master' into storage_reduction
ac1dd21
Implement reviewer feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ def __init__( | |
self.param_names = None | ||
|
||
self.var_refs_defined = set() | ||
self.range_args = [] | ||
|
||
def __call__(self, impl_node: gt_ir.Node, sources: gt_text.TextBlock): | ||
assert isinstance(impl_node, gt_ir.StencilImplementation) | ||
|
@@ -110,7 +111,7 @@ def __call__(self, impl_node: gt_ir.Node, sources: gt_text.TextBlock): | |
return self.sources | ||
|
||
def make_temporary_field( | ||
self, name: str, data_type: gt_ir.DataType, extent: gt_definitions.Extent | ||
self, name: str, data_type: gt_ir.DataType, extent: gt_definitions.Extent, axes: list | ||
): | ||
source_lines = [] | ||
boundary = extent.to_boundary() | ||
|
@@ -119,7 +120,10 @@ def make_temporary_field( | |
domain=self.domain_arg_name, d=d, size=" {:+d}".format(size) if size > 0 else "" | ||
) | ||
for d, size in enumerate(boundary.frame_size) | ||
if d < len(axes) | ||
) | ||
for i in range(len(extent) - len(axes)): | ||
shape += ", 1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
source_lines.append( | ||
"{name} = {np_prefix}.empty(({shape}), dtype={np_prefix}.{dtype})".format( | ||
name=name, np_prefix=self.numpy_prefix, shape=shape, dtype=data_type.dtype.name | ||
|
@@ -293,7 +297,7 @@ def visit_StencilImplementation(self, node: gt_ir.StencilImplementation): | |
field = node.fields[name] | ||
self.sources.extend( | ||
self.make_temporary_field( | ||
field.name, field.data_type, node.fields_extents[field.name] | ||
field.name, field.data_type, node.fields_extents[field.name], field.axes | ||
) | ||
) | ||
self.sources.empty_line() | ||
|
Oops, something went wrong.
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.
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.
This should use the
filter_mask
orNumericTuple.from_mask
after merging.