17 tasks across 4 phases:
- Phase 1: 10 tasks converting 35 CUDA kernel internals to native BF16
(bf16_* wrappers, native arithmetic, no __bfloat162float casts)
- Phase 2: Delete GpuTensor + nvrtc dependency (replace with raw CudaSlice)
- Phase 3: Fix Rust compilation errors at host boundaries
- Phase 4: Wire cublasGemmEx + test
Includes lessons learned from failed bulk-sed approach and explicit
conversion rules for every agent.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Final 3 inline duplicates replaced with shared function calls:
- execute_trade(): notional cash model (was inline cash/position update)
- check_trailing_stop(): regime-adaptive trailing stop decision
- enforce_hold(): hold enforcement decision (action aliasing kept inline)
Training kernel now uses ALL 10 shared functions from trade_physics.cuh:
decode_exposure_index, compute_target_position, decode_order_type,
execute_trade, compute_tx_cost, enforce_hold, check_trailing_stop,
check_capital_floor, apply_margin_cap, update_hold_time
Zero inline duplicates remain. Both training and backtest kernels
use identical trade physics — no more train/eval mismatches.
Smoke test: Sharpe=4.89, 443 trades, no SIGSEGV.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 tasks: build.rs POC → parameterize #define → update launches → build all
→ replace runtime compilation → delete NVRTC infra → integration test.
Key insight: convert #define STATE_DIM/NUM_ATOMS to kernel params so each
kernel has ONE version regardless of model config. No multi-variant compilation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fixed struct name: ExperienceCollectorConfig (not GpuExperienceCollectorConfig)
- Fixed max_pos scoping: moved declaration before action_select launch
- Fixed exiting_trade ordering: preliminary variable before trailing stop
- Documented hardcoded 5-action limitation in branching_action_select
- Zero Q-gap during hold periods (conviction meaningless when forced)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Layer 1 now targets experience_action_select (GPU-fused training path)
AND branching_action_select (backtest/fallback), not just the fallback
- Action masking covers both greedy AND random exploration paths
- Exposure index uses parameterized b0_size, not hardcoded 5 or 9
- Fixed end-of-episode variable name (total_bars, not timesteps_per_episode)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Root cause: backtest windows of 300K bars produced ±billions% returns via
multiplicative compounding, and sqrt(252) annualization was wrong for
1-minute bars.
Fixes:
- Window size capped to 10K bars (~25 trading days), evenly distributed
across the full validation set (was clustered in first 6%)
- Annualization: configurable bars_per_day field in GpuBacktestConfig
(default 390.0 for 1-min), produces sqrt(98280) ≈ 313.5
- tanh normalization recalibrated: Sharpe/5, Sortino/8 (was /2, /3)
- CVaR threshold scaled to per-bar: 0.003 with slope 1400 (was 0.05/200)
- VaR/CVaR strided sampling covers full window (was first 4096 only)
- financials.rs + ab_testing.rs: sqrt(252) → sqrt(98280) for consistency
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Trade detection now counts reversals (S100→L50) as completed segments
- old_pos_pnl saved before position update for correct reversal P&L
- realized_pnl writeback uses old position PnL on reversal bars
- 0% win rate persists — needs deeper investigation (likely tx cost interaction)
WIP: The trade_return formula produces correct sign for raw market moves,
but every trade still shows as a loss. Suspect tx costs on both entry AND
exit of each reversal segment exceed the 1-bar price movement.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
RTH/ETH cost differential, market impact (done), book depth fill quality,
macro events, weekend gap risk, margin utilization feature.
All configurable via TOML. We trade against real markets — simulation must match.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
C51 for action selection (expected Q), IQN for risk quantification (CVaR).
Disagreement between C51 and IQN expected Q = uncertainty signal.
Architecture already 90% built — IQN head exists but output unused.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests must match reality. All profiles use the full 8-component
composite reward. No legacy PnL-only fallback.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DSR + normalized PnL + drawdown penalty + idle penalty + regime-adaptive
scaling + asymmetric loss + position-time decay + transaction costs.
All computed per-step in the CUDA kernel. Zero CPU involvement.
12 floats per-episode state, ~25 FLOPs per step, zero extra kernel
launches. 7 new hyperopt dimensions (Phase Fast fixed, Phase Full
searchable). Regime scaling from existing ADX/CUSUM features.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove per-epoch GPU data freeing that forced re-upload every epoch.
Training data within a walk-forward window is immutable — uploading once
and keeping it GPU-resident eliminates the init phase entirely.
Epoch time: 153ms → 78ms on RTX 3050 (epochs 2+).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Based on kernel deep dive: 1.56% occupancy on H100 from 1-warp/sample
architecture, 46KB stack spill, 47 kernel launches per step.
7 tasks: cuBLAS forward, batched backward, fuse BF16/EMA, multi-block
prefix sum, C51 loss kernel, H100 profiling.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Spec: 3-phase plan to reduce DQN training epoch from 37s to <5s on H100.
- Phase 1: eliminate 300 CPU roundtrips in PER sampling (GPU Philox RNG)
- Phase 2: increase kernel occupancy (batch_size 512+, cuBLAS profiling)
- Phase 3: pipeline overlap (dual-stream experience/training)
Profiling instrumentation added to training loop (init/experience/training/validation breakdown).
RTX 3050 baseline: training=97.2%, experience=2.3% — PER sampling
with CPU RNG + DtoH sync is the primary bottleneck.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove ALL #[cfg(feature = "cuda")] guards (~400+ occurrences)
- Remove ALL #[cfg_attr(not(feature = "cuda"), ignore)] test annotations (~250)
- Make cuda default feature in 9 ML crates (ml, ml-core, ml-dqn, ml-ppo, etc.)
- Convert nvrtc JIT compilation to precompiled nvcc (searchsorted, prefix_sum)
- Move compile_ptx_for_device() to ml-core for shared access
- Delete dead CPU code: multi_step.rs, self_supervised_pretraining.rs,
training_guard_gpu_tests.rs, CPU PER buffer paths, CPU Q-diagnostics
- Replace unwrap_or(Device::Cpu) with hard errors everywhere
- Remove dead is_cuda() else branches in DQN/PPO/hyperopt trainers
- Change config defaults from "cpu" to "cuda" (rainbow, tlob, pipeline)
- Port IQL value network to GPU kernel (5 CUDA entry points)
- Port HER goal relabeling to GPU kernel (warp-per-sample)
- Wire DSR GPU-to-CPU sync in training loop
- cfg!(feature = "cuda") → true in inference_validator
Zero warnings, zero errors across entire workspace.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- B1: Add LIB_FILTER mapping for tggn→tgnn module name (prevents zero-test false positive)
- W1: Replace ml_supervised:: imports with canonical ml:: paths in supervised_gpu_smoke_test
- W4: Use clean pass/fail exit code instead of raw failure count
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Task 3b: GPU smoke test for all 8 supervised models via UnifiedTrainable
- Wire supervised_gpu_smoke_test into Task 4 workflow shell script (replaces wildcard)
- Each supervised model gets explicit test filter: test_${MODEL}_gpu_smoke
- Retain fallback for model-specific _integration tests if they exist
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add bayesian_changepoint_test to core tests (spec 4.5)
- Replace fragmented YAML with complete WorkflowTemplate (all 4 templates)
- Add complete notify-result template with notify parameter gating
- Remove dead DQN_SMOKE_EPOCHS env var (no consumer in codebase)
- Replace templateRef with resource template (workflow-of-workflows)
to fix PVC/volume context issue in ci-pipeline integration
- Fix supervised integration test || true → compile-check guard
- Remove dead epochs parameter from all consumers
- Inline shell script into YAML (no separate code block)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers PVC creation, test data population, TEST_DATA_DIR wiring,
WorkflowTemplate, CronWorkflow, argo-test.sh CLI, and CI integration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Compile+test in same H100 pod (eliminates cross-node PVC transfer)
- New cargo-target-cuda-test PVC (30Gi) — zero contention with training
- onExit notify, podGC, activeDeadlineSeconds, fsGroup, gpu-warmup
- Continue-on-failure with per-model exit code capture
- CUDA_COMPUTE_CAP=90, complete change detection paths
- TEST_DATA_DIR marked as required prerequisite code change
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Spec for Argo WorkflowTemplate that compiles with --features cuda
on CPU node and runs full GPU/CUDA test suite on H100 with real
market data from a dedicated test-data-pvc.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore 45-action factored space via Branching DQN (Tavakoli 2018),
outputting 11 Q-values (5+3+3) instead of 45. This was reduced to 5
exposure-only actions during debugging and was never intended as permanent.
- Enable use_branching: true by default in DQNConfig and DQNHyperparameters
- Add branching paths to select_action_with_confidence and select_action_inference
- Update agent.rs select_action_factored for branching-aware selection
- Expand CountBonus to per-branch tracking with bonuses_branched()
- Add order_type + urgency distribution tracking in monitoring
- Add DQN_ORDER_ACTIONS=3, DQN_URGENCY_ACTIONS=3, DQN_TOTAL_ACTIONS=45 to CUDA header
- Fix 7 pre-existing clippy doc_markdown errors in regime_conditional.rs
- Fix pre-existing cognitive_complexity in replay_buffer_type.rs (extract helpers)
- Fix flaky GPU test OOM under parallel execution (CPU fallback + test VRAM safety)
- Delete unused flash_attention submodules (block_sparse, causal_masking, etc.)
- Add GPU hot-path guard scripts and ensemble/hyperopt adapter improvements
Tests: ml-dqn 416/0, ml 905/0, clippy 0 errors on both crates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>