34 lines
1.5 KiB
Rust
34 lines
1.5 KiB
Rust
/// Canonical state layout — single source of truth.
|
|
///
|
|
/// Training and validation MUST produce identical state vectors.
|
|
/// All systems use these constants instead of configurable state_dim fields.
|
|
///
|
|
/// Layout (grouped by update frequency, fast-changing first):
|
|
/// [0..42) Market features (OHLCV + technicals)
|
|
/// [42..62) OFI (20-dim order flow from MBP-10)
|
|
/// [62..78) MTF (4 lookbacks x 4 features)
|
|
/// [78..86) Portfolio base (8 features)
|
|
/// [86..92) Plan/ISV (6 features)
|
|
/// [92..96) Zero padding (tensor core alignment)
|
|
|
|
pub const STATE_DIM: usize = 96;
|
|
pub const STATE_DIM_PADDED: usize = 128; // pad128(STATE_DIM) for cuBLAS K-tile alignment
|
|
|
|
pub const MARKET_DIM: usize = 42;
|
|
pub const OFI_DIM: usize = 20;
|
|
pub const MTF_DIM: usize = 16;
|
|
pub const PORTFOLIO_BASE_DIM: usize = 8;
|
|
pub const PORTFOLIO_PLAN_DIM: usize = 6;
|
|
pub const PADDING_DIM: usize = 4;
|
|
|
|
pub const MARKET_START: usize = 0;
|
|
pub const OFI_START: usize = MARKET_START + MARKET_DIM; // 42
|
|
pub const MTF_START: usize = OFI_START + OFI_DIM; // 62
|
|
pub const PORTFOLIO_START: usize = MTF_START + MTF_DIM; // 78
|
|
pub const PLAN_ISV_START: usize = PORTFOLIO_START + PORTFOLIO_BASE_DIM; // 86
|
|
pub const PADDING_START: usize = PLAN_ISV_START + PORTFOLIO_PLAN_DIM; // 92
|
|
|
|
const _: () = assert!(PADDING_START + PADDING_DIM == STATE_DIM, "layout must sum to STATE_DIM");
|
|
const _: () = assert!(STATE_DIM % 8 == 0, "STATE_DIM must be 8-aligned for tensor cores");
|
|
const _: () = assert!(STATE_DIM_PADDED % 128 == 0, "STATE_DIM_PADDED must be 128-aligned for cuBLAS");
|