loki.transformations.dependency
Classes
|
Duplicate subroutines which includes the creation of new :any:`Item`s as well as the addition of the corresponding new dependencies. |
|
Remove subroutines which includes the removal of the relevant :any:`Item`s as well as the removal of the corresponding dependencies. |
- class DuplicateKernel(duplicate_kernels=None, duplicate_suffix='duplicated', duplicate_module_suffix=None, duplicate_subgraph=False)
Bases:
TransformationDuplicate subroutines which includes the creation of new :any:`Item`s as well as the addition of the corresponding new dependencies.
Therefore, this transformation creates a new item and also implements the relevant routines for dry-run pipeline planning runs.
- Parameters:
duplicate_kernels (str|tuple|list, optional) – Kernel name(s) to be duplicated.
duplicate_suffix (str, optional) – Suffix to be used to append the original kernel name(s).
duplicate_module_suffix (str, optional) – Suffix to be used to append the original module name(s), if defined, otherwise duplicate_suffix
duplicate_subgraph (bool, optional) – Whether or not duplicate the subgraph beneath the kernel(s) that are duplicated.
- creates_items = True
- reverse_traversal = True
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutineitems.For transformations that modify
Subroutineobjects, this method should be implemented. It gets called via the dispatch methodapply().- Parameters:
routine (
Subroutine) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- plan_subroutine(routine, **kwargs)
Define the planning steps to apply for
Subroutineitems.For transformations that modify the dependencies of
routine(e.g., adding new procedure calls, inlining calls, renaming the interface) this should be implemented. It gets called via the dispatch methodapply()if the optionalplan_modeargument is set to True.- Parameters:
routine (
Subroutine) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- class RemoveKernel(remove_kernels=None)
Bases:
TransformationRemove subroutines which includes the removal of the relevant :any:`Item`s as well as the removal of the corresponding dependencies.
Therefore, this transformation creates a new item and also implements the relevant routines for dry-run pipeline planning runs.
- creates_items = True
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutineitems.For transformations that modify
Subroutineobjects, this method should be implemented. It gets called via the dispatch methodapply().- Parameters:
routine (
Subroutine) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- plan_subroutine(routine, **kwargs)
Define the planning steps to apply for
Subroutineitems.For transformations that modify the dependencies of
routine(e.g., adding new procedure calls, inlining calls, renaming the interface) this should be implemented. It gets called via the dispatch methodapply()if the optionalplan_modeargument is set to True.- Parameters:
routine (
Subroutine) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.