summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/checksum/zseries/README.md
blob: 5d59ceb6f6a5daa225aac73ac0a7530a129afd71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
crc32-s390x
===========

A library of functions for accelerating CRC32 calculations using the
Vector Galois Field Multiply instruction family instructions introduced in
the z13. The Vector Extension Facility for z/Architecture provides two
instructions to perform a binary Galois field multiplication. Both
instructions (VGFM and VGFMA) can operate on different element sizes.
For the 32-bit CRC computation, doublewords are used throughout the
implementation.

Quick start
-----------

Type make to generate a static library libcrc32\_s390x.a.

The library provides functions to compute CRC-32 (IEEE 802.3) and
CRC-32C (Castagnoli), with optional bit reflection (with the `*_le`
versions of the functions).

Function prototypes are declared in crc32-s390x.h. A sample program
crc32-cli.c shows how the library is used.

Testing
-------

The correctness of the hardware-accelerated implementation is verified
with the pure-software Rocksoft Model CRC algorithm. There are four
variants of the test, each of which exercise one type of CRC on random
data with random alignment and buffer sizes, in an infinite loop:

    ./crc32_be_test
    ./crc32_le_test
    ./crc32c_be_test
    ./crc32c_le_test

If the hardware-accelerated algorithm ever returns a different result
than the Rocksoft Model, the test will print messages to indicate the
errors.

Performance
-----------

The performance of the hardware-accelerated implemention is compared
with the slicing-by-8 algorithm. Testing 500000 iterations of a CRC
of 32kB of data showed a 70-times speed-up:

    $ time ./crc32_sw_bench 32768 500000
    CRC: a98177aa
    
    real    0m21.862s
    user    0m21.859s
    sys     0m0.002s
    
    $ time ./crc32_vx_bench 32768 500000
    CRC: a98177aa
    
    real    0m0.323s
    user    0m0.323s
    sys     0m0.000s