aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorKareem Ergawy <kareem.ergawy@amd.com>2025-04-02 09:24:38 +0200
committerGitHub <noreply@github.com>2025-04-02 09:24:38 +0200
commit5d364481e36871584affa54c58a803a936b9a5d6 (patch)
tree7a779a11a415bada48f6033eb5de349c814a92d6 /flang/lib/Frontend/CompilerInvocation.cpp
parent730e8a4a59a5398f61c526eb00eb409e9306d19c (diff)
downloadllvm-5d364481e36871584affa54c58a803a936b9a5d6.zip
llvm-5d364481e36871584affa54c58a803a936b9a5d6.tar.gz
llvm-5d364481e36871584affa54c58a803a936b9a5d6.tar.bz2
[flang][OpenMP] Upstream first part of `do concurrent` mapping (#126026)
This PR starts the effort to upstream AMD's internal implementation of `do concurrent` to OpenMP mapping. This replaces #77285 since we extended this WIP quite a bit on our fork over the past year. An important part of this PR is a document that describes the current status downstream, the upstreaming status, and next steps to make this pass much more useful. In addition to this document, this PR also contains the skeleton of the pass (no useful transformations are done yet) and some testing for the added command line options. This looks like a huge PR but a lot of the added stuff is documentation. It is also worth noting that the downstream pass has been validated on https://github.com/BerkeleyLab/fiats. For the CPU mapping, this achived performance speed-ups that match pure OpenMP, for GPU mapping we are still working on extending our support for implicit memory mapping and locality specifiers. PR stack: - https://github.com/llvm/llvm-project/pull/126026 (this PR) - https://github.com/llvm/llvm-project/pull/127595 - https://github.com/llvm/llvm-project/pull/127633 - https://github.com/llvm/llvm-project/pull/127634 - https://github.com/llvm/llvm-project/pull/127635
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 229695b..1ea7834 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -158,6 +158,32 @@ static bool parseDebugArgs(Fortran::frontend::CodeGenOptions &opts,
return true;
}
+static void parseDoConcurrentMapping(Fortran::frontend::CodeGenOptions &opts,
+ llvm::opt::ArgList &args,
+ clang::DiagnosticsEngine &diags) {
+ llvm::opt::Arg *arg =
+ args.getLastArg(clang::driver::options::OPT_fdo_concurrent_to_openmp_EQ);
+ if (!arg)
+ return;
+
+ using DoConcurrentMappingKind =
+ Fortran::frontend::CodeGenOptions::DoConcurrentMappingKind;
+ std::optional<DoConcurrentMappingKind> val =
+ llvm::StringSwitch<std::optional<DoConcurrentMappingKind>>(
+ arg->getValue())
+ .Case("none", DoConcurrentMappingKind::DCMK_None)
+ .Case("host", DoConcurrentMappingKind::DCMK_Host)
+ .Case("device", DoConcurrentMappingKind::DCMK_Device)
+ .Default(std::nullopt);
+
+ if (!val.has_value()) {
+ diags.Report(clang::diag::err_drv_invalid_value)
+ << arg->getAsString(args) << arg->getValue();
+ }
+
+ opts.setDoConcurrentMapping(val.value());
+}
+
static bool parseVectorLibArg(Fortran::frontend::CodeGenOptions &opts,
llvm::opt::ArgList &args,
clang::DiagnosticsEngine &diags) {
@@ -433,6 +459,8 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
clang::driver::options::OPT_funderscoring, false)) {
opts.Underscoring = 0;
}
+
+ parseDoConcurrentMapping(opts, args, diags);
}
/// Parses all target input arguments and populates the target