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

Yves/wellrng512a support #23032

Draft
wants to merge 7 commits into
base: blead
Choose a base branch
from
Draft

Yves/wellrng512a support #23032

wants to merge 7 commits into from

Conversation

demerphq
Copy link
Collaborator

@demerphq demerphq commented Feb 26, 2025

This patch sequence adds support for building Perl with WELLRNG512a, a modern random number generator by Matsumoto (co-creator of the Mersenne Twister), L’Ecuyer (a major RNG researcher), and Panneton. It is considered superior to the MT family of RNG's. It is suitable for 32 bit and 64 bit builds.

See:

https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linear
http://www.iro.umontreal.ca/~lecuyer/myftp/papers/wellrng.pdf

You can access the new behavior by adding -Accflags=-DPERL_USE_WELL512A_RNG to your favourite Configure invocation. Eg:

./Configure -Dusethreads -Doptimize="-g3 -ggdb3" -d -Dusedevel -Dcc=ccache\ gcc -Dld=gcc -DDEBUGGING -A ccflags=-DPERL_USE_WELL512A_RNG
  • This set of changes requires a perldelta entry, and it is NOT currently included.
  • This set of changes requires additional documentation and especially it needs direct recognition of the creators as well as the author of the implementation that this patch sequence contains. It is from Chris Lomont via his paper here: https://lomont.org/papers/2008/Lomont_PRNG_2008.pdf
  • This set of changes is currently in DRAFT status to stimulate discussion and for review purposes. It includes incidental changes that will be submitted independently in other MR's.

@demerphq demerphq force-pushed the yves/wellrng512a_support branch 4 times, most recently from 05b9934 to a2de3a5 Compare February 26, 2025 21:13
demerphq added 7 commits March 1, 2025 18:09
If we have a symbol which has a different definition depending on a c
pre-processor condition, include the condition when de-duping.

For instance if in intrpvar.h we had

    #ifdef HAS_QUAD
    PERLVAR(I, SomeField, U64TYPE)
    #else
    PERLVAR(I, SomeField, U32)
    #endif

We don't want to throw warnings about duplicate SomeField, as only one
of the definitions will be active at a time.

This includes changes to regen/HeaderParser.pl to facilitate this, by
adding a cond_as_str() method to the HeaderLine objects.
I am not sure what we should do with the internal_random_state in
perl_clone() but it should either be treated the same as random_state or
it should be independently intialized somehow. We shouldn't leave the
states content undefined.
This makes it so that the internal RNG support functions
and variables are named the same as their non-internal
equivalents, but with _internal as a suffix. This should
make it easier to find them. For instance PL_internal_random_state
will not show up when searching for PL_random_state, but
PL_random_state_internal will.
Same for &PL_random_state_internal, which gets replaced with
PL_PTR_RANDOM_STATE_INTERNAL.

We also create a similar define for &(proto_perl->Irandom_state)
which gets replaced by PL_PTR_PROTO_RANDOM_STATE, and
&(proto_perl->Irandom_state_internal) which gets replaced by
PL_PTR_PROTO_RANDOM_STATE_INTERNAL.
We provide our own RNG, we do not need any information from Configure
about the system RNG. Configure basically should not be involved in such
things, just like it isn't with regard to hash functions.

This is a placeholder commit so that Tux knows what need to be done and
for discussion purposes. It isn't intended for direct merging. The
change needs to be done the normal way for Configure changes.
@demerphq demerphq force-pushed the yves/wellrng512a_support branch from a370c14 to 7f22457 Compare March 1, 2025 17:14
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.

1 participant