You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[core] Unstable placement group GPU bundle order #51117
when creating placement group with bundle resource requirements like [{'gpu': 1, 'cpu: 1}] * 64 and 'PACK' strategy, we are expecting the created bundle index to align with gpu node-rank order, like [node1 * 8, node2 * 8, ...], but sometimes the order is wrong, like [node1, node2 * 7, node2, node1 * 7].
we doubt the root cause is the unstable bundle resource sorting here:
. after the sorting, the bundle order is effectively random since std::sort is not guaranteed to be stable, therefore the 'PACK' allocator would pack bundles randomly into one node.
we verified this hypothesis by using resource requirements guarantee sorting order, like [{'gpu': 1, 'cpu': 1 - 0.0001 * i} for i in range(64)], in which case the bundle index is correct. so we suggest replacing the std::sort with std::stable_sort shall solve this issue?
Versions / Dependencies
ray 2.43.0
Reproduction script
bundles = [{"GPU": 1, "CPU": 1} for _ in range(64)]
pg = placement_group(bundles, strategy="PACK")
ray.get(pg.ready())
table = placement_group_table(pg)
print(table)
Issue Severity
Medium: It is a significant difficulty but I can work around it.
Adding a comment on this issue hoping this gets added as a feature.
Currently, because of no order guarantees, user code ends up writing some reordering logic after placement group creation. Most RL frameworks built on top of Ray write this reordering logic themselves at the moment. Examples include OpenRLHF, SkyRL, NemoRL and SLIME.
Having either
the order guarantee for strategy='PACK' or
An explicit flag to provide ordered bundles (placement_group(bundles, strategy='PACK', preserve_pack_order=True))
would be very helpful.
I am not sure how much overhead is present in guaranteeing the ordering (I would assume it's low), but if possible, I would prefer PACK to provide stable ordering by default.
Activity
jjyao commentedon Mar 10, 2025
@xvblack, PG doesn't provide such order guarantee. If you need that order guarantee, you need to do something your self.
Sort ray placement group bundle indices for vLLM engines (#971)
Sort ray placement group bundle indices for vLLM engines (#971)
SumanthRH commentedon Mar 11, 2026
Adding a comment on this issue hoping this gets added as a feature.
Currently, because of no order guarantees, user code ends up writing some reordering logic after placement group creation. Most RL frameworks built on top of Ray write this reordering logic themselves at the moment. Examples include OpenRLHF, SkyRL, NemoRL and SLIME.
Having either
strategy='PACK'orplacement_group(bundles, strategy='PACK', preserve_pack_order=True))would be very helpful.
I am not sure how much overhead is present in guaranteeing the ordering (I would assume it's low), but if possible, I would prefer
PACKto provide stable ordering by default.jeffreywang88 commentedon Mar 13, 2026
Providing a utility to sort bundles within a PG as a simple workaround: #61715.
fix(placement): node-contiguous actor bundles so EP/CP groups stay in…
fix(placement): node-contiguous actor bundles so EP/CP groups stay in…