-
Notifications
You must be signed in to change notification settings - Fork 133
Add cast point to RemoteSpawn::new #2414
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
Open
samlurye
wants to merge
2
commits into
meta-pytorch:main
Choose a base branch
from
samlurye:export-D91663308
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fc9ea52 to
69dfca4
Compare
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 28, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 28, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
3420f9c to
147a97f
Compare
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 28, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 28, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
147a97f to
1f0706e
Compare
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 28, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
0b5b098 to
a184b1e
Compare
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 29, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 29, 2026
Summary: Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
a184b1e to
5970d56
Compare
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 29, 2026
Summary: Pull Request resolved: meta-pytorch#2414 Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 29, 2026
Summary: Currently, spawning a `PythonActor` happens in two stages -- first, we spawn the actors in the actor mesh; then, in a second, separate message, we construct the instance of the user's `Actor` implementation in python. This opens the door for a race condition where: 1. Actor A spawns a python actor mesh and passes a mesh ref to Actor B. 2. Actor B calls an endpoint on the mesh ref. 3. Actor B's message arrives in between actor spawn and the `Init` message from Actor A. 4. Actor B's call fails because the python actor thinks it hasn't been properly initialized yet. This PR solves the problem by processing the `Init` message as part of `PythonActor::init`, which is guaranteed to run before any other message is processed. This wasn't possible before meta-pytorch#2414 because we didn't have access to the point/rank of the actor until after `PythonActor::init`. Differential Revision: D91739758
Differential Revision: D91829469
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 30, 2026
Summary: Pull Request resolved: meta-pytorch#2414 Add the ability to pass an `Attrs` object to `RemoteSpawn::new`, with "environment"-specific info that can be used during actor spawning. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb its message headers through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
5970d56 to
95f90e7
Compare
Summary: Pull Request resolved: meta-pytorch#2414 Add the ability to pass an `Attrs` object to `RemoteSpawn::new`, with "environment"-specific info that can be used during actor spawning. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb its message headers through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 30, 2026
Summary: Pull Request resolved: meta-pytorch#2414 Add an optional `ndslice::Point` as an argument to `RemoteSpawn::new`. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point through `RemoteSpawn::gspawn` so that the actor being spawned has access to its cast rank and coordinates when it is created. This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions. Differential Revision: D91663308
samlurye
added a commit
to samlurye/monarch-1
that referenced
this pull request
Jan 30, 2026
Summary: Pull Request resolved: meta-pytorch#2426 Currently, spawning a `PythonActor` happens in two stages -- first, we spawn the actors in the actor mesh; then, in a second, separate message, we construct the instance of the user's `Actor` implementation in python. This opens the door for a race condition where: 1. Actor A spawns a python actor mesh and passes a mesh ref to Actor B. 2. Actor B calls an endpoint on the mesh ref. 3. Actor B's message arrives in between actor spawn and the `Init` message from Actor A. 4. Actor B's call fails because the python actor thinks it hasn't been properly initialized yet. This PR solves the problem by processing the `Init` message as part of `PythonActor::init`, which is guaranteed to run before any other message is processed. This wasn't possible before meta-pytorch#2414 because we didn't have access to the point/rank of the actor until after `PythonActor::init`. Differential Revision: D91739758
95f90e7 to
a462954
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Add an optional
ndslice::Pointas an argument toRemoteSpawn::new. When an actor is spawned remotely as part of a proc mesh, the proc mesh agent will plumb the cast point throughRemoteSpawn::gspawnso that the actor being spawned has access to its cast rank and coordinates when it is created.This will improve the experience for actors (like PythonActor) that need to know their position in an actor mesh before their full capabilities are available; previously, we would need to first spawn the actor, and then separately send a message with its cast point, which can cause race conditions.
Differential Revision: D91663308