Reference Guide  2.5.0
psyclone.psyGen.Transformation Class Reference
Inheritance diagram for psyclone.psyGen.Transformation:
Collaboration diagram for psyclone.psyGen.Transformation:

Public Member Functions

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

Detailed Description

Abstract baseclass for a transformation. Uses the abc module so it
can not be instantiated.

Definition at line 2743 of file psyGen.py.

Member Function Documentation

◆ apply()

def psyclone.psyGen.Transformation.apply (   self,
  node,
  options = None 
)
Abstract method that applies the transformation. This function
must be implemented by each transform. As a minimum each apply
function must take a node to which the transform is applied, and
a dictionary of additional options, which will also be passed on
to the validate functions. This dictionary is used to provide
optional parameters, and also to modify the behaviour of
validation of transformations: for example, if the user knows that
a transformation can correctly be applied in a specific case, but
the more generic code validation would not allow this. Validation
functions should check for a key in the options dictionary to
disable certain tests. Those keys will be documented in each
apply() and validate() function.

Note that some apply() functions might take a slightly different
set of parameters.

:param node: The node (or list of nodes) for the transformation \
        - specific to the actual transform used.
:type node: depends on actual transformation
:param options: a dictionary with options for transformations.
:type options: Optional[Dict[str, Any]]

Reimplemented in psyclone.transformations.ACCParallelTrans, psyclone.transformations.ParallelRegionTrans, psyclone.transformations.ACCEnterDataTrans, psyclone.domain.common.transformations.alg_trans.AlgTrans, psyclone.psyir.transformations.psy_data_trans.PSyDataTrans, psyclone.transformations.OMPSingleTrans, psyclone.transformations.KernelImportsToArguments, psyclone.transformations.ACCDataTrans, psyclone.transformations.ACCKernelsTrans, psyclone.transformations.ACCRoutineTrans, psyclone.transformations.Dynamo0p3KernelConstTrans, psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans, psyclone.transformations.Dynamo0p3ColourTrans, psyclone.transformations.ColourTrans, psyclone.transformations.Dynamo0p3OMPLoopTrans, psyclone.transformations.GOceanOMPParallelLoopTrans, psyclone.transformations.OMPParallelLoopTrans, psyclone.transformations.ACCLoopTrans, psyclone.transformations.OMPDeclareTargetTrans, psyclone.transformations.OMPTaskloopTrans, psyclone.psyir.transformations.replace_induction_variables_trans.ReplaceInductionVariablesTrans, psyclone.psyir.transformations.reference2arrayrange_trans.Reference2ArrayRangeTrans, psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans, psyclone.psyir.transformations.omp_taskwait_trans.OMPTaskwaitTrans, psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans, psyclone.psyir.transformations.omp_target_trans.OMPTargetTrans, psyclone.psyir.transformations.omp_loop_trans.OMPLoopTrans, psyclone.psyir.transformations.loop_tiling_2d_trans.LoopTiling2DTrans, psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans, psyclone.psyir.transformations.intrinsics.sign2code_trans.Sign2CodeTrans, psyclone.psyir.transformations.intrinsics.minormax2code_trans.MinOrMax2CodeTrans, psyclone.psyir.transformations.intrinsics.matmul2code_trans.Matmul2CodeTrans, psyclone.psyir.transformations.intrinsics.dotproduct2code_trans.DotProduct2CodeTrans, psyclone.psyir.transformations.intrinsics.array_reduction_base_trans.ArrayReductionBaseTrans, psyclone.psyir.transformations.intrinsics.abs2code_trans.Abs2CodeTrans, psyclone.psyir.transformations.inline_trans.InlineTrans, psyclone.psyir.transformations.hoist_trans.HoistTrans, psyclone.psyir.transformations.hoist_loop_bound_expr_trans.HoistLoopBoundExprTrans, psyclone.psyir.transformations.hoist_local_arrays_trans.HoistLocalArraysTrans, psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans, psyclone.psyir.transformations.chunk_loop_trans.ChunkLoopTrans, psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans, psyclone.psyir.transformations.arrayaccess2loop_trans.ArrayAccess2LoopTrans, psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans, psyclone.psyir.transformations.acc_update_trans.ACCUpdateTrans, psyclone.psyGen.DummyTransformation, psyclone.psyad.transformations.assignment_trans.AssignmentTrans, psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans, psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans, psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans.RaisePSyIR2LFRicKernTrans, psyclone.domain.gocean.transformations.raise_psyir_2_gocean_kern_trans.RaisePSyIR2GOceanKernTrans, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans, psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans, psyclone.domain.common.transformations.kernel_module_inline_trans.KernelModuleInlineTrans, psyclone.domain.common.transformations.alg_invoke_2_psy_call_trans.AlgInvoke2PSyCallTrans, and psyclone.transformations.Dynamo0p3RedundantComputationTrans.

Definition at line 2758 of file psyGen.py.

2758  def apply(self, node, options=None):
2759  '''Abstract method that applies the transformation. This function
2760  must be implemented by each transform. As a minimum each apply
2761  function must take a node to which the transform is applied, and
2762  a dictionary of additional options, which will also be passed on
2763  to the validate functions. This dictionary is used to provide
2764  optional parameters, and also to modify the behaviour of
2765  validation of transformations: for example, if the user knows that
2766  a transformation can correctly be applied in a specific case, but
2767  the more generic code validation would not allow this. Validation
2768  functions should check for a key in the options dictionary to
2769  disable certain tests. Those keys will be documented in each
2770  apply() and validate() function.
2771 
2772  Note that some apply() functions might take a slightly different
2773  set of parameters.
2774 
2775  :param node: The node (or list of nodes) for the transformation \
2776  - specific to the actual transform used.
2777  :type node: depends on actual transformation
2778  :param options: a dictionary with options for transformations.
2779  :type options: Optional[Dict[str, Any]]
2780 
2781  '''
2782 

◆ name()

def psyclone.psyGen.Transformation.name (   self)
:returns: the transformation's class name.
:rtype: str

Reimplemented in psyclone.transformations.KernelImportsToArguments, psyclone.transformations.ACCDataTrans, psyclone.transformations.ACCKernelsTrans, psyclone.transformations.ACCRoutineTrans, psyclone.transformations.ACCEnterDataTrans, psyclone.transformations.Dynamo0p3KernelConstTrans, psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans, psyclone.transformations.MoveTrans, psyclone.transformations.OMPParallelTrans, psyclone.transformations.OMPMasterTrans, psyclone.transformations.OMPSingleTrans, psyclone.psyir.transformations.psy_data_trans.PSyDataTrans, psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans, psyclone.psyir.transformations.loop_trans.LoopTrans, psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans, psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans, psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans, psyclone.psyGen.DummyTransformation, psyclone.psyad.transformations.assignment_trans.AssignmentTrans, psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans, psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans, psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans, and psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.

Definition at line 2749 of file psyGen.py.

2749  def name(self):
2750  '''
2751  :returns: the transformation's class name.
2752  :rtype: str
2753 
2754  '''
2755  return type(self).__name__
2756 
Here is the caller graph for this function:

◆ validate()

def psyclone.psyGen.Transformation.validate (   self,
  node,
  options = None 
)
Method that validates that the input data is correct.
It will raise exceptions if the input data is incorrect. This
function needs to be implemented by each transformation.

The validate function can be called by the user independent of
the apply() function, but it will automatically be executed as
part of an apply() call.

As minimum each validate function must take a node to which the
transform is applied and a dictionary of additional options.
This dictionary is used to provide optional parameters and also
to modify the behaviour of validation: for example, if the user
knows that a transformation can correctly be applied in a specific
case but the more generic code validation would not allow this.
Validation functions should check for particular keys in the options
dict in order to disable certain tests. Those keys will be documented
in each apply() and validate() function as 'options["option-name"]'.

Note that some validate functions might take a slightly different
set of parameters.

:param node: The node (or list of nodes) for the transformation \
        - specific to the actual transform used.
:type node: depends on actual transformation
:param options: a dictionary with options for transformations.
:type options: Optional[Dict[str, Any]]

Reimplemented in psyclone.transformations.ACCEnterDataTrans, psyclone.psyir.transformations.region_trans.RegionTrans, psyclone.psyir.transformations.psy_data_trans.PSyDataTrans, psyclone.transformations.ACCDataTrans, psyclone.transformations.ACCKernelsTrans, psyclone.transformations.ACCParallelTrans, psyclone.transformations.OMPParallelTrans, psyclone.transformations.ParallelRegionTrans, psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans, psyclone.psyir.transformations.extract_trans.ExtractTrans, psyclone.transformations.KernelImportsToArguments, psyclone.transformations.ACCRoutineTrans, psyclone.transformations.Dynamo0p3KernelConstTrans, psyclone.transformations.Dynamo0p3RedundantComputationTrans, psyclone.transformations.GOceanOMPLoopTrans, psyclone.transformations.Dynamo0p3OMPLoopTrans, psyclone.transformations.DynamoOMPParallelLoopTrans, psyclone.transformations.OMPDeclareTargetTrans, psyclone.psyir.transformations.replace_induction_variables_trans.ReplaceInductionVariablesTrans, psyclone.psyir.transformations.reference2arrayrange_trans.Reference2ArrayRangeTrans, psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans, psyclone.psyir.transformations.omp_taskwait_trans.OMPTaskwaitTrans, psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans, psyclone.psyir.transformations.loop_trans.LoopTrans, psyclone.psyir.transformations.loop_tiling_2d_trans.LoopTiling2DTrans, psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans, psyclone.psyir.transformations.intrinsics.matmul2code_trans.Matmul2CodeTrans, psyclone.psyir.transformations.intrinsics.intrinsic2code_trans.Intrinsic2CodeTrans, psyclone.psyir.transformations.intrinsics.dotproduct2code_trans.DotProduct2CodeTrans, psyclone.psyir.transformations.intrinsics.array_reduction_base_trans.ArrayReductionBaseTrans, psyclone.psyir.transformations.inline_trans.InlineTrans, psyclone.psyir.transformations.hoist_trans.HoistTrans, psyclone.psyir.transformations.hoist_loop_bound_expr_trans.HoistLoopBoundExprTrans, psyclone.psyir.transformations.hoist_local_arrays_trans.HoistLocalArraysTrans, psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans, psyclone.psyir.transformations.chunk_loop_trans.ChunkLoopTrans, psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans, psyclone.psyir.transformations.arrayaccess2loop_trans.ArrayAccess2LoopTrans, psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans, psyclone.psyir.transformations.acc_update_trans.ACCUpdateTrans, psyclone.psyad.transformations.assignment_trans.AssignmentTrans, psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans, psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans, psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans.RaisePSyIR2LFRicKernTrans, psyclone.domain.gocean.transformations.raise_psyir_2_gocean_kern_trans.RaisePSyIR2GOceanKernTrans, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans, psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans, psyclone.domain.common.transformations.raise_psyir_2_alg_trans.RaisePSyIR2AlgTrans, psyclone.domain.common.transformations.kernel_module_inline_trans.KernelModuleInlineTrans, psyclone.domain.common.transformations.alg_trans.AlgTrans, psyclone.domain.common.transformations.alg_invoke_2_psy_call_trans.AlgInvoke2PSyCallTrans, and psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.

Definition at line 2783 of file psyGen.py.

2783  def validate(self, node, options=None):
2784  '''Method that validates that the input data is correct.
2785  It will raise exceptions if the input data is incorrect. This
2786  function needs to be implemented by each transformation.
2787 
2788  The validate function can be called by the user independent of
2789  the apply() function, but it will automatically be executed as
2790  part of an apply() call.
2791 
2792  As minimum each validate function must take a node to which the
2793  transform is applied and a dictionary of additional options.
2794  This dictionary is used to provide optional parameters and also
2795  to modify the behaviour of validation: for example, if the user
2796  knows that a transformation can correctly be applied in a specific
2797  case but the more generic code validation would not allow this.
2798  Validation functions should check for particular keys in the options
2799  dict in order to disable certain tests. Those keys will be documented
2800  in each apply() and validate() function as 'options["option-name"]'.
2801 
2802  Note that some validate functions might take a slightly different
2803  set of parameters.
2804 
2805  :param node: The node (or list of nodes) for the transformation \
2806  - specific to the actual transform used.
2807  :type node: depends on actual transformation
2808  :param options: a dictionary with options for transformations.
2809  :type options: Optional[Dict[str, Any]]
2810  '''
2811  # pylint: disable=unused-argument
2812 
2813 
Here is the caller graph for this function:

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