psyclone.psyir.transformations.nan_test_trans

This module contains the base class for verifying that input and output parameters of a region of code is not NAN and not infinite. It is basically identical to ReadOnlyVerifyTrans (which provides input parameter before and output parameter after a kernel), from which it inherits all actual code.

Classes

  • NanTestTrans: This transformation inserts a NanTestNode into the PSyIR of a

class psyclone.psyir.transformations.nan_test_trans.NanTestTrans(node_class=<class 'psyclone.psyir.nodes.nan_test_node.NanTestNode'>)

This transformation inserts a NanTestNode into the PSyIR of a schedule. At code creation time this node will use the PSyData API to create code that will verify all input parameters are not NANs and not infinite, and the same for all output parameters.

After applying the transformation the Nodes marked for verification are children of the NanTestNode. Nodes to verify can be individual constructs within an Invoke (e.g. Loops containing a Kernel or BuiltIn call) or entire Invokes.

Parameters:

node_class (psyclone.psyir.nodes.NanTestNode or derived class) – The class of Node which will be inserted into the tree (defaults to NanTestNode), but can be any derived class.

Inheritance

Inheritance diagram of NanTestTrans
validate(node_list, options=None)

Performs validation checks specific to nan-test transformations. This function is only here so that it is documented.

Parameters:
  • node_list (list of psyclone.psyir.nodes.Node) – the list of Node(s) we are checking.

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

Raises:
  • TransformationError – if transformation is applied to a Kernel or a BuiltIn call without its parent Loop.

  • TransformationError – if transformation is applied to a Loop without its parent Directive when optimisations are applied.

  • TransformationError – if transformation is applied to an orphaned Directive without its parent Directive.