Files
foxhunt/crates/ml-dqn
jgrusewski a0f104514a fix: GPU residency tests — sample_weights_ref/sample_indices_ref return correctly-sized views
Pre-allocated sampling buffers are max_batch_size (1024) elements large, but kernels
only write the first batch_size elements. sample_weights_ref() and sample_indices_ref()
returned the full 1024-element CudaSlice, causing:
- weight[16] == 0 (uninitialized elements beyond batch_size)
- assert_eq!(indices_host.len(), 10) failing with 1024

Fix: track last_batch_size in GpuReplayBuffer and return CudaView<'_, T> sliced to
last_batch_size from the two ref methods. Update all callers to pass &view to
memcpy_dtoh (CudaView implements DevicePtr so no other API changes needed).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 01:13:01 +02:00
..