mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #5015] [Bug][TE]: GH200: DMA-BUF-registered GPU MRs whose start is 2^k-aligned (k ≥ 32) wrap every 2^k bytes, giving silent data corruption #1270
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#1270
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 @0z5a on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/5015
Describe the bug
On GH200, a GPU buffer registered through Mooncake's DMA-BUF path (
WITH_NVIDIA_PEERMEM=0, i.e.exportDmabuf()→cuMemGetHandleForAddressRange→ibv_reg_dmabuf_mr) misbehaves when the MR's start address is exactly 2^k-aligned with k ≥ 32:The same buffers registered with
ibv_reg_mr(nvidia-peermem, the defaultWITH_NVIDIA_PEERMEM=1) are correct.Large
cudaMallocallocations land on such boundaries in ordinary use. A 16 GiB allocation at0xf1b700000000, which is 2^32-aligned, corrupted a plain run with no forced alignment. So any process on the DMA-BUF path can hit this, intermittently, depending on where its allocation lands.Results
Setup:
main829d95ff.cudaMalloc.MC_MAX_MR_SIZE=2147483648The wrap follows whichever side's MR start is aligned. The same buffers registered with
ibv_reg_mrare correct, and Mooncake passes the region straight toibv_reg_dmabuf_mr. So the cause is likely below Mooncake: the kernel's DMA-BUF umem / mlx5 page-size selection for ≥ 4 GiB pages, the NIC firmware, or the GPU driver's DMA-BUF export. It does not look like a Mooncake logic error, but Mooncake users on this path are exposed to it.Related reports
UCX_CUDA_COPY_DMABUF=no. That report's environment lists NIC firmware 32.38.3056; the runs above used 32.43.1014.Why it matters for Mooncake
WITH_NVIDIA_PEERMEM=0and Data Direct registration both go through this path today.Workaround and possible mitigation
MC_MAX_MR_SIZEat or below 4 GiB, which splits large buffers into several MRs (Mooncake#2017). It removed the corruption here. A wrap period of 2^32 or more can't show up inside a 2 GiB MR, but this only avoids the symptom; it isn't a root-cause fix.I can turn either into a PR and test it on the same hardware if that direction is acceptable.
AI assistance disclosure
The investigation and test scripts were prepared with AI assistance (Claude); I reviewed them and ran the tests on the hardware above.
@github-actions[bot] commented on GitHub (Oct 27, 2026):
Thanks for opening this issue, @0z5a!
192209249A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@0z5a commented on GitHub (Oct 28, 2026):
Follow-up: I ran the same test on an x86 host. With the same VA alignment, it is clean there.
Setup:
mlx5_core/mlx5_ib/ib_coremodules (DKMS, not the in-tree drivers) and rdma-core 2601.0.7.nvidia_peermemloaded on this host.mainatfe4f297a, which includes #4987 and #4998.WITH_NVIDIA_PEERMEMunset; after #4987 this host picks DMA-BUF)MC_MAX_MR_SIZE=2147483648ibv_reg_mr(WITH_NVIDIA_PEERMEM=1)Bad address [14], as expected without a peer-memory moduleIn every DMA-BUF row except the
MC_MAX_MR_SIZEone, each side registered a single 12 GiB MR; the log shows no auto-split. So forcing the MR's VA onto a 2^k boundary is not enough to trigger the wrap on this x86 host, on the same kernel and RDMA modules as the GH200 run.That does not rule out the kernel or mlx5 large-page path:
So the trigger probably needs the DMA addresses to be 2^k-aligned as well. Today's exposure looks narrowed to GH200-class hosts; the root cause is still open.
#4987 is relevant here: a GH200 host without
nvidia_peermemnow takes the DMA-BUF path by default. That makes the cap or warning suggested above more useful for GH200.AI assistance: the test scripts and this summary were prepared with Claude; I reviewed them and ran the tests on the hardware above.