-
Notifications
You must be signed in to change notification settings - Fork 384
[Transfer Engine]Coro rpc communicator #795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Transfer Engine]Coro rpc communicator #795
Conversation
JasonZhang517
commented
Sep 1, 2025
- add a communicator including server and client pool
- add pybind interface of the communicator
- add test files
mooncake-integration/CMakeLists.txt
Outdated
pybind11_add_module(engine ${SOURCES} ${CACHE_ALLOCATOR_SOURCES} | ||
transfer_engine/transfer_engine_py.cpp | ||
../mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp | ||
../mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to add these files here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to use coro_rpc_connector as a submodule of mooncake transfer engine, we have to compile it here
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Outdated
Show resolved
Hide resolved
return false; | ||
} | ||
|
||
int CoroRPCCommunicator::sendData(const std::string& target_address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendData should be a wrapper of sendDataAsync, dont rewrite same code twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use syncAwait(Lazy{}) as impl
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
auto future_ptr = std::make_shared<pybind11::object>(future_obj); | ||
auto loop_ptr = std::make_shared<pybind11::object>(pybind11::reinterpret_borrow<pybind11::object>(loop)); | ||
|
||
auto task_func = std::make_shared<std::function<void()>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
auto task_func = std::make_shared<std::function<void()>>( | ||
[communicator, target_addr, data_holder, future_ptr, loop_ptr]() { | ||
int result = communicator->sendData(*target_addr, data_holder->data(), data_holder->size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
co_await communicator->sendDataAsync
return future_obj; | ||
} | ||
|
||
int CoroRPCInterface::sendTensor(const std::string& target_address, pybind11::handle tensor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according async_send_tensor
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
return future_obj; | ||
} | ||
|
||
void CoroRPCInterface::setDataReceiveCallback(pybind11::function callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use asyncio future
…ronous coroutine 3. change std::future to lazy return value
4162d03
to
8953508
Compare
mooncake-transfer-engine/include/transport/coro_rpc_connector/cororpc_communicator.h
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/include/transport/coro_rpc_connector/cororpc_interface.h
Show resolved
Hide resolved
mooncake-transfer-engine/include/transport/coro_rpc_connector/cororpc_interface.h
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/include/transport/coro_rpc_connector/cororpc_interface.h
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_communicator.cpp
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Show resolved
Hide resolved
mooncake-transfer-engine/src/transport/coro_rpc_connector/cororpc_interface.cpp
Outdated
Show resolved
Hide resolved
@JasonZhang517 Do you happen to have any updates for this PR? |
77b6863
to
abd15a1
Compare