File dynamic_for.hpp
↰ Parent directory (include/poet/core)
Runtime-bounded loops with a compile-time-unrolled body.
Definition (include/poet/core/dynamic_for.hpp)
Detailed Description
One run_loop template covers every public overload: the stride, the callable form, and the extra by-value arguments are template parameters, so no tag object or dispatch value is passed at run time. The main loop emits fully unrolled blocks of Unroll iterations; the tail is a binary decomposition with O(log2 Unroll) branches; a range smaller than Unroll is inlined so the lane constants stay visible.
Unroll is exact: POET_NO_UNROLL keeps the compiler from unrolling the main loop again and opaque_count hides the block count from the complete unroller. A range of exactly Unroll is one block and no loop. tests/exact_unroll_check.cpp counts the bodies.
dynamic_for pays off for multi-accumulator work: the lane form (func(lane_constant, index)) gives one accumulator per lane, breaking the serial dependence of a plain loop. For element-wise work or one serial chain, a plain for loop has less overhead.
Includes
cstddeflimitspoet/core/for_utils.hpp(File for_utils.hpp)rangestupletype_traitsutility