Skip to content

Commit

Permalink
Use POWER8 accelerated crc32
Browse files Browse the repository at this point in the history
 - Make accelerated checksum available to InnoDB and XtraDB.
 - Fall back to slice-by-eight if not available. The mode used is printed on startup.
 - Will only build on POWER systems at the moment until CMakeLists are modified
   to only add the crc32_power8/ files when building on POWER.

running MySQL-5.7 unittest/gunit/innodb/ut0crc32-t

Before:

1..2
Using software crc32 implementation, CPU is little-endian
ok 1
Using software crc32 implementation, CPU is little-endian
    normal CRC32: real    0.148006 sec
    normal CRC32: user    0.148000 sec
    normal CRC32: sys     0.000000 sec
big endian CRC32: real    0.144293 sec
big endian CRC32: user    0.144000 sec
big endian CRC32: sys     0.000000 sec
ok 2

After:

1..2
Using POWER8 crc32 implementation, CPU is little-endian
ok 1
Using POWER8 crc32 implementation, CPU is little-endian
    normal CRC32: real    0.008097 sec
    normal CRC32: user    0.008000 sec
    normal CRC32: sys     0.000000 sec
big endian CRC32: real    0.147043 sec
big endian CRC32: user    0.144000 sec
big endian CRC32: sys     0.000000 sec
ok 2

Author CRC32 ASM code: Anton Blanchard <anton@au.ibm.com>
ref: https://github.com/antonblanchard/crc32-vpmsum

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
  • Loading branch information
daxtens authored and grooverdan committed Dec 15, 2015
1 parent 44b107d commit 2538c7c
Show file tree
Hide file tree
Showing 17 changed files with 3,558 additions and 6 deletions.
5 changes: 5 additions & 0 deletions extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ IF(WITH_INNOBASE_STORAGE_ENGINE OR WITH_XTRADB_STORAGE_ENGINE)

# We use the InnoDB code directly in case the code changes.
ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM")

enable_language(ASM)

SET(INNOBASE_SOURCES
../storage/innobase/buf/buf0checksum.cc
../storage/innobase/ut/ut0crc32.cc
../storage/innobase/ut/ut0ut.cc
../storage/innobase/ut/crc32_power8/crc32.S
../storage/innobase/ut/crc32_power8/crc32_wrapper.c
../storage/innobase/page/page0zip.cc
)

Expand Down
3 changes: 3 additions & 0 deletions storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ IF(MSVC)
PROPERTIES COMPILE_FLAGS "/wd4003")
ENDIF()

enable_language(ASM)

SET(INNOBASE_SOURCES
api/api0api.cc
Expand Down Expand Up @@ -477,6 +478,8 @@ SET(INNOBASE_SOURCES
ut/ut0bh.cc
ut/ut0byte.cc
ut/ut0crc32.cc
ut/crc32_power8/crc32.S
ut/crc32_power8/crc32_wrapper.c
ut/ut0dbg.cc
ut/ut0list.cc
ut/ut0mem.cc
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/ut0crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ typedef ib_uint32_t (*ib_ut_crc32_t)(const byte* ptr, ulint len);
extern ib_ut_crc32_t ut_crc32;

extern bool ut_crc32_sse2_enabled;
extern bool ut_crc32_power8_enabled;

#endif /* ut0crc32_h */
10 changes: 7 additions & 3 deletions storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1869,9 +1869,13 @@ innobase_start_or_create_for_mysql(void)

srv_boot();

ib_logf(IB_LOG_LEVEL_INFO,
"%s CPU crc32 instructions",
ut_crc32_sse2_enabled ? "Using" : "Not using");
if (ut_crc32_sse2_enabled) {
ib_logf(IB_LOG_LEVEL_INFO, "Using SSE crc32 instructions");
} else if (ut_crc32_power8_enabled) {
ib_logf(IB_LOG_LEVEL_INFO, "Using POWER8 crc32 instructions");
} else {
ib_logf(IB_LOG_LEVEL_INFO, "Using generic crc32 instructions");
}

if (!srv_read_only_mode) {

Expand Down
Loading

0 comments on commit 2538c7c

Please sign in to comment.