-
Notifications
You must be signed in to change notification settings - Fork 62
[MLIR][OpenMP] Updated fix for intermixed TargetDataOp and TargetOp #56
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
Changes from all commits
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 |
---|---|---|
|
@@ -2515,8 +2515,12 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder, | |
argIndex++; | ||
} | ||
|
||
bodyGenStatus = inlineConvertOmpRegions(region, "omp.data.region", | ||
builder, moduleTranslation); | ||
SmallVector<llvm::PHINode *> phis; | ||
llvm::BasicBlock *continuationBlock = | ||
convertOmpOpRegions(region, "omp.data.region", builder, | ||
moduleTranslation, bodyGenStatus, &phis); | ||
builder.SetInsertPoint(continuationBlock, | ||
continuationBlock->getFirstInsertionPt()); | ||
} | ||
break; | ||
case BodyGenTy::DupNoPriv: | ||
|
@@ -2525,8 +2529,12 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder, | |
// If device info is available then region has already been generated | ||
if (info.DevicePtrInfoMap.empty()) { | ||
builder.restoreIP(codeGenIP); | ||
bodyGenStatus = inlineConvertOmpRegions(region, "omp.data.region", | ||
builder, moduleTranslation); | ||
SmallVector<llvm::PHINode *> phis; | ||
llvm::BasicBlock *continuationBlock = | ||
convertOmpOpRegions(region, "omp.data.region", builder, | ||
moduleTranslation, bodyGenStatus, &phis); | ||
builder.SetInsertPoint(continuationBlock, | ||
continuationBlock->getFirstInsertionPt()); | ||
} | ||
break; | ||
} | ||
|
@@ -3543,6 +3551,8 @@ convertTopLevelTargetOp(Operation *op, llvm::IRBuilderBase &builder, | |
LLVM::ModuleTranslation &moduleTranslation) { | ||
if (isa<omp::TargetOp>(op)) | ||
return convertOmpTarget(*op, builder, moduleTranslation); | ||
if (isa<omp::TargetDataOp>(op)) | ||
return convertOmpTargetData(op, builder, moduleTranslation); | ||
bool interrupted = | ||
op->walk<WalkOrder::PreOrder>([&](omp::TargetOp targetOp) { | ||
if (failed(convertOmpTarget(*targetOp, builder, moduleTranslation))) | ||
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. Wouldn't we need to find nested 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. Yes, I forgot this wasn't a recursive function, so there should be a case for the TargetDataOp as well. |
||
|
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.
Just out of curiosity: Why did the original call break things? I see the only difference is that it does some special handling if there is a single block in the region.
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.
The special case assumes that that no new basic blocks are created, which does happen for omp.target, so it seems to generate code in the wrong place because of this.
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.
We currently still have this change only in ATD, should we upstream it or has it somehow become unnecessary? I don't actually know how to reproduce the issue it fixes, that's why I ask instead of checking myself @jsjodin @TIFitis