alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
PhiloxState.hpp
Go to the documentation of this file.
1/* Copyright 2022-2025 Jiri Vyskocil, Rene Widera, Bernhard Manfred Gruber, Tim Hanel
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
7#include <cstdint>
8
9namespace alpaka::rand::engine::internal
10{
11 template<typename T_Params>
12 class PhiloxSingle;
13 template<typename T_Params>
14 class PhiloxVector;
15
16 /** Philox state
17 *
18 * @tparam T_Counter Type of the Counter array
19 * @tparam T_Key Type of the Key array
20 */
21 template<typename T_Counter, typename T_Key, typename Impl>
22 struct PhiloxState;
23
24 /** Philox state specialization for vector engine
25 * more memory/register efficient
26 *
27 */
28 template<typename T_Counter, typename T_Key, typename T_Params>
29 struct PhiloxState<T_Counter, T_Key, PhiloxVector<T_Params>>
30 {
31 using Counter = T_Counter;
32 using Key = T_Key;
33 Counter counter;
34 Key key;
35 };
36
37 /** Philox state specialization for single value engine
38 *
39 * @tparam T_Counter Type of the Counter array
40 * @tparam T_Key Type of the Key array
41 */
42 template<typename T_Counter, typename T_Key, typename T_Params>
43 struct PhiloxState<T_Counter, T_Key, PhiloxSingle<T_Params>>
44 {
45 using Counter = T_Counter;
46 using Key = T_Key;
47
48 Counter counter;
49 Key key;
50 Counter result;
51 std::uint32_t position;
52 };
53
54} // namespace alpaka::rand::engine::internal