Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Issue 552123005: Integrate SIMD optimisations for zlib (Closed)

Created:
6 years, 3 months ago by robert.bradford
Modified:
6 years, 2 months ago
Reviewers:
hans, agl, nathan ciobanu
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Integrate SIMD optimisations for zlib These optimisations have been published on zlib mailing list and at https://github.com/jtkukunas/zlib/ This change merges the following optimisation patches: - "For x86, add CPUID check." - "Adds SSE2 optimized hash shifting to fill_window." - "add SSE4.2 optimized hash function" - "add PCLMULQDQ optimized CRC folding" From Jim Kukunas <james.t.kukunas@linux.intel.com>; and adapts them to the current zlib version in Chromium. The optimisations are enabled at runtime if all the necessary CPU features are present. As the optimisations require extra cflags to enable the compiler to use the instructions the optimisations are held in their own static library with a stub implementation to allow linking on other platforms. TEST=net_unittests(GZipUnitTest) passes, Chrome functions and performance improvement seen on RoboHornet benchmark on Linux Desktop BUG=401517 Committed: https://crrev.com/e045ec106de29562ae94eafccde49a7b73848471 Cr-Commit-Position: refs/heads/master@{#300866}

Patch Set 1 #

Patch Set 2 : Address lack of inline keyword on MSVC for C (vs C++) #

Patch Set 3 : Fix issues in fallback (non-SIMD) code #

Total comments: 7

Patch Set 4 : Remove ifdefs and move simd code to specific static library #

Patch Set 5 : fix gn build (uses different cflags -Wunused-variable) #

Total comments: 12

Patch Set 6 : Stop being linux only, formatting fixes and stub x86 checking code correctly #

Patch Set 7 : Singleton on Windows, add reference frame data from optimised version #

Total comments: 20

Patch Set 8 : Coding style fixes and use memcmp() for alternate frame data handling #

Patch Set 9 : Improve README.chromium and fix reference to cpu.h #

Patch Set 10 : ios also has gyp/cflags bug (#420616) #

Patch Set 11 : Fix stub build - broken by earlier head file rearrangement #

Patch Set 12 : Add host toolset for android builds to static library #

Patch Set 13 : Ensure input buffer for deflate used by WebRtcRtpDumpWriter is a multiple of 16 bytes #

Patch Set 14 : Fix crc_fold_copy to work with inputs where len % 16 > 0 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1163 lines, -32 lines) Patch
M net/spdy/spdy_framer_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +166 lines, -7 lines 0 comments Download
M third_party/zlib/BUILD.gn View 1 2 3 4 5 7 2 chunks +15 lines, -0 lines 0 comments Download
M third_party/zlib/README.chromium View 1 2 3 4 5 6 7 8 1 chunk +16 lines, -0 lines 0 comments Download
M third_party/zlib/crc32.c View 1 2 3 2 chunks +27 lines, -0 lines 0 comments Download
A third_party/zlib/crc_folding.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +478 lines, -0 lines 0 comments Download
M third_party/zlib/deflate.h View 1 2 3 4 5 6 2 chunks +13 lines, -0 lines 0 comments Download
M third_party/zlib/deflate.c View 1 2 3 4 5 6 7 18 chunks +73 lines, -25 lines 0 comments Download
A third_party/zlib/fill_window_sse.c View 1 2 3 4 5 6 7 8 1 chunk +202 lines, -0 lines 1 comment Download
A third_party/zlib/simd_stub.c View 1 2 3 4 5 6 7 8 9 10 1 chunk +41 lines, -0 lines 0 comments Download
A third_party/zlib/x86.h View 1 2 3 4 5 6 7 8 1 chunk +13 lines, -0 lines 0 comments Download
A third_party/zlib/x86.c View 1 2 3 4 5 6 7 1 chunk +90 lines, -0 lines 0 comments Download
M third_party/zlib/zlib.gyp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +23 lines, -0 lines 0 comments Download
M third_party/zlib/zutil.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 30 (8 generated)
robert.bradford
Hi Adam, As we discussed by email here is a patch that integrates SIMD optimisations ...
6 years, 3 months ago (2014-09-12 15:17:45 UTC) #2
agl
(Please note: currently on vacation. It'll probably be Tuesday before I can get to this.) ...
6 years, 3 months ago (2014-09-12 16:41:11 UTC) #3
agl
There is a huge amount of #ifdef noise. It would be far better for the ...
6 years, 3 months ago (2014-09-23 21:41:40 UTC) #4
robert.bradford
Hi Adam, PTAL when you're ready. I simplified the #ifdef situation massively and also moved ...
6 years, 2 months ago (2014-09-25 17:52:20 UTC) #5
agl
https://codereview.chromium.org/552123005/diff/80001/third_party/zlib/deflate.h File third_party/zlib/deflate.h (right): https://codereview.chromium.org/552123005/diff/80001/third_party/zlib/deflate.h#newcode110 third_party/zlib/deflate.h:110: unsigned __attribute__((aligned(16))) crc0[4 * 5]; I think that this ...
6 years, 2 months ago (2014-09-26 18:32:27 UTC) #6
nathan ciobanu
RoboHornet 2D Canvas toDataURL benchmark with this patch applied scored 22% better than without. Tested ...
6 years, 2 months ago (2014-10-02 22:46:34 UTC) #8
agl
(Note: this is pending updates from Intel.)
6 years, 2 months ago (2014-10-07 20:52:33 UTC) #9
robert.bradford
On 2014/10/07 20:52:33, agl wrote: > (Note: this is pending updates from Intel.) I think ...
6 years, 2 months ago (2014-10-10 18:09:46 UTC) #10
agl
On 2014/10/10 18:09:46, robert.bradford wrote: > I think that all your review feedback was integrated ...
6 years, 2 months ago (2014-10-10 18:44:47 UTC) #11
robert.bradford
Hi Adam, PTAL at this latest version of the patch. I've tested it on Mac ...
6 years, 2 months ago (2014-10-15 16:14:40 UTC) #12
agl
really only nits remaining. https://codereview.chromium.org/552123005/diff/140001/net/spdy/spdy_framer_test.cc File net/spdy/spdy_framer_test.cc (right): https://codereview.chromium.org/552123005/diff/140001/net/spdy/spdy_framer_test.cc#newcode2054 net/spdy/spdy_framer_test.cc:2054: #if !defined(ZLIB_X86_SIMD) Let's not add ...
6 years, 2 months ago (2014-10-17 00:45:35 UTC) #13
robert.bradford
Hi Adam, PTAL, I agreed with and implemented all your review feedback. https://codereview.chromium.org/552123005/diff/140001/net/spdy/spdy_framer_test.cc File net/spdy/spdy_framer_test.cc ...
6 years, 2 months ago (2014-10-20 16:45:54 UTC) #14
agl
lgtm
6 years, 2 months ago (2014-10-20 17:50:36 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/552123005/180001
6 years, 2 months ago (2014-10-20 17:51:52 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_arm64_dbg_recipe/builds/14291) android_clang_dbg_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/14247) ios_rel_device ...
6 years, 2 months ago (2014-10-20 18:00:44 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/552123005/240001
6 years, 2 months ago (2014-10-21 11:05:20 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel/builds/4744)
6 years, 2 months ago (2014-10-21 13:15:03 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/552123005/280001
6 years, 2 months ago (2014-10-23 10:13:34 UTC) #25
commit-bot: I haz the power
Committed patchset #14 (id:280001)
6 years, 2 months ago (2014-10-23 11:11:11 UTC) #26
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/e045ec106de29562ae94eafccde49a7b73848471 Cr-Commit-Position: refs/heads/master@{#300866}
6 years, 2 months ago (2014-10-23 11:11:58 UTC) #27
robert.bradford
A revert of this CL (patchset #14 id:280001) has been created in https://codereview.chromium.org/671163003/ by robert.bradford@intel.com. ...
6 years, 2 months ago (2014-10-23 14:43:42 UTC) #28
hans
6 years, 2 months ago (2014-10-23 16:11:27 UTC) #30
Message was sent while issue was closed.
https://codereview.chromium.org/552123005/diff/280001/third_party/zlib/fill_w...
File third_party/zlib/fill_window_sse.c (right):

https://codereview.chromium.org/552123005/diff/280001/third_party/zlib/fill_w...
third_party/zlib/fill_window_sse.c:195: h = _mm_crc32_u32(h, val);
I think this intrinsic is available in smmintrin.h on GCC and Clang as well. Can
we just include that and avoid the inline asm above?

(The reason I noticed this is because the code failed to build on Clang on
Windows because smmintrin.h isn't included.)

Powered by Google App Engine
This is Rietveld 408576698