[llvm-bugs] [Bug 49779] New: The device runtime cannot simply skip nested parallel regions but it has to execute them

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 30 14:39:57 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49779

            Bug ID: 49779
           Summary: The device runtime cannot simply skip nested parallel
                    regions but it has to execute them
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: jdoerfert at anl.gov
                CC: a.bataev at hotmail.com, jonathanchesterfield at gmail.com,
                    llvm-bugs at lists.llvm.org

The following code (https://godbolt.org/z/aMqTePnE9) 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210330/002ba50b/attachment.html>


More information about the llvm-bugs mailing list