mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #1406] [Bug]: Registering self managed memory from mmap to ascend direct transport fails #452
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#452
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 @matthewygf on GitHub (Jan 19, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/1406
Bug Report
My setup is using LMCache v0.3.12, Mooncake v0.3.7post2, but as far as I know, the current ascend direct transport still have the same code path.
To reproduce the issue:
ret = aclrtPointerGetAttributes(addr, &attributes);This will fail due to aclrtPointerGetAttributes currently only support aclMallocHost allocated memory.
One potential fix is to allow the python client to pass in the type of memory but require changing the interface.
Second potential fix is to use the slightly lower level api from ascend, which should support the mmap memory.
Before submitting...
@matthewygf commented on GitHub (Jan 19, 2026):
Tagging related issue https://github.com/LMCache/LMCache-Ascend/issues/144
@ykwd commented on GitHub (Jan 19, 2026):
@ascend-direct-dev could you take a look? Thanks
@ascend-direct-dev commented on GitHub (Jan 19, 2026):
Hixl only supports memory allocated via aclMallocHost. I will list several reasons why memory allocated via mmap is not recommended:
Under the UB/HCCS transport protocol, the performance of memcpy operations using mmap-allocated host memory is significantly worse compared to memory allocated via aclMallocHost.
In buffer pool mode, when performing D2H or H2D copies, the aclrt interface cannot recognize mmap-allocated memory and will directly report an error.
@ascend-direct-dev commented on GitHub (Jan 19, 2026):
I recommend adapting lmcache-ascend to use aclMallocHost for allocating host memory.
@matthewygf commented on GitHub (Jan 19, 2026):
@ascend-direct-dev Thanks very much for your reply !
Indeed we usually use
aclMallocHostfor allocating host memory. However, in some settings where we want to move around the memory, we will usemmap.What's the real reason being aclMallocHost being faster ? Is that being page locked memory and prepopulating the huge pages? In that case we can also do these via the sys calls etc.
I really don't see why the
cannot recognize mmap-allocated memoryshould not be fixed. This is actually recognizable if we use the rt APIs. Thanks !@ascend-direct-dev commented on GitHub (Jan 20, 2026):
In buffer pool mode, which use d2rd + d2h_copy to achieve d2rh transfer, the d2h_copy phase will call aclrtMemcpyBatch, which cannot recognize mmap-allocated memory. Additionally, if the memory is allocated with aclMallocHost, it means the memory is definitely pinned, which is safer. Does LMcache-ascend have to use memory allocated via mmap?
@matthewygf commented on GitHub (Jan 20, 2026):
@ascend-direct-dev thanks again for the reply.
I see.
We find that any h2d if we have a numa-friendly memory allocated on A2 machine, the performance would be better perhaps ~5-8%. We currently achieve this by mmap , mlock, mbind which can achieve pinned numa-friendly memory.
I suppose we can switch back to aclmallochost if needed to turn on bufferpool mode etc.
@github-actions[bot] commented on GitHub (Jun 9, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
@github-actions[bot] commented on GitHub (Jun 16, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.