psyclone.psyir.transformations.omp_task_trans#
This module provides the OMPTaskTrans transformation.
Classes#
OMPTaskTrans: Apply an OpenMP Task Transformation to a Loop. The Loop must
- class psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans[source]#
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.
Inheritance

- apply(node, options=None, **kwargs)[source]#
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:
!$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.
- Parameters:
node (
Loop) – the supplied node to which we will apply the OMPTaskTrans transformationoptions (dictionary of string:values or None) – a dictionary with options for transformations and validation.
collapse (int | bool) – if it’s a bool and is False (default), it won’t collapse. If it’s a bool and is True, it will collapse as much as possible. If it’s an integer, it will attempt to collapse until the specified number of loops (if they exist and are safe to collapse them). The options ‘ignore_dependencies_for’ and ‘force’ also affect the collapse applicability analysis.
force (bool) – whether to force parallelisation of the target loop (i.e. ignore any dependence analysis).
force_private (collections.abc.Iterable[str]) – specify a list of symbol names explicitly requested to be private.
ignore_dependencies_for (None | List[str]) – specify a list of symbol names to ignore for the dependence analysis checks.
sequential (bool) – whether this is a sequential loop.
verbose (bool) – whether to report the reasons the validate and collapse steps have failed.
nowait (bool) – whether to add a nowait clause and a corresponding barrier (or equivalent) to enable asynchronous execution.
privatise_arrays (bool) – whether to make the write after write dependency symbols declared as private.
reduction_ops (List[psyclone.psyir.nodes.operation.Operator | psyclone.psyir.nodes.intrinsic_call.IntrinsicCall.Intrinsic]) – if non-empty, attempt parallelisation of loops by inferring reduction clauses involving any of the reduction operators in the list.
node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.
- property name#
- Returns:
the name of this transformation.
- Return type:
str
- validate(node, options=None, **kwargs)[source]#
Validity checks for input arguments.
Note that currently this implementation calls the apply methods of KernelModuleInlineTrans and FoldConditionalReturnExpressionsTrans. Although a copy of the provided node is used for this (so as to avoid any modifications to it in case the validation fails), this pattern indicates we should possibly re-write this transformation to require that those transformations have been applied first.
- Parameters:
node (
Loop) – the Loop node to validate.options (dict of string:values or None) – a dictionary with options for transformations.
collapse (int | bool) – if it’s a bool and is False (default), it won’t collapse. If it’s a bool and is True, it will collapse as much as possible. If it’s an integer, it will attempt to collapse until the specified number of loops (if they exist and are safe to collapse them). The options ‘ignore_dependencies_for’ and ‘force’ also affect the collapse applicability analysis.
force (bool) – whether to force parallelisation of the target loop (i.e. ignore any dependence analysis).
force_private (collections.abc.Iterable[str]) – specify a list of symbol names explicitly requested to be private.
ignore_dependencies_for (None | List[str]) – specify a list of symbol names to ignore for the dependence analysis checks.
sequential (bool) – whether this is a sequential loop.
verbose (bool) – whether to report the reasons the validate and collapse steps have failed.
nowait (bool) – whether to add a nowait clause and a corresponding barrier (or equivalent) to enable asynchronous execution.
privatise_arrays (bool) – whether to make the write after write dependency symbols declared as private.
reduction_ops (List[psyclone.psyir.nodes.operation.Operator | psyclone.psyir.nodes.intrinsic_call.IntrinsicCall.Intrinsic]) – if non-empty, attempt parallelisation of loops by inferring reduction clauses involving any of the reduction operators in the list.
node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.