Skip to content

Commit e58cb3a

Browse files
Copilotevilsocket
andauthored
fix: resolve pre-existing CI failures - madvise on Android, missing files field on Windows
Agent-Logs-Url: https://github.com/evilsocket/cake/sessions/4cd3dc02-5334-464d-8e1d-e9a2135e8792 Co-authored-by: evilsocket <86922+evilsocket@users.noreply.github.com>
1 parent 6c8a4bc commit e58cb3a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

cake-core/src/utils/tensor_storage.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ impl MappedShard {
190190
if ptr == libc::MAP_FAILED {
191191
anyhow::bail!("mmap failed: {}", std::io::Error::last_os_error());
192192
}
193-
// Hint: sequential access pattern — triggers aggressive readahead on NVMe
194-
unsafe { libc::posix_madvise(ptr, len, libc::POSIX_MADV_SEQUENTIAL); }
193+
// Hint: sequential access pattern — triggers aggressive readahead on NVMe.
194+
// Use madvise (POSIX.1-2003 base) which is available on all Unix platforms
195+
// including Android. posix_madvise is not defined in Android's libc.
196+
unsafe { libc::madvise(ptr, len, libc::MADV_SEQUENTIAL); }
195197
Ok(Self { mmap_ptr: ptr as *const u8, mmap_len: len })
196198
}
197199

@@ -238,9 +240,6 @@ pub struct SafetensorsStorage {
238240
index: HashMap<String, TensorMeta>,
239241
/// Memory-mapped shard files (indexed by shard_idx in TensorMeta).
240242
shards: Vec<MappedShard>,
241-
/// File handles for non-mmap fallback.
242-
#[cfg(not(unix))]
243-
files: Vec<File>,
244243
}
245244

246245
impl SafetensorsStorage {

0 commit comments

Comments
 (0)