MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Hash64Farm_Batch512

Function Hash64Farm_Batch512

tensorflow/core/lib/hash/hash.cc:706–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704}
705
706void Hash64Farm_Batch512(const char** data, uint64_t* h_out, size_t len) {
707 const uint64_t seed = 81;
708 if (len <= 32) {
709 if (len <= 16) {
710 HashLen0to16Batch(data, h_out, len);
711 return;
712 } else {
713 HashLen17to32Batch(data, h_out, len);
714 return;
715 }
716 } else if (len <= 64) {
717 HashLen33to64Batch(data, h_out, len);
718 return;
719 }
720
721 __m512i k2_batch = _mm512_set1_epi64(k2);
722 __m512i k1_batch = _mm512_set1_epi64(k1);
723 __m512i k0_batch = _mm512_set1_epi64(k0);
724 __m512i factor_113_batch = _mm512_set1_epi64(113);
725 __m512i factor_9_batch = _mm512_set1_epi64(9);
726 __m512i factor_len_batch = _mm512_set1_epi64(len);
727 __m512i x = _mm512_set1_epi64(seed);
728 __m512i seed_batch = _mm512_set1_epi64(seed);
729
730 __m512i y = _mm512_mullo_epi64_hand(seed_batch, k1_batch);
731 y = _mm512_add_epi64(y, factor_113_batch);
732 __m512i tmp = _mm512_mullo_epi64_hand(y, k2_batch);
733 tmp = _mm512_add_epi64(tmp, factor_113_batch);
734 __m512i z = _mm512_mullo_epi64_hand(ShiftMixBatch(tmp), k2_batch);
735
736 std::pair<__m512i, __m512i> v = std::make_pair(_mm512_set1_epi64(0),
737 _mm512_set1_epi64(0));
738 std::pair<__m512i, __m512i> w = std::make_pair(_mm512_set1_epi64(0),
739 _mm512_set1_epi64(0));
740
741 x = _mm512_mullo_epi64_hand(x, k2_batch);
742 x = _mm512_add_epi64(x, Fetch64Batch(data, 0));
743
744 size_t end_idx = ((len - 1) / 64) * 64;
745 size_t last64_idx = end_idx + ((len - 1) & 63) - 63;
746 assert(len - 64 == last64_idx);
747
748 size_t start_idx = 0;
749 do {
750 tmp = _mm512_add_epi64(x, y);
751 tmp = _mm512_add_epi64(tmp, v.first);
752 tmp = _mm512_add_epi64(tmp, Fetch64Batch(data, start_idx+8));
753 x = Rotate64Batch(tmp, 37);
754 x = _mm512_mullo_epi64_hand(x, k1_batch);
755
756 tmp = _mm512_add_epi64(y, v.second);
757 tmp = _mm512_add_epi64(tmp, Fetch64Batch(data, start_idx+48));
758 y = Rotate64Batch(tmp, 42);
759 y = _mm512_mullo_epi64_hand(y, k1_batch);
760
761 x = _mm512_xor_si512(x, w.second);
762
763 y = _mm512_add_epi64(y, v.first);

Callers 4

TESTFunction · 0.85
BM_Hash64BatchX8FarmFunction · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85

Calls 9

HashLen0to16BatchFunction · 0.85
HashLen17to32BatchFunction · 0.85
HashLen33to64BatchFunction · 0.85
_mm512_mullo_epi64_handFunction · 0.85
ShiftMixBatchFunction · 0.85
Fetch64BatchFunction · 0.85
Rotate64BatchFunction · 0.85
HashLen16BatchFunction · 0.85

Tested by 2

TESTFunction · 0.68
BM_Hash64BatchX8FarmFunction · 0.68