[Git][ghc/ghc][master] compiler/coreprep: Turn off dictionary speculation by default
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Jan 13 18:01:34 UTC 2025
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
ab3ab3e3 by Luite Stegeman at 2025-01-13T12:59:58-05:00
compiler/coreprep: Turn off dictionary speculation by default
Speculative evaluation can cause performance regressions,
therefore we turn it off by default. It can be enabled again
with the -fspec-eval-dictfun flag
See #25284
- - - - -
4 changed files:
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/DynFlags.hs
- docs/users_guide/using-optimisation.rst
- testsuite/tests/rts/ipe/T24005/t24005.hs
Changes:
=====================================
compiler/GHC/CoreToStg/Prep.hs
=====================================
@@ -2054,12 +2054,27 @@ floats and how far they go.
Note [Controlling Speculative Evaluation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Most of the time, speculative evaluation has a positive effect on performance,
-but we have found a case where speculative evaluation of dictionary functions
-leads to a performance regression #25284.
-
-Therefore we have some flags to control it. See the optimization section in
-the User's Guide for the description of these flags and when to use them.
+Most of the time, speculative evaluation in the coreprep phase has a positive
+effect on performance, however we have found that some forms of speculative
+evaluation can lead to large performance regressions. See #25284.
+
+Therefore we have some flags to control which types of speculative evaluation
+are done:
+
+ -fspec-eval
+ Globally enable/disable speculative evaluation ( -fno-spec-eval also turns
+ off all other speculative evaluation). On by default for all
+ optimization levels. Turning on this flag by itself should never cause
+ a performance regression. Please open a ticket if you find any.
+
+ -fspec-eval-dictfun
+ Enable speculative evaluation for dictionary functions. Off by default
+ since it can cause an increase in allocations (#24284). We have no
+ examples that show a large performance improvement when turning on this
+ flag. Please open a ticket if you find any.
+
+Also see the optimization section in the User's Guide for the description of
+these flags and when to use them.
Note [Floats and FloatDecision]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
compiler/GHC/Driver/DynFlags.hs
=====================================
@@ -1288,7 +1288,7 @@ optLevelFlags -- see Note [Documenting optimisation flags]
-- , ([2], Opt_StaticArgumentTransformation)
-- Static Argument Transformation needs investigation. See #9374
, ([0,1,2], Opt_SpecEval)
- , ([0,1,2], Opt_SpecEvalDictFun)
+ , ([], Opt_SpecEvalDictFun)
]
=====================================
docs/users_guide/using-optimisation.rst
=====================================
@@ -428,7 +428,7 @@ as such you shouldn't need to set any of them explicitly. A flag
:category:
:reverse: -fno-spec-eval-dictfun
- :default: on
+ :default: off
:since: 9.14.1
Enables speculative (strict) evaluation of dictionary functions.
=====================================
testsuite/tests/rts/ipe/T24005/t24005.hs
=====================================
@@ -32,5 +32,5 @@ instance Show a => Show (B a) where
main :: IO ()
main = do
-- Should both result in InfoProvs with correct source locations
- (\(Box d) -> print =<< whereFrom d) $ mkBox @(Show A)
- (\(Box d) -> print =<< whereFrom d) $ mkBox @(Show (B A))
+ (\(Box !d) -> print =<< whereFrom d) $ mkBox @(Show A)
+ (\(Box !d) -> print =<< whereFrom d) $ mkBox @(Show (B A))
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ab3ab3e3d489a351e84f4fe681de1731549376a2
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ab3ab3e3d489a351e84f4fe681de1731549376a2
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250113/63bb01d8/attachment-0001.html>
More information about the ghc-commits
mailing list