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.Notes
The per-routine item config keys
resolve_vector_notationandresolve_implicit_rhs_ranges(both bool, defaultTrue) can be used to control vector notation resolution for a specific routine. Example scheduler config:[routines.my_routine] role = "kernel" resolve_vector_notation = false resolve_implicit_rhs_ranges = false
- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.role (string) – Role of the subroutine in the call tree; should be
"kernel"or"driver".
- process_kernel(routine, rename_indices=False, do_resolve_vector_notation=True, do_resolve_implicit_rhs_ranges=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 remaining vector notation (beyond the horizontal dimension) into explicit loops via
resolve_vector_notation. The horizontal dimension is always resolved byresolve_vector_dimensionregardless of this flag, so that downstream SCC transformations find scalar loop indices instead of range notation. Default isTrue.do_resolve_implicit_rhs_ranges (bool, optional) – Whether to resolve assignments and masked statements whose RHS arrays use bare
:ranges while resolving vector notation. Default isTrue.
- process_driver(routine, do_resolve_vector_notation=True, do_resolve_implicit_rhs_ranges=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.do_resolve_implicit_rhs_ranges (bool, optional) – Whether to resolve assignments and masked statements whose RHS arrays use bare
:ranges while resolving vector notation. Default isTrue.