Add a go-fast button to Skia GYP configs.
authormtklein <mtklein@chromium.org>
Thu, 26 Mar 2015 12:30:44 +0000 (05:30 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 26 Mar 2015 12:30:44 +0000 (05:30 -0700)
./gyp_skia -Dskia_fast=1 will
  - always optimize for the current machine as much as possible
  - drop the frame pointer
  - optimize floating point arithmetic ignoring IEEE compliance

This allows things like 3-argument VEX prefix SSE instructions and
NEON autovectorization, and can give some seriously helpful clues
about how to rearrange floating point math for speed.

I've been having trouble with LTO linking, so I'll leave that out for now.

I don't think we should set up bots with this mode.  -ffast-math means
I'm forced to run DM with --match ~Blend ~Path ~Rect ~Math ~Scalar
~Matrix ~Point before it passes, which is a disconcerting chunk of tests
to disable (including all of PathOps).

BUG=skia:

Review URL: https://codereview.chromium.org/1036533003

gyp/common_conditions.gypi
gyp/common_variables.gypi

index b9a9296..a38c92d 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
+
 # conditions used in both common.gypi and skia.gyp in chromium
 #
 {
           '-Wno-invalid-offsetof',  # GCC <4.6 is old-school strict about what is POD.
         ],
         'conditions': [
+          [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
           [ 'skia_os != "chromeos"', {
             'conditions': [
               [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
         },
         'xcode_settings': {
           'conditions': [
+            [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
             [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
             [ 'skia_arch_width == 32', { 'ARCHS': ['i386']   }],
             [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
index 60dcccc..1031b52 100644 (file)
     'skia_moz2d%': 0,
     'skia_is_bot%': '<!(python -c "import os; print os.environ.get(\'CHROME_HEADLESS\', 0)")',
     'skia_egl%': '<(skia_egl)',
+    'skia_fast%': 0,
+    'skia_fast_flags': [
+        '-O3',                   # Even for Debug builds.
+        '-march=native',         # Use all features of and optimize for THIS machine.
+        '-fomit-frame-pointer',  # Sometimes an extra register is nice, and cuts a push/pop.
+        '-ffast-math',           # Optimize float math even when it breaks IEEE compliance.
+        #'-flto'                  # Enable link-time optimization.
+    ],
 
     # These are referenced by our .gypi files that list files (e.g. core.gypi)
     #