-
Notifications
You must be signed in to change notification settings - Fork 30
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) 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
src/psyclone/tests/domain/lfric/lfric_extract_driver_creator_test.py
Outdated
Show resolved
Hide resolved
@arporter This is finally ready for review, it is huge because:
However, most of the PR is a 1-to-1 mapping to previous code, I decided to leave the:
I am happy to do this in different review steps if it becomes too much (also Github slows down a lot when reviewing long PRs all at once) There are a couple of coverage misses that I may need help constructing the LFRic examples that should trigger them. |
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.
Great stuff Sergi, it's really good to see so much code being removed. I've made it through all the source files now and some of the tests.
Generally small things to tidy up although I'd like to get rid of cursor
from all the declaration
routines as it's not used. In fact, I'm not totally sure it's needed for the initialisation - did you have ordering issues?
@@ -877,14 +882,14 @@ def quad_rule(self, var_accesses=None): | |||
self.append_integer_reference(arg) | |||
elif generic_name in ["weights_xy", "weights_z"]: | |||
# 1d arrays: | |||
# TODO # 1910: These should be pointers |
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.
Was this TODO incorrect - i.e. it's fine that they aren't pointers? Can #1910 be closed?
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.
Ah, as this is the kernel-call argument list I suppose we don't care whether or not they are pointers as we just need References?
ScalarType.Intrinsic.INTEGER, | ||
tag=tag) | ||
symbol = self._symtab.find_or_create( | ||
self._kern.colourmap.name, symbol_type=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'm a bit confused here. self._kern.colourmap
is a call to LFRicKern.colourmap
and that returns a Symbol. Perhaps it's not in the right table or perhaps symbol
ends up being that same symbol? While I'm here, the docstring for LFRicKern.colourmap
says it returns a str
but it in fact it returns a Symbol
. It's not the fault of this PR but would you mind fixing it?
@@ -984,7 +993,7 @@ def cell_ref_name(self, var_accesses=None): | |||
AccessType.READ, | |||
self._kern, ["colour", "cell"]) | |||
|
|||
return (self._kern.colourmap + "(colour,cell)", | |||
return (self._kern.colourmap.name + "(colour,cell)", |
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 this now be array_ref.debug_string()
or (better) use the FortranWriter?
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 guess it should also have a TODO as this will need cleaning up somehow.
@@ -61,10 +60,6 @@ class KernStubArgList(ArgOrdering): | |||
''' | |||
def __init__(self, kern): | |||
ArgOrdering.__init__(self, kern) | |||
# TODO 719 The stub_symtab is not connected to other parts of the |
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.
Whoop! Does this mean that this PR will close #719?
def initialise(self, parent): | ||
for name in self._nlayers_names: | ||
sym = self.symtab.lookup(name) | ||
sym.interface = ArgumentInterface( |
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.
Please add a comment here - I can't currently work out why you have to do this here rather than when the symbol is created in the symbol table of the kernel stub?
result = generate(os.path.join(BASE_PATH, | ||
"columnwise_op_asm_kernel_mod.F90"), | ||
api=TEST_API) | ||
stub_psyir = generate(os.path.join(BASE_PATH, |
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.
It's not psyir but text at this point.
result = generate(os.path.join(BASE_PATH, | ||
"columnwise_op_app_kernel_mod.F90"), | ||
api=TEST_API) | ||
stub_psyir = generate(os.path.join(BASE_PATH, |
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.
text again.
expected = " ! call our kernels\n" | ||
assert (expected + " !\n" | ||
" call testkern_domain_code(nlayers_f1, ncell_2d_no_halos, " | ||
assert (" call testkern_domain_code(nlayers_f1, ncell_2d_no_halos, " |
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.
Please extend to check that it is not within a loop.
# Now call the loop handling method directly. | ||
out = fortran_writer.loop_node(schedule.children[0]) | ||
out = fortran_writer(schedule) |
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.
Possibly this whole bit (from L301) can be removed now?
@@ -115,6 +115,7 @@ def test_create_read_in_code_missing_symbol(capsys, monkeypatch): | |||
cntr = minfo.get_psyir() | |||
# We can't use 'remove()' with a DataSymbol. | |||
cntr.symbol_table._symbols.pop("module_var_b") | |||
return |
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 attention.... :-)
No description provided.