# loki.transformations.single_column.demote

Classes

`SCCDemoteTransformation`(horizontal[, ...]) | A set of utilities to determine which local arrays can be safely demoted in a `Subroutine` as part of a transformation pass.

class SCCDemoteTransformation(horizontal, demote_local_arrays=True)

  Bases: `Transformation`

  A set of utilities to determine which local arrays can be safely demoted in a `Subroutine` as part of a transformation pass.

  Unless the option demote_local_arrays is set to False, this transformation will demote local arrays that do not buffer values between vector loops. Specific arrays in individual routines can also be marked for preservation by assigning them to the preserve_arrays list in the `SchedulerConfig`.

  Parameters:

    horizontal (`Dimension`) – `Dimension` object describing the variable conventions used in code to define the horizontal data dimension and iteration space.

  classmethod get_locals_to_demote(routine, sections, horizontal)

    Create a list of local temporary arrays after checking that demotion is safe.

    Demotion is considered safe if the temporary is only used within one coherent vector-section (see `extract_vector_sections`).

    Local temporaries get demoted if they have: * Only one dimension, which is the `horizontal` * Have the `horizontal` as the innermost dimension, with all

    > other dimensions being declared constant parameters.

  transform_subroutine(routine, **kwargs)

    Apply SCCDemote utilities to a `Subroutine`.

    Parameters:

      - routine (`Subroutine`) – Subroutine to apply this transformation to.

      - role (string) – Role of the subroutine in the call tree; should be `"kernel"`

  process_kernel(routine, demote_locals=True, preserve_arrays=None)

    Applies the SCCDemote utilities to a “kernel” and demotes all suitable local arrays.

    Parameters:

      routine (`Subroutine`) – Subroutine to apply this transformation to.