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

Method access

mllm/engine/prefix_cache/ZenFS.cpp:616–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616char* ZenFileSystem::access(vp_addr_t addr) {
617 // Extract components from the virtual address
618 vp_blob_addr_t blob_addr = getBlobAddr(addr, options_.page_bits, options_.lane_bits);
619 vp_page_addr_t page_addr = getPageAddr(addr, options_.page_bits, options_.lane_bits);
620 vp_lane_addr_t lane_addr = getLaneAddr(addr, options_.page_bits, options_.lane_bits);
621
622 // Find the blob
623 auto it = blob_.find(blob_addr);
624 if (it != blob_.end()) {
625 // Get the tensor data pointer
626 char* data_ptr = it->second.data.ptr<char>();
627 if (data_ptr) {
628 // Calculate the offset to the specific lane
629 // Each lane represents a token, and each token has per_kv_token_mem_size_ bytes
630 size_t offset = (page_addr * (1 << options_.lane_bits) + lane_addr) * per_kv_token_mem_size_;
631 return data_ptr + offset;
632 }
633 }
634
635 return nullptr;
636}
637
638void ZenFileSystem::_createBlobOnDisk() {
639 // Calculate blob size.

Callers 1

physicalAddrMethod · 0.80

Calls 5

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

Tested by

no test coverage detected