-
Notifications
You must be signed in to change notification settings - Fork 29
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
(closes #1010, #1910, #719, #798, #1648) Generate PSy-layers and Kernel Subs using PSyIR lowering (instead of gen_code/f2pygen) #2834
base: master
Are you sure you want to change the base?
Conversation
…10_remaining_lfric_lowering
…rsor on invokes declarations and initialisations
… invoke comments
…nto 1010_remaining_lfric_lowering
…ith psyir backend
Regarding cursor:
However:
PSyclone/src/psyclone/domain/lfric/lfric_invoke.py Lines 285 to 303 in 1a67f95
|
@arporter This is ready for another review. The PR has increased a bit from last time but mostly with the same syntax changes applied to GOcean tests and lots of deletions - which is satisfying. As a result, a few more issues can be closed (updated in the PR title). |
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.
Phew, I've made it. There are a couple of changes that worry me a bit but other than that it's just small things. To cover myself, I have asked (a lot) for modified tests to have compilation checks added where possible.
``LFRicInvoke``. In both cases these methods make use of the subclasses | ||
of ``LFRicCollection`` to declare variables. | ||
the ``stub_declarations`` and ``invoke_declarations`` methods in the | ||
appropirate ``LFRicCollection``. |
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.
"appropriate"
if self._kernel.cma_operation not in ["apply", "matrix-matrix"]: | ||
for name in self._nlayers_names: | ||
sym = self.symtab.lookup(name) | ||
# Symbols are created thinking for the Invoke context, so make |
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.
Thanks for adding. Perhaps: "Some Symbols are created as though for an Invoke context, so make sure they are..."
@@ -145,6 +148,10 @@ def reference_accesses(self, var_accesses): | |||
# Use the KernelCallArgList class, which can also provide variable | |||
# access information: | |||
create_arg_list = KernCallArgList(self) | |||
# KernCallArgList creates symbols (sometimes with wrong type), we don't |
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.
You've not added a TODO here?
@@ -469,12 +469,9 @@ def is_intergrid(self): | |||
return self._intergrid_ref is not None | |||
|
|||
@property | |||
def colourmap(self): | |||
def colourmap(self: DataSymbol): |
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.
I think you meant -> DataSymbol:
?
PSyData node to add the declaration (which the PSyData node added to the | ||
symbol table, but since the symbol table is not used by gen_code, it | ||
would otherwise be missing). | ||
already be generated by PSyIR). |
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.
You've shortened this docstring a bit too much :-)
assert ("'symbol' argument to StructureReference.create() should be a " | ||
"DataSymbol but found 'NoneType'" in str(err.value)) | ||
assert ("A StructureReference must refer to a symbol that is (or could be)" | ||
" a structure, has been given a 'None' with name: 'unknown'") |
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.
"...but has been given a ..."
assert ("symbol that is (or could be) a structure, however symbol " | ||
"'fake' has type 'Scalar" in str(err.value)) | ||
assert ("A StructureReference must refer to a symbol that is (or could be)" | ||
" a structure, has been given a 'Scalar' with name: 'unknown'") |
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.
"..., but has been given a ..."
|
||
groups = re.search(correct_re, code, re.I) | ||
assert groups is not None | ||
# groups = re.search(correct_re, code, re.I) |
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 needs reinstating?
code = str(psy_ast.gen) | ||
psy_file.write(fll.process(code)) | ||
|
||
# Not everything is captured by PSyIR as Symbols (e.g. multiple |
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.
I don't quite understand this comment?
No description provided.