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: unassignedb...@nondot.org
          Reporter: jdoerf...@anl.gov
                CC: a.bat...@hotmail.com, jonathanchesterfi...@gmail.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to