Make random faster by putting the innermost var last by abadams · Pull Request #6504 · halide/Halide · GitHub
Skip to content

Make random faster by putting the innermost var last#6504

Merged
abadams merged 4 commits into
masterfrom
abadams/low_bit_noise
Jan 4, 2022
Merged

Make random faster by putting the innermost var last#6504
abadams merged 4 commits into
masterfrom
abadams/low_bit_noise

Conversation

@abadams

@abadams abadams commented Dec 18, 2021

Copy link
Copy Markdown
Member

40% faster, and I fixed the issue where the low bits of our noise have a low period. This combined with #6506 makes it possible to generate low-bit-width-noise very cheaply for things like dithering.

@abadams abadams changed the title Make random 2x faster by putting the innermost var last Make random faster by putting the innermost var last Dec 19, 2021
By pulling constant additions outside of quadratics, we can shave off a
few add instructions in the inner loop for random number generation,
which uses a quadratic modulo 2^32

I also removed the !overflows predicates, because rules already fail to
match if a fold overflows.

New rules formally verified.
@abadams abadams requested a review from rootjalex January 3, 2022 18:16
@abadams

abadams commented Jan 4, 2022

Copy link
Copy Markdown
Member Author

@steven-johnson steven-johnson self-requested a review January 4, 2022 16:31
@abadams abadams merged commit 0021165 into master Jan 4, 2022
@steven-johnson

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants