github.com/parquet-go/parquet-go@v0.20.0/bloom/xxhash/sum64uint_amd64.go (about)

     1  //go:build !purego
     2  
     3  package xxhash
     4  
     5  import "golang.org/x/sys/cpu"
     6  
     7  // This file contains the declaration of signatures for the multi hashing
     8  // functions implemented in sum64uint_amd64.s, which provides vectorized
     9  // versions of the algorithms written in sum64uint_purego.go.
    10  //
    11  // The use of SIMD optimization yields measurable throughput increases when
    12  // computing multiple hash values in parallel compared to hashing values
    13  // individually in loops:
    14  //
    15  // name                   old speed      new speed      delta
    16  // MultiSum64Uint8/4KB    4.94GB/s ± 2%  6.82GB/s ± 5%  +38.00%  (p=0.000 n=10+10)
    17  // MultiSum64Uint16/4KB   3.44GB/s ± 2%  4.63GB/s ± 4%  +34.56%  (p=0.000 n=10+10)
    18  // MultiSum64Uint32/4KB   4.84GB/s ± 2%  6.39GB/s ± 4%  +31.94%  (p=0.000 n=10+10)
    19  // MultiSum64Uint64/4KB   3.77GB/s ± 2%  4.95GB/s ± 2%  +31.14%  (p=0.000 n=9+10)
    20  // MultiSum64Uint128/4KB  1.84GB/s ± 2%  3.11GB/s ± 4%  +68.70%  (p=0.000 n=9+10)
    21  //
    22  // name                   old hash/s     new hash/s     delta
    23  // MultiSum64Uint8/4KB        617M ± 2%      852M ± 5%  +38.00%  (p=0.000 n=10+10)
    24  // MultiSum64Uint16/4KB       431M ± 2%      579M ± 4%  +34.56%  (p=0.000 n=10+10)
    25  // MultiSum64Uint32/4KB       605M ± 2%      799M ± 4%  +31.94%  (p=0.000 n=10+10)
    26  // MultiSum64Uint64/4KB       471M ± 2%      618M ± 2%  +31.14%  (p=0.000 n=9+10)
    27  // MultiSum64Uint128/4KB      231M ± 2%      389M ± 4%  +68.70%  (p=0.000 n=9+10)
    28  //
    29  // The benchmarks measure the throughput of hashes produced, as a rate of values
    30  // and bytes.
    31  
    32  var hasAVX512 = cpu.X86.HasAVX512 &&
    33  	cpu.X86.HasAVX512F &&
    34  	cpu.X86.HasAVX512CD
    35  
    36  //go:noescape
    37  func MultiSum64Uint8(h []uint64, v []uint8) int
    38  
    39  //go:noescape
    40  func MultiSum64Uint16(h []uint64, v []uint16) int
    41  
    42  //go:noescape
    43  func MultiSum64Uint32(h []uint64, v []uint32) int
    44  
    45  //go:noescape
    46  func MultiSum64Uint64(h []uint64, v []uint64) int
    47  
    48  //go:noescape
    49  func MultiSum64Uint128(h []uint64, v [][16]byte) int