feat(sp22-vnext): Phase B0 — AuxTradeOutcome ops struct scaffolding
First Rust-side commit of Phase B for the SP22 H6 vNext trade-outcome aux head. Pure orchestrator scaffolding mirroring AuxHeadsForwardOps / AuxHeadsBackwardOps. Zero production callers — additive per the gpu_grn / aux_trunk commit-by-commit ordering convention (scaffold → trainer fields → collector wireup). Adds: - gpu_dqn_trainer.rs: 4 cubin embeds (TRADE_OUTCOME_LABEL_CUBIN, AUX_TRADE_OUTCOME_FORWARD_CUBIN, AUX_TRADE_OUTCOME_LOSS_REDUCE_CUBIN, AUX_TRADE_OUTCOME_BACKWARD_CUBIN). All #[allow(dead_code)] until B1+. - gpu_aux_heads.rs: AUX_OUTCOME_K = 3 constant (parallel to AUX_NEXT_BAR_K). - gpu_aux_heads.rs: AuxTradeOutcomeForwardOps struct holding 3 kernel handles (forward + loss_reduce + label producer). Launch methods: forward(), loss_reduce(), compute_label(). Per-env label kernel uses grid ceil(n_envs/256) — pure per-env map, no reduction. - gpu_aux_heads.rs: AuxTradeOutcomeBackwardOps struct holding 1 kernel handle (backward). Launch method: backward(). Reuses existing K-generic aux_param_grad_reduce from AuxHeadsBackwardOps — no separate reducer needed. Contract shapes mirror AuxHeadsForwardOps/AuxHeadsBackwardOps so subsequent wireup commits plug in with minimal contract drift. Phase B proper (input concat 256→262 with plan_params) becomes a small change touching only the buffer fill + W1 shape once B1-B4 land the wireup. Phase B1 next: trainer struct fields for W1/b1/W2/b2 + Adam state + Xavier init + reset registry entries. Audit: docs/dqn-wire-up-audit.md Phase B0 section. Cargo check clean (21 warnings, none new). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17764,3 +17764,19 @@ dW*_partial + db*_partial ──→ aux_param_grad_reduce (existing, K-generic)
|
||||
Phase B is the next major commit and the largest scope shift (Rust-side struct fields for aux head W1/W2/b1/b2 weights, Adam state, hidden_post / logits / softmax / dW*_partial buffers; gpu_aux_heads.rs gets a parallel `AuxTradeOutcomeForwardOps` + `AuxTradeOutcomeBackwardOps` struct; Phase B wires the chain into `gpu_experience_collector.rs::collect_experiences_gpu` immediately after the K=2 head's launches).
|
||||
|
||||
Cargo check clean. Phase A complete. Ready for Phase B.
|
||||
|
||||
#### Phase B0 — AuxTradeOutcome ops struct scaffolding (2026-05-14)
|
||||
|
||||
First Rust-side commit of Phase B. Pure scaffolding: adds orchestrator structs in `gpu_aux_heads.rs` parallel to the existing `AuxHeadsForwardOps` / `AuxHeadsBackwardOps`, plus the 4 cubin embeds in `gpu_dqn_trainer.rs`. Zero production callers — additive per `feedback_wire_everything_up`'s commit-by-commit ordering convention (mirrors the original SP14 Layer C aux trunk pattern: scaffold → trainer fields → collector wireup).
|
||||
|
||||
**Changes**:
|
||||
- `gpu_dqn_trainer.rs`: 4 new `pub(crate) static` cubin embeds — `TRADE_OUTCOME_LABEL_CUBIN`, `AUX_TRADE_OUTCOME_FORWARD_CUBIN`, `AUX_TRADE_OUTCOME_LOSS_REDUCE_CUBIN`, `AUX_TRADE_OUTCOME_BACKWARD_CUBIN`. All `#[allow(dead_code)]` until wireup.
|
||||
- `gpu_aux_heads.rs`: New constant `AUX_OUTCOME_K = 3` (parallel to `AUX_NEXT_BAR_K = 2`).
|
||||
- `gpu_aux_heads.rs`: New struct `AuxTradeOutcomeForwardOps` holding 3 kernel handles (forward + loss_reduce + label producer). Launch methods: `forward()`, `loss_reduce()`, `compute_label()`. Mirrors `AuxHeadsForwardOps`'s contract shape for forward + loss_reduce; the label producer is per-env-only with grid `ceil(n_envs/256)` (no reduction).
|
||||
- `gpu_aux_heads.rs`: New struct `AuxTradeOutcomeBackwardOps` holding 1 kernel handle (backward). Launch method: `backward()`. **Reuses the existing K-generic `aux_param_grad_reduce`** from `AuxHeadsBackwardOps` — no separate reducer needed.
|
||||
|
||||
**Phase B1 next**: trainer struct fields for W1/b1/W2/b2 + Adam state (m/v per param) + Xavier init. Phase B1 lands the weight tensors and reset registry; B2 lands saved-tensor + per-sample partial buffers; B3 wires the forward chain into `collect_experiences_gpu`; B4 wires backward. After all that, the spec's actual Phase B (input concat 256→262 with `plan_params`) becomes a small change touching only the buffer fill + W1 shape.
|
||||
|
||||
**Discipline**: `feedback_no_partial_refactor` honored — cubin embed + ops struct + load function names are atomic; the ops methods can't be called without the trainer struct fields, but having the methods land first lets the field-allocation commits compile-check the wireup endpoint by endpoint.
|
||||
|
||||
Cargo check clean (21 warnings, none new — all pre-existing `DevicePtrMut` unused imports + sp14 unused isv_slots).
|
||||
|
||||
Reference in New Issue
Block a user