Reference Guide  2.5.0
psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans Class Reference
Inheritance diagram for psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans:
Collaboration diagram for psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans:

Public Member Functions

def __str__ (self)
 
def name (self)
 
def validate (self, node, options=None)
 
def apply (self, node, options=None)
 

Additional Inherited Members

- Static Public Attributes inherited from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans
tuple excluded_node_types = (nodes.Return, psyGen.HaloExchange, nodes.CodeBlock)
 
- Static Public Attributes inherited from psyclone.psyir.transformations.loop_trans.LoopTrans
tuple excluded_node_types = ()
 

Detailed Description

 Apply an OpenMP Task Transformation to a Loop. The Loop must
be within an OpenMP Serial region (Single or Master) at codegen time.
Once lowering begins, no more modifications to the tree should occur
as the task directives do not recompute dependencies after lowering.
In the future it may be possible to do this through an _update_node
implementation.

Definition at line 52 of file omp_task_trans.py.

Member Function Documentation

◆ apply()

def psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.apply (   self,
  node,
  options = None 
)
Apply the OMPTaskTrans to the specified node in a Schedule.

Can only be applied to a Loop.

The specified node is wrapped by directives during code generation
like so:

.. code-block:: fortran

  !$OMP TASK
  ...
  !$OMP END TASK

At code-generation time, this node must be
within (i.e. a child of) an OpenMP Serial region (OpenMP Single or
OpenMP Master)

Any kernels or Calls will be inlined into the region before the task
transformation is applied.

:param node: the supplied node to which we will apply the \
             OMPTaskTrans transformation
:type node: :py:class:`psyclone.psyir.nodes.Loop`
:param options: a dictionary with options for transformations\
                and validation.
:type options: dictionary of string:values or None

Reimplemented from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.

Definition at line 172 of file omp_task_trans.py.

172  def apply(self, node, options=None):
173  '''Apply the OMPTaskTrans to the specified node in a Schedule.
174 
175  Can only be applied to a Loop.
176 
177  The specified node is wrapped by directives during code generation
178  like so:
179 
180  .. code-block:: fortran
181 
182  !$OMP TASK
183  ...
184  !$OMP END TASK
185 
186  At code-generation time, this node must be
187  within (i.e. a child of) an OpenMP Serial region (OpenMP Single or
188  OpenMP Master)
189 
190  Any kernels or Calls will be inlined into the region before the task
191  transformation is applied.
192 
193  :param node: the supplied node to which we will apply the \
194  OMPTaskTrans transformation
195  :type node: :py:class:`psyclone.psyir.nodes.Loop`
196  :param options: a dictionary with options for transformations\
197  and validation.
198  :type options: dictionary of string:values or None
199  '''
200  self.validate(node, options=options)
201  if not options:
202  options = {}
203  self._inline_kernels(node)
204  super().apply(node, options)

References psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans._inline_kernels(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.validate(), psyclone.transformations.MoveTrans.validate(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.validate(), psyclone.domain.common.transformations.alg_invoke_2_psy_call_trans.AlgInvoke2PSyCallTrans.validate(), psyclone.domain.common.transformations.alg_trans.AlgTrans.validate(), psyclone.domain.common.transformations.kernel_module_inline_trans.KernelModuleInlineTrans.validate(), psyclone.domain.common.transformations.raise_psyir_2_alg_trans.RaisePSyIR2AlgTrans.validate(), psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.validate(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.validate(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.validate(), psyclone.domain.gocean.transformations.raise_psyir_2_gocean_kern_trans.RaisePSyIR2GOceanKernTrans.validate(), psyclone.domain.lfric.transformations.lfric_alg_invoke_2_psy_call_trans.LFRicAlgInvoke2PSyCallTrans.validate(), psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans.RaisePSyIR2LFRicKernTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.validate(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.validate(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.validate(), psyclone.psyGen.Transformation.validate(), psyclone.psyir.transformations.acc_update_trans.ACCUpdateTrans.validate(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayaccess2loop_trans.ArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.validate(), psyclone.psyir.transformations.chunk_loop_trans.ChunkLoopTrans.validate(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.validate(), psyclone.psyir.transformations.hoist_local_arrays_trans.HoistLocalArraysTrans.validate(), psyclone.psyir.transformations.hoist_loop_bound_expr_trans.HoistLoopBoundExprTrans.validate(), psyclone.psyir.transformations.hoist_trans.HoistTrans.validate(), psyclone.psyir.transformations.inline_trans.InlineTrans.validate(), psyclone.psyir.transformations.intrinsics.array_reduction_base_trans.ArrayReductionBaseTrans.validate(), psyclone.psyir.transformations.intrinsics.dotproduct2code_trans.DotProduct2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.intrinsic2code_trans.Intrinsic2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.matmul2code_trans.Matmul2CodeTrans.validate(), psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans.validate(), psyclone.psyir.transformations.loop_tiling_2d_trans.LoopTiling2DTrans.validate(), psyclone.psyir.transformations.loop_trans.LoopTrans.validate(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.validate(), psyclone.psyir.transformations.omp_taskwait_trans.OMPTaskwaitTrans.validate(), psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.validate(), psyclone.psyir.transformations.reference2arrayrange_trans.Reference2ArrayRangeTrans.validate(), psyclone.psyir.transformations.replace_induction_variables_trans.ReplaceInductionVariablesTrans.validate(), psyclone.transformations.OMPDeclareTargetTrans.validate(), psyclone.transformations.DynamoOMPParallelLoopTrans.validate(), psyclone.transformations.Dynamo0p3OMPLoopTrans.validate(), psyclone.transformations.GOceanOMPLoopTrans.validate(), psyclone.transformations.Dynamo0p3RedundantComputationTrans.validate(), psyclone.transformations.Dynamo0p3KernelConstTrans.validate(), psyclone.transformations.ACCRoutineTrans.validate(), psyclone.transformations.KernelImportsToArguments.validate(), psyclone.domain.gocean.transformations.gocean_loop_fuse_trans.GOceanLoopFuseTrans.validate(), psyclone.domain.lfric.transformations.lfric_loop_fuse_trans.LFRicLoopFuseTrans.validate(), psyclone.psyir.transformations.loop_fuse_trans.LoopFuseTrans.validate(), psyclone.domain.gocean.transformations.gocean_extract_trans.GOceanExtractTrans.validate(), psyclone.domain.lfric.transformations.lfric_extract_trans.LFRicExtractTrans.validate(), psyclone.psyir.transformations.extract_trans.ExtractTrans.validate(), psyclone.psyir.transformations.nan_test_trans.NanTestTrans.validate(), psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans.validate(), psyclone.transformations.ParallelRegionTrans.validate(), psyclone.transformations.OMPParallelTrans.validate(), psyclone.transformations.ACCParallelTrans.validate(), psyclone.transformations.ACCKernelsTrans.validate(), psyclone.transformations.ACCDataTrans.validate(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.validate(), psyclone.psyir.transformations.region_trans.RegionTrans.validate(), and psyclone.transformations.ACCEnterDataTrans.validate().

Here is the call graph for this function:

◆ name()

def psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name (   self)
:returns: the name of this transformation.
:rtype: str

Reimplemented from psyclone.psyir.transformations.loop_trans.LoopTrans.

Definition at line 65 of file omp_task_trans.py.

65  def name(self):
66  '''
67  :returns: the name of this transformation.
68  :rtype: str
69  '''
70  return "OMPTaskTrans"
71 
Here is the caller graph for this function:

◆ validate()

def psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.validate (   self,
  node,
  options = None 
)
Validity checks for input arguments.

:param node: the Loop node to validate.
:type node: :py:class:`psyclone.psyir.nodes.Loop`
:param options: a dictionary with options for transformations.
:type options: dict of string:values or None

Reimplemented from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.

Definition at line 72 of file omp_task_trans.py.

72  def validate(self, node, options=None):
73  '''
74  Validity checks for input arguments.
75 
76  :param node: the Loop node to validate.
77  :type node: :py:class:`psyclone.psyir.nodes.Loop`
78  :param options: a dictionary with options for transformations.
79  :type options: dict of string:values or None
80  '''
81  # Disallow CodeBlocks inside the region
82  if any(node.walk(CodeBlock)):
83  raise GenerationError(
84  "OMPTaskTransformation cannot be applied to a region "
85  "containing a code block")
86 
87  super().validate(node, options)
88  # Check we can apply all the required transformations on any sub
89  # nodes
90  root_ancestor = node.root
91  path_to_node = node.path_from(root_ancestor)
92  routine_copy = root_ancestor.copy()
93  node_copy = routine_copy
94  for index in path_to_node:
95  node_copy = node_copy.children[index]
96 
97  kerns = node_copy.walk(Kern)
98  kintrans = KernelModuleInlineTrans()
99  cond_trans = FoldConditionalReturnExpressionsTrans()
100  intrans = InlineTrans()
101  for kern in kerns:
102  kintrans.validate(kern)
103  cond_trans.validate(kern.get_kernel_schedule())
104  # We need to apply these transformations to ensure we can
105  # validate the InlineTrans
106  kintrans.apply(kern)
107  cond_trans.apply(kern.get_kernel_schedule())
108  kern.lower_to_language_level()
109 
110  calls = node_copy.walk(Call)
111  for call in calls:
112  # Skip over intrinsic calls as we can't inline them
113  if isinstance(call, IntrinsicCall):
114  continue
115  intrans.validate(call)
116 
Here is the caller graph for this function:

The documentation for this class was generated from the following file: