Skip to content
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

Ofast deprecation clarifications #101005

Merged
merged 3 commits into from
Aug 2, 2024
Merged

Ofast deprecation clarifications #101005

merged 3 commits into from
Aug 2, 2024

Conversation

sjoerdmeijer
Copy link
Collaborator

Following up on the RFC discussion, this is clarifying that the main purpose and effect of the -Ofast deprecation is to discourage its usage and that everything else is more or less open for discussion, e.g. there is no timeline yet for removal.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 29, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 29, 2024

@llvm/pr-subscribers-clang

Author: Sjoerd Meijer (sjoerdmeijer)

Changes

Following up on the RFC discussion, this is clarifying that the main purpose and effect of the -Ofast deprecation is to discourage its usage and that everything else is more or less open for discussion, e.g. there is no timeline yet for removal.


Full diff: https://github.com/llvm/llvm-project/pull/101005.diff

2 Files Affected:

  • (modified) clang/docs/CommandGuide/clang.rst (+5-2)
  • (modified) clang/docs/ReleaseNotes.rst (+6-4)
diff --git a/clang/docs/CommandGuide/clang.rst b/clang/docs/CommandGuide/clang.rst
index 663aca1f6ddcb..6ce340b20c252 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -429,8 +429,11 @@ Code Generation Options
 
     :option:`-Ofast` Enables all the optimizations from :option:`-O3` along
     with other aggressive optimizations that may violate strict compliance with
-    language standards. This is deprecated in favor of :option:`-O3`
-    in combination with :option:`-ffast-math`.
+    language standards. This is deprecated in Clang-19 and a warning is emitted
+    that :option:`-O3` in combination with :option:`-ffast-math` should be used
+    instead if the request for non-standard math behavior is intended. Thus, as
+    there is no timeline yet for removal, the aim is to discourage its usage
+    due to the compliance violating optimizations.
 
     :option:`-Os` Like :option:`-O2` with extra optimizations to reduce code
     size.
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 71d615553c613..430fa77218954 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -495,10 +495,12 @@ New Compiler Flags
 Deprecated Compiler Flags
 -------------------------
 
-- The ``-Ofast`` command-line option has been deprecated. This option both
-  enables the ``-O3`` optimization-level, as well as enabling non-standard
-  ``-ffast-math`` behaviors. As such, it is somewhat misleading as an
-  "optimization level". Users are advised to switch to ``-O3 -ffast-math`` if
+- The ``-Ofast`` command-line option has been deprecated, but there is no
+  timeline for removal yet. Thus, the main effect of emitting a deprecation
+  warning message is to discourage its usage due to the problems of ``-Ofast``:
+  it enables both the ``-O3`` optimization-level as well as non-standard
+  ``-ffast-math`` behaviors and as such it is perceived to be misleading as an
+  optimization level.  Users are advised to switch to ``-O3 -ffast-math`` if
   the use of non-standard math behavior is intended, and ``-O3`` otherwise.
   See `RFC <https://discourse.llvm.org/t/rfc-deprecate-ofast/78687>`_ for details.
 

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

I think we need these changes to be against main and not 19.x, aside from the release notes (otherwise we're losing the documentation in 20.x). For the release notes, I think we can talk to @tstellar and @tru about getting the 19.x notes updated once we've finalized the wording for it.

One other change we should probably make at the same time is to update Options.td to use HelpTextForVariants so the help text for Flang does not suggest the option is deprecated in their driver.

Comment on lines 434 to 436
instead if the request for non-standard math behavior is intended. Thus, as
there is no timeline yet for removal, the aim is to discourage its usage
due to the compliance violating optimizations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
instead if the request for non-standard math behavior is intended. Thus, as
there is no timeline yet for removal, the aim is to discourage its usage
due to the compliance violating optimizations.
instead if the request for non-standard math behavior is intended.
There is no timeline yet for removal; the aim is to discourage use of :option:`-Ofast`
due to the surprising behavior of an optimization flag changing the observable
behavior of correct code.

Comment on lines 498 to 503
- The ``-Ofast`` command-line option has been deprecated, but there is no
timeline for removal yet. Thus, the main effect of emitting a deprecation
warning message is to discourage its usage due to the problems of ``-Ofast``:
it enables both the ``-O3`` optimization-level as well as non-standard
``-ffast-math`` behaviors and as such it is perceived to be misleading as an
optimization level. Users are advised to switch to ``-O3 -ffast-math`` if
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The ``-Ofast`` command-line option has been deprecated, but there is no
timeline for removal yet. Thus, the main effect of emitting a deprecation
warning message is to discourage its usage due to the problems of ``-Ofast``:
it enables both the ``-O3`` optimization-level as well as non-standard
``-ffast-math`` behaviors and as such it is perceived to be misleading as an
optimization level. Users are advised to switch to ``-O3 -ffast-math`` if
- The ``-Ofast`` command-line option has been deprecated, but there is no
timeline for removal. Deprecation is intended to discourage use of the flag
due to the problems of ``-Ofast``: it enables both the ``-O3`` optimization
level as well as non-standard ``-ffast-math`` behaviors and as such it is
misleading as an optimization level. Users are advised to switch to
``-O3 -ffast-math`` if

@sjoerdmeijer
Copy link
Collaborator Author

I think we need these changes to be against main and not 19.x, aside from the release notes (otherwise we're losing the documentation in 20.x).

Oh right, yes, missed that, makes sense. Will split this up, let's do the documentation update here first as suggested.

Following up on the RFC discussion, this is clarifying that the main purpose
and effect of the -Ofast deprecation is to discourage its usage and that
everything else is more or less open for discussion, e.g. there is no timeline
yet for removal.
@sjoerdmeijer sjoerdmeijer changed the base branch from release/19.x to main July 29, 2024 14:25
@sjoerdmeijer sjoerdmeijer requested review from tbaederr, Endilll, nikic and a team as code owners July 29, 2024 14:25
Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I'm happy enough with the proposed wording (I want to give others a chance to weigh in before approving though).

clang/docs/CommandGuide/clang.rst Outdated Show resolved Hide resolved
@sjoerdmeijer sjoerdmeijer removed request for a team and tbaederr July 29, 2024 14:49
@dwblaikie dwblaikie removed their request for review July 29, 2024 15:19
clang/docs/CommandGuide/clang.rst Outdated Show resolved Hide resolved
Copy link
Member

@jyknight jyknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@sjoerdmeijer
Copy link
Collaborator Author

@AaronBallman, shall we merge this?

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's go ahead and merge this and get it backported to 19.x, thank you!

@sjoerdmeijer sjoerdmeijer merged commit 48d4d4b into llvm:main Aug 2, 2024
8 checks passed
@sjoerdmeijer
Copy link
Collaborator Author

LGTM, let's go ahead and merge this and get it backported to 19.x, thank you!

Thanks for your help with this.

I am mostly unfamiliar with the release process. Do you know how we can achieve this? Do we suggest this commit to the release manager for a backport and cherry pick? Or do we prepare a patch?

We could add similar clarifications to the release notes, which were initially included in an earlier version of this patch. So same question how we would need to approach that.

@AaronBallman
Copy link
Collaborator

We have instructions at https://www.llvm.org/docs/GitHub.html#backporting-fixes-to-the-release-branches but the basic gist of it is to add a special comment and add the PR to the correct milestone. As in:

/cherry-pick 48d4d4b

@AaronBallman AaronBallman added this to the LLVM 19.X Release milestone Aug 2, 2024
@AaronBallman
Copy link
Collaborator

We could add similar clarifications to the release notes, which were initially included in an earlier version of this patch. So same question how we would need to approach that.

In terms of updating the release notes, once the cherry-pick happens, there's an automated bot message asking if you want to add a release note for the changes. I think the best way forward would be to follow those instructions and ask the release managers to help apply the changes.

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 2, 2024
Following up on the RFC discussion, this is clarifying that the main
purpose and effect of the -Ofast deprecation is to discourage its usage
and that everything else is more or less open for discussion, e.g. there
is no timeline yet for removal.

---------

Co-authored-by: Aaron Ballman <[email protected]>
(cherry picked from commit 48d4d4b)
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 2, 2024

/pull-request #101663

banach-space pushed a commit to banach-space/llvm-project that referenced this pull request Aug 7, 2024
Following up on the RFC discussion, this is clarifying that the main
purpose and effect of the -Ofast deprecation is to discourage its usage
and that everything else is more or less open for discussion, e.g. there
is no timeline yet for removal.

---------

Co-authored-by: Aaron Ballman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
Development

Successfully merging this pull request may close these issues.

5 participants