update CMake and Google3 builds for AVX/AVX2

The _avx.cpp code was working in a degraded (SSE2/SSSE3) mode silently.
This CL will make the _avx.cpp code start using AVX.

There is currently no _avx2.cpp code, but I'm writing some now,
and this change will make it work properly from the start.

Chrome and Android builds should already be okay.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1535443003
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1535443003
This commit is contained in:
mtklein 2015-12-17 10:18:04 -08:00 committed by Commit bot
parent 62a627be6a
commit f6d8d28883
2 changed files with 41 additions and 1 deletions

View File

@ -84,6 +84,8 @@ BASE_SRCS_UNIX = glob(
# Included in :opts_sse4 library.
"src/opts/*SSE4*",
"src/opts/*sse4*",
# Included in :opts_avx or :opts_avx2
"src/opts/*avx*",
"src/opts/SkBitmapProcState_opts_none.cpp",
"src/opts/SkBlitMask_opts_none.cpp",
"src/opts/SkBlitRow_opts_none.cpp",
@ -123,6 +125,7 @@ BASE_SRCS_ANDROID = glob(
"src/opts/*ssse3*",
"src/opts/*SSE4*",
"src/opts/*sse4*",
"src/opts/*avx*",
"src/opts/*x86*",
"src/opts/SkBitmapProcState_opts_none.cpp",
"src/opts/SkBlitMask_opts_none.cpp",
@ -165,6 +168,7 @@ BASE_SRCS_IOS = glob(
"src/opts/*ssse3*",
"src/opts/*SSE4*",
"src/opts/*sse4*",
"src/opts/*avx*",
"src/opts/*x86*",
"src/opts/SkBitmapProcState_opts_none.cpp",
"src/opts/SkBlitMask_opts_none.cpp",
@ -212,6 +216,18 @@ SSE4_SRCS = glob(
],
)
AVX_SRCS = glob(
[
"src/opts/*_avx.cpp",
],
)
AVX2_SRCS = glob(
[
"src/opts/*_avx2.cpp",
],
)
BASE_HDRS = glob(
[
"include/**/*.h",
@ -229,6 +245,8 @@ BASE_HDRS = glob(
# Dependencies.
BASE_DEPS_UNIX = [
":opts_avx2",
":opts_avx",
":opts_sse4",
":opts_ssse3",
]
@ -424,6 +442,24 @@ cc_library(
deps = EXTERNAL_DEPS_ALL,
)
cc_library(
name = "opts_avx",
srcs = AVX_SRCS,
copts = COPTS + ["-mavx"],
defines = DEFINES,
includes = INCLUDES,
deps = EXTERNAL_DEPS_ALL,
)
cc_library(
name = "opts_avx2",
srcs = AVX2_SRCS,
copts = COPTS + ["-mavx2"],
defines = DEFINES,
includes = INCLUDES,
deps = EXTERNAL_DEPS_ALL,
)
# If you need Ganesh (GPU) support in Skia, please contact skia-team@google.com
# for help.
cc_library(

View File

@ -114,11 +114,15 @@ endif()
remove_srcs(../src/gpu/gl/angle/*) # TODO
remove_srcs(../src/codec/* ../src/android/*) # TODO: Requires Chromium's libjpeg-turbo, and incompatible giflib.
# Certain files must be compiled with support for SSSE3 or SSE4.1 intrinsics.
# Certain files must be compiled with support for SSSE3, SSE4.1, AVX, or AVX2 intrinsics.
file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp)
file (GLOB_RECURSE sse41_srcs ../src/*sse4*.cpp ../src/*SSE4*.cpp)
file (GLOB_RECURSE avx_srcs ../src/*_avx.cpp)
file (GLOB_RECURSE avx2_srcs ../src/*_avx2.cpp)
set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3)
set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1)
set_source_files_properties(${avx_srcs} PROPERTIES COMPILE_FLAGS -mavx)
set_source_files_properties(${avx2_srcs} PROPERTIES COMPILE_FLAGS -mavx2)
# Detect our optional dependencies.
# If we can't find them, don't build the parts of Skia that use them.