Skip to content

Commit 8077858

Browse files
committed
[OpenMP] Use workdistribute instead of coexecute
1 parent ca0cc44 commit 8077858

File tree

8 files changed

+152
-152
lines changed

8 files changed

+152
-152
lines changed

flang/include/flang/Semantics/openmp-directive-sets.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static const OmpDirectiveSet topTargetSet{
143143
Directive::OMPD_target_teams_distribute_parallel_do_simd,
144144
Directive::OMPD_target_teams_distribute_simd,
145145
Directive::OMPD_target_teams_loop,
146-
Directive::OMPD_target_teams_coexecute,
146+
Directive::OMPD_target_teams_workdistribute,
147147
};
148148

149149
static const OmpDirectiveSet allTargetSet{topTargetSet};
@@ -173,7 +173,7 @@ static const OmpDirectiveSet topTeamsSet{
173173
Directive::OMPD_teams_distribute_parallel_do_simd,
174174
Directive::OMPD_teams_distribute_simd,
175175
Directive::OMPD_teams_loop,
176-
Directive::OMPD_teams_coexecute,
176+
Directive::OMPD_teams_workdistribute,
177177
};
178178

179179
static const OmpDirectiveSet bottomTeamsSet{
@@ -189,14 +189,14 @@ static const OmpDirectiveSet allTeamsSet{
189189
Directive::OMPD_target_teams_distribute_parallel_do_simd,
190190
Directive::OMPD_target_teams_distribute_simd,
191191
Directive::OMPD_target_teams_loop,
192-
Directive::OMPD_target_teams_coexecute,
192+
Directive::OMPD_target_teams_workdistribute,
193193
} | topTeamsSet,
194194
};
195195

196-
static const OmpDirectiveSet allCoexecuteSet{
197-
Directive::OMPD_coexecute,
198-
Directive::OMPD_teams_coexecute,
199-
Directive::OMPD_target_teams_coexecute,
196+
static const OmpDirectiveSet allWorkdistributeSet{
197+
Directive::OMPD_workdistribute,
198+
Directive::OMPD_teams_workdistribute,
199+
Directive::OMPD_target_teams_workdistribute,
200200
};
201201

202202
//===----------------------------------------------------------------------===//
@@ -239,9 +239,9 @@ static const OmpDirectiveSet blockConstructSet{
239239
Directive::OMPD_taskgroup,
240240
Directive::OMPD_teams,
241241
Directive::OMPD_workshare,
242-
Directive::OMPD_target_teams_coexecute,
243-
Directive::OMPD_teams_coexecute,
244-
Directive::OMPD_coexecute,
242+
Directive::OMPD_target_teams_workdistribute,
243+
Directive::OMPD_teams_workdistribute,
244+
Directive::OMPD_workdistribute,
245245
};
246246

247247
static const OmpDirectiveSet loopConstructSet{
@@ -306,7 +306,7 @@ static const OmpDirectiveSet workShareSet{
306306
Directive::OMPD_scope,
307307
Directive::OMPD_sections,
308308
Directive::OMPD_single,
309-
Directive::OMPD_coexecute,
309+
Directive::OMPD_workdistribute,
310310
} | allDoSet,
311311
};
312312

@@ -389,7 +389,7 @@ static const OmpDirectiveSet nestedReduceWorkshareAllowedSet{
389389
};
390390

391391
static const OmpDirectiveSet nestedTeamsAllowedSet{
392-
Directive::OMPD_coexecute,
392+
Directive::OMPD_workdistribute,
393393
Directive::OMPD_distribute,
394394
Directive::OMPD_distribute_parallel_do,
395395
Directive::OMPD_distribute_parallel_do_simd,

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,14 +2670,14 @@ genTeamsOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
26702670
queue, item, clauseOps);
26712671
}
26722672

2673-
static mlir::omp::CoexecuteOp
2674-
genCoexecuteOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
2673+
static mlir::omp::WorkdistributeOp
2674+
genWorkdistributeOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
26752675
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
26762676
mlir::Location loc, const ConstructQueue &queue,
26772677
ConstructQueue::const_iterator item) {
2678-
return genOpWithBody<mlir::omp::CoexecuteOp>(
2678+
return genOpWithBody<mlir::omp::WorkdistributeOp>(
26792679
OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval,
2680-
llvm::omp::Directive::OMPD_coexecute), queue, item);
2680+
llvm::omp::Directive::OMPD_workdistribute), queue, item);
26812681
}
26822682

26832683
//===----------------------------------------------------------------------===//
@@ -3939,16 +3939,15 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
39393939
newOp = genTeamsOp(converter, symTable, stmtCtx, semaCtx, eval, loc, queue,
39403940
item);
39413941
break;
3942-
case llvm::omp::Directive::OMPD_coexecute:
3943-
newOp = genCoexecuteOp(converter, symTable, semaCtx, eval, loc, queue, item);
3944-
break;
39453942
case llvm::omp::Directive::OMPD_tile:
39463943
case llvm::omp::Directive::OMPD_unroll: {
39473944
unsigned version = semaCtx.langOptions().OpenMPVersion;
39483945
TODO(loc, "Unhandled loop directive (" +
39493946
llvm::omp::getOpenMPDirectiveName(dir, version) + ")");
39503947
}
3951-
// case llvm::omp::Directive::OMPD_workdistribute:
3948+
case llvm::omp::Directive::OMPD_workdistribute:
3949+
newOp = genWorkdistributeOp(converter, symTable, semaCtx, eval, loc, queue, item);
3950+
break;
39523951
case llvm::omp::Directive::OMPD_workshare:
39533952
newOp = genWorkshareOp(converter, symTable, stmtCtx, semaCtx, eval, loc,
39543953
queue, item);

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,15 +1344,15 @@ TYPE_PARSER(
13441344
"SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
13451345
"TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
13461346
"TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
1347-
"TARGET TEAMS COEXECUTE" >> pure(llvm::omp::Directive::OMPD_target_teams_coexecute),
1347+
"TARGET TEAMS WORKDISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_target_teams_workdistribute),
13481348
"TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
13491349
"TARGET" >> pure(llvm::omp::Directive::OMPD_target),
13501350
"TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
13511351
"TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
1352-
"TEAMS COEXECUTE" >> pure(llvm::omp::Directive::OMPD_teams_coexecute),
1352+
"TEAMS WORKDISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_teams_workdistribute),
13531353
"TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
13541354
"WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare),
1355-
"COEXECUTE" >> pure(llvm::omp::Directive::OMPD_coexecute))))
1355+
"WORKDISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_workdistribute))))
13561356

13571357
TYPE_PARSER(sourced(construct<OmpBeginBlockDirective>(
13581358
sourced(Parser<OmpBlockDirective>{}), Parser<OmpClauseList>{})))

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,9 +1617,9 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
16171617
case llvm::omp::Directive::OMPD_task:
16181618
case llvm::omp::Directive::OMPD_taskgroup:
16191619
case llvm::omp::Directive::OMPD_teams:
1620-
case llvm::omp::Directive::OMPD_coexecute:
1621-
case llvm::omp::Directive::OMPD_teams_coexecute:
1622-
case llvm::omp::Directive::OMPD_target_teams_coexecute:
1620+
case llvm::omp::Directive::OMPD_workdistribute:
1621+
case llvm::omp::Directive::OMPD_teams_workdistribute:
1622+
case llvm::omp::Directive::OMPD_target_teams_workdistribute:
16231623
case llvm::omp::Directive::OMPD_workshare:
16241624
case llvm::omp::Directive::OMPD_parallel_workshare:
16251625
case llvm::omp::Directive::OMPD_target_teams:
@@ -1653,9 +1653,9 @@ void OmpAttributeVisitor::Post(const parser::OpenMPBlockConstruct &x) {
16531653
case llvm::omp::Directive::OMPD_target:
16541654
case llvm::omp::Directive::OMPD_task:
16551655
case llvm::omp::Directive::OMPD_teams:
1656-
case llvm::omp::Directive::OMPD_coexecute:
1657-
case llvm::omp::Directive::OMPD_teams_coexecute:
1658-
case llvm::omp::Directive::OMPD_target_teams_coexecute:
1656+
case llvm::omp::Directive::OMPD_workdistribute:
1657+
case llvm::omp::Directive::OMPD_teams_workdistribute:
1658+
case llvm::omp::Directive::OMPD_target_teams_workdistribute:
16591659
case llvm::omp::Directive::OMPD_parallel_workshare:
16601660
case llvm::omp::Directive::OMPD_target_teams:
16611661
case llvm::omp::Directive::OMPD_target_parallel: {

flang/test/Lower/OpenMP/coexecute.f90

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
2+
3+
! CHECK-LABEL: func @_QPtarget_teams_workdistribute
4+
subroutine target_teams_workdistribute()
5+
! CHECK: omp.target
6+
! CHECK: omp.teams
7+
! CHECK: omp.workdistribute
8+
!$omp target teams workdistribute
9+
! CHECK: fir.call
10+
call f1()
11+
! CHECK: omp.terminator
12+
! CHECK: omp.terminator
13+
! CHECK: omp.terminator
14+
!$omp end target teams workdistribute
15+
end subroutine target_teams_workdistribute
16+
17+
! CHECK-LABEL: func @_QPteams_workdistribute
18+
subroutine teams_workdistribute()
19+
! CHECK: omp.teams
20+
! CHECK: omp.workdistribute
21+
!$omp teams workdistribute
22+
! CHECK: fir.call
23+
call f1()
24+
! CHECK: omp.terminator
25+
! CHECK: omp.terminator
26+
!$omp end teams workdistribute
27+
end subroutine teams_workdistribute
28+
29+
! CHECK-LABEL: func @_QPtarget_teams_workdistribute_m
30+
subroutine target_teams_workdistribute_m()
31+
! CHECK: omp.target
32+
! CHECK: omp.teams
33+
! CHECK: omp.workdistribute
34+
!$omp target
35+
!$omp teams
36+
!$omp workdistribute
37+
! CHECK: fir.call
38+
call f1()
39+
! CHECK: omp.terminator
40+
! CHECK: omp.terminator
41+
! CHECK: omp.terminator
42+
!$omp end workdistribute
43+
!$omp end teams
44+
!$omp end target
45+
end subroutine target_teams_workdistribute_m
46+
47+
! CHECK-LABEL: func @_QPteams_workdistribute_m
48+
subroutine teams_workdistribute_m()
49+
! CHECK: omp.teams
50+
! CHECK: omp.workdistribute
51+
!$omp teams
52+
!$omp workdistribute
53+
! CHECK: fir.call
54+
call f1()
55+
! CHECK: omp.terminator
56+
! CHECK: omp.terminator
57+
!$omp end workdistribute
58+
!$omp end teams
59+
end subroutine teams_workdistribute_m

0 commit comments

Comments
 (0)