This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fw: [PATCH][Aarch64] Add vectorized mersenne twister


Hi Michael,

I think the correct list for this patch would be libstdc++@gcc.gnu.org
(I'm sure someone there will correct me if I'm wrong).

I'm interested in the answer to your point about polluting the global
namespace.

Thanks,
James

----- Forwarded message from Michael Collison <Michael.Collison@arm.com> -----

Date: Thu, 1 Jun 2017 23:47:57 +0000
From: Michael Collison <Michael.Collison@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
CC: nd <nd@arm.com>
Subject: [PATCH][Aarch64] Add vectorized mersenne twister

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.

This implementation includes "arm_neon.h" when including the optimized <ext/random>.  This has the effect of polluting the global namespace with the Neon intrinsics, so user macros and functions could potentially clash with them.  Is this acceptable given this only happens when <ext/random> is explicitly included? Comments and input are welcome.

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) << " ";
    }
}



2017-06-01  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.
	(operator==): New function.
	(simd_fast_mersenne_twister_engine): New template class.
	* config/cpu/aarch64/opt/bits/opt_random.h: New file.
	* include/ext/random (add include for arm_neon.h):
	(simd_fast_mersenne_twister_engine): add _M_state private
	array for ARM_NEON conditional compilation.



----- End forwarded message -----

Attachment: gnutools-4218-v10.patch
Description: gnutools-4218-v10.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]