Current implementation is not compatible with asynchronous target
regions, need to remove it.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This revision causes a bug with generic regions. Firstprivate constants now aren't mapped properly into an internal parallel region and will just be zero. For example if I run this code I will see different values for the constants inside and outside the parallel region.
#include <complex>
#include <cstdio>
void foo(const std::complex<double> X, std::complex<double> Y) {
#pragma omp target firstprivate(X) map(from:Y)
  {
    printf ("Outside parallel: %f + %fi\n", X.real(), X.imag());
#pragma omp parallel firstprivate(X)
    {
      printf ("Inside parallel: %f + %fi\n", X.real(), X.imag());
      Y = X;
    }
  }
}
int main() {
  std::complex<double> X = {1.0, 1.0};
  std::complex<double> Y;
  foo(X, Y);
}Outside parallel: 1.000000 + 1.000000i Inside parallel: 0.000000 + 0.000000i
I'm assuming they aren't being properly copied because they were originally global constants that had visibility everywhere.
Comment Actions
Hi, thanks for the report. I think I know the reason, I prepared a patch D105647. Could you check if it fixes the issue?