@@ -2397,6 +2397,22 @@ is unspecified and is therefore considered infinite.
2397
2397
In case of ivdep being applied both w/o an array variable and for a particular
2398
2398
array, the array variables that were not designated a separate ivdep will receive
2399
2399
the no-array ivdep's safelen, with the correspondent treatment by the backend.
2400
+
2401
+ .. code-block:: c++
2402
+
2403
+ void foo() {
2404
+ int a[10];
2405
+ [[intel::ivdep]] for (int i = 0; i != 10; ++i) { }
2406
+ [[intel::ivdep(2)]] for (int i = 0; i != 10; ++i) { }
2407
+ [[intel::ivdep(a)]] for (int i = 0; i != 10; ++i) { }
2408
+ [[intel::ivdep(a, 2)]] for (int i = 0; i != 10; ++i) { }
2409
+ }
2410
+
2411
+ template<int N>
2412
+ void bar() {
2413
+ [[intel::ivdep(N)]] for(;;) { }
2414
+ }
2415
+
2400
2416
}];
2401
2417
}
2402
2418
@@ -2407,6 +2423,19 @@ def SYCLIntelFPGAIIAttrDocs : Documentation {
2407
2423
This attribute applies to a loop. Indicates that the loop should be pipelined
2408
2424
with an initiation interval of N. N must be a positive integer. Cannot be
2409
2425
applied multiple times to the same loop.
2426
+
2427
+ .. code-block:: c++
2428
+
2429
+ void foo() {
2430
+ int var = 0;
2431
+ [[intel::ii(4)]] for (int i = 0; i < 10; ++i) var++;
2432
+ }
2433
+
2434
+ template<int N>
2435
+ void bar() {
2436
+ [[intel::ii(N)]] for(;;) { }
2437
+ }
2438
+
2410
2439
}];
2411
2440
}
2412
2441
@@ -2418,6 +2447,19 @@ This attribute applies to a loop. Indicates that the loop should allow no more
2418
2447
than N threads or iterations to execute it simultaneously. N must be a non
2419
2448
negative integer. '0' indicates the max_concurrency case to be unbounded. Cannot
2420
2449
be applied multiple times to the same loop.
2450
+
2451
+ .. code-block:: c++
2452
+
2453
+ void foo() {
2454
+ int a[10];
2455
+ [[intel::max_concurrency(2)]] for (int i = 0; i != 10; ++i) a[i] = 0;
2456
+ }
2457
+
2458
+ template<int N>
2459
+ void bar() {
2460
+ [[intel::max_concurrency(N)]] for(;;) { }
2461
+ }
2462
+
2421
2463
}];
2422
2464
}
2423
2465
@@ -2429,6 +2471,34 @@ This attribute applies to a loop. Indicates that the loop nest should be
2429
2471
coalesced into a single loop without affecting functionality. Parameter N is
2430
2472
optional. If specified, it shall be a positive integer, and indicates how many
2431
2473
of the nested loop levels should be coalesced.
2474
+
2475
+ .. code-block:: c++
2476
+
2477
+ void foo() {
2478
+ int a[10];
2479
+ [[intel::loop_coalesce]] for (int i = 0; i != 10; ++i) a[i] = 0;
2480
+ }
2481
+
2482
+ template<int N>
2483
+ void loop_coalesce() {
2484
+ int j = 0, n = 48;
2485
+ [[intel::loop_coalesce(N)]]
2486
+ while (j < n) {
2487
+ if (j % 4) {
2488
+ ++j;
2489
+ continue;
2490
+ }
2491
+ }
2492
+ j = 0;
2493
+ [[intel::loop_coalesce]]
2494
+ while (j < n) {
2495
+ if (j % 6) {
2496
+ ++j;
2497
+ continue;
2498
+ }
2499
+ }
2500
+ }
2501
+
2432
2502
}];
2433
2503
}
2434
2504
@@ -2440,6 +2510,14 @@ This attribute applies to a loop. Disables pipelining of the loop data path,
2440
2510
causing the loop to be executed serially. Cannot be used on the same loop in
2441
2511
conjunction with max_interleaving, speculated_iterations, max_concurrency, ii
2442
2512
or ivdep.
2513
+
2514
+ .. code-block:: c++
2515
+
2516
+ void foo() {
2517
+ int var = 0;
2518
+ [[intel::disable_loop_pipelining] for (int i = 0; i < 10; ++i) var++;
2519
+ }
2520
+
2443
2521
}];
2444
2522
}
2445
2523
@@ -2453,6 +2531,19 @@ mean that this attribute can only be applied to inner loops in user code - outer
2453
2531
loops in user code may still be contained in an implicit loop due to NDRange).
2454
2532
Parameter N is mandatory, and shall be non-negative integer. Cannot be
2455
2533
used on the same loop in conjunction with disable_loop_pipelining.
2534
+
2535
+ .. code-block:: c++
2536
+
2537
+ void foo() {
2538
+ int a[10];
2539
+ [[intel::max_interleaving(4)]] for (int i = 0; i != 10; ++i) a[i] = 0;
2540
+ }
2541
+
2542
+ template<int N>
2543
+ void bar() {
2544
+ [[intel::max_interleaving(N)]] for(;;) { }
2545
+ }
2546
+
2456
2547
}];
2457
2548
}
2458
2549
@@ -2465,6 +2556,19 @@ iterations that will be in flight for a loop invocation (i.e. the exit
2465
2556
condition for these iterations will not have been evaluated yet).
2466
2557
Parameter N is mandatory, and may either be 0, or a positive integer. Cannot be
2467
2558
used on the same loop in conjunction with disable_loop_pipelining.
2559
+
2560
+ .. code-block:: c++
2561
+
2562
+ void foo() {
2563
+ int var = 0;
2564
+ [[intel::speculated_iterations(4)]] for (int i = 0; i < 10; ++i) var++;
2565
+ }
2566
+
2567
+ template<int N>
2568
+ void bar() {
2569
+ [[intel::speculated_iterations(N)]] for(;;) { }
2570
+ }
2571
+
2468
2572
}];
2469
2573
}
2470
2574
@@ -2474,6 +2578,21 @@ def SYCLIntelFPGANofusionAttrDocs : Documentation {
2474
2578
let Content = [{
2475
2579
This attribute applies to a loop. Indicates that the annotated
2476
2580
loop should not be fused with any adjacent loop.
2581
+
2582
+ .. code-block:: c++
2583
+
2584
+ void foo() {
2585
+ [[intel::nofusion]] for (int i=0; i<10;++i) { }
2586
+ }
2587
+
2588
+ void nofusion() {
2589
+ int a1[10];
2590
+ for (int i = 0; i < 10; ++i) {
2591
+ [[intel::nofusion]] for (int j = 0; j < 10; ++j) {
2592
+ a1[i] += a1[j];
2593
+ }
2594
+ }
2595
+
2477
2596
}];
2478
2597
}
2479
2598
0 commit comments