psyclone.domain.gocean.transformations.gocean_loop_fuse_trans#

This module contains the GOcean-specific loop-fusion transformation.

Classes#

class psyclone.domain.gocean.transformations.gocean_loop_fuse_trans.GOceanLoopFuseTrans[source]#

GOcean API specialisation of the base class in order to fuse two GOcean loops after performing validity checks (e.g. that the loops are over the same grid-point type). For example:

>>> from psyclone.tests.utilities import get_psylayer_schedule
>>> filename = "eg1/shallow_alg.f90"
>>> schedule = get_psylayer_schedule(filename, "gocean-examples")
>>>
>>> from psyclone.domain.gocean.transformations import GOceanLoopFuseTrans
>>> ftrans = GOceanLoopFuseTrans()

# Currently produces an error with “Cannot fuse loops that are over ” # “different grid-point types: go_cu and go_cv” # >>> ftrans.apply(schedule[0], schedule[1])

Inheritance

Inheritance diagram of GOceanLoopFuseTrans
apply(node1, node2, options=None, **kwargs)[source]#

Applies the GoceanLoopFuseTrans to the provided nodes.

Parameters:
  • node1 (GOLoop) – the first Node representing a GOLoop.

  • node2 (GOLoop) – the second Node representing a GOLoop.

  • force (bool) – whether to force fusion of the target loop (i.e. ignore any dependence analysis). This only skips a limited number of the checks, and does not fully force merging.

  • node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.

  • verbose (bool) – whether to log the reason the validation failed, at the moment with a comment in the provided PSyIR node.

validate(node1, node2, options=None, **kwargs)[source]#

Checks if it is valid to apply the GOceanLoopFuseTrans transform. It ensures that the fused loops are over the same grid-point types, before calling the normal LoopFuseTrans validation function.

Parameters:
  • node1 (GOLoop) – the first Node representing a GOLoop.

  • node2 (GOLoop) – the second Node representing a GOLoop.

  • options (Optional[Dict[str, Any]]) – a dictionary with options for transformations.

  • force (bool) – whether to force fusion of the target loop (i.e. ignore any dependence analysis). This only skips a limited number of the checks, and does not fully force merging.

  • node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.

  • verbose (bool) – whether to log the reason the validation failed, at the moment with a comment in the provided PSyIR node.

Raises: