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

[RNG] Added experimental support of Philox counter-based PRNG #1785

Merged
merged 55 commits into from
Sep 4, 2024

Conversation

ElenaTyuleneva
Copy link
Contributor

@ElenaTyuleneva ElenaTyuleneva commented Aug 20, 2024

C++ draft proposal was used as a design for public API - p2075r6.pdf, the latest correction by the time of PR creation is issue4134

Things to make before the merge:

  • Add testing for parameter n = 2 <- added statistics test philox_uniform_real_distribution_test.pass.cpp to check that we are generating a statistically valid sequence.
  • Add uglification
  • Mark the feature as experimental since C++ std proposal has not yet got the final revision
  • Add statistics test for scalar-input Philox for W!=32 and W!=64
  • Apply clang-format

* Aligned the number of _ in templates
* Corrected max method(added -1)
* Scalar generate_internal() is now working in-place without extra memory buffer
* Applied mask in mulhilo calculations
* Added necessary headers
* small corrections in philox_uniform_real_distribution_test.pass.cpp
* Make philox eqation more obvious in the code
include/oneapi/dpl/internal/random_impl/philox_engine.h Outdated Show resolved Hide resolved
include/oneapi/dpl/internal/random_impl/philox_engine.h Outdated Show resolved Hide resolved
static constexpr ::std::size_t word_count = _n;
static constexpr ::std::size_t round_count = _r;

static_assert(_n == 2 || _n == 4, "_n must be 2 or 4");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"parameter n must be 2 or 4"

parameter name is just aligned with spec

include/oneapi/dpl/internal/random_impl/philox_engine.h Outdated Show resolved Hide resolved
include/oneapi/dpl/internal/random_impl/philox_engine.h Outdated Show resolved Hide resolved
include/oneapi/dpl/internal/random_impl/philox_engine.h Outdated Show resolved Hide resolved
@timmiesmith timmiesmith added this to the 2022.7.0 milestone Sep 4, 2024
@ElenaTyuleneva
Copy link
Contributor Author

@aelizaro , the PR is ready for the final review, I've pushed all planned commits here.

Copy link
Contributor

@aelizaro aelizaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the huge work @ElenaTyuleneva!

The changes looks good to me.
Reviewed offline with @rarutyun. All the major design comments are resolved; we agreed to merge the feature as experimental. The algorithmic part of the implementation wasn't checked too thoroughly, but it relies on good test coverage, which is done in this PR.

@ElenaTyuleneva ElenaTyuleneva merged commit 1072629 into main Sep 4, 2024
22 checks passed
@ElenaTyuleneva ElenaTyuleneva deleted the dev/etyulene/eng_philox_engine branch September 4, 2024 19:29
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.

6 participants