mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
Fix ODR failures in TensorRandom.
(cherry picked from commit bded5028a5bd112181b94b2a246ac2c20e671c2f)
This commit is contained in:
parent
709d704819
commit
21e0ad056e
@ -14,7 +14,7 @@
|
|||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC uint64_t get_random_seed() {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE uint64_t get_random_seed() {
|
||||||
#if defined(EIGEN_GPU_COMPILE_PHASE)
|
#if defined(EIGEN_GPU_COMPILE_PHASE)
|
||||||
// We don't support 3d kernels since we currently only use 1 and
|
// We don't support 3d kernels since we currently only use 1 and
|
||||||
// 2d kernels.
|
// 2d kernels.
|
||||||
@ -27,7 +27,7 @@ EIGEN_DEVICE_FUNC uint64_t get_random_seed() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unsigned PCG_XSH_RS_generator(uint64_t* state, uint64_t stream) {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unsigned PCG_XSH_RS_generator(uint64_t* state, uint64_t stream) {
|
||||||
// TODO: Unify with the implementation in the non blocking thread pool.
|
// TODO: Unify with the implementation in the non blocking thread pool.
|
||||||
uint64_t current = *state;
|
uint64_t current = *state;
|
||||||
// Update the internal state
|
// Update the internal state
|
||||||
@ -36,7 +36,7 @@ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unsigned PCG_XSH_RS_generator(uint6
|
|||||||
return static_cast<unsigned>((current ^ (current >> 22)) >> (22 + (current >> 61)));
|
return static_cast<unsigned>((current ^ (current >> 22)) >> (22 + (current >> 61)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE uint64_t PCG_XSH_RS_state(uint64_t seed) {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE uint64_t PCG_XSH_RS_state(uint64_t seed) {
|
||||||
seed = seed ? seed : get_random_seed();
|
seed = seed ? seed : get_random_seed();
|
||||||
return seed * 6364136223846793005ULL + 0xda3e39cb94b95bdbULL;
|
return seed * 6364136223846793005ULL + 0xda3e39cb94b95bdbULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user