Commit b523734d authored by Justin Lebar's avatar Justin Lebar Committed by TensorFlower Gardener
Browse files

[XLA] Don't re-seed RNG on every call to HloEvaluator::Evaluate.

Some tests -- in particular, tests that do reductions and so invoke a small
subcomputation many times -- invoke HloEvaluator::Evaluate() many times.
Previously, each such invocation was creating an std::random_device.

Creating std::random_device is very expensive -- it touches /dev/urandom and so
on.  This was creating a lot of overhead (25%+) in these tests.  So instead, we
do it only once, and do a simple atomic op to generate new seeds.

PiperOrigin-RevId: 228963974
parent 2f2f865d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment