These functions provide the ability to finely control the pipelining of a loop.
|
| template<unsigned MinIters, loop_options Opts = loop_options{}, typename Fn> |
| void | aie::peeled_loop (unsigned count, Fn &&fn) |
| | Invokes a function object a given number of times, applying peeling at the front and back of the loop.
|
| |
| template<unsigned MinIters, loop_options Opts = loop_options{}, typename Fn> |
| void | aie::pipelined_loop (unsigned count, Fn &&fn) |
| | Invokes a function object a given number of times.
|
| |
| template<unsigned MinIters, loop_options OptsFn1 = loop_options{}, loop_options OptsFn2 = loop_options{}, typename Fn1, typename Fn2> |
| void | aie::pipelined_loops (unsigned count, Fn1 &&fn1, Fn2 &&fn2) |
| | Invokes two function objects a given number of times.
|
| |
◆ aie::loop_options
A structure containing options related to loop iteration peeling.
To be used with aie::pipelined_loop
| Class Members |
|
unsigned |
peel_back = 0 |
The number of iterations to peel at the back of the loop. |
|
unsigned |
peel_front = 0 |
The number of iterations to peel at the front of the loop. |
|
int |
preamble_offset = 0 |
Adjust the preamble. |
◆ peeled_loop()
template<unsigned MinIters,
loop_options Opts = loop_options{}, typename Fn>
| void aie::peeled_loop |
( |
unsigned | count, |
|
|
Fn && | fn ) |
Invokes a function object a given number of times, applying peeling at the front and back of the loop.
constexpr unsigned MinIters = 8;
auto loop_body = [&](unsigned idx){ ... };
void peeled_loop(unsigned count, Fn &&fn)
Invokes a function object a given number of times, applying peeling at the front and back of the loop...
Definition utils.hpp:762
A structure containing options related to loop iteration peeling.
Definition utils.hpp:572
- Template Parameters
-
| MinIters | Lower bound on the number of iterations of the loop body |
| Opts | Options related to peeling loop iterations |
- Parameters
-
| count | Number of iterations |
| fn | The callable to the function |
◆ pipelined_loop()
template<unsigned MinIters,
loop_options Opts = loop_options{}, typename Fn>
| void aie::pipelined_loop |
( |
unsigned | count, |
|
|
Fn && | fn ) |
Invokes a function object a given number of times.
The pipelining can be controlled by optionally peeling iterations.
constexpr unsigned MinIters = 8;
auto loop_body = [&](unsigned idx){ ... };
void pipelined_loop(unsigned count, Fn &&fn)
Invokes a function object a given number of times.
Definition utils.hpp:736
- Template Parameters
-
| MinIters | Lower bound on the number of iterations of the loop body |
| Opts | Options related to peeling loop iterations |
- Parameters
-
| count | Number of iterations |
| fn | The callable to pipeline |
◆ pipelined_loops()
template<unsigned MinIters,
loop_options OptsFn1 = loop_options{},
loop_options OptsFn2 = loop_options{}, typename Fn1, typename Fn2>
| void aie::pipelined_loops |
( |
unsigned | count, |
|
|
Fn1 && | fn1, |
|
|
Fn2 && | fn2 ) |
Invokes two function objects a given number of times.
The pipelining of each can be controlled by optionally peeling iterations.
- Template Parameters
-
| MinIters | Lower bound on the number of iterations of the loop body |
| OptsFn1 | Options related to peeling loop iterations of the first function |
| OptsFn2 | Options related to peeling loop iterations of the second function |
- Parameters
-
| count | Number of iterations |
| fn1 | The first callable to pipeline |
| fn2 | The second callable to pipeline |
For example, take the following
constexpr unsigned MinIters = 4;
auto loop_body1 = [&](unsigned idx){ ... };
auto loop_body2 = [&](unsigned idx){ ... };
unsigned n = 16;
aie::loop_options{.peel_front = 3, .peel_back = 4}>(n, loop_body1, loop_body2);
void pipelined_loops(unsigned count, Fn1 &&fn1, Fn2 &&fn2)
Invokes two function objects a given number of times.
Definition utils.hpp:803
This will result in the following execution:
|stage0 |stage1 |stage2 (main loop) |stage3 |stage4 |
----|-------|-----------|-----------------------------------|-------|-------|
fn1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| 14| 15| - | - |
fn2 | - | - | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| 14| 15|