fix: zero clippy errors + remove dead cfg gate + hex literals

- Fixed 5 clippy warnings: unused variables, empty else, hex literals
- Removed dead #[cfg(not(feature = "cuda"))] gate in PPO
- Monitoring reduce error properly handled (no let _ on must_use)
- Stack size constants use hex (0x4000, 0x10000) per clippy

Workspace status:
  cargo check --workspace --lib: 0 errors
  cargo clippy --workspace --lib -D warnings: 0 errors
  ml-core: 302/302 passed
  ml-dqn: 359/359 passed
  ml-ppo: 168/168 passed
  smoke_e2e_dqn_training_loop: PASSED (0.59s)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-20 11:31:24 +01:00
parent 3cbb0b761d
commit f8247710a1
4 changed files with 7 additions and 10 deletions

View File

@@ -622,11 +622,6 @@ impl PPO {
Ok((0.0, 0.0))
}
}
#[cfg(not(feature = "cuda"))]
{
let _ = batch;
Ok((0.0, 0.0))
}
}
/// Update PPO networks from GPU-resident experience data.

View File

@@ -186,10 +186,10 @@ impl GpuCuriosityTrainer {
use cudarc::driver::sys::{cuCtxSetLimit, CUlimit, CUresult};
// 16KB: kernel uses ~3KB/thread (513 floats) + call frames + nvcc spills.
// 8KB was insufficient on some GPUs with deep call chains.
let result = unsafe { cuCtxSetLimit(CUlimit::CU_LIMIT_STACK_SIZE, 16384) };
let result = unsafe { cuCtxSetLimit(CUlimit::CU_LIMIT_STACK_SIZE, 0x4000) };
if result != CUresult::CUDA_SUCCESS {
return Err(MLError::ModelError(format!(
"cuCtxSetLimit(STACK_SIZE, 16384) failed: {result:?}"
"cuCtxSetLimit(STACK_SIZE, 0x4000) failed: {result:?}"
)));
}
}

View File

@@ -412,7 +412,7 @@ impl GpuDqnTrainer {
// per array. Default 1KB causes ILLEGAL_ADDRESS stack overflow.
{
use cudarc::driver::sys::{cuCtxSetLimit, CUlimit, CUresult};
let stack_bytes = 65536_usize;
let stack_bytes = 0x10000_usize; // 64KB
let result = unsafe { cuCtxSetLimit(CUlimit::CU_LIMIT_STACK_SIZE, stack_bytes) };
if result != CUresult::CUDA_SUCCESS {
return Err(MLError::ModelError(format!(

View File

@@ -791,11 +791,13 @@ impl DQNTrainer {
if let Some(ref mut mon) = self.gpu_monitoring {
if let Err(e) = mon.reduce(collector.rewards_gpu(), collector.actions_gpu(), count) {
debug!("GPU monitoring reduce failed: {e}");
}
// Catch async monitoring kernel crashes before they poison the stream
if let Some(ref stream) = self.cuda_stream {
if let Err(e) = stream.synchronize() {
if stream.synchronize().is_err() {
warn!("GPU monitoring kernel crashed — disabling monitoring");
self.gpu_monitoring = None;
} else {
}
}
}