<div dir="ltr"><div>On Fri, Jan 19, 2018 at 12:30 AM, George Rimar <span dir="ltr"><<a href="mailto:grimar@accesssoftek.com" target="_blank">grimar@accesssoftek.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><span class="">
<p>><span style="color:rgb(33,33,33);font-size:12pt">I don't believe that spending time on "tuning" shift2 value is a good idea because I doubt that that is theoretically meaningful. </span></p>
<p><span style="color:rgb(33,33,33);font-size:12pt">> If my understanding is correct, changing that value doesn't have any significant effects.</span></p>
</span><div style="color:rgb(33,33,33)">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>It have effect. Setting to values >= 11 gives boost for llvm-check. Even given that results are varie a bit, </div>
<div>T<span style="font-size:12pt">i</span><span style="font-size:12pt">me(Shift2=6) is </span><span style="font-size:12pt">always noticable worse than Time(Shift2=11).</span></div>
<div><span style="font-size:12pt">It is not a calculation error, difference is stable.</span></div></div></div></div></div></div></div></blockquote><div><br></div><div>Your benchmark scores depend on symbol names exported from DSO files. 11 might achieve better performance than 6 in your testcase, but that doesn't mean 11 is always better than the others in other test cases. IIUC, theoretically, as I said, no number should be better than the others as long as the hash function returns evenly distributed hash values. Please explain your theory behind why 11 is better than 6 if you want to proceed with this patch.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div>I am not much in favor of tuning it too much, because anyways in linker we do not have information about all symbols that loader<br>
</div>
<div>will try to lookup. So I believe it is just impossible to find ideal .gnu_hash. But I would hardcode any value in [11,20] instead of 6 probably,<br>
</div>
<div>it is a free boost.<br>
</div><span class="">
<div><br>
</div>
<div>>The bloom filter for the .gnu.hash table is a two-bit bloom filter. To choose two bit locations, we compute one hash value H and create</div>
<div>>two hash values H1 and H2 in the following manner :Assume a 64-bit machine. Bits H[0,5] are always used for computing the</div>
<div>>first hash H1. Bits H[Shift2, Shift2 + 5] are used for computing the second hash H2.​<br>
</div>
<div>>As long as the hash function produces evenly distributed hash values, choosing bits [6, 11] isn't different from choosing other bits, say [15, 20]. </div>
<div>>No Shift2 greater than 5 should be better than any other Shift2 values in theory.</div>
<div>> </div>
<div>>Am I missing something?</div>
<div><br>
</div>
</span><div style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">
I think there is a mistake here. See, we have following code:<br>
</div>
<div style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><span class="">
<div>Val |= uint64_t(1) << (Sym.Hash % C);</div>
</span><span class=""><div>Val |= uint64_t(1) << ((Sym.Hash >> getShift2()) % C);</div>
<div><span style="white-space:pre-wrap"></span></div>
</span><div>C == 64 for 64 bits, ot 2^6. It is simplified to:<br>
</div>
<div><span style="white-space:pre-wrap"></span></div>
<div>Val |= uint64_t(1) << (Sym.Hash >> 6);</div>
<div>Val |= uint64_t(1) << (Sym.Hash >> (Shift2 + 6));</div>
<div><span style="white-space:pre-wrap"></span></div>
<div>Or I believe bits H[6, 63] are used to find Bit 1 and H[6 + Shift2, 63] for Bit 2.​<span class="HOEnZb"><font color="#888888"><br>
</font></span></div><span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<div>George.<br>
</div>
</font></span></div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>

</blockquote></div><br></div></div>