This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH v2][Aarch64] Add vectorized mersenne twister
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Michael Collison <Michael dot Collison at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Tue, 25 Jul 2017 18:37:20 +0100
- Subject: Re: [PATCH v2][Aarch64] Add vectorized mersenne twister
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4A18480491
- References: <HE1PR0802MB2377FAB17E09314A6CB3143795A10@HE1PR0802MB2377.eurprd08.prod.outlook.com> <20170725173130.GQ15340@redhat.com> <20170725173338.GR15340@redhat.com>
On 25/07/17 18:33 +0100, Jonathan Wakely wrote:
On 25/07/17 18:31 +0100, Jonathan Wakely wrote:
On 18/07/17 05:53 +0000, Michael Collison wrote:
This is the second version of a patch for Aarc64 to add a vectorized mersenne twister to libstdc++. The first version used intrinsics and included "arm_neon.h". After feedback from the community this version uses only GCC vector extensions and Aarch64 simd data types.
This patch adds an vectorized implementation of the mersenne twister random number generator. This implementation is approximately 2.6 times faster than the non-vectorized implementation.
Sample code to use the new generator would look like this:
#include <random>
#include <ext/random>
#include <iostream>
int
main()
{
__gnu_cxx::sfmt19937 mt(1729);
std::uniform_int_distribution<int> dist(0,1008);
for (int i = 0; i < 16; ++i)
{
std::cout << dist(mt) << " ";
}
}
Okay for trunk?
2017-07-16 Michael Collison <michael.collison@arm.com>
Add optimized implementation of mersenne twister for aarch64
* config/cpu/aarch64/opt/ext/opt_random.h: New file.
(__arch64_recursion): New function.
(__aarch64_lsr_128): New function.
(__aarch64_lsl_128): New function.
(operator==): New function.
(simd_fast_mersenne_twister_engine): Implement
method _M_gen_rand.
* config/cpu/aarch64/opt/bits/opt_random.h: New file.
* include/ext/random: (simd_fast_mersenne_twister_engine):
add _M_state private array.
This has been committed, was it actually approved?
It looks OK anyway, apart from the doxygen comment on ext/opt_random.h
which names the wrong file: @file ext/random.tcc
Oh, it looks like this mail was sent to "gcc--patches@gcc.gnu.org" and
then another copy was sent to gcc-patches, but without CCing the
libstdc++ list.
I'm not sure if Ulrich's "looks OK" was an explicit approval, but he
is a libstdc++ maintainer so let's say yes :)
https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01017.html