Files
foxhunt/docs
jgrusewski a5ee49e8ab feat(sp20): Phase 3 Task 3.1 — errata for redundant hold_cost_scale_compute_kernel
The plan asks for a separate `hold_cost_scale_compute_kernel.cu` to
host the two-sided multiplicative ramp 1.05/0.95 controller for
`HOLD_COST_SCALE_INDEX = 513`. Reality: the controller is already
implemented inside Phase 1.3's `sp20_controllers_compute_kernel.cu`
lines 175-194 (block 6 of the 6-controller fused kernel) and tested
end-to-end at `sp20_controllers_compute_test::hold_cost_scale_two_
sided_ramp` covering all 5 cases (ramp up, ramp down, deadband, upper-
clamp, lower-clamp).

Splitting it back into a separate kernel would:
  1. Break the in-thread `tgt` reuse optimization documented in the
     fused kernel header (sp20_controllers_compute_kernel.cu:73-78);
     forces 1 extra ISV read per step.
  2. Add separate launch + cubin + Rust launcher boilerplate for
     ~20 LoC of kernel logic.
  3. Force the production caller (gpu_experience_collector.rs:6549)
     to make TWO controller-kernel launches per step.

Per `feedback_no_partial_refactor` ("when a contract changes, every
consumer migrates atomically") + `feedback_no_quickfixes`, the
correct response is errata, not a partial-refactor split.

This commit also documents 4 additional Phase 3 plan-vs-reality gaps
that emerged during implementation review (Gaps 8-11):

  - Gap 8: Task 3.3's target_hold_pct controller is already wired in
    Phase 1.3 + has a unit test; Task 3.3 commit will add a behavioral
    integration test, NO production code changes.

  - Gap 9: hold_baseline_buffer layout is `[N_envs, 30]` row-major
    (per-env), NOT a single global ring as the spec phrasing implied
    — the kernel is per-env-parallel and per-trade attribution
    requires per-env stride.

  - Gap 10: `PS_ENTRY_BAR` does NOT exist; `PS_HOLD_TIME` (slot 10) +
    `segment_hold_time` (already in scope at trade close) suffice.
    No new state slot needed — keeps PS_STRIDE = 43 contract stable.

  - Gap 11: Task 3.4 plan refers to `GpuBatchPtrs` but that struct
    is in `crates/ml-dqn/src/gpu_replay_buffer.rs`. The collector
    struct is `GpuExperienceBatch`. Both need the new `aux_conf`
    field + the ring-buffer scatter/gather column in between.

Plan-level errata only; no code touched in this commit. Implementation
of the actual Phase 3 work continues in Tasks 3.2 / 3.3 / 3.4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 01:19:05 +02:00
..