3bc1a33ce8cb97a6d1a6b3e50fcf77408d485320
[platform/upstream/llvm.git] / openmp / docs / remarks / OMP133.rst
1 Call may contain unknown parallel regions. Use `__attribute__((assume("omp_no_parallelism")))` to override. [OMP133]
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
35    omp133.cpp:6:5: remark: Call may contain unknown parallel regions. Use 
36    `__attribute__((assume("omp_no_parallelism")))` to override. [OMP133]
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
46    __attribute__((assume("omp_no_parallelism"))) extern void setup();
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.