loki.transformations.loop_blocking
Functions
|
Replaces arrays inside the inner loop with blocked counterparts. |
|
calculates the dimensions for a blocked version of the array. |
|
|
|
Returns a new dimension object with all occurences of indices changed to replacement_index. |
|
Blocks a loop by splitting it into an outer loop and inner loop of size block_size. |
Classes
|
This class holds the loop splitting variables, e.g. outer loop block sizes and iteration bounds. |
- split_loop(routine: Subroutine, loop: Loop, block_size: int)
Blocks a loop by splitting it into an outer loop and inner loop of size block_size.
- Parameters:
routine (
Subroutine
) – Subroutine object containing the loop. New variables introduced in the loop splitting will be declared in the body of routine.loop (
Loop
) – Loop to be split.block_size (int) – inner loop size (size of blocking blocks)
- block_loop_arrays(routine: Subroutine, splitting_vars, inner_loop: Loop, outer_loop: Loop, blocking_indices)
Replaces arrays inside the inner loop with blocked counterparts.
This routine declares array variables to hold the blocks of the arrays used inside the loop and replaces array variables inside the loop with their blocked counterparts. An array is blocked with the leading dimensions
- Parameters:
routine (Subroutine) – routine in which the blocking variables should be added.
blocking_indices (tuple or list of str) – list of the index variables that arrays inside the loop should be blocked by.
inner_loop (
Loop
) – inner loop after loop splittingouter_loop (
Loop
) – outer loop body after loop splittingblocking_indices –
- Variable names of the indexes that should be blocked if in array
expressions.