Skip to content

[feat] hma connector supports GPU buffer MR for GPUDirct RDMA#981

Open
relat-ivity wants to merge 7 commits into
ModelEngine-Group:developfrom
relat-ivity:dsv4-gdr
Open

[feat] hma connector supports GPU buffer MR for GPUDirct RDMA#981
relat-ivity wants to merge 7 commits into
ModelEngine-Group:developfrom
relat-ivity:dsv4-gdr

Conversation

@relat-ivity

Copy link
Copy Markdown
Contributor

Purpose

Enable the HMA connector to provide GPU KV buffer address and size metadata to UCM stores, following the existing ucm_connector registration logic in PR #958.

Modifications

  • hma_connector.py: Collects GPU buffer addresses and sizes of the vLLM KV cache, and passes them to UCM store for GDR pre-registration.

Test

Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py Outdated
Comment thread ucm/integration/vllm/hma_connector.py
@relat-ivity relat-ivity marked this pull request as draft June 5, 2026 08:14
@relat-ivity relat-ivity marked this pull request as ready for review June 5, 2026 08:17

@ygwpz ygwpz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up Review - PR #981

Previous Concerns: All Addressed ✅

All 7 concerns from the previous review have been successfully addressed:

  1. Data integrity assertion (Line 167-169): Added assert len(buffer_addrs) == len(buffer_sizes)
  2. Code clarity (Line 29-30): Added comment explaining GPU buffer purpose
  3. Debug logging (Line 119-125): Added logging for GPU buffer registration
  4. Redundant int() conversion (Line 171): Simplified key creation
  5. Type safety (Line 112-116): Added validation for non-empty lists
  6. Overflow protection (Line 46): Changed to safe sum calculation
  7. Warning for missing layouts (Line 159-163): Added logging instead of silent skip

New Observations (Minor - L3-L5)

Three minor suggestions for code quality improvements. See inline comments below.

Summary

The new commits thoroughly address all previous concerns with appropriate safeguards, logging, and validation. The implementation is now more robust and maintainable. Good work!

The three minor suggestions below are optional improvements that could be addressed in a follow-up PR if desired.

Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
Comment thread ucm/integration/vllm/hma_connector.py
tensor_size = math.prod([t.shape[i] for i in size_dims]) * t.element_size()
# GPU buffer sizes for GPUDirect RDMA registration in store.
# Total buffer size = number of blocks (shape[0]) × bytes per block stride.
buffer_sizes.append(int(t.shape[0]) * block_stride)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical: Potential integer overflow. When t.shape[0] is very large (e.g., millions of blocks) and block_stride is also large, this multiplication could overflow in Python's int conversion. Consider using int(t.shape[0]) * int(block_stride) or add bounds checking to ensure the product doesn't exceed expected limits for GPUDirect RDMA registration.

), "KV cache buffer addresses and sizes must have the same length."
for addr, size in zip(buffer_addrs, buffer_sizes):
key = (addr, size)
if key in gpu_kv_buffer_set:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion: For better readability, use addr and size variables directly instead of key[0] and key[1] in the append statements below:

gpu_kv_buffer_set.add((addr, size))
gpu_kv_buffer_addrs.append(addr)
gpu_kv_buffer_sizes.append(size)

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.

2 participants