Remove the per-element staging buffer in the BRNG fallback - #178
Open
vlad-perevezentsev wants to merge 3 commits into
Open
vlad-perevezentsev wants to merge 3 commits into
vlad-perevezentsev wants to merge 3 commits into
Conversation
vlad-perevezentsev
requested review from
antonwolfy,
jharlow-intel,
ndgrigorian and
xaleryb
as code owners
September 18, 2026 12:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes two changes to irk_uniform_bits_vec, neither of which alters generated values.
viRngUniformfallback taken byWH, MCG31, R250 and MRG32K3Aassembles 16-bit halves in a 4096-entry stack tile instead of anmkl_mallocbuffer of 8 or 16 bytes per element. That allocation was also unchecked in release builds, where assert compiles out, so a large request could crash instead of raising.MKL_INT / 2count cap ofviRngUniformBits64no longer lives in a copy of its own, far from the 32-bit limit it is contrasted withFor
randint(0, 2**64, size=2**30 + 4096)onWH, peak memory drops from 24.05 to 8.05 GiB and time from 12.6 to 5.6 s, matching the native path in memory. Generation is also 1.6–3x faster for 4M–16M elements on all four BRNGs, and unchanged below that.