Skip to content

feat(lmcache): add cuMem CUDA IPC transfer lifecycle - #526

Open
devinkuhn wants to merge 2 commits into
local-inference-lab:dev/jovian-judgementfrom
devinkuhn:split/glm53-lmcache-transfer
Open

feat(lmcache): add cuMem CUDA IPC transfer lifecycle#526
devinkuhn wants to merge 2 commits into
local-inference-lab:dev/jovian-judgementfrom
devinkuhn:split/glm53-lmcache-transfer

Conversation

@devinkuhn

@devinkuhn devinkuhn commented Aug 30, 2026

Copy link
Copy Markdown

Summary

Adds the cuMem/CUDA-IPC lifecycle and sparse hybrid transfer normalization required by exact Mamba boundary-state caching.

Behavior

  • refcounted CUDA cuMem allocation import/export
  • cross-process FD broker transport for all four ranks
  • context-preserving unregister; no cudaDeviceReset
  • rollback for partial imports and wrapper creation
  • engine-driven store/retrieve cleanup
  • production-safe legacy D2H routing for compressed logical geometry
  • effective per-window block-count validation for store and retrieve
  • accepts both raw full-chunk block tables and already-windowed exact-state tables
  • normalizes before null-chunk masking so unavailable historical Mamba checkpoints are skipped, not copied
  • native H2D and uncompressed native D2H remain available

Exact Mamba handoff and connector semantics are in #525. Separated object groups are enabled by #527.

Why this update

The original D16 qualification was invalidated by delayed recurrent-state corruption. D22 demonstrated that transfer validation must use the same effective sliding-window geometry consumed by the kernels; requiring raw full-chunk Mamba counts rejects the correct one-checkpoint representation.

Verification

  • focused transfer normalization/lifecycle tests: reported in the latest branch commit
  • git diff --check: clean
  • D22 runtime: 60 L1 objects / 993,329,152 bytes after 131,041-token store; two concurrent requests reloaded 129,024 tokens each (258,048 total); coherent outputs and post-reload probe; no fatal runtime errors

Supersedes the transfer portion of closed umbrella PR #522.

Duplicate-work note

This updates the existing focused transfer PR; it does not duplicate the scheduler-local prefix work in #403 or #482.

AI assistance disclosure

AI assistance was used in preparing this contribution.

Final D22 production receipt (2026-08-30)

The reviewed transfer stack is live with the rebuilt SM120 CUDA extension ff81d0cc81720a0016d085c6cd88f704685162695814fe2e4454279bbc270db4. Its pybind ABI exposes block_stride_elems, and the source includes the xword-alignment guard. Forced external reload transferred 119,808 tokens on each of four ranks with no transfer fault or corruption.

Add refcounted cross-process cuMem mappings, context-preserving unregister, atomic transfer cleanup, and safe D2H routing for compressed logical geometry.

AI-assisted-by: Cursor Agent and Hermes Agent

Signed-off-by: Devin Kuhn <dkuhn@applefcu.org>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d0e40a41-138f-4d20-9530-1c2b7cc111fa

📥 Commits

Reviewing files that changed from the base of the PR and between 0b67266 and edd5644.

📒 Files selected for processing (8)
  • docker/glm53-flash/lmcache-d16-overlay/cumem_shareable_interposer.c
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/multiprocess/modules/lmcache_driven_transfer.py
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/multiprocess/transfer_context/worker_transfer.py
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/platform/cuda/cache_context.py
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/platform/cuda/cumem_ipc.py
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/platform/cuda/ipc_wrapper.py
  • docker/glm53-flash/lmcache-d16-overlay/overlay/lmcache/v1/platform/kv_wrap.py
  • tests/v1/kv_connector/unit/test_lmcache_d16_transfer.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

@devinkuhn

Copy link
Copy Markdown
Author

Important qualification update: the stores-enabled D16 control reproduced a GPU2 illegal-memory-access/Xid 31 during startup warmup, while the otherwise identical store-disabled control started and passed the bounded 32k/128k/256k C1-C4 sentinel matrix. This PR is not ready for adoption; D2H store ownership/ordering remains under investigation.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Devin Kuhn <dkuhn@applefcu.org>
@devinkuhn

Copy link
Copy Markdown
Author

D22 qualification update: sparse exact-state transfer normalization is included in edd5644. Store/retrieve validation now uses effective sliding-window counts, accepts pre-windowed exact-state tables, and performs null-chunk masking after normalization. The corrected production run stored 60 objects / 993,329,152 bytes and externally reloaded 258,048 tokens coherently. This supersedes the earlier warning comment; full evidence is in #528.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant