Skip to content

Commit

Permalink
#2661 remove _psyir_depth_expression method
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed Oct 31, 2024
1 parent 2db822f commit a714670
Showing 1 changed file with 9 additions and 47 deletions.
56 changes: 9 additions & 47 deletions src/psyclone/dynamo0p3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3753,30 +3753,7 @@ def _compute_halo_depth(self):
as the depth can change as transformations are applied to the
schedule.
:return: the halo exchange depth as a Fortran string
:rtype: str
'''
return self._psyir_depth_expression()

# get information about reading from the halo from all read fields
# dependent on this halo exchange
depth_info_list = self._compute_halo_read_depth_info()

# if there is only one entry in the list we can just return
# the depth
if len(depth_info_list) == 1:
return str(depth_info_list[0])
# the depth information can't be reduced to a single
# expression, therefore we need to determine the maximum
# of all expressions
depth_str_list = [str(depth_info) for depth_info in
depth_info_list]
return "max("+",".join(depth_str_list)+")"

def _psyir_depth_expression(self):
'''
:returns: the PSyIR expression to compute the halo depth.
:return: the PSyIR for the halo exchange depth.
:rtype: :py:class:`psyclone.psyir.nodes.Node`
'''
Expand All @@ -3788,11 +3765,11 @@ def _psyir_depth_expression(self):
IntrinsicCall.Intrinsic.MAX,
[depth.psyir_expression() for depth in depth_info_list])

# Simplify the resulting expression. We need to create a fake
# Assignment to temporarily host the expression.
sym_maths = SymbolicMaths.get()
from psyclone.psyir.nodes import Assignment
fake_assign = Assignment.create(
Reference(DataSymbol("tmp", INTEGER_TYPE)),
psyir)
Reference(DataSymbol("tmp", INTEGER_TYPE)), psyir)
self.parent.addchild(fake_assign)

sym_maths.expand(fake_assign.rhs)
Expand Down Expand Up @@ -4112,7 +4089,7 @@ def lower_to_language_level(self):
'''
symbol = DataSymbol(self._field.proxy_name, UnresolvedType())
method = self._halo_exchange_name
depth_expr = self._psyir_depth_expression()
depth_expr = self._compute_halo_depth()

# Create infrastructure Calls
if self.vector_index:
Expand Down Expand Up @@ -4214,18 +4191,6 @@ def _compute_halo_depth(self):
# pylint: disable=protected-access
return self._get_hex_end()._compute_halo_depth()

def _psyir_depth_expression(self):
'''
Call the required method in the corresponding halo exchange end
object. This is done as the field in halo exchange start is
only read and the dependence analysis beneath this call
requires the field to be modified.
:returns: the PSyIR expression to compute the halo depth.
:rtype: :py:class:`psyclone.psyir.nodes.Node`
'''
return self._get_hex_end()._psyir_depth_expression()

def required(self):
'''Call the required method in the corresponding halo exchange end
object. This is done as the field in halo exchange start is
Expand Down Expand Up @@ -4774,13 +4739,10 @@ def _compute_from_field(self, field):
stencil_depth = field.descriptor.stencil['extent']
if stencil_depth:
# stencil_depth is provided in the kernel metadata
if self._var_depth:
self._var_depth = BinaryOperation.create(
BinaryOperation.Operator.ADD,
Literal(str(stencil_depth), INTEGER_TYPE),
self._var_depth)
else:
self._var_depth = Literal(str(stencil_depth), INTEGER_TYPE)
self._var_depth = BinaryOperation.create(
BinaryOperation.Operator.ADD,
Literal(str(stencil_depth), INTEGER_TYPE),
self._var_depth.copy())
else:
# Stencil_depth is provided by the algorithm layer.
# It is currently not possible to specify kind for an
Expand Down

0 comments on commit a714670

Please sign in to comment.