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:
@@ -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}")))?;
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user