passlab / rexompiler

REX OpenMP Compiler
https://passlab.github.io/rexompiler/
Other
1 stars 1 forks source link

OpenMP: Loop: Worksharing-Loop #50

Open yanyh15 opened 4 years ago

yanyh15 commented 4 years ago

The syntax of the worksharing-loop construct is as follows

#pragma omp for [clause[ [,] clause] ... ] new-line
loop-nest

where loop-nest is a canonical loop nest and clause is one of the following:

private(list)
firstprivate(list)
lastprivate([lastprivate-modifier:]list)
linear(list[:linear-step])
reduction([reduction-modifier,]reduction-identifier:list)
schedule([modifier [, modifier]:]kind[, chunk_size])
collapse(n)
ordered[(n)]
nowait
allocate([allocator:]list)
order([order-modifier:]concurrent)

XOMP for worksharing-loop are currently as follows:

APIs of kmp and gomp for parallel directive

Handling of clauses

Compilation

Tests

ouankou commented 3 years ago

SgOmpForStatement is used to represent loop worksharing in the REX compiler. To implement UPIR, we rename this node to SgUpirLoopParallelStatement for worksharing. In addition, SgUpirLoopStatement is implemented for the affine loop.

Given a loop in OpenMP:

#pragma omp for
  for (int i = 0; i < 10; i++)
    ...

Originally, we have:

SgOmpForStatement
  for-loop

In UPIR:

SgUpirLoopParallelStatement
  SgUpirLoopStatement
    for-loop