-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang][OpenMP] Enable tiling #143715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][OpenMP] Enable tiling #143715
Changes from all commits
548684f
02fb537
3efaa77
b7f09a0
75b0ab5
dccb7f4
1e63230
4b5412a
411882b
b39287e
5f51565
e1eaf9a
ac41499
9f74cf1
bb9132c
6681b4e
54593af
93d9952
a738a56
9757360
9e35a6f
8dfaf57
84c5cc1
53ab195
fa6e323
bce250c
8ae7ff6
a3d3db7
8510c40
d462a6c
f59c027
b21af72
7820ef5
995fc53
62b3ed1
71ed212
a0435d0
4f2f7eb
a687d97
d1b69c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -503,7 +503,7 @@ static void processHostEvalClauses(lower::AbstractConverter &converter, | |
[[fallthrough]]; | ||
case OMPD_distribute: | ||
case OMPD_distribute_simd: | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->iv); | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->ops, hostInfo->iv); | ||
break; | ||
|
||
case OMPD_teams: | ||
|
@@ -522,7 +522,7 @@ static void processHostEvalClauses(lower::AbstractConverter &converter, | |
[[fallthrough]]; | ||
case OMPD_target_teams_distribute: | ||
case OMPD_target_teams_distribute_simd: | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->iv); | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->ops, hostInfo->iv); | ||
cp.processNumTeams(stmtCtx, hostInfo->ops); | ||
break; | ||
|
||
|
@@ -533,7 +533,7 @@ static void processHostEvalClauses(lower::AbstractConverter &converter, | |
cp.processNumTeams(stmtCtx, hostInfo->ops); | ||
[[fallthrough]]; | ||
case OMPD_loop: | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->iv); | ||
cp.processCollapse(loc, eval, hostInfo->ops, hostInfo->ops, hostInfo->iv); | ||
break; | ||
|
||
case OMPD_teams_workdistribute: | ||
|
@@ -1569,9 +1569,10 @@ genLoopNestClauses(lower::AbstractConverter &converter, | |
|
||
HostEvalInfo *hostEvalInfo = getHostEvalInfoStackTop(converter); | ||
if (!hostEvalInfo || !hostEvalInfo->apply(clauseOps, iv)) | ||
cp.processCollapse(loc, eval, clauseOps, iv); | ||
cp.processCollapse(loc, eval, clauseOps, clauseOps, iv); | ||
|
||
clauseOps.loopInclusive = converter.getFirOpBuilder().getUnitAttr(); | ||
cp.processTileSizes(eval, clauseOps); | ||
} | ||
|
||
static void genLoopClauses( | ||
|
@@ -1948,9 +1949,9 @@ static mlir::omp::LoopNestOp genLoopNestOp( | |
return llvm::SmallVector<const semantics::Symbol *>(iv); | ||
}; | ||
|
||
auto *nestedEval = | ||
getCollapsedLoopEval(eval, getCollapseValue(item->clauses)); | ||
|
||
uint64_t nestValue = getCollapseValue(item->clauses); | ||
nestValue = nestValue < iv.size() ? iv.size() : nestValue; | ||
auto *nestedEval = getCollapsedLoopEval(eval, nestValue); | ||
return genOpWithBody<mlir::omp::LoopNestOp>( | ||
OpWithBodyGenInfo(converter, symTable, semaCtx, loc, *nestedEval, | ||
directive) | ||
|
@@ -3843,8 +3844,8 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable, | |
parser::omp::GetOmpDirectiveName(*ompNestedLoopCons).v; | ||
switch (nestedDirective) { | ||
case llvm::omp::Directive::OMPD_tile: | ||
// Emit the omp.loop_nest with annotation for tiling | ||
genOMP(converter, symTable, semaCtx, eval, ompNestedLoopCons->value()); | ||
// Skip OMPD_tile since the tile sizes will be retrieved when | ||
// generating the omp.loop_nest op. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Add a TODO for when the loop transformation is applied on its own, with no worksharing or similar construct associated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case it will not be a nested construct and will hit the TODO on line 3476. |
||
break; | ||
default: { | ||
unsigned version = semaCtx.langOptions().OpenMPVersion; | ||
|
@@ -3957,18 +3958,6 @@ void Fortran::lower::genOpenMPSymbolProperties( | |
lower::genDeclareTargetIntGlobal(converter, var); | ||
} | ||
|
||
int64_t | ||
Fortran::lower::getCollapseValue(const parser::OmpClauseList &clauseList) { | ||
for (const parser::OmpClause &clause : clauseList.v) { | ||
if (const auto &collapseClause = | ||
std::get_if<parser::OmpClause::Collapse>(&clause.u)) { | ||
const auto *expr = semantics::GetExpr(collapseClause->v); | ||
return evaluate::ToInt64(*expr).value(); | ||
} | ||
} | ||
return 1; | ||
} | ||
|
||
void Fortran::lower::genThreadprivateOp(lower::AbstractConverter &converter, | ||
const lower::pft::Variable &var) { | ||
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.