fix: replace global lock with per-device transfer_lock to prevent deadlock#2816
fix: replace global lock with per-device transfer_lock to prevent deadlock#2816maobaolong merged 1 commit intoLMCache:devfrom
Conversation
…dlock Signed-off-by: baoloongmao <baoloongmao@tencent.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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! This pull request addresses a critical deadlock issue in the Highlights
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a per-device transfer_lock in GPUContext to serialize GPU↔CPU data transfers, replacing a previous global lock. This change aims to prevent deadlocks with the implicit CUDA driver lock and allow concurrent transfers across different devices. The server.py file has been updated to utilize this new per-device lock for both storing data (GPU to CPU) and retrieving data (CPU to GPU).
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com> Signed-off-by: Aaron Wu <aaron.wu@dell.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…dlock (LMCache#2816) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
What this PR does / why we need it:
The global
self.lockin MPCacheEngine was acquired insidetorch.cuda.device()context, creating a circular dependencywith the implicit CUDA driver lock (ABBA deadlock).
Replace it with a per-device
transfer_lockon GPUCacheContextso that GPU↔CPU transfers on the same
device are serialised without cross-lock contention.
Special notes for your reviewers:
If applicable: