-
Notifications
You must be signed in to change notification settings - Fork 13
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
Block-index injection transformations #303
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/303/index.html |
7b0f059
to
2bf86eb
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
==========================================
+ Coverage 95.12% 95.14% +0.02%
==========================================
Files 165 167 +2
Lines 35143 35374 +231
==========================================
+ Hits 33429 33656 +227
- Misses 1714 1718 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Really nice! And I just started to implement some transformation/utilities on top of/utilising the BlockIndexInjectTransformation
without encountering any problem.
Nevertheless, some comments regarding some typos and questions/suggestions (probably because I have not fully understood the BlockViewToFieldViewTransformation
)
paths=(blockview_to_fieldview_code[0],), config=config, seed_routines='driver', frontend=frontend | ||
) | ||
scheduler.process(BlockViewToFieldViewTransformation(horizontal, global_gfl_ptr=True)) | ||
scheduler.process(BlockIndexInjectTransformation(blocking)) |
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.
Could/should we add some tests/assertions to test the result/output of BlockViewToFieldViewTransformation
before applying BlockIndexInjectTransformation
? Like this only the combination of both transformation is tested?!
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.
Good point, and I'll also use those tests to mop-up the missing lines highlighted by the coverage report. Thanks!
2bf86eb
to
4d4f6ee
Compare
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.
First of all, apologies for the delay in reviewing this.
Many thanks, this looks great and I like the structure with the split into two transformation steps to separate generic and specific functionality.
I've left quite a few comments, some are already a couple of days old and therefore might be outdated by now, but they are mostly about details or documentation.
|
||
# First get rank mismatched call statement args | ||
vmap = {} | ||
for call in [call for call in FindNodes(ir.CallStatement).visit(body) if call.name in targets]: |
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.
for call in [call for call in FindNodes(ir.CallStatement).visit(body) if call.name in targets]: | |
for call in FindNodes(ir.CallStatement).visit(body): | |
if call.name in targets: |
f7153f9
to
cd8eed3
Compare
Thanks again @reuterbal for the derived-type enrichment fix 🙏 |
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.
Many thanks! Sorry for the kerfuffle around enrichment but I'm glad this solution works as I had a suspicion this was a symptom of an underlying bug.
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.
Very happy with this overall, so GTG from me.
I left a few comments about overall structure of the transformations
sub-package, but these are merely meant as commentary, as this change highlights the need for further restructuring.
|
||
# Sanitize the subroutine | ||
resolve_associates(routine) | ||
v_index = SCCBaseTransformation.get_integer_variable(routine, name=self.horizontal.index) |
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.
[no action] Note to self, these should be separated out into general utilities. The fact that this field trafo is calling into the SCC stack signals the problem.
parent = self.build_ydvars_global_gfl_ptr(parent) | ||
|
||
_type = var.type | ||
if 'gfl_ptr' in var.basename.lower(): |
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.
[no action] This is extremely bespoke to (potentially changing) IFS conventions, which is absolutely fine for now. In the future we will likely need to factor out bespoke "IFS Fields" transformations into a separate sub-package, as we add more to these.
eea26f5
to
9ae7b50
Compare
In order to mitigate the cost of creating thread-local copies of data structures, per-block views of fields can be replaced with full field views and the block-index can be inserted into the field pointer.
This is achieved via two transformations:
BlockViewToFieldViewTransformation
: A very IFS specific transformation that simply replaces per-block view pointers with full field pointers. It also injects the missing type definitions forFIELD_RANKSUFF_ARRAY
types.BlockIndexInjectTransformation
: A general transformation that injects the block-index to all arrays that have a local rank one less than their declared rank