
On a MI250x

The following program doesn't finish when compiled as:
`clang -fopenmp -O3 --offload-arch=gfx90a `

But it does finish when compiled as:
`clang -fopenmp --offload-arch=gfx90a 
`
```#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

#pragma omp requires atomic_default_mem_order(acq_rel)

int main() {

  int x = 0, y = 0;
  int errors = 0;
      
#pragma omp target parallel num_threads(2) map(tofrom: x, y, errors)
   {
       int thrd = omp_get_thread_num();
       if (thrd == 0) {
          x = 10;
          #pragma omp atomic write 
          y = 1;
       }
       if (thrd == 1){
          int tmp = 0;
          while (tmp == 0) {
            #pragma omp atomic read 
            tmp = y;
          }
          if(x != 10) errors++;
       }
   }
   if(errors)
     printf("Test Failed\n");
   else
     printf("Test Passed\n");

   return errors;
}
```
OpenMP offload Program with atomic does not finished when build with -O3 of AMD GPUs
This is a GitHub Issue
repo:llvm-project
owner:llvm
Title : OpenMP offload Program with atomic does not finished when build with -O3 of AMD GPUs
Issue date:

--- start body ---

On a MI250x

The following program doesn't finish when compiled as:
`clang -fopenmp -O3 --offload-arch=gfx90a `

But it does finish when compiled as:
`clang -fopenmp --offload-arch=gfx90a 
`
```#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

#pragma omp requires atomic_default_mem_order(acq_rel)

int main() {

  int x = 0, y = 0;
  int errors = 0;
      
#pragma omp target parallel num_threads(2) map(tofrom: x, y, errors)
   {
       int thrd = omp_get_thread_num();
       if (thrd == 0) {
          x = 10;
          #pragma omp atomic write 
          y = 1;
       }
       if (thrd == 1){
          int tmp = 0;
          while (tmp == 0) {
            #pragma omp atomic read 
            tmp = y;
          }
          if(x != 10) errors++;
       }
   }
   if(errors)
     printf("Test Failed\n");
   else
     printf("Test Passed\n");

   return errors;
}
```
--- end body ---
