MCPcopy Create free account
hub / github.com/UbiquitousLearning/mllm / hintsPrefetch

Method hintsPrefetch

mllm/engine/prefix_cache/ZenFS.cpp:521–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521void ZenFileSystem::hintsPrefetch(vp_addr_t token_lane_addr) const {
522 // 1. Find which blob we are.
523 vp_blob_addr_t blob_addr = getBlobAddr(token_lane_addr, options_.page_bits, options_.lane_bits);
524
525 // 2. If this blob in mmap file, we need to prefetch.
526 auto it = blob_.find(blob_addr);
527 if (it != blob_.end() && it->second.type == ZenFSBlobType::kOnDiskMMAP && it->second.mmap_file.has_value()) {
528 // Calculate the offset and length for prefetch
529 // Each lane represents a token, and we need to prefetch based on the token lane address
530 vp_page_addr_t page_addr = getPageAddr(token_lane_addr, options_.page_bits, options_.lane_bits);
531 vp_lane_addr_t lane_addr = getLaneAddr(token_lane_addr, options_.page_bits, options_.lane_bits);
532
533 // Calculate offset: page offset + lane offset
534 size_t page_offset = page_addr * per_kv_token_mem_size_;
535 size_t lane_offset = lane_addr * per_kv_token_mem_size_;
536 size_t offset = page_offset + lane_offset;
537
538 it->second.mmap_file.value()->prefetch(offset, per_kv_token_mem_size_);
539 }
540}
541
542void ZenFileSystem::hintsPurge(vp_addr_t token_lane_addr) {
543 // 1. Find which blob we are.

Callers 1

prefetchMethod · 0.80

Calls 7

getBlobAddrFunction · 0.85
getPageAddrFunction · 0.85
getLaneAddrFunction · 0.85
findMethod · 0.45
endMethod · 0.45
has_valueMethod · 0.45
prefetchMethod · 0.45

Tested by

no test coverage detected