-
Notifications
You must be signed in to change notification settings - Fork 55
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] Support host_eval
for target teams loop
#228
base: amd-trunk-dev
Are you sure you want to change the base?
Conversation
Extends `host_eval` support for the currently supported form of the generic `loop` directive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Kareem for working on this! I've got a couple of small comments, but I think it's almost there.
case OMPD_loop: | ||
case OMPD_teams_loop: | ||
case OMPD_target_teams_loop: | ||
cp.processCollapse(loc, eval, hostInfo.ops, hostInfo.iv); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to also make sure thread_limit
and num_teams
are processed when applicable.
case OMPD_loop: | |
case OMPD_teams_loop: | |
case OMPD_target_teams_loop: | |
cp.processCollapse(loc, eval, hostInfo.ops, hostInfo.iv); | |
break; | |
case OMPD_teams_loop: | |
cp.processThreadLimit(stmtCtx, hostInfo.ops); | |
[[fallthrough]]; | |
case OMPD_target_teams_loop: | |
cp.processNumTeams(stmtCtx, hostInfo.ops); | |
[[fallthrough]]; | |
case OMPD_loop: | |
cp.processCollapse(loc, eval, hostInfo.ops, hostInfo.iv); | |
break; |
@@ -1909,7 +1909,7 @@ llvm::omp::OMPTgtExecModeFlags TargetOp::getKernelExecFlags() { | |||
|
|||
// Detect Generic-SPMD: target-teams-distribute[-simd]. | |||
if (numWrappers == 1) { | |||
if (!isa<DistributeOp>(innermostWrapper)) | |||
if (!isa<DistributeOp>(innermostWrapper) && !isa<LoopOp>(innermostWrapper)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly incorrect, because it will cause target teams loop
to be tagged as Generic-SPMD instead of SPMD. Perhaps you can set a local llvm::omp::OMPTgtExecModeFlags
variable to OMP_TGT_EXEC_MODE_GENERIC_SPMD
or OMP_TGT_EXEC_MODE_SPMD
based on whether the wrapper is omp.distribute
or omp.loop
and return it if all conditions below are met, instead of it always being OMP_TGT_EXEC_MODE_GENERIC_SPMD
.
Also update the comment above, to prevent it from becoming misleading.
Extends
host_eval
support for the currently supported form of the genericloop
directive.