E.V.E
v2023.02.15
Loading...
Searching...
No Matches

Detailed Description

Defines the number of computations an algorithm handles per loop step.

Variables

template<int N>
constexpr auto eve::algo::unroll = (unroll_key = eve::index<N>)

Variable Documentation

◆ unroll

template<int N>
auto eve::algo::unroll = (unroll_key = eve::index<N>)
inlineconstexpr
Header file #include <eve/module/algo.hpp>
namespace eve::algo
{
template<int N> inline constexpr auto unroll = eve_implementation_defined;
}
constexpr auto unroll
Definition traits.hpp:172
Template Parameters
NRegisters handled per step, one or more.

Sets the number of SIMD registers a loop step handles: N registers are processed before the loop condition is tested again, which spreads the loop overhead over more work and lets independent operations overlap. Simple algorithms are unrolled by default. A larger N is better when the body is short and its iterations are independent, and worse when the body is expensive or an iteration reads what the previous iteration wrote.

unroll<1> is no unrolling, a single register a step, and eve::algo::no_unrolling is its shorthand.

std::vector<float> data(1024);
// One comparison per lane: eight registers a step amortise the loop overhead.
auto found = find_if[unroll<8>](data, [](auto x) { return x > 0.f; });
constexpr auto find_if
SIMD version of std::find_if.
Definition find.hpp:130
See also
no_unrolling, expensive_callable