Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efficiently partitionable threefry PRNG 32-bit random bits implementation #13012

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

froystig
Copy link
Member

@froystig froystig commented Oct 27, 2022

Puzzled over and co-authored with @mattjj!

This essentially makes the implementation of Threefry 32-bit random bits into a pure map (in a way that the compiler notices that it is).

The cost relative to the existing implementation is 2x over-generation of bits, but in return we are bit-equivalent between the two implementations.

This sits behind a flag for now. If/when we verify no major (unpartitioned) performance regressions, we can swap this in as the default.

@froystig froystig requested a review from mattjj October 27, 2022 16:45
@froystig froystig self-assigned this Oct 27, 2022
@google-ml-butler google-ml-butler bot added kokoro:force-run pull ready Ready for copybara import and testing labels Oct 27, 2022
@froystig froystig force-pushed the rng-part-overgenerate branch from e49948c to 60e4d55 Compare October 27, 2022 22:43
@froystig froystig force-pushed the rng-part-overgenerate branch from 60e4d55 to 3b8de0d Compare October 27, 2022 22:45
@mattjj mattjj force-pushed the rng-part-overgenerate branch 2 times, most recently from b42f7c7 to 24127f0 Compare October 28, 2022 17:04
the cost is 2x overgeneration of bits

Co-authored-by: Matthew Johnson <[email protected]>
@mattjj mattjj force-pushed the rng-part-overgenerate branch from 24127f0 to c8b9280 Compare October 28, 2022 17:07
@froystig froystig changed the title efficiently partitionable threefry PRNG random bits implementation efficiently partitionable threefry PRNG 32-bit random bits implementation Oct 28, 2022
@copybara-service copybara-service bot merged commit 89b240b into jax-ml:main Oct 28, 2022
@froystig froystig deleted the rng-part-overgenerate branch November 22, 2022 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants