diff --git a/crates/ml-dqn/src/gpu_replay_buffer.rs b/crates/ml-dqn/src/gpu_replay_buffer.rs index bd8f815ae..63bcc650f 100644 --- a/crates/ml-dqn/src/gpu_replay_buffer.rs +++ b/crates/ml-dqn/src/gpu_replay_buffer.rs @@ -918,7 +918,8 @@ fn a32i(s: &Arc, n: usize, nm: &str) -> Result, MLErr s.alloc_zeros::(n).map_err(|e| MLError::ModelError(format!("alloc {nm}: {e}"))) } -/// DtoD clone of first `n` elements from `src` into a new allocation (async on stream). +#[cfg(test)] +mod tests { use super::*; fn make_stream() -> Arc { @@ -951,3 +952,4 @@ fn a32i(s: &Arc, n: usize, nm: &str) -> Result, MLErr b.step(); b.clear().expect("clear"); assert_eq!(b.len(), 0); assert_eq!(b.current_step, 0); } +} diff --git a/crates/ml/src/trainers/dqn/smoke_tests/gpu_residency.rs b/crates/ml/src/trainers/dqn/smoke_tests/gpu_residency.rs index 81b109714..bf8ccd7fc 100644 --- a/crates/ml/src/trainers/dqn/smoke_tests/gpu_residency.rs +++ b/crates/ml/src/trainers/dqn/smoke_tests/gpu_residency.rs @@ -193,7 +193,7 @@ fn test_gpu_replay_buffer_priority_update_valid() -> anyhow::Result<()> { let idx = batch.indices_ptr; buf.update_priorities_gpu_raw(idx, &td_errors, 16)?; // Verify sampling still works with updated priorities (proves update succeeded) - let batch2 = buf.sample_proportional(16)?; + buf.sample_proportional(16)?; let weights_host = dtoh_f32(buf.sample_weights_ref(), &stream)?; // Weights should still be positive after priority update @@ -221,7 +221,7 @@ fn test_searchsorted_gpu_correctness() -> anyhow::Result<()> { // Sample multiple times to exercise the searchsorted codepath (GPU-resident) for trial in 0..5 { - let batch = buf.sample_proportional(10)?; + buf.sample_proportional(10)?; let indices_host = dtoh_u32(buf.sample_indices_ref(), &stream)?; for (i, &idx) in indices_host.iter().enumerate() { assert!( diff --git a/crates/ml/src/trainers/dqn/smoke_tests/training_stability.rs b/crates/ml/src/trainers/dqn/smoke_tests/training_stability.rs index afd78853f..6e34ecba2 100644 --- a/crates/ml/src/trainers/dqn/smoke_tests/training_stability.rs +++ b/crates/ml/src/trainers/dqn/smoke_tests/training_stability.rs @@ -114,7 +114,7 @@ fn test_per_weights_valid() -> anyhow::Result<()> { buf.insert_batch(&states, &next_states, &actions, &rewards, &dones, 1)?; } - let batch = buf.sample_proportional(16)?; + buf.sample_proportional(16)?; // Download f32 weights to host for assertion let mut weights_host = vec![0.0_f32; 16]; @@ -158,7 +158,7 @@ fn test_per_indices_valid() -> anyhow::Result<()> { buf.insert_batch(&states, &next_states, &actions, &rewards, &dones, 1)?; } - let batch = buf.sample_proportional(16)?; + buf.sample_proportional(16)?; // Download indices to host for assertion let mut indices_host = vec![0_u32; 16];