<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - The device runtime cannot simply skip nested parallel regions but it has to execute them"
   href="https://bugs.llvm.org/show_bug.cgi?id=49779">49779</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The device runtime cannot simply skip nested parallel regions but it has to execute them
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jdoerfert@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>a.bataev@hotmail.com, jonathanchesterfield@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code (<a href="https://godbolt.org/z/aMqTePnE9">https://godbolt.org/z/aMqTePnE9</a>) should increment
C between 2 and 6 times, depending on the choice of #threads for the parallel
regions. Clang right now increments C only once, which is wrong. The problem is
the nested parallel region is skipped completely but it should be executed by
at least one thread (for each encountering thread), thus we should see 3 given
our current mapping of the parallel region in main.


```
void work(int *C) {
  #pragma omp atomic
  ++(*C);
}

void use(int *C) {
  #pragma omp parallel num_threads(2)
  work(C);
}

int main() {
  int C = 0;
  #pragma omp target map(C)
  { 
    use(&C); 
    #pragma omp parallel num_threads(2)
    use(&C);
  }

  return C;
}
```


This bug is to make sure the new runtime doesn't have the same issue.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>