Sirraide | c44fa3e | 2024-05-22 15:58:48 | [diff] [blame] | 1 | Call may contain unknown parallel regions. Use `[[omp::assume("omp_no_parallelism")]]` to override. [OMP133] |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 2 | ==================================================================================================================== |
| 3 | |
| 4 | .. _omp133: |
| 5 | |
| 6 | This analysis remark identifies calls that prevented :ref:`OMP131 <omp131>` from |
| 7 | providing the generic-mode kernel with a fully specialized state machine. This |
| 8 | remark will identify each call that may contain unknown parallel regions that |
| 9 | caused the kernel to require a fallback. |
| 10 | |
| 11 | Examples |
| 12 | -------- |
| 13 | |
| 14 | This will occur for any generic-mode kernel that may contain unknown parallel |
| 15 | regions. This is typically coupled with the :ref:`OMP132 <omp132>` remark. |
| 16 | |
| 17 | .. code-block:: c++ |
| 18 | |
| 19 | extern void setup(); |
| 20 | |
| 21 | void foo() { |
| 22 | #pragma omp target |
| 23 | { |
| 24 | setup(); |
| 25 | #pragma omp parallel |
| 26 | { |
| 27 | work(); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | .. code-block:: console |
| 33 | |
| 34 | $ clang++ -fopenmp -fopenmp-targets=nvptx64 -O2 -Rpass-analysis=openmp-opt omp133.cpp |
Shao-Ce SUN | 0c66025 | 2021-11-15 01:17:08 | [diff] [blame] | 35 | omp133.cpp:6:5: remark: Call may contain unknown parallel regions. Use |
Sirraide | c44fa3e | 2024-05-22 15:58:48 | [diff] [blame] | 36 | `[[omp::assume("omp_no_parallelism")]]` to override. [OMP133] |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 37 | setup(); |
| 38 | ^ |
| 39 | |
| 40 | The remark suggests marking the function with the assumption that it contains no |
| 41 | parallel regions. If this is done then the kernel will be rewritten with a fully |
| 42 | specialized state machine. |
| 43 | |
| 44 | .. code-block:: c++ |
| 45 | |
Sirraide | c44fa3e | 2024-05-22 15:58:48 | [diff] [blame] | 46 | [[omp::assume("omp_no_parallelism")]] extern void setup(); |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 47 | |
| 48 | |
| 49 | void foo() { |
| 50 | #pragma omp target |
| 51 | { |
| 52 | setup(); |
| 53 | #pragma omp parallel |
| 54 | { |
| 55 | work(); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | .. code-block:: console |
| 61 | |
| 62 | $ clang++ -fopenmp -fopenmp-targets=nvptx64 -O2 -Rpass=openmp-opt omp133.cpp |
| 63 | omp133.cpp:4:1: remark: Rewriting generic-mode kernel with a customized state machine. [OMP131] |
| 64 | #pragma omp target |
| 65 | ^ |
| 66 | |
| 67 | Diagnostic Scope |
| 68 | ---------------- |
| 69 | |
| 70 | OpenMP target offloading analysis remark. |