-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[OpenACC][CIR] Basic infrastructure for OpenACC lowering #134717
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 3 commits
0c0892e
534ea46
aac78c8
67fe2d3
46a6fff
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This contains code to emit Decl nodes as CIR code. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "CIRGenFunction.h" | ||
| #include "clang/AST/DeclOpenACC.h" | ||
|
|
||
| using namespace clang; | ||
| using namespace clang::CIRGen; | ||
|
|
||
| void CIRGenFunction::emitOpenACCDeclare(const OpenACCDeclareDecl &d) { | ||
| getCIRGenModule().errorNYI(d.getSourceRange(), "OpenACC Declare Construct"); | ||
| } | ||
|
|
||
| void CIRGenFunction::emitOpenACCRoutine(const OpenACCRoutineDecl &d) { | ||
| getCIRGenModule().errorNYI(d.getSourceRange(), "OpenACC Routine Construct"); | ||
| } | ||
|
|
||
| void CIRGenModule::emitGlobalOpenACCDecl(const OpenACCConstructDecl *d) { | ||
| if (isa<OpenACCRoutineDecl>(d)) | ||
| errorNYI(d->getSourceRange(), "OpenACC Routine Construct"); | ||
| else if (isa<OpenACCDeclareDecl>(d)) | ||
| errorNYI(d->getSourceRange(), "OpenACC Declare Construct"); | ||
| } | ||
|
Contributor
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. Should there be an errorNYI or llvm_unreachable call for the case where this is neither of the above?
Collaborator
Author
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. yeah, unreachable. I'll add it. |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -509,6 +509,36 @@ class CIRGenFunction : public CIRGenTypeCache { | |||||
| public: | ||||||
| Address createTempAlloca(mlir::Type ty, CharUnits align, mlir::Location loc, | ||||||
| const Twine &name, bool insertIntoFnEntryBlock); | ||||||
|
|
||||||
| //===--------------------------------------------------------------------===// | ||||||
| // OpenACC Emission | ||||||
| //===--------------------------------------------------------------------===// | ||||||
| public: | ||||||
| mlir::LogicalResult | ||||||
| emitOpenACCComputeConstruct(const OpenACCComputeConstruct &S); | ||||||
|
||||||
| emitOpenACCComputeConstruct(const OpenACCComputeConstruct &S); | |
| emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s); |
MLIR naming style throughout the changes to this header
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.
Ooof... I was doing so well :D I caught myself on this one a dozen times so far, I'm guessing beating the old coding standard out of my fingers is going to take a while :)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| #include "mlir/IR/Builders.h" | ||
| #include "clang/AST/ExprCXX.h" | ||
| #include "clang/AST/Stmt.h" | ||
| #include "clang/AST/StmtOpenACC.h" | ||
|
|
||
| using namespace clang; | ||
| using namespace clang::CIRGen; | ||
|
|
@@ -192,25 +193,39 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s, | |
| case Stmt::OMPAssumeDirectiveClass: | ||
| case Stmt::OMPMaskedDirectiveClass: | ||
| case Stmt::OMPStripeDirectiveClass: | ||
| case Stmt::ObjCAtCatchStmtClass: | ||
| case Stmt::ObjCAtFinallyStmtClass: | ||
| cgm.errorNYI(s->getSourceRange(), | ||
| std::string("emitStmt: ") + s->getStmtClassName()); | ||
| return mlir::failure(); | ||
| case Stmt::OpenACCComputeConstructClass: | ||
| return emitOpenACCComputeConstruct(cast<OpenACCComputeConstruct>(*s)); | ||
|
||
| case Stmt::OpenACCLoopConstructClass: | ||
| return emitOpenACCLoopConstruct(cast<OpenACCLoopConstruct>(*s)); | ||
| case Stmt::OpenACCCombinedConstructClass: | ||
| return emitOpenACCCombinedConstruct(cast<OpenACCCombinedConstruct>(*s)); | ||
| case Stmt::OpenACCDataConstructClass: | ||
| return emitOpenACCDataConstruct(cast<OpenACCDataConstruct>(*s)); | ||
| case Stmt::OpenACCEnterDataConstructClass: | ||
| return emitOpenACCEnterDataConstruct(cast<OpenACCEnterDataConstruct>(*s)); | ||
| case Stmt::OpenACCExitDataConstructClass: | ||
| return emitOpenACCExitDataConstruct(cast<OpenACCExitDataConstruct>(*s)); | ||
| case Stmt::OpenACCHostDataConstructClass: | ||
| return emitOpenACCHostDataConstruct(cast<OpenACCHostDataConstruct>(*s)); | ||
| case Stmt::OpenACCWaitConstructClass: | ||
| return emitOpenACCWaitConstruct(cast<OpenACCWaitConstruct>(*s)); | ||
| case Stmt::OpenACCInitConstructClass: | ||
| return emitOpenACCInitConstruct(cast<OpenACCInitConstruct>(*s)); | ||
| case Stmt::OpenACCShutdownConstructClass: | ||
| return emitOpenACCShutdownConstruct(cast<OpenACCShutdownConstruct>(*s)); | ||
| case Stmt::OpenACCSetConstructClass: | ||
| return emitOpenACCSetConstruct(cast<OpenACCSetConstruct>(*s)); | ||
| case Stmt::OpenACCUpdateConstructClass: | ||
| return emitOpenACCUpdateConstruct(cast<OpenACCUpdateConstruct>(*s)); | ||
| case Stmt::OpenACCCacheConstructClass: | ||
| return emitOpenACCCacheConstruct(cast<OpenACCCacheConstruct>(*s)); | ||
| case Stmt::OpenACCAtomicConstructClass: | ||
| case Stmt::ObjCAtCatchStmtClass: | ||
| case Stmt::ObjCAtFinallyStmtClass: | ||
| cgm.errorNYI(s->getSourceRange(), | ||
| std::string("emitStmt: ") + s->getStmtClassName()); | ||
| return mlir::failure(); | ||
| return emitOpenACCAtomicConstruct(cast<OpenACCAtomicConstruct>(*s)); | ||
| } | ||
|
|
||
| llvm_unreachable("Unexpected statement class"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Emit OpenACC Stmt nodes as CIR code. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "CIRGenBuilder.h" | ||
| #include "CIRGenFunction.h" | ||
| #include "clang/AST/StmtOpenACC.h" | ||
|
|
||
| using namespace clang; | ||
| using namespace clang::CIRGen; | ||
| using namespace cir; | ||
|
|
||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Compute Construct"); | ||
| return mlir::failure(); | ||
| } | ||
|
|
||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCLoopConstruct(const OpenACCLoopConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Loop Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult CIRGenFunction::emitOpenACCCombinedConstruct( | ||
| const OpenACCCombinedConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Combined Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCDataConstruct(const OpenACCDataConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Data Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult CIRGenFunction::emitOpenACCEnterDataConstruct( | ||
| const OpenACCEnterDataConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC EnterData Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult CIRGenFunction::emitOpenACCExitDataConstruct( | ||
| const OpenACCExitDataConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC ExitData Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult CIRGenFunction::emitOpenACCHostDataConstruct( | ||
| const OpenACCHostDataConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC HostData Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCWaitConstruct(const OpenACCWaitConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Wait Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCInitConstruct(const OpenACCInitConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Init Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult CIRGenFunction::emitOpenACCShutdownConstruct( | ||
| const OpenACCShutdownConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Shutdown Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCSetConstruct(const OpenACCSetConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Set Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCUpdateConstruct(const OpenACCUpdateConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Update Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCAtomicConstruct(const OpenACCAtomicConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Atomic Construct"); | ||
| return mlir::failure(); | ||
| } | ||
| mlir::LogicalResult | ||
| CIRGenFunction::emitOpenACCCacheConstruct(const OpenACCCacheConstruct &s) { | ||
| getCIRGenModule().errorNYI(s.getSourceRange(), "OpenACC Cache Construct"); | ||
| return mlir::failure(); | ||
| } |
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 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 typically don't do full-stops during diagnostics as they are not sentences. we sometimes use semi-colons though, which is probably more fitting here.