Template Function poet::dynamic_for(T1, T2, T3, Func&&)

Function Documentation

template<std::size_t Unroll, typename T1, typename T2, typename T3, typename Func, std::enable_if_t<detail::is_df_callable_v<std::remove_reference_t<Func>, std::common_type_t<T1, T2, T3>>, int> = 0>
void poet::dynamic_for(T1 begin, T2 end, T3 step, Func &&func)

Executes a runtime-sized loop using compile-time unrolling.

Iterates over [begin, end) with the given step, emitting blocks of Unroll iterations. step == 1 selects the compile-time-stride path.

Template Parameters:

Unroll – Iterations per unrolled block, exactly: the compiler does not unroll the main loop further, and a range of exactly Unroll is one block and no loop. No default: choose per call site. 2 small codegen, 4 balanced, 8 profiled hot loops, 1 a loop that stays rolled.

Parameters:
  • begin – Inclusive start bound.

  • end – Exclusive end bound.

  • step – Increment per iteration. May be negative.

  • func – Callable invoked per iteration, in either form:

    • func(std::integral_constant<std::size_t, lane>{}, index): lane as type

    • func(index): index only