diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 2fb0d5823d6c5..decbf76359d79 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2380,6 +2380,22 @@ is unspecified and is therefore considered infinite. In case of ivdep being applied both w/o an array variable and for a particular array, the array variables that were not designated a separate ivdep will receive the no-array ivdep's safelen, with the correspondent treatment by the backend. + +.. code-block:: c++ + + void foo() { + int a[10]; + [[intel::ivdep]] for (int i = 0; i != 10; ++i) { } + [[intel::ivdep(2)]] for (int i = 0; i != 10; ++i) { } + [[intel::ivdep(a)]] for (int i = 0; i != 10; ++i) { } + [[intel::ivdep(a, 2)]] for (int i = 0; i != 10; ++i) { } + } + + template + void bar() { + [[intel::ivdep(N)]] for(;;) { } + } + }]; } @@ -2390,6 +2406,19 @@ def SYCLIntelFPGAIIAttrDocs : Documentation { This attribute applies to a loop. Indicates that the loop should be pipelined with an initiation interval of N. N must be a positive integer. Cannot be applied multiple times to the same loop. + +.. code-block:: c++ + + void foo() { + int var = 0; + [[intel::ii(4)]] for (int i = 0; i < 10; ++i) var++; + } + + template + void bar() { + [[intel::ii(N)]] for(;;) { } + } + }]; } @@ -2401,6 +2430,19 @@ This attribute applies to a loop. Indicates that the loop should allow no more than N threads or iterations to execute it simultaneously. N must be a non negative integer. '0' indicates the max_concurrency case to be unbounded. Cannot be applied multiple times to the same loop. + +.. code-block:: c++ + + void foo() { + int a[10]; + [[intel::max_concurrency(2)]] for (int i = 0; i != 10; ++i) a[i] = 0; + } + + template + void bar() { + [[intel::max_concurrency(N)]] for(;;) { } + } + }]; } @@ -2412,6 +2454,34 @@ This attribute applies to a loop. Indicates that the loop nest should be coalesced into a single loop without affecting functionality. Parameter N is optional. If specified, it shall be a positive integer, and indicates how many of the nested loop levels should be coalesced. + +.. code-block:: c++ + + void foo() { + int a[10]; + [[intel::loop_coalesce]] for (int i = 0; i != 10; ++i) a[i] = 0; + } + + template + void loop_coalesce() { + int j = 0, n = 48; + [[intel::loop_coalesce(N)]] + while (j < n) { + if (j % 4) { + ++j; + continue; + } + } + j = 0; + [[intel::loop_coalesce]] + while (j < n) { + if (j % 6) { + ++j; + continue; + } + } + } + }]; } @@ -2423,6 +2493,14 @@ This attribute applies to a loop. Disables pipelining of the loop data path, causing the loop to be executed serially. Cannot be used on the same loop in conjunction with max_interleaving, speculated_iterations, max_concurrency, ii or ivdep. + +.. code-block:: c++ + + void foo() { + int var = 0; + [[intel::disable_loop_pipelining] for (int i = 0; i < 10; ++i) var++; + } + }]; } @@ -2436,6 +2514,19 @@ mean that this attribute can only be applied to inner loops in user code - outer loops in user code may still be contained in an implicit loop due to NDRange). Parameter N is mandatory, and shall be non-negative integer. Cannot be used on the same loop in conjunction with disable_loop_pipelining. + +.. code-block:: c++ + + void foo() { + int a[10]; + [[intel::max_interleaving(4)]] for (int i = 0; i != 10; ++i) a[i] = 0; + } + + template + void bar() { + [[intel::max_interleaving(N)]] for(;;) { } + } + }]; } @@ -2448,6 +2539,19 @@ iterations that will be in flight for a loop invocation (i.e. the exit condition for these iterations will not have been evaluated yet). Parameter N is mandatory, and may either be 0, or a positive integer. Cannot be used on the same loop in conjunction with disable_loop_pipelining. + +.. code-block:: c++ + + void foo() { + int var = 0; + [[intel::speculated_iterations(4)]] for (int i = 0; i < 10; ++i) var++; + } + + template + void bar() { + [[intel::speculated_iterations(N)]] for(;;) { } + } + }]; } @@ -2457,6 +2561,21 @@ def SYCLIntelFPGANofusionAttrDocs : Documentation { let Content = [{ This attribute applies to a loop. Indicates that the annotated loop should not be fused with any adjacent loop. + +.. code-block:: c++ + + void foo() { + [[intel::nofusion]] for (int i=0; i<10;++i) { } + } + + void nofusion() { + int a1[10]; + for (int i = 0; i < 10; ++i) { + [[intel::nofusion]] for (int j = 0; j < 10; ++j) { + a1[i] += a1[j]; + } + } + }]; }