Skip to content

[Bugfix][TE] Fix 64KB alignment for default memory allocator - #4057

Open
gygdh-001 wants to merge 1 commit into
kvcache-ai:mainfrom
gygdh-001:fix-ascend-malloc-64kb-alignment
Open

[Bugfix][TE] Fix 64KB alignment for default memory allocator#4057
gygdh-001 wants to merge 1 commit into
kvcache-ai:mainfrom
gygdh-001:fix-ascend-malloc-64kb-alignment

Conversation

@gygdh-001

@gygdh-001 gygdh-001 commented Sep 11, 2026

Copy link
Copy Markdown

Description

initMemoryAllocator()'s fallback path used plain malloc, whose address is not 64KB
page-aligned. Ascend SVM (_devmm_mem_remote_map) requires a 64KB-aligned src_va, so
aclrtHostRegister failed with EINVAL. The fallback now uses posix_memalign(64 * 1024, ...).

Fixes #4055

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Reshard (mooncake-reshard)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Manual verification on Ascend 910B: cross-card rdma path reaches 7.2 GB/s (1MB block ×
batch16 × 10 rounds, all ok). With the alignment fix, the fallback allocator returns 64KB-aligned
addresses and aclrtHostRegister no longer fails with EINVAL.

Test results:

  • Unit tests pass
  • Integration tests pass (if applicable)
  • Manual testing done (describe below)

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

initMemoryAllocator()'s fallback path used plain malloc(), whose address is
not 64KB page-aligned. Ascend SVM (_devmm_mem_remote_map) requires a
64KB-aligned src_va, so aclrtHostRegister failed with EINVAL. Use
posix_memalign(64KB) for the default allocator instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Default transfer-engine allocator is not 64KB-aligned, breaking Ascend SVM

1 participant