Repository navigation
Add dpnp.random.Generator on the oneMKL device RNG API - #3157
Open
ndgrigorian wants to merge 1 commit into
Open
ndgrigorian wants to merge 1 commit into
ndgrigorian wants to merge 1 commit into
Conversation
ndgrigorian
requested review from
antonwolfy and
vlad-perevezentsev
as code owners
November 4, 2026 19:45
5 of 7 tasks
ndgrigorian
force-pushed
the
feature/device-rng-generator
branch
from
November 4, 2026 19:47
dbdb2c8 to
3963d20
Compare
Add the dpnp.libtensor._rng_impl extension, which samples on the device from oneMKL's device philox4x32x10 engine, and the Generator API of NumPy on top of it: BitGenerator, Philox4x3210, SeedSequence (NumPy's), default_rng, and the random, uniform, standard_normal and normal methods. A bit generator keeps its state on the host and every launch rebuilds its engines from it, so the values depend only on the seed and the output size, not on the device. The legacy RandomState and module functions are unchanged.
6 of 7 tasks
ndgrigorian
force-pushed
the
feature/device-rng-generator
branch
from
November 4, 2026 19:50
3963d20 to
6c3ff46
Compare
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3157/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.22.0dev0=np2py314h8d9cdd5_27 ran successfully. |
Collaborator
This branch has not been deployed
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 is the first of a series splitting #3147 into smaller pieces. It adds the new framework for device-side random number generation and NumPy's
GeneratorAPI, with only the base distributionsThe new
dpnp.libtensor._rng_implextension samples on the device using the oneMKL device RNG API (header-only, so no oneMKL RNG library is linked). A bit generator keeps its state on the host, and each kernel launch rebuilds its engines from that state, so sampling never waits on the device and the values depend only on the seed and the output size, not on the deviceAdds
dpnp.random.Generatorwithrandom,uniform,standard_normal,normalandspawn, anddefault_rngdpnp.random.BitGenerator(withrandom_raw,spawn,stateandlock),SeedSequence(NumPy's) and thePhilox4x3210bit generator on oneMKL's devicephilox4x32x10The legacy
RandomStateand the module-level functions are untouched until later in the seriesSeries:
dpnp.random.Generatoron the oneMKL device RNG API #3157 (this PR): framework,Philox4x3210and the base distributionsdpnp.random.Generator#3158: Continuous distributionsdpnp.random.Generator#3159: Discrete distributionsdpnp.random.Generator#3160: Multivariate distributions and permutationsPCG64DXSMandMRG32k3abit generators todpnp.random#3161:PCG64DXSMandMRG32k3abit generatorsdpnp.random.RandomStateon the device RNG #3162:RandomStateand the module functions on the device RNG