<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 30, 2014 at 12:35 PM, JF Bastien <span dir="ltr"><<a href="mailto:jfb@google.com" target="_blank">jfb@google.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Can you elaborate? We could definitely add salt+seed to bitcode+IL if<br>
it's deemed better than what's currently there (they're reconstructed<br>
from command-line salt and Module ID).<br></blockquote><div><br></div><div><a href="http://llvm.org/docs/LangRef.html#module-flags-metadata">http://llvm.org/docs/LangRef.html#module-flags-metadata</a><br></div><div><br></div>
<div>I used it for autolinking.  #pragma comment(lib, ...) produces something like:</div><div><div>!llvm.module.flags = !{!0}</div><div>!0 = metadata !{i32 6, metadata !"Linker Options", metadata !1}</div><div>!1 = metadata !{metadata !2}</div>
<div>!2 = metadata !{metadata !"/DEFAULTLIB:asdf.lib"}</div></div><div><br></div><div>It could extend to your use case.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

The current design requires the exact same source version of LLVM,<br>
with the same target and pass ordering, for the produced binary to be<br>
bit-for-bit the same. Even slight changes in these could add one RNG<br>
query which means that all subsequent decisions will potentially be<br>
different.</blockquote><div><br></div><div>That seems like a reasonable restriction.  I wouldn't expect differing source revs of LLVM to produce the same results.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="">
>> Apologies if this has already been asked, but can we rely on the STL RNGs<br>
>> to produce identical results across implementations?  Ideally, the same<br>
>> bitcode and same seed should produce the same results regardless of host<br>
>> platform.<br>
<br>
</div>It currently hard-codes std::mt19937_64, which is spec'd to return the<br>
same value stream:<br>
  typedef mersenne_twister_engine<uint_fast64_t, [some constants]> mt19937_64;<br>
  Required behavior: The 10000 th consecutive invocation of a<br>
default-constructed object of type mt19937_64 shall produce the value<br>
9981545732273789042.<br>
<br>
Hmm, unless I'm mistaken std::uniform_int_distribution<uint64_t><br>
doesn't offer such a guarantee, so this is currently broken, and the<br>
intended behavior isn't respected. Julian, can you look into this?<br>
</blockquote></div><br></div><div class="gmail_extra">Cool!</div></div>