Skip to content

Commit

Permalink
#2661 more tidying and removal of duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed Oct 31, 2024
1 parent f4226d9 commit 84b54b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/psyclone/domain/lfric/lfric_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,6 @@ def gen_mark_halos_clean_dirty(self, parent):
# Set halo clean/dirty for all fields that are modified
fields = self.unique_modified_args("gh_field")

sym_table = self.ancestor(InvokeSchedule).symbol_table

# First set all of the halo dirty unless we are
# subsequently going to set all of the halo clean
for field in fields:
Expand All @@ -941,7 +939,7 @@ def gen_mark_halos_clean_dirty(self, parent):
from psyclone.dynamo0p3 import HaloWriteAccess
# The HaloWriteAccess class provides information about how the
# supplied field is accessed within its parent loop
hwa = HaloWriteAccess(field, sym_table, self)
hwa = HaloWriteAccess(field, self)
if not hwa.max_depth or hwa.dirty_outer:
# output set dirty as some of the halo will not be set to clean
if field.vector_size > 1:
Expand Down
23 changes: 11 additions & 12 deletions src/psyclone/dynamo0p3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3916,8 +3916,7 @@ def _compute_halo_write_info(self):
f"Internal logic error. There should be at most one write "
f"dependence for a halo exchange. Found "
f"'{len(write_dependencies)}'")
return HaloWriteAccess(write_dependencies[0], self._symbol_table,
parent=self)
return HaloWriteAccess(write_dependencies[0], parent=self)

def required(self, ignore_hex_dep=False):
'''Determines whether this halo exchange is definitely required
Expand Down Expand Up @@ -4509,13 +4508,13 @@ class HaloWriteAccess(HaloDepth):
:param field: the field that we are concerned with.
:type field: :py:class:`psyclone.dynamo0p3.DynArgument`
:param sym_table: the symbol table associated with the scoping region \
that contains this halo access.
:type sym_table: :py:class:`psyclone.psyir.symbols.SymbolTable`
:param parent: the parent PSyIR node associated with the scoping region
that contains this halo access.
:type parent: :py:class:`psyclone.psyir.nodes.Node`
'''
def __init__(self, field, sym_table, parent):
HaloDepth.__init__(self, sym_table, parent)
def __init__(self, field, parent):
HaloDepth.__init__(self, parent)
self._compute_from_field(field)

@property
Expand All @@ -4537,17 +4536,18 @@ def clean_depth(self):
'''
Returns the depth to which this halo is clean following the write.
:returns:
:rtype:
:returns: PSyIR for the expression for the clean halo depth or None.
:rtype: :py:class:`psyclone.psyir.nodes.Node` | NoneType
'''
if self.var_depth:
halo_depth = self.var_depth
elif self.max_depth:
# halo accesses(s) is/are to the full halo
# depth (-1 if continuous)
halo_depth = Reference(self._symbol_table.lookup_with_tag(
"max_halo_depth_mesh"))
table = self._parent.scope.symbol_table
halo_depth = Reference(
table.lookup_with_tag("max_halo_depth_mesh"))
else:
return None

Expand All @@ -4557,7 +4557,6 @@ def clean_depth(self):
halo_depth.copy(), Literal("1", INTEGER_TYPE))

sym_maths = SymbolicMaths.get()
from psyclone.psyir.nodes import Assignment, Schedule
fake_assign = Assignment.create(
Reference(DataSymbol("tmp", INTEGER_TYPE)),
halo_depth)
Expand Down

0 comments on commit 84b54b5

Please sign in to comment.