-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] [OpenMP] Add support for '#pragma omp stripe'. #119891
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
14 commits
Select commit
Hold shift + click to select a range
378bc7a
[OpenMP] Add support for '#pragma omp stripe'.
zahiraam 39bdde0
Fixed format and added LIT test openmp-stripe.c.
zahiraam 576bd73
Fix format.
zahiraam a7b9d5a
Addressed review comments.
zahiraam ed47654
Merge branch 'main' into OMPStripe
zahiraam 6ac5f9f
Fix format.
zahiraam f6273a1
Fixed number of generated loops for tile and stripe constructs.
zahiraam dd22f6f
Addressed review comments.
zahiraam 3315b78
Fix the doc.
zahiraam 4ba107b
Update of terminology addressed.
zahiraam 31be8c1
Removed function.
zahiraam fcab7ca
Merge remote-tracking branch 'origin/main' into OMPStripe
zahiraam 953ec05
Merge remote-tracking branch 'origin/main' into OMPStripe
zahiraam 29130b7
Updated RN.
zahiraam 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
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 |
---|---|---|
|
@@ -994,7 +994,9 @@ class OMPLoopTransformationDirective : public OMPLoopBasedDirective { | |
static bool classof(const Stmt *T) { | ||
Stmt::StmtClass C = T->getStmtClass(); | ||
return C == OMPTileDirectiveClass || C == OMPUnrollDirectiveClass || | ||
C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass; | ||
C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass || | ||
C == OMPStripeDirectiveClass; | ||
; | ||
} | ||
}; | ||
|
||
|
@@ -5560,7 +5562,7 @@ class OMPTileDirective final : public OMPLoopTransformationDirective { | |
: OMPLoopTransformationDirective(OMPTileDirectiveClass, | ||
llvm::omp::OMPD_tile, StartLoc, EndLoc, | ||
NumLoops) { | ||
setNumGeneratedLoops(3 * NumLoops); | ||
setNumGeneratedLoops(2 * NumLoops); | ||
} | ||
|
||
void setPreInits(Stmt *PreInits) { | ||
|
@@ -5621,6 +5623,82 @@ class OMPTileDirective final : public OMPLoopTransformationDirective { | |
} | ||
}; | ||
|
||
/// This represents the '#pragma omp stripe' loop transformation directive. | ||
class OMPStripeDirective final : public OMPLoopTransformationDirective { | ||
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. Add a comment describing the supported construct |
||
friend class ASTStmtReader; | ||
friend class OMPExecutableDirective; | ||
|
||
/// Default list of offsets. | ||
enum { | ||
PreInitsOffset = 0, | ||
TransformedStmtOffset, | ||
}; | ||
|
||
explicit OMPStripeDirective(SourceLocation StartLoc, SourceLocation EndLoc, | ||
unsigned NumLoops) | ||
: OMPLoopTransformationDirective(OMPStripeDirectiveClass, | ||
llvm::omp::OMPD_stripe, StartLoc, EndLoc, | ||
NumLoops) { | ||
setNumGeneratedLoops(2 * NumLoops); | ||
} | ||
|
||
void setPreInits(Stmt *PreInits) { | ||
Data->getChildren()[PreInitsOffset] = PreInits; | ||
} | ||
|
||
void setTransformedStmt(Stmt *S) { | ||
Data->getChildren()[TransformedStmtOffset] = S; | ||
} | ||
|
||
public: | ||
/// Create a new AST node representation for '#pragma omp stripe'. | ||
/// | ||
/// \param C Context of the AST. | ||
/// \param StartLoc Location of the introducer (e.g. the 'omp' token). | ||
/// \param EndLoc Location of the directive's end (e.g. the tok::eod). | ||
/// \param Clauses The directive's clauses. | ||
/// \param NumLoops Number of associated loops (number of items in the | ||
/// 'sizes' clause). | ||
/// \param AssociatedStmt The outermost associated loop. | ||
/// \param TransformedStmt The loop nest after striping, or nullptr in | ||
/// dependent contexts. | ||
/// \param PreInits Helper preinits statements for the loop nest. | ||
static OMPStripeDirective * | ||
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, | ||
ArrayRef<OMPClause *> Clauses, unsigned NumLoops, Stmt *AssociatedStmt, | ||
Stmt *TransformedStmt, Stmt *PreInits); | ||
|
||
/// Build an empty '#pragma omp stripe' AST node for deserialization. | ||
/// | ||
/// \param C Context of the AST. | ||
/// \param NumClauses Number of clauses to allocate. | ||
/// \param NumLoops Number of associated loops to allocate. | ||
static OMPStripeDirective * | ||
CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops); | ||
|
||
/// Gets/sets the associated loops after striping. | ||
/// | ||
/// This is in de-sugared format stored as a CompoundStmt. | ||
/// | ||
/// \code | ||
/// for (...) | ||
/// ... | ||
/// \endcode | ||
/// | ||
/// Note that if the generated loops a become associated loops of another | ||
/// directive, they may need to be hoisted before them. | ||
Stmt *getTransformedStmt() const { | ||
return Data->getChildren()[TransformedStmtOffset]; | ||
} | ||
|
||
/// Return preinits statement. | ||
Stmt *getPreInits() const { return Data->getChildren()[PreInitsOffset]; } | ||
|
||
static bool classof(const Stmt *T) { | ||
return T->getStmtClass() == OMPStripeDirectiveClass; | ||
} | ||
}; | ||
|
||
/// This represents the '#pragma omp unroll' loop transformation directive. | ||
/// | ||
/// \code | ||
|
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.