mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4871] [Bug]: MemFabric TENT registers adjacent buffers individually, potentially causing overlapping memory registrations #1237
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#1237
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?
Originally created by @jamesjxliu on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4871
Bug Report
The vector overload of MemFabricTransport::addMemoryBuffer() currently loops over the buffers and calls the single-buffer registration method for each one.
MemFabric aligns memory ranges to NPU page boundaries before registering them. Two adjacent, non-overlapping buffers can therefore produce overlapping aligned ranges when registered separately. With device_urma, the subsequent memory registration may fail with an “overlaps existing MR” error.
Before submitting...
@github-actions[bot] commented on GitHub (Oct 23, 2026):
Thanks for opening this issue, @jamesjxliu!
20507750A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@he-yufeng commented on GitHub (Oct 23, 2026):
Confirmed the mechanism on current main.
MemFabricTransport::addMemoryBuffer(std::vector<BufferDesc>&)is a plain loop over the single-buffer overload, and that overload hands each range straight toMemFabricUnderApi::SmemTransRegisterMem, which is a dlsym of the vendorsmem_trans_register_mem. So the outward page rounding you describe happens below this repo's visibility and every vector element becomes its own MR.The overlap condition is narrower than "adjacent", which is worth pinning for whoever picks this up: two buffers only collide after rounding when the shared boundary is not itself page aligned.
[0, 100)and[100, 200)with a 4 KiB page both round to[0, 4096)and the second registration fails;[0, 4096)and[4096, 8192)stay disjoint. Callers that hand over slab pieces at arbitrary offsets hit it, callers that hand over page-aligned segment splits do not.On the fix shape, merging contiguous ranges before registration is the obvious move, but
removeMemoryBufferderegisters by address and there is no refcount today, so a merged registration needs one: the merged range stays registered until its last member is removed, and a per-desc remove must not tear down a range other descs still sit in. That is the part I would want a regression around, not the coalescing loop itself. If the vendor side could take a list and register one MR per aligned range instead, that would be the cleaner contract and would keep this file's per-desc semantics intact.