MCPcopy Create free account
hub / github.com/evilsocket/cake / prefetch_experts

Method prefetch_experts

cake-core/src/models/common/disk_expert_provider.rs:505–523  ·  view source on GitHub ↗
(&self, indices: &[usize])

Source from the content-addressed store, hash-verified

503
504 #[cfg(unix)]
505 fn prefetch_experts(&self, indices: &[usize]) {
506 for &idx in indices {
507 if idx >= self.num_experts {
508 continue;
509 }
510 let names = &self.expert_names[idx];
511 for name in [&names.gate_proj, &names.up_proj, &names.down_proj] {
512 if let Some((bytes, _, _)) = self.storage.tensor_bytes(name) {
513 unsafe {
514 libc::madvise(
515 bytes.as_ptr() as *mut libc::c_void,
516 bytes.len(),
517 libc::MADV_WILLNEED,
518 );
519 }
520 }
521 }
522 }
523 }
524}
525
526impl DiskExpertProvider {

Callers

nothing calls this directly

Calls 2

as_ptrMethod · 0.80
tensor_bytesMethod · 0.45

Tested by

no test coverage detected