[llvm] r211705 - Random Number Generator (llvm)

Stephen Crane sjcrane at uci.edu
Mon Jun 30 09:37:47 PDT 2014


We need to salt the RNG with Module-specific info, so that each
translation unit of a parallel make using the same seed actually gets
a different random stream. I agree that at least the seed should in
fact be serialized, since it is needed to construct a reproducible
stream. However, as long as the ModuleID is serialized (it is, right?)
the salt and state need not be, since the RNG state only depends on
the seed and the ModuleID.

However, with all that in mind, perhaps we can move this somewhere
else. It was intended as a module-specific random stream, but there
may be another way to do this. Hopefully the final result won't
include too much threading/locking...

- stephen

On Mon, Jun 30, 2014 at 9:25 AM, JF Bastien <jfb at google.com> wrote:
>> This looks interesting, but why is there a pointer from llvm::Module to this?  This doesn’t seem like part of the IR structure of a file, and isn’t serializable into bitcode or .ll files.  Unless I’m missing something big here, this should not be part of llvm::Module.
>
>
> Hi Chris,
>
> We discussed this on the review (http://reviews.llvm.org/D3390) and
> IRC: should it be in the Module, LLVMContext, or somewhere else? The
> agreement was that there was no great place to put it. Module seemed
> best because it's currently the unit of concurrency (no need for
> TLS/locking, and unpredictability in the RNG stream), and the initial
> seed+salt are part of how the final bitcode and machine code get
> generated (I definitely think this should be part of bitcode
> serialization so that we can get reproducible results with the same
> toolchain). Would you rather have something else?
>
> Adding the author of the patch to the email.




More information about the llvm-commits mailing list