fix: fix heterogeneous rdma transport error#1657
Conversation
Enhance Store and TransferEngine with health check, metrics, and NUMA support
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决异构RDMA传输中一个关键的内存识别问题。通过修正 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue with heterogeneous RDMA transport where CPU memory was being incorrectly identified, leading to NPU errors. The main change is in isCpuMemory to correctly classify memory types. Additionally, a test file is updated to include NPU devices, and a header file is modified to add a friend class declaration. My review focuses on improving code clarity and correctness.
| if (int ret = aclrtPointerGetAttributes(addr, &attributes)) { | ||
| LOG(ERROR) << "aclrtPointrtGetAttributes error, ret: " << ret; | ||
| return false; | ||
| // If ACL cannot identify the pointer, it is not ACL-managed device | ||
| // memory, so treat it as regular CPU memory. | ||
| LOG(WARNING) << "aclrtPointerGetAttributes failed for addr " << addr | ||
| << ", ret: " << ret |
There was a problem hiding this comment.
The logic for determining if a memory address belongs to the CPU has been updated. The previous implementation only checked for ACL_HOST memory (type == 0) and incorrectly returned false on aclrtPointerGetAttributes failure. The new logic correctly treats any memory that is not explicitly device memory (type != 1) as CPU memory. This includes ACL_HOST memory (type == 0), regular CPU memory (type == 2), and cases where aclrtPointerGetAttributes fails. This change is crucial for correctness.
| "], []], " " \"npu:0\": [[" | ||
| + device_names + | ||
| "], []], " " \"cuda:0\": [[" + |
There was a problem hiding this comment.
The string concatenation for adding the npu:0 entry has inconsistent formatting, which makes the code harder to read. Please reformat this section for better clarity and consistency with the surrounding code.
| "], []], " " \"npu:0\": [[" | |
| + device_names + | |
| "], []], " " \"cuda:0\": [[" + | |
| "], []], " | |
| " \"npu:0\": [[" + | |
| device_names + | |
| "], []], " | |
| " \"cuda:0\": [[" + |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| return (attributes.location.type == 0); | ||
| // location.type: 0 = ACL host memory, 1 = device memory, 2 = regular | ||
| // CPU memory (malloc). Only type 1 is device memory; all others are CPU. | ||
| return (attributes.location.type != 1); |
There was a problem hiding this comment.
Use constant value if possible.
| friend class RdmaEndPoint; | ||
| friend class WorkerPool; | ||
|
|
||
| friend class HeterogeneousRdmaTransport; |
There was a problem hiding this comment.
Could you clarify which private member(s) this is needed for? If none currently, this should be removed — friend breaks encapsulation and shouldn't be added speculatively.
There was a problem hiding this comment.
HeterogeneousRdmaTransport needs to access the private members submitTransfer, submitTransferTask, and getTransferStatus in RdmaTransport. If friend is not added, it will result in a compilation error.
There was a problem hiding this comment.
HeterogeneousRdmaTransport needs to access the private members submitTransfer, submitTransferTask, and getTransferStatus in RdmaTransport. If friend is not added, it will result in a compilation error.
Thanks for the explanation — that makes sense for the original code. However, PR #1663 has since been merged, which moved submitTransfer and related methods from private to public. So the friend class declaration is no longer needed. Could you rebase onto the latest main and drop that change?
There was a problem hiding this comment.
The corresponding modifications have been submitted.
| return false; | ||
| // If ACL cannot identify the pointer, it is not ACL-managed device | ||
| // memory, so treat it as regular CPU memory. | ||
| LOG(WARNING) << "aclrtPointerGetAttributes failed for addr " << addr |
There was a problem hiding this comment.
reformat the example file string concatenation
--------- Co-authored-by: sunwenhan <sunwenhan@xfusion.com>
Description
修复异构RDMA Transport对cpu memory的判断错误导致的NPU报错问题