loki.transformations.single_column.base
Classes
|
A basic set of utilities used in the SCC transformation. |
- class SCCBaseTransformation(horizontal)
Bases:
TransformationA basic set of utilities used in the SCC transformation. These utilities can either be used as a transformation in their own right, or the contained class methods can be called directly.
- Parameters:
horizontal (
Dimension) –Dimensionobject describing the variable conventions used in code to define the horizontal data dimension and iteration space.
- static rename_index_aliases(routine, dimension)
Rename index aliases: map all index aliases
dimension.indicestodimension.index.- Parameters:
routine (
Subroutine) – The subroutine to rename index aliases.horizontal (
Dimension) –Dimensionobject to rename the index aliases to the first/former index.
- static is_elemental(routine)
Check whether
Subroutineroutineis an elemental routine. Need for distinguishing elemental and non-elemental function to transform those in a different way.- Parameters:
routine (
Subroutine) – The subroutine to check whether elemental
- transform_subroutine(routine, **kwargs)
Apply SCCBase 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"or"driver".
Notes
The per-routine item config key
resolve_vector_notation(bool, defaultTrue) can be set toFalseto skip vector notation resolution for a specific routine. Example scheduler config:[routines.my_routine] role = "kernel" resolve_vector_notation = false
- process_kernel(routine, rename_indices=False, do_resolve_vector_notation=True)
Applies the SCCBase utilities to a “kernel”. This consists of resolving associates, masked statements and vector notation.
- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.rename_indices (bool, optional) – Whether to rename index aliases to
dimension.index. Default isFalse.do_resolve_vector_notation (bool, optional) – Whether to resolve vector notation into explicit loops. Set to
Falseto skip this step for routines where generated loop bounds may not be available on device or where the transformation is otherwise undesirable. Default isTrue.
- process_driver(routine, do_resolve_vector_notation=True)
Applies the SCCBase utilities to a “driver”. This consists of resolving associates and, by default, vector notation.
- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.do_resolve_vector_notation (bool, optional) – Whether to resolve vector notation into explicit loops. Set to
Falseto skip this step for driver routines where generated loop bounds may not be available on device. Default isTrue.