Specifies a block of
code in the SIMD loop or SIMD-enabled function that should be executed
serially, in a logical order of SIMD lanes.
block will use a single SIMD lane to execute
operations in the order of the loop iterations, or logical lanes of a
SIMD-enabled function. This preserves ordering of operations in the block with
respect to each other, and correlates with iteration space of the enclosing
SIMD construct. The ordered
block is executed in order, with respect to each SIMD
lane or each loop iteration. The operations within the ordered
block can be re-ordered by optimizations, as long
as the original execution semantics are preserved.
blocks allow the isolation and
resolution of situations prohibited from SIMD execution. This includes
cross-iteration data dependencies, function calls with side effects, such as
oneTBB and native
thread synchronization primitives.
sections are useful for
resolving cross-iteration data dependencies in otherwise data-parallel
computations. For example, the section may handle histogram updates as shown
for (int i = 0; i < N; i++)
float amount = compute_amount(i);
int cluster = compute_cluster(i);
totals[cluster] += amount; // Requires ordering to process multiple updates for the same cluster