-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[OpenACC] Initial commits to support OpenACC #70234
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
b3d64b3
895fd15
ccb4f3b
fb2c16b
8f060a1
59754f2
256d85b
cb21a13
5a01864
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 |
---|---|---|
|
@@ -3532,6 +3532,13 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts, | |
if (Opts.OpenMPCUDAMode) | ||
GenerateArg(Consumer, OPT_fopenmp_cuda_mode); | ||
|
||
if (Opts.OpenACC) { | ||
GenerateArg(Consumer, OPT_fopenacc); | ||
if (!Opts.OpenACCMacroOverride.empty()) | ||
GenerateArg(Consumer, OPT_openacc_macro_override, | ||
Opts.OpenACCMacroOverride); | ||
} | ||
|
||
// The arguments used to set Optimize, OptimizeSize and NoInlineDefine are | ||
// generated from CodeGenOptions. | ||
|
||
|
@@ -4001,6 +4008,14 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, | |
(T.isNVPTX() || T.isAMDGCN()) && | ||
Args.hasArg(options::OPT_fopenmp_cuda_mode); | ||
|
||
// OpenACC Configuration. | ||
if (Args.hasArg(options::OPT_fopenacc)) { | ||
Opts.OpenACC = true; | ||
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. Maybe keep the version of the ACC in this value instead of having a separate string field, just like OpenMP does? 0 means th support is disabled, non-zero - supported version number. 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. I likely will in the future, however as we currently don't have support for multiple versions of OpenACC, we only need 'true' or 'false'. So for now, it seems prudent to not do that yet (as it won't be used). |
||
|
||
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override)) | ||
Opts.OpenACCMacroOverride = A->getValue(); | ||
} | ||
|
||
// FIXME: Eliminate this dependency. | ||
unsigned Opt = getOptimizationLevel(Args, IK, Diags), | ||
OptSize = getOptimizationLevelSize(Args); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//===--- ParseOpenACC.cpp - OpenACC-specific parsing support --------------===// | ||
// | ||
// 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 file implements the parsing logic for OpenACC language features. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "clang/Parse/ParseDiagnostic.h" | ||
#include "clang/Parse/Parser.h" | ||
|
||
using namespace clang; | ||
|
||
Parser::DeclGroupPtrTy Parser::ParseOpenACCDirective() { | ||
Diag(Tok, diag::warn_pragma_acc_unimplemented); | ||
SkipUntil(tok::annot_pragma_openacc_end); | ||
return nullptr; | ||
} | ||
StmtResult Parser::ParseOpenACCDirectiveStmt() { | ||
Diag(Tok, diag::warn_pragma_acc_unimplemented); | ||
SkipUntil(tok::annot_pragma_openacc_end); | ||
return StmtEmpty(); | ||
} |
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.
Why do you need this form? Is not EQ form is enough?
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.
It is for general consistency here, we typically provide both for many similar options. We typically don't use the 'EQ' form for CC1 at all (since it requires driver string-appending), and users are often more comfortable with the EQ version. I'm not attached to either, but it seems that it is sensible to provide both.