fix(F1): silence unsafe_code warning on snapshot alloc — SAFETY comment + allow attribute

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-20 21:14:29 +02:00
parent 782633a47e
commit edaa078a17

View File

@@ -88,6 +88,9 @@ impl SnapshotRing {
let n = self.param_count;
let num_bytes = n * std::mem::size_of::<f32>();
// SAFETY: `alloc` returns uninitialized GPU memory, which we immediately
// overwrite with `memcpy_dtod` below before any read. No UB window.
#[allow(unsafe_code)]
let mut new_weights = unsafe { self.stream.alloc::<f32>(n) }
.map_err(|e| MLError::ModelError(format!("snapshot alloc: {e}")))?;
{