All Projects → jsnell → Parallel Xxhash

jsnell / Parallel Xxhash

Licence: mit
Compute xxHash hash codes for 8 keys in parallel

Projects that are alternatives of or similar to Parallel Xxhash

Md5 Simd
Accelerate aggregated MD5 hashing performance up to 8x for AVX512 and 4x for AVX2. Useful for server applications that need to compute many MD5 sums in parallel.
Stars: ✭ 71 (+97.22%)
Mutual labels:  hashing, simd
Deep Mihash
Code for papers "Hashing with Mutual Information" (TPAMI 2019) and "Hashing with Binary Matrix Pursuit" (ECCV 2018)
Stars: ✭ 13 (-63.89%)
Mutual labels:  hashing
Fastnoisesimd
C++ SIMD Noise Library
Stars: ✭ 542 (+1405.56%)
Mutual labels:  simd
Cglm
📽 Highly Optimized Graphics Math (glm) for C
Stars: ✭ 887 (+2363.89%)
Mutual labels:  simd
Zero Allocation Hashing
Zero-allocation hashing for Java
Stars: ✭ 561 (+1458.33%)
Mutual labels:  hashing
Java Competitive Programming
I have written some important Algorithms and Data Structures in an efficient way in Java with proper references to time and space complexity. These Pre-cooked and well-tested codes help to implement larger hackathon problems in lesser time. DFS, BFS, LCA, All Pair Shortest Path, Longest Common Subsequence, Binary Search, Lower Bound Search, Maximal Matching, Matrix Exponentiation, Segment Tree, Sparse Table, Merge Sort, Miller Prime Test, Prims - Minimum Spanning Tree, BIT - Binary Index Tree, Two Pointers, BST - Binary Search Tree, Maximum Subarray Sum, Immutable Data Structures, Persistent Data Structurs - Persistent Trie, Dijkstra, Z - Function, Minimum Cost Maximal Matching, Heavy Light Decomposition, Knapsack, Suffix Array and LCP - Longest Common Prefix, Squre Root Decomposition, Kth Order Statics, Trie / Prefix Tree, LIS - Longest Increasing Subsequence, Hashing
Stars: ✭ 24 (-33.33%)
Mutual labels:  hashing
Turbopfor Integer Compression
Fastest Integer Compression
Stars: ✭ 520 (+1344.44%)
Mutual labels:  simd
Xsimd
C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, NEON, AVX512)
Stars: ✭ 964 (+2577.78%)
Mutual labels:  simd
Directxmath
DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
Stars: ✭ 859 (+2286.11%)
Mutual labels:  simd
Xnnpack
High-efficiency floating-point neural network inference operators for mobile, server, and Web
Stars: ✭ 808 (+2144.44%)
Mutual labels:  simd
Cgmath
A linear algebra and mathematics library for computer graphics.
Stars: ✭ 773 (+2047.22%)
Mutual labels:  simd
Pikkr
JSON parser which picks up values directly without performing tokenization in Rust
Stars: ✭ 580 (+1511.11%)
Mutual labels:  simd
Simdsetoperations
testbed for different SIMD implementations for set intersection and set union
Stars: ✭ 24 (-33.33%)
Mutual labels:  simd
Lazy importer
library for importing functions from dlls in a hidden, reverse engineer unfriendly way
Stars: ✭ 544 (+1411.11%)
Mutual labels:  hashing
Quadray Engine
Realtime raytracer using SIMD on ARM, MIPS, PPC and x86
Stars: ✭ 13 (-63.89%)
Mutual labels:  simd
Name That Hash
🔗 Don't know what type of hash it is? Name That Hash will name that hash type! 🤖 Identify MD5, SHA256 and 3000+ other hashes ☄ Comes with a neat web app 🔥
Stars: ✭ 540 (+1400%)
Mutual labels:  hashing
Sirix
SirixDB is a temporal, evolutionary database system, which uses an accumulate only approach. It keeps the full history of each resource. Every commit stores a space-efficient snapshot through structural sharing. It is log-structured and never overwrites data. SirixDB uses a novel page-level versioning approach called sliding snapshot.
Stars: ✭ 638 (+1672.22%)
Mutual labels:  hashing
Edge
Extreme-scale Discontinuous Galerkin Environment (EDGE)
Stars: ✭ 18 (-50%)
Mutual labels:  simd
Rhashmap
Robin Hood hash map library
Stars: ✭ 33 (-8.33%)
Mutual labels:  hashing
Libsimdpp
Portable header-only C++ low level SIMD library
Stars: ✭ 914 (+2438.89%)
Mutual labels:  simd

parallel-xxhash

Two implementations of the xxHash hash function (specifically, the 32 bit version).

  • parallel: Computing the hash values of 8 keys in parallel, using AVX2 intrinsics.
  • scalar: Computing the hash value of a single key.

These are very special purpose implementations, and will not be of any interest in most programs. Use these functions if:

  • Your keys have a constant size, and are a multiple of 4 bytes long. Variable size keys are not supported. Nor are non-word aligned keys.
  • You have an application that can receive and process inputs in batches such that you usually have 8 keys to process at once. (Doesn't need to be full batches of 8, but the break-even point vs. a fast scalar hash is probably around batches of 3-4 keys).
  • You can arrange for your hash keys to be in a column-major order without too much pain.
  • You can compile the program with -mavx2. (While there is a non-avx2 fallback, there's not a lot of point to it).
  • A single 32 bit hash value per key is sufficient.

The scalar implementation is mainly included as a fallback, for programs that generally use the parallel code, but have some exceptional cases that need identical hash codes for individual keys. Except for very small keys (at most 20 bytes), you are probably better off with the reference implementation of some modern hash function.

DATA LAYOUT

For the parallel version the keys should be laid out adjacent to each other, in column-major order. That is, the first word in keys should be the first word of the first key. The second word of keys should be the first word of the second key. And so on:

  key1[0] key2[0] ... key7[0]
  key2[1] key2[1] ... key7[1]
  ...
  key1[SizeWords-1] key2[SizeWords-1] ... key7[SizeWords-1]

EXAMPLES

Assume the following definitions:

   static const uint32_t KEY_LENGTH = 3;

   static uint32_t rows[][KEY_LENGTH] = {
      {1, 2, 3},
      {4, 5, 6},
      {7, 8, 9},
      {10, 11, 12},
      {13, 14, 15},
      {16, 17, 18},
      {19, 20, 21},
      {22, 23, 24},
  };

  static uint32_t cols[][8] = {
      {1, 4, 7, 10, 13, 16, 19, 22},
      {2, 5, 8, 11, 14, 17, 20, 23},
      {3, 6, 9, 12, 15, 18, 21, 24},
  };

  static uint32_t seeds[] = { 0x3afc8e77, 0x924f408d };
  static const uint32_t seed_count = sizeof(seeds) / sizeof(uint32_t);

The implementations could be used as follows to compute hash values for each of the key / seed combinations:

  void example_scalar() {
      for (int s = 0; s < seed_count; ++s) {
          for (int i = 0; i < 8; ++i) {
              uint32_t* row = rows[i];
              uint32_t res = xxhash32<3>::scalar(row, seeds[s]);
              printf("seed=%08x, key={%u,%u,%u}, hash=%u\n",
                     seeds[s], row[0], row[1], row[2], res);
          }
      }
  }

  void example_parallel() {
      for (int s = 0; s < seed_count; ++s) {
          uint32_t res[8];
          __m256i hash = xxhash32<3>::parallel(cols[0], seeds[s], res);
          for (int i = 0; i < 8; ++i) {
              printf("seed=%08x, key={%u,%u,%u}, hash=%u\n",
                     seeds[s], cols[0][i], cols[1][i], cols[2][i],
                     res[i]);
          }
      }
  }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].