Skip to content

Commit 0513b04

Browse files
committed
Leave comments for shouldUseWorkshareLowering
1 parent 3ad05db commit 0513b04

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

flang/lib/Optimizer/OpenMP/LowerWorkshare.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,23 @@ using namespace mlir;
4040

4141
namespace flangomp {
4242
bool shouldUseWorkshareLowering(Operation *op) {
43-
auto workshare = dyn_cast<omp::WorkshareOp>(op->getParentOp());
44-
if (!workshare)
45-
return false;
46-
return workshare->getParentOfType<omp::ParallelOp>();
43+
// TODO this is insufficient, as we could have
44+
// omp.parallel {
45+
// omp.workshare {
46+
// omp.parallel {
47+
// hlfir.elemental {}
48+
//
49+
// Then this hlfir.elemental shall _not_ use the lowering for workshare
50+
//
51+
// Standard says:
52+
// For a parallel construct, the construct is a unit of work with respect to
53+
// the workshare construct. The statements contained in the parallel
54+
// construct are executed by a new thread team.
55+
//
56+
// TODO similarly for single, critical, etc. Need to think through the
57+
// patterns and implement this function.
58+
//
59+
return op->getParentOfType<omp::WorkshareOp>();
4760
}
4861
} // namespace flangomp
4962

0 commit comments

Comments
 (0)