mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #641] [MERGED] [Store] Import Offset Allocator #1712
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1712
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/Mooncake/pull/641
Author: @ykwd
Created: 7/18/2025
Status: ✅ Merged
Merged: 7/18/2025
Merged by: @ykwd
Base:
main← Head:offset_allocator📝 Commits (10+)
8cf9c00refactor(store): replace manual slice management with offset_allocatorcae6b22refactor(store): improve buffer management with allocation handlea7e992achore(ci): temporarily disable ssd test73b312dtest(offsetAllocator): add max contiguous allocation after small allocations test09736b9revert modifications of store_py and ci39c352eOptimize the offset allocator; Add unit tests3955d9bAdd benchmarks for allocator85784ddEnable allocation size more than 4GBae3c988rename class name40ced6dEnhance the unit tests📊 Changes
9 files changed (+2287 additions, -2 deletions)
View changed files
📝
mooncake-store/CMakeLists.txt(+2 -1)➕
mooncake-store/benchmarks/CMakeLists.txt(+3 -0)➕
mooncake-store/benchmarks/allocator_bench.cpp(+179 -0)➕
mooncake-store/benchmarks/allocator_bench_result.md(+176 -0)➕
mooncake-store/include/offset_allocator/offset_allocator.hpp(+184 -0)📝
mooncake-store/src/CMakeLists.txt(+2 -1)➕
mooncake-store/src/offset_allocator.cpp(+600 -0)📝
mooncake-store/tests/CMakeLists.txt(+11 -0)➕
mooncake-store/tests/offset_allocator_test.cpp(+1130 -0)📄 Description
Content
Import a new offset allocator to address the following issue:
Compared with the original implementation, the imported OffsetAllocator is wrapped to support registering or allocating with a size larger than 3.75 GB, and is further optimized for LLM inference scenario. The optimization will:
a) slightly decrease the memory utilization ratio in general cases;
b) makes no difference when the allocated size is equal to a bin size;
c) largely improve the memory utilization ratio when the allocated size is mostly uniform and not equal to any bin size.
The LLM inference tasks, in most cases, will put objects with mostly uniform sizes, which falls into the latter two cases.
See the following benchmark reports for details.
Result
Uniform size, size equals power of 2
OffsetAllocator (After Optimization)
OffsetAllocator (Before Optimization)
Uniform size, size equals power of 2 +/- 17
OffsetAllocator (After Optimization)
OffsetAllocator (Before Optimization)
Uniform size, size equals power of 2 multiply 0.9 or 1.1
OffsetAllocator (After Optimization)
OffsetAllocator (Before Optimization)
Random Size
OffsetAllocator (After Optimization)
OffsetAllocator (Before Optimization)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.