jgrusewski
45a2041db4
feat(rl): SP20 P6 position heat cap — force-flat on over-leverage
Last-defense guard: if |position_lots| exceeds the ISV-driven
RL_HEAT_CAP_MAX_LOTS (slot 504, default 8 = MAX_UNITS × max_order_size),
the kernel overrides actions[b] to FlatFromLong (a3) or FlatFromShort
(a4) — full flatten, no partial. Catches runaway pyramid accumulation
before it reaches actions_to_market_targets.
Override stack ordering (step_with_lobsim):
1. rl_trail_mutate (a7/a8)
2. rl_trail_stop_check → may override to FlatFromLong/Short
3. rl_position_heat_check (THIS) → may override to FlatFromLong/Short
4. actions_to_market_targets → reads final actions[b]
Kernel `cuda/rl_position_heat_check.cu`:
* 1 block, b_size threads (grid-stride for b_size > 256)
* Reads position_lots from pos_state at offset 0 (PosFlat layout)
* Cap read from ISV[504]; if cap ≤ 0 → no-op (guard disabled)
* Per feedback_no_atomicadd: fired-count diagnostic uses shared-mem
flag array + thread-0 serial count (b_size ≤ 256 in practice)
* Writes fired-count to ISV[505] for diag
ISV slots:
* 504: RL_HEAT_CAP_MAX_LOTS_INDEX (seed 8.0)
* 505: RL_HEAT_CAP_FIRED_COUNT_INDEX (diagnostic, written per step)
* RL_SLOTS_END bumped 505 → 506
Diag (alpha_rl_train):
* "heat_cap": { "fired_count": N, "max_lots": 8 }
GPU oracle test (trade_management_kernels.rs):
* position_heat_cap_overrides_on_breach — long 5 > cap 4 → a3;
short -5 < -cap -4 → a4; long 3 ≤ cap 4 → untouched (Hold)
Verification (RTX 3050 Ti):
* cargo check -p ml-alpha --examples → clean
* integrated_trainer_smoke 1/1 → ok
* trade_management_kernels 6/6 (was 5/5, +1 heat cap) → ok
* audit-rust-consts → 0 flags
2026-05-24 20:36:05 +02:00
..
2026-05-19 01:19:13 +02:00
2026-05-16 21:57:26 +02:00
2026-05-22 11:16:29 +02:00
2026-05-22 09:03:00 +02:00
2026-05-16 22:59:36 +02:00
2026-05-18 14:59:12 +02:00
2026-05-21 16:18:04 +02:00
2026-05-21 23:48:15 +02:00
2026-05-16 21:50:20 +02:00
2026-05-21 20:43:51 +02:00
2026-05-23 10:39:25 +02:00
2026-05-22 22:28:19 +02:00
2026-05-19 17:32:28 +02:00
2026-05-21 19:10:22 +02:00
2026-05-24 18:40:30 +02:00
2026-05-22 01:45:45 +02:00
2026-05-16 21:51:48 +02:00
2026-05-21 16:04:29 +02:00
2026-05-23 13:36:03 +02:00
2026-05-24 01:47:18 +02:00
2026-05-16 21:38:54 +02:00
2026-05-24 19:23:39 +02:00
2026-05-22 20:46:55 +02:00
2026-05-22 01:45:45 +02:00
2026-05-19 01:19:13 +02:00
2026-05-22 11:32:19 +02:00
2026-05-16 21:42:28 +02:00
2026-05-23 10:39:25 +02:00
2026-05-16 21:52:57 +02:00
2026-05-23 13:56:40 +02:00
2026-05-23 12:59:42 +02:00
2026-05-24 01:47:18 +02:00
2026-05-23 12:59:42 +02:00
2026-05-22 01:07:33 +02:00
2026-05-18 23:16:38 +02:00
2026-05-24 20:36:05 +02:00