loki.transformations.sanitise.unused_routines
Classes
Sanitise configured routines that are no longer used but still need to compile. |
- class SanitiseUnusedRoutineTransformation(routines=None, stub_kind='error_stop')
Bases:
TransformationSanitise configured routines that are no longer used but still need to compile.
For selected routines this transformation rewrites kept array declarations in the routine specification to fully deferred shape, removes local array declarations that no longer need to be represented, and replaces the executable body with a configurable stub.
- Parameters:
routines (tuple or list of str, optional) – Routine names or qualified scheduler item names to sanitise. Matching uses
SchedulerConfig.match_item_keyswith parent matching enabled, so bothroutineandmodule#routineforms are supported.stub_kind (str, optional) – The replacement body to insert for sanitised routines. Supported values are
'error_stop'for a fail-loud stub and'empty'for an empty executable section. Defaults to'error_stop'.
- transform_subroutine(routine, **kwargs)
Sanitise one configured routine by shrinking its declarations and replacing its body.
Only declarations that still matter to the routine interface or storage semantics are kept, and any retained arrays are rewritten to fully deferred shape so their original bounds expressions are no longer required.