Page MenuHomePhabricator

[OPENMP50]Codegen for scan directive in simd loops.
ClosedPublic

Authored by ABataev on Apr 15 2020, 12:27 PM.

Details

Summary

Added codegen for scandirectives in simd loop. The codegen transforms
original code:

int x = 0;
 #pragma omp simd reduction(inscan, +: x)
for (..) {
  <first part>
  #pragma omp scan inclusive(x)
  <second part>
}

into

int x = 0;
for (..) {
  int x_priv = 0;
  <first part>
  x = x_priv + x;
  x_priv = x;
  <second part>
}

and

int x = 0;
 #pragma omp simd reduction(inscan, +: x)
for (..) {
  <first part>
  #pragma omp scan exclusive(x)
  <second part>
}

into

int x = 0;
for (..) {
  int x_priv = 0;
  <second part>
  int temp = x;
  x = x_priv + x;
  x_priv = temp;
  <first part>
}

Diff Detail

Event Timeline

ABataev created this revision.Apr 15 2020, 12:27 PM
jdoerfert added inline comments.Apr 21 2020, 6:31 PM
clang/lib/CodeGen/CGOpenMPRuntime.h
1351 ↗(On Diff #257802)

I think it is not Unknown but None (or similar) as we know that it is not a scan reduction.

clang/lib/CodeGen/CGStmtOpenMP.cpp
268

What does this conditional do?

ABataev updated this revision to Diff 259270.Apr 22 2020, 6:46 AM

ddress comments

simoll added a subscriber: simoll.Apr 22 2020, 7:02 AM
ABataev updated this revision to Diff 261917.May 4 2020, 1:02 PM

Rebase and simplify

jdoerfert accepted this revision.Wed, Jun 10, 1:02 PM

LGTM. Thx!

This revision is now accepted and ready to land.Wed, Jun 10, 1:02 PM
This revision was automatically updated to reflect the committed changes.