Repository navigation
[jax][tpu] Simplify elastic TPU scaling to use simplier slice counting - #62141
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility, get_num_intact_tpu_slices, to count physically intact TPU slices regardless of their idle status, which improves the reliability of elastic scaling for TPU workloads. The changes also include refactoring the elastic scaling policy to use this new utility and removing redundant worker group shutdowns in the controller. Feedback includes identifying a duplicate test case in test_tpu.py, suggesting the restoration of a helpful comment regarding impossible TPU configurations, and providing recommendations to improve code clarity and conciseness in the new TPU utility function.
TimothySeah
left a comment
There was a problem hiding this comment.
Nice this is super clean and thoroughly tested!
|
Talked offline about how this change re-introduces the issue of fragmented TPU slices leading to the controller appearing to have the resources to scale when it doesn't. For example if we have 4 slices (each with 4 hosts) allocated to task1, and 2 other slices allocated to task2. If the first 4 slices each have 1 node die, the calculation using this intact logic will be: Thus we'd get I think this behavior trade-off is fine if it enables |
ryanaoleary
left a comment
There was a problem hiding this comment.
LGTM, maybe we can create a follow-up issue for how to handle idleness for GPU/TPU workers that are in contention
a98ecde to
e776e58
Compare
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
161c482 to
5d65c70
Compare
MengjinYan
left a comment
There was a problem hiding this comment.
Looks good from Core's perspective as well
ray-project#62141) ## Description 1. Introduces `get_num_tpu_slices` in ray.util.tpu, which counts physically intact TPU slices (all hosts alive, correct chip count) without requiring them to be idle. This replaces the use of `get_num_ready_tpu_slices` during elastic scaling, removing the need to fully shut down the old worker group before querying for available slices. 2. Simplifies ElasticScalingPolicy by removing the current_num_workers bookkeeping. Previously, the policy had to track running workers and add back "owned" slices to the ready count. With intact-slice counting, this workaround is no longer needed — the formula is simply min(resource_based_slices, intact_slices) * workers_per_slice. 3. Removes the eager `_shutdown_worker_group` call from the controller's non-running state handler, since the scaling policy no longer requires workers to be stopped before it can accurately count available slices. --------- Signed-off-by: Lehui Liu <[email protected]>

Description
get_num_tpu_slicesin ray.util.tpu, which counts physically intact TPU slices (all hosts alive, correct chip count) without requiring them to be idle. This replaces the use ofget_num_ready_tpu_slicesduring elastic scaling, removing the need to fully shut down the old worker group before querying for available slices._shutdown_worker_groupcall from the controller's non-running state handler, since the scaling policy no longer requires workers to be stopped before it can accurately count available slices.