Bug audit Pattern 2 — 6 SP15 launchers in gpu_dqn_trainer.rs were doing
load_cubin + load_function PER CALL inside the launcher body, called
from gpu_experience_collector.rs's per-rollout-step body (~thousands
of times per epoch x 4096 envs x 1000 timesteps).
Same architectural bug class as commits 5d63762ab (bn_tanh_concat_dd)
and 1396b62ec (sp15_baseline + cost_net). load_cubin/load_function
are host-side driver API calls — not capturable inside graph capture,
and prone to CUDA_ERROR_ILLEGAL_ADDRESS in subprocess child contexts
(documented failure mode in 1396b62ec).
Migration:
- launch_sp15_dd_state, launch_sp15_dd_state_reduce,
launch_sp15_dd_trajectory_decreasing, launch_sp15_alpha_split_producer,
launch_sp15_final_reward, launch_sp15_plasticity_injection —
signatures changed to accept &CudaFunction parameter.
- Collector struct gains 6 new pre-loaded CudaFunction fields,
populated once in collector::new() (mirrors SP14 EGF kernel loading
added in commit 09202aa99).
- All 6 hot-path call sites updated to pass &self.exp_<kernel>_kernel
reference (5 in collect_experiences_gpu, 1 in plasticity-injection
trigger path).
- Oracle tests in sp15_phase1_oracle_tests.rs pass through a small
load_sp15_kernel test helper that inlines the per-call load (graph
capture isn't a concern in oracle scaffolds; production callers use
struct-cached handles via the collector).
- docs/dqn-gpu-hot-path-audit.md gains Fix 29 documenting the
pattern, the 6 migrated sites, deferred evaluator launchers, and
out-of-scope orphan launchers.
Per feedback_no_partial_refactor: all 6 launchers + their callers
migrate atomically. Per pearl_no_host_branches_in_captured_graph:
zero load_cubin in collector per-rollout-step body after this commit.
Deferred (separate scope): launch_sp15_sharpe_per_bar and
launch_sp15_position_history_derivation are evaluator-path callers
(GpuBacktestEvaluator) — fixing them requires adding fields to a
different struct, deferred to a separate atomic commit. Orphan
launchers (regret_signal, cooldown) have no production callers; left
untouched.
Cubin static visibility: all 6 affected SP15 cubins were already
pub static (collector imports work without visibility promotion).
Verification: cargo check clean (only pre-existing warnings); 7/7
sp14_oracle_tests pass; 36/36 sp15_phase1_oracle_tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>