mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4029] [Bug]: NoF client cannot handle unaligned buffer lengths and addresses #1018
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#1018
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 @cage-goat on GitHub (Sep 11, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4029
Bug Report
Related to #4021 and PR #4024.
#4024 addresses master-side disk allocation alignment and reserves padding space for objects whose sizes are not multiples of the namespace block size. For example, with
block_size=512 B, a 513 B object receives at least 1024 B of disk space, including the 511 B needed to complete the last LBA. Its logical size remains 513 B.This additional space is reserved on disk; it does not extend the caller's memory buffer. The client therefore needs to construct a 1024 B I/O without reading or writing beyond the caller's 513 B buffer.
Upstream applications such as LMCache and SGLang pass logical object sizes, which are not necessarily multiples of the namespace
block_size. The actual buffer address may also be unaligned. Currently, the client rejects these requests when its alignment checks fail.The client should adapt I/O lengths and buffer layouts while preserving logical object sizes, minimizing payload copies, and allowing
memcpywhen necessary.The RDMA path should use SGLs to describe the data. The NVMe base specification distinguishes the following SGL capabilities:
The client should select a strategy based on the usable transport capabilities, buffer layout, and memory registration, rather than SGL support alone:
For example, if the first 512 B of a 513 B object can be transferred directly, only the final byte needs to be copied into a zero-padded 512 B tail block. The prefix and tail block can form a valid SGL or be submitted separately.
A tail-only copy cannot fix an incompatible starting address. If the selected path requires 4-byte alignment but the buffer starts at
base + 1, full staging is needed. A byte-granular path should not introduce copies solely because the address is not 4-byte aligned.The TCP path should use local iovecs to pad the I/O length. SPDK
readv/writevcan describe:The total I/O length should satisfy LBA alignment while the logical object size remains unchanged. Callers should not need to extend their buffers. Prefer direct use of the original buffer, with temporary buffers and necessary copies when direct use is unavailable.
Expected results:
Before submitting...
@github-actions[bot] commented on GitHub (Sep 11, 2026):
Thanks for opening this issue, @cage-goat!
318081269A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide