fix: pre-initialize cast kernels at buffer construction

cuModuleLoadData hangs on H100 CUDA 13 when called after CUDA graph
capture — the context state appears incompatible with module loading.
Pre-initialize the OnceLock during GpuReplayBuffer::new() when the
context is clean and no graphs have been captured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-06 13:35:49 +02:00
parent 049d07a441
commit 365a7a17b4

View File

@@ -256,6 +256,12 @@ impl GpuReplayBuffer {
let update_batch_max = a32f(stream, 1, "update_batch_max")?;
let update_max_merge = a32f(stream, 1, "update_max_merge")?;
// Pre-initialize cast kernels while CUDA context is clean.
// OnceLock + cuModuleLoadData requires a current CUDA context.
// If deferred to first PER update (after graph capture), the context
// may be in a state that blocks cuModuleLoadData on H100 CUDA 13.
get_cast_kernels(stream)?;
Ok(Self {
config, stream: Arc::clone(stream), kernels: k,
states: s, next_states: ns, actions: a, rewards: r, dones: d, priorities: p,