loki.transformations.single_column.vector
Classes
|
A set of utilities to determine which local arrays can be safely demoted in a |
|
A set of utilities that can be used to strip vector loops from a |
|
A transformation to wrap thread-parallel IR sections within a horizontal loop. |
- class SCCDevectorTransformation(horizontal, trim_vector_sections=False)
Bases:
Transformation
A set of utilities that can be used to strip vector loops from a
Subroutine
and determine the regions of the IR to be placed within thread-parallel loop directives.- Parameters:
horizontal (
Dimension
) –Dimension
object describing the variable conventions used in code to define the horizontal data dimension and iteration space.trim_vector_sections (bool) – Flag to trigger trimming of extracted vector sections to remove nodes that are not assignments involving vector parallel arrays.
- classmethod kernel_remove_vector_loops(routine, horizontal)
Remove all vector loops over the specified dimension.
- Parameters:
routine (
Subroutine
) – The subroutine in the vector loops should be removed.horizontal (
Dimension
) – The dimension specifying the horizontal vector dimension
- classmethod extract_vector_sections(section, horizontal)
Extract a contiguous sections of nodes that contains vector-level computations and are not interrupted by recursive subroutine calls or nested control-flow structures.
- classmethod get_trimmed_sections(routine, horizontal, sections)
Trim extracted vector sections to remove nodes that are not assignments involving vector parallel arrays.
- transform_subroutine(routine, **kwargs)
Apply SCCDevector 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)
Applies the SCCDevector utilities to a “kernel”. This consists simply of stripping vector loops and determing which sections of the IR can be placed within thread-parallel loops.
- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.
- process_driver(routine, targets=())
Applies the SCCDevector utilities to a “driver”. This consists simply of stripping vector loops and determining which sections of the IR can be placed within thread-parallel loops.
- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.targets (list or string) – List of subroutines that are to be considered as part of the transformation call tree.
- class SCCRevectorTransformation(horizontal)
Bases:
Transformation
A transformation to wrap thread-parallel IR sections within a horizontal loop. This transformation relies on markers placed by
SCCDevectorTransformation
.- Parameters:
horizontal (
Dimension
) –Dimension
object describing the variable conventions used in code to define the horizontal data dimension and iteration space.
- classmethod wrap_vector_section(section, routine, horizontal)
Wrap a section of nodes in a vector-level loop across the horizontal.
- Parameters:
section (tuple of
Node
) – A section of nodes to be wrapped in a vector-level looproutine (
Subroutine
) – The subroutine in the vector loops should be removed.horizontal (
Dimension
) – The dimension specifying the horizontal vector dimension
- transform_subroutine(routine, **kwargs)
Apply SCCRevector utilities to a
Subroutine
. It wraps all thread-parallel sections within a horizontal loop. The markers placed bySCCDevectorTransformation
are removed- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.
- 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 thehorizontal
as the innermost dimension, with allother 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.