-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][OpenMP] Remove experimental warning #144915
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
Conversation
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.
LGTM. I have a nit, but too minor to warrant an update to this PR. Only address it if you are planning to push an update to this PR on account of someone else's review with beefier changes requested.
flang/test/Driver/fopenmp.f90
Outdated
@@ -74,6 +74,6 @@ | |||
! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}" | |||
! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}" | |||
! | |||
! RUN: %flang -fopenmp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL | |||
! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL |
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.
NIT: sed 's/EXPERIMENTAL/INCOMPLETE/g'
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.
LGTM. Thanks a lot
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.
LGTM
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Tom Eccles (tblah) ChangesRFC: https://discourse.llvm.org/t/rfc-removing-the-openmp-experimental-warning-for-llvm-21/86455 Fixes: #110008 There are a handful of open issues still to resolve before this can go out of draft. See the linked issue. Full diff: https://github.com/llvm/llvm-project/pull/144915.diff 3 Files Affected:
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 29f6480ba935c..68f87ebb1b39f 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -143,8 +143,8 @@ def warn_drv_unsupported_option_for_processor : Warning<
def warn_drv_unsupported_openmp_library : Warning<
"the library '%0=%1' is not supported, OpenMP will not be enabled">,
InGroup<OptionIgnored>;
-def warn_openmp_experimental : Warning<
- "OpenMP support in flang is still experimental">,
+def warn_openmp_incomplete : Warning<
+ "OpenMP support for version %0 in flang is still incomplete">,
InGroup<ExperimentalOption>;
def err_drv_invalid_thread_model_for_target : Error<
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 47d0e345086b2..04613457cb20a 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -11,6 +11,7 @@
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Driver/CommonArgs.h"
+#include "clang/Driver/OptionUtils.h"
#include "clang/Driver/Options.h"
#include "llvm/Frontend/Debug/Options.h"
#include "llvm/Support/Path.h"
@@ -772,6 +773,13 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
}
}
+static std::string OpenMPVersionToString(int Version) {
+ int Major = Version / 10;
+ int Minor = Version % 10;
+
+ return llvm::Twine{Major}.concat(".").concat(llvm::Twine{Minor}).str();
+}
+
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
const ArgList &Args, const char *LinkingOutput) const {
@@ -906,9 +914,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_fopenmp_force_usm))
CmdArgs.push_back("-fopenmp-force-usm");
- // TODO: OpenMP support isn't "done" yet, so for now we warn that it
- // is experimental.
- D.Diag(diag::warn_openmp_experimental);
+
+ // TODO: OpenMP support for newer versions of the standard is incomplete.
+ if (int Version =
+ getLastArgIntValue(Args, options::OPT_fopenmp_version_EQ, 0)) {
+ if (Version >= 40)
+ D.Diag(diag::warn_openmp_incomplete)
+ << OpenMPVersionToString(Version);
+ }
// FIXME: Clang supports a whole bunch more flags here.
break;
diff --git a/flang/test/Driver/fopenmp.f90 b/flang/test/Driver/fopenmp.f90
index b3c3547800bdb..3a150aa657953 100644
--- a/flang/test/Driver/fopenmp.f90
+++ b/flang/test/Driver/fopenmp.f90
@@ -74,6 +74,6 @@
! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}"
! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}"
!
-! RUN: %flang -fopenmp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL
+! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPLETE
!
-! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support in flang is still experimental
+! CHECK-INCOMPLETE: flang{{.*}}: warning: OpenMP support for version 4.0 in flang is still incomplete
|
@llvm/pr-subscribers-flang-driver Author: Tom Eccles (tblah) ChangesRFC: https://discourse.llvm.org/t/rfc-removing-the-openmp-experimental-warning-for-llvm-21/86455 Fixes: #110008 There are a handful of open issues still to resolve before this can go out of draft. See the linked issue. Full diff: https://github.com/llvm/llvm-project/pull/144915.diff 3 Files Affected:
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 29f6480ba935c..68f87ebb1b39f 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -143,8 +143,8 @@ def warn_drv_unsupported_option_for_processor : Warning<
def warn_drv_unsupported_openmp_library : Warning<
"the library '%0=%1' is not supported, OpenMP will not be enabled">,
InGroup<OptionIgnored>;
-def warn_openmp_experimental : Warning<
- "OpenMP support in flang is still experimental">,
+def warn_openmp_incomplete : Warning<
+ "OpenMP support for version %0 in flang is still incomplete">,
InGroup<ExperimentalOption>;
def err_drv_invalid_thread_model_for_target : Error<
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 47d0e345086b2..04613457cb20a 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -11,6 +11,7 @@
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Driver/CommonArgs.h"
+#include "clang/Driver/OptionUtils.h"
#include "clang/Driver/Options.h"
#include "llvm/Frontend/Debug/Options.h"
#include "llvm/Support/Path.h"
@@ -772,6 +773,13 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
}
}
+static std::string OpenMPVersionToString(int Version) {
+ int Major = Version / 10;
+ int Minor = Version % 10;
+
+ return llvm::Twine{Major}.concat(".").concat(llvm::Twine{Minor}).str();
+}
+
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
const ArgList &Args, const char *LinkingOutput) const {
@@ -906,9 +914,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_fopenmp_force_usm))
CmdArgs.push_back("-fopenmp-force-usm");
- // TODO: OpenMP support isn't "done" yet, so for now we warn that it
- // is experimental.
- D.Diag(diag::warn_openmp_experimental);
+
+ // TODO: OpenMP support for newer versions of the standard is incomplete.
+ if (int Version =
+ getLastArgIntValue(Args, options::OPT_fopenmp_version_EQ, 0)) {
+ if (Version >= 40)
+ D.Diag(diag::warn_openmp_incomplete)
+ << OpenMPVersionToString(Version);
+ }
// FIXME: Clang supports a whole bunch more flags here.
break;
diff --git a/flang/test/Driver/fopenmp.f90 b/flang/test/Driver/fopenmp.f90
index b3c3547800bdb..3a150aa657953 100644
--- a/flang/test/Driver/fopenmp.f90
+++ b/flang/test/Driver/fopenmp.f90
@@ -74,6 +74,6 @@
! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}"
! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}"
!
-! RUN: %flang -fopenmp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL
+! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPLETE
!
-! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support in flang is still experimental
+! CHECK-INCOMPLETE: flang{{.*}}: warning: OpenMP support for version 4.0 in flang is still incomplete
|
I've taken this out of draft. The only remaining item in #110008 is some improved semantic checks for Loop transformation constructs. The parsing of these constructs works already and a TODO is emitted, but semantic checks should be updated to allow loop transformation constructs in place of Fortran do loops e.g.
@Stylie777 is already working on this, but his work could conflict with #143715 and #144785 he will likely base his patch upon that other work and post after they are merged. I would like to go ahead and merge this now because the loop transformation constructs are an OpenMP 5.1 feature and they do not lead to a compiler crash, only a misleading semantic error. Is everyone okay with this being merged? |
I am okay with it. |
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.
Thanks Tom. I'm fine with merging this.
172de0a
to
ebd2980
Compare
RFC: https://discourse.llvm.org/t/rfc-removing-the-openmp-experimental-warning-for-llvm-21/86455
Fixes: #110008
There are a handful of open issues still to resolve before this can go out of draft. See the linked issue.