-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][OpenMP] lower simple array reductions #84958
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e166c69
[flang][OpenMP] lower simple array reductions
tblah d0b6f12
Update TODO message
tblah e6155a5
Add TODO for stack allocations inside of a loop
tblah 209cd38
Move createStackTempFromMold into a function
tblah e30d18a
Add more tests
tblah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1111,6 +1111,35 @@ hlfir::createTempFromMold(mlir::Location loc, fir::FirOpBuilder &builder, | |
return {hlfir::Entity{declareOp.getBase()}, isHeapAlloc}; | ||
} | ||
|
||
hlfir::Entity hlfir::createStackTempFromMold(mlir::Location loc, | ||
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. @ergawy FYI: This patch has a |
||
fir::FirOpBuilder &builder, | ||
hlfir::Entity mold) { | ||
llvm::SmallVector<mlir::Value> lenParams; | ||
hlfir::genLengthParameters(loc, builder, mold, lenParams); | ||
llvm::StringRef tmpName{".tmp"}; | ||
mlir::Value alloc; | ||
mlir::Value shape{}; | ||
fir::FortranVariableFlagsAttr declAttrs; | ||
|
||
if (mold.isPolymorphic()) { | ||
// genAllocatableApplyMold does heap allocation | ||
TODO(loc, "createStackTempFromMold for polymorphic type"); | ||
} else if (mold.isArray()) { | ||
mlir::Type sequenceType = | ||
hlfir::getFortranElementOrSequenceType(mold.getType()); | ||
shape = hlfir::genShape(loc, builder, mold); | ||
auto extents = hlfir::getIndexExtents(loc, builder, shape); | ||
alloc = | ||
builder.createTemporary(loc, sequenceType, tmpName, extents, lenParams); | ||
} else { | ||
alloc = builder.createTemporary(loc, mold.getFortranElementType(), tmpName, | ||
/*shape=*/std::nullopt, lenParams); | ||
} | ||
auto declareOp = builder.create<hlfir::DeclareOp>(loc, alloc, tmpName, shape, | ||
lenParams, declAttrs); | ||
return hlfir::Entity{declareOp.getBase()}; | ||
} | ||
|
||
hlfir::EntityWithAttributes | ||
hlfir::convertCharacterKind(mlir::Location loc, fir::FirOpBuilder &builder, | ||
hlfir::Entity scalarChar, int toKind) { | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is a getTypeAsString (
llvm-project/flang/lib/Optimizer/Dialect/FIRType.cpp
Line 520 in 07b18c5
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.
Yeah that looks much better, thanks! I will do it in a separate patch because I think it might change existing names.
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.
OK, that is fine.
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.
#85666