Implement events and async processing for RPC backend, enabling pipeline parallel input processing - #24675
Conversation
Also simplistic command ordering. Ignore that. Future commits will fix it ;)
|
@ggerganov - Sorry to ping you directly. You seem to span ownership between RPC and pipeline parallelism. Would you be able to review this change? |
|
@ggerganov - Gentle reminder. If you think this is a bad idea overall, I'm happy to hear that too so I can stop thinking about it 🙂 |
|
FWIW, I tested this a while back and it seemed to work, though I don't have any rigorous results. |
|
I'm trying to add TP support via RDMA and this PR would be essential in doing that |
|
@am17an , if you're familiar with this code area, could you give this PR a review? You may not be able to approve, but you could help find any dumb stuff before ggerganov spends time on it 🙂 |
|
I'd especially be interested to hear if you think this implementation can stretch to cover RDMA and TP. I am being a bit lazy in this implementation and relying on TCP and the rpc-server for synchronization, but I hope/planned that switching those bits out should be a relatively self-contained change. |
|
This conflicts with #25912 -- The merge is not difficult. We both touch the |
|
ok, so both this PR and PR #18626 implement the same design which is one thread per endpoint which dispatches commands from a queue. I am obviously biased but I find my implementation much better because it handles all commands in a generic way, without code duplication. One critical thing that I was missing was having a cache for the @sredman thanks a lot for your work, it really helped my to understand the performance issue with my PR. I'd appreciate if you can review and test PR #18626 so we can finally implement PP support in the RPC backend. |
|
@rgerganov , I am biased to your implementation too. You are much more familiar with working within llama.cpp than I am, not least you hold the mechanical understanding of how all the I'm glad I was able to provide the missing puzzle piece for your branch. We can thank Claude too. I provided the instruction, but Claude did the hard work of grinding through the logs to figure out where the blocking was 🙂 . I'll review your PR this week. |
Overview
Implement events and async processing for RPC backend, enabling pipeline parallel input processing.
Note this does NOT change the single-threaded design of
rpc-server, meaning if you have onerpc-serverhandling multiple GPUs, those GPUs will effectively not be pipelined. Easy workaround: Use multiplerpc-serverinstances, one per GPU.I think I've laid out the code such that if the
rpc-serverwere handling multiple devices in parallel, it would "just work", but that is necessarily uncertain since it is not implemented.Additional information
Results:
Using two 4-thread CPU workers:
Baseline: same CPU with 8 threads:
Using 2x AMD v320 (MI25) workers (with Vulkan backend):
Baseline: direct Vulkan without RPC:
Not shown: master build comparison, since those very boringly show the same t/s with two devices as with one, since master branch does not support pipeline parallelism in RPC!
This also enables pipeline parallelism in hybrid scenarios with a mix of local devices and RPC devices.
Tested in my lab with a mix of local devices plus RPC CPU and GPU workers. Previously I was getting about 5 t/s with GLM5.1, with pipeline parallelism I get about 20t/s, with four CPU workers holding the bulk of the sparse layers. I need more GPUs!
Requirements