1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Compiled-environment contract (OA-CC-20).
//!
//! A compiled environment declares reset, step and observation programs that
//! `Engine::capture` records once and `CompiledRollout` replays across a fixed
//! PPO horizon without per-step host recording. The design record is
//! `oaCompiledEnvironment.md`.
//!
//! The seven-word rollout cursor shared by every replay program is:
//!
//! | Word | Role |
//! |---:|---|
//! | 0 | Step index, advanced on device |
//! | 1 | Philox/action-sampling state, low |
//! | 2 | Philox/action-sampling state, high |
//! | 3 | Reset-seed state, low |
//! | 4 | Reset-seed state, high |
//! | 5 | Final-step flag for terminal handling |
//! | 6 | Rollout append cursor |
use crate::;
use ;
/// Replayable reset/step/observation contract for one [`Environment`].
///
/// Implementations must keep every replay-visible piece of episode state in
/// device-resident matrices: the captured plans bind those buffers once and
/// replay the identical command sequence, so no host-computed value may
/// differ across replays. Deterministic per-episode variation belongs in
/// on-device counters (as CartPole's `episode_index` does) or in the cursor
/// words above.