[Rust Frontend][gRPC] Add explicit data-parallel rank routing (#51178)

Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Connor Carpenter
2026-08-10 15:05:24 -07:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 3c6b2e9c08
commit fa722b9f01
19 changed files with 215 additions and 60 deletions
+7 -8
View File
@@ -48,10 +48,13 @@ pub struct Opt {
}
/// Run one mock engine until shutdown or transport failure.
async fn run_engine(engine_index: u32, opt: Opt, shutdown: CancellationToken) -> Result<()> {
async fn run_engine(engine_index: usize, opt: Opt, shutdown: CancellationToken) -> Result<()> {
let engine_index =
u16::try_from(engine_index).context("mock engine index exceeds two-byte identity limit")?;
let engine_id = EngineId::from_engine_index(engine_index);
let MockEngineSockets { data_sockets, .. } = connect_to_frontend(
&opt.handshake_address,
EngineId::from_engine_index(engine_index),
engine_id,
MockEngineConfig::default(),
)
.await
@@ -71,7 +74,7 @@ async fn run_engine(engine_index: u32, opt: Opt, shutdown: CancellationToken) ->
));
// Engine loop: input_rx -> engine logic -> output_tx
let mut engine_loop = tokio::spawn(engine::run_engine_loop(
engine_index,
u32::from(engine_index),
opt,
input_rx,
output_tx,
@@ -111,11 +114,7 @@ pub async fn run(opt: Opt, shutdown: CancellationToken) -> Result<()> {
let mut engines = JoinSet::new();
for engine_index in 0..opt.engine_count {
engines.spawn(run_engine(
engine_index as u32,
opt.clone(),
shutdown.clone(),
));
engines.spawn(run_engine(engine_index, opt.clone(), shutdown.clone()));
}
tokio::select! {