| AI Engine-ML Intrinsics User Guide (v2025.2)

Loading...
Searching...
No Matches
Macros
Loop annotations
Compiler optimizations » Code annotations

## Overview

These annotations are used after the heading of the for or while loop. These are meant to customize the behavior of software pipelining.

## Macros
#define | __aie_loop_fold_adjust_preamble(x)
| This directive rotates the modulo scheduled leaf loop with N cycles, increasing the preamble with N cycles if N is positive, and decreasing it with -N cycles if N is negative.
#define | __aie_loop_fold_budget_ratio(x)
| Specify the amount of backtracking in modulo scheduling of leaf loops.
#define | __aie_loop_fold_initiation_interval(x)
| Set the minimum cycle count of the pipelined loop.
#define | __aie_loop_fold_non_leaf_solution(x)
| This directive imposes a specific solution in the cycle/code size trade-offs of non-leaf loop pipelining.
#define | __aie_loop_keep_sw()
| Keep the software loop: prohibit both zero and low-overhead loop constructs.

## Macro Definition Documentation

## ◆ __aie_loop_fold_adjust_preamble

#define __aie_loop_fold_adjust_preamble | ( |  | x | ) |

This directive rotates the modulo scheduled leaf loop with N cycles, increasing the preamble with N cycles if N is positive, and decreasing it with -N cycles if N is negative.

Parameters

  x | loop adjustment.

## ◆ __aie_loop_fold_budget_ratio

#define __aie_loop_fold_budget_ratio | ( |  | x | ) |

Specify the amount of backtracking in modulo scheduling of leaf loops.

Parameters

  x | budget ratio.

## ◆ __aie_loop_fold_initiation_interval

#define __aie_loop_fold_initiation_interval | ( |  | x | ) |

Set the minimum cycle count of the pipelined loop.

Parameters

  x | initiation interval.

## ◆ __aie_loop_fold_non_leaf_solution

#define __aie_loop_fold_non_leaf_solution | ( |  | x | ) |

This directive imposes a specific solution in the cycle/code size trade-offs of non-leaf loop pipelining.

Possible values are :

- 0 (disable pipelining).
- 1 (do not decrement the loop count).
- 2 (decrement the loop count once and duplicate the loop to the postamble).
- 3 (decrement the loop count once and duplicate the loop to the preamble).
- 4 (decrement the loop count twice and duplicate the loop to both preamble and postamble).

By default the smallest value is selected that results in the best cycle count for the corresponding loop.

Parameters

  x | non-leaf loop solution.

## ◆ __aie_loop_keep_sw

#define __aie_loop_keep_sw | ( |  | ) |

Keep the software loop: prohibit both zero and low-overhead loop constructs.