IterationFold`s from sequences of nested :class:`Iteration.
Given a section of Iteration/Expression tree as below:
for i = 1 to N-1 // folded for j = 1 to N-1 // folded foo1()
Assuming a fold with offset 1 in both /i/ and /j/ and body
for i = 1 to N-1 for j = 1 to N-1 foo1() for i = 2 to N-2 for j = 2 to N-2 foo2()
transform(node, mode='basic', options=None)¶
Transform Iteration/Expression trees to generate highly optimized C code.
- node – The Iteration/Expression tree to be transformed, or an iterable of Iteration/Expression trees.
- mode – Drive the tree transformation.
modeis a string indicating a certain optimization pipeline.
- options – A dictionary with additional information to drive the DLE.
modeparameter accepts the following values:
* 'noop': Do nothing. * 'basic': Add instructions to avoid denormal numbers and create elemental functions for rapid JIT-compilation. * 'advanced': 'basic', vectorization, loop blocking. * 'speculative': Apply all of the 'advanced' transformations, plus other transformations that might increase (or possibly decrease) performance.
optionsparameter accepts the following values:
* 'blockshape': The block shape for loop blocking (a tuple). * 'blockinner': By default, loop blocking is not applied to the innermost dimension of an Iteration/Expression tree (to maximize vectorization). Set this flag to True to override this heuristic. * 'blockalways': Apply blocking even though the DLE thinks it's not worthwhile applying it.