The syntax of the tile construct is as follows:
#pragma omp tile sizes(size-list) new-line
loop-nest
where loop-nest is a canonical loop nest and size-list is a list s1,…,sn of positive integer expressions.
A loop transformation construct replaces itself, including its associated loop nest, with a structured block that may be another loop nest. If the loop transformation construct is nested inside another loop nest, its replacement becomes part of that loop nest and therefore its generated loops may become associated with another loop-associated directive that forms an enclosing construct. A loop transformation construct that is closely nested within another loop transformation construct applies before the enclosing loop transformation construct.
The associated loop nest of a loop transformation construct must have canonical loop nest form (see Section 2.11.1). All generated loops have canonical loop nest form, unless otherwise specified. Loop iteration variables of generated loops are always private in the enclosing teams, parallel, simd, or task generating construct.
Summary The tile construct tiles one or more loops.
The syntax of the tile construct is as follows:
!$omp tile sizes(size-list)
loop-nest
[!$omp end tile]
where loop-nest is a canonical loop nest and size-list is a list s1,…,sn of positive integer expressions.
If an end tile directive is not specified, an end tile directive is assumed at the end of the do-loops.
Description The tile construct controls the outer n loops of the associated loop nest, where n is the number of items in size-list. Let ℓ1, …ℓn be the associated loops, from outermost to innermost, which the construct replaces with a loop nest that consists of 2n perfectly nested loops. Let f1,…,fn,t1,…,tn be the generated loops, from outermost to innermost. The loops f1,…,fn are the floor loops and the loops t1,…,tn are the tile loops. The tile loops do not have canonical loop nest form.
Let Ω be the logical iteration vector space of the associated loops. For any (α1,…,αn) ∈ ℕn, define a tile Tα1,…,αn as the set of iterations {(i1,…,in) ∈ Ω∣∀k ∈{1,…,n} : skαk ≤ ik < skαk + sk} and F = {Tα1,…,αn∣Tα1,…,αn≠∅} as the set of tiles with at least one iteration. Tiles that contain ∏ k=1nsk iterations are complete tiles. Otherwise, they are partial tiles.
The floor loops iterate over all tiles {Tα1,…,αn ∈ F} in lexicographic order with respect to their indices (α1,…,αn) and the tile loops iterate over the iterations in Tα1,…,αn in the lexicographic order of the corresponding iteration vectors. An implementation may reorder the sequential execution of two iterations if at least one is from a partial tile and if their respective logical iteration vectors in loop-nest do not have a product order relation.
Restrictions Restrictions to the tile construct are as follows:
Summary The unroll construct fully or partially unrolls a loop.
The syntax of the unroll construct is as follows:
!$omp unroll [clause]
loop-nest
[!$omp end unroll]
where loop-nest is a canonical loop nest and clause is one of the following:
full
partial[(unroll-factor)]
where unroll-factor is a positive integer expression that is a compile-time constant.
If an end unroll directive is not specified, an end unroll directive is assumed at the end of the do-loop.
Description The unroll construct controls the outermost loop of the loop nest.
When the full clause is specified, the associated loop is fully unrolled – it is replaced with n instances of its loop body, one for each logical iteration of the associated loop and in the order of its logical iterations. The construct is replaced by a structured block that only contains the n loop body instances.
When the partial clause is specified, the associated loop is first tiled with a tile size of unroll-factor. Then, the generated tile loop is fully unrolled. If the partial clause is used without an unroll-factor argument then the unroll factor is a positive integer that is implementation defined.
When neither the full nor the partial clauses are specified, if and how the loop is unrolled is implementation defined.
The unroll construct results in a generated loop that has canonical loop nest form if and only if the partial clause is specified.
Restrictions Restrictions to the unroll construct are as follows: