ABC (opens in a new tab)
Pass manager base class.
Initialize an empty pass manager object.
- tasks (Task | list (opens in a new tab)[Task]) – A pass set to be added to the pass manager schedule.
- max_iteration (int (opens in a new tab)) – The maximum number of iterations the schedule will be looped if the condition is not met.
Append tasks to the schedule of passes.
tasks (Task | list (opens in a new tab)[Task]) – A set of pass manager tasks to be added to schedule.
TypeError (opens in a new tab) – When any element of tasks is not a subclass of passmanager Task.
Removes a particular pass in the scheduler.
index (int (opens in a new tab)) – Pass index to remove, based on the position in
PassManagerError – If the index is not found.
Replace a particular pass in the scheduler.
- index (int (opens in a new tab)) – Task index to replace, based on the position in
- tasks (Task | list (opens in a new tab)[Task]) – A set of pass manager tasks to be added to schedule.
- TypeError (opens in a new tab) – When any element of tasks is not a subclass of passmanager Task.
- PassManagerError – If the index is not found.
run(in_programs, callback=None, **kwargs)
Run all the passes on the specified
in_programs (Any | list (opens in a new tab)[Any]) – Input programs to transform via all the registered passes. A single input object cannot be a Python builtin list object. A list object is considered as multiple input objects to optimize.
callback (Callable) –
A callback function that will be called after each pass execution. The function will be called with 4 keyword arguments:
task (GenericPass): the pass being run passmanager_ir (Any): depending on pass manager subclass property_set (PropertySet): the property set running_time (float): the time to execute the pass count (int): the index for the pass execution
The exact arguments pass expose the internals of the pass manager and are subject to change as the pass manager internals change. If you intend to reuse a callback function over multiple releases be sure to check that the arguments being passed are the same.
To use the callback feature you define a function that will take in kwargs dict and access the variables. For example:
def callback_func(**kwargs): task = kwargs['task'] passmanager_ir = kwargs['passmanager_ir'] property_set = kwargs['property_set'] running_time = kwargs['running_time'] count = kwargs['count'] ...
kwargs – Arbitrary arguments passed to the compiler frontend and backend.
The transformed program(s).
Linearize this manager into a single
FlowControllerLinear, so that it can be nested inside another pass manager.
A linearized pass manager.