[PATCH v2][Aarch64] Add vectorized mersenne twister

Jonathan Wakely jwakely@redhat.com
Tue Jul 25 17:31:00 GMT 2017


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?



More information about the Libstdc++ mailing list