Skip to content

Conversation

@zdevito
Copy link
Contributor

@zdevito zdevito commented Dec 23, 2025

Stack from ghstack (oldest at bottom):

This makes it more clear that the actor init message can be creating at the same time as the call to allocate the python actor by refactoring ActorMesh._create. It gets inlined into the ProcMesh spawn code, and calls a method that returns the PythonMessage that is the init message.

However, we currently cannot remove the actual cast of the init message. This is because actor init itself uses the context of the init message to initialize its rank. This information is not available to the rust actor's init method so we cannot handle our init method from within it.

Nevertheless, this change makes it clearer how to merge the init when it is possible.

Differential Revision: D89700862

NOTE FOR REVIEWERS: This PR has internal Meta-specific changes or comments, please review them on Phabricator!

This makes it more clear that the actor init message can be creating at the same time as the call to allocate the python actor by refactoring ActorMesh._create. It gets inlined into the ProcMesh spawn code, and calls a method that returns the PythonMessage that is the init message.

However, we currently _cannot_ remove the actual cast of the init message. This is because actor init itself uses the context of the init message to initialize its rank. This information is not available to the rust actor's init method so we cannot handle our init method from within it.

Nevertheless, this change makes it clearer how to merge the init when it is possible.

Differential Revision: [D89700862](https://our.internmc.facebook.com/intern/diff/D89700862/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D89700862/)!

[ghstack-poisoned]
This was referenced Dec 22, 2025
zdevito added a commit that referenced this pull request Dec 23, 2025
This makes it more clear that the actor init message can be creating at the same time as the call to allocate the python actor by refactoring ActorMesh._create. It gets inlined into the ProcMesh spawn code, and calls a method that returns the PythonMessage that is the init message.

However, we currently _cannot_ remove the actual cast of the init message. This is because actor init itself uses the context of the init message to initialize its rank. This information is not available to the rust actor's init method so we cannot handle our init method from within it.

Nevertheless, this change makes it clearer how to merge the init when it is possible.

Differential Revision: [D89700862](https://our.internmc.facebook.com/intern/diff/D89700862/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D89700862/)!

ghstack-source-id: 330922394
Pull Request resolved: #2205
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 23, 2025
This makes it more clear that the actor init message can be creating at the same time as the call to allocate the python actor by refactoring ActorMesh._create. It gets inlined into the ProcMesh spawn code, and calls a method that returns the PythonMessage that is the init message.

However, we currently _cannot_ remove the actual cast of the init message. This is because actor init itself uses the context of the init message to initialize its rank. This information is not available to the rust actor's init method so we cannot handle our init method from within it.

Nevertheless, this change makes it clearer how to merge the init when it is possible.

Differential Revision: [D89700862](https://our.internmc.facebook.com/intern/diff/D89700862/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D89700862/)!

[ghstack-poisoned]
zdevito added a commit that referenced this pull request Dec 23, 2025
Pull Request resolved: #2205

This makes it more clear that the actor init message can be creating at the same time as the call to allocate the python actor by refactoring ActorMesh._create. It gets inlined into the ProcMesh spawn code, and calls a method that returns the PythonMessage that is the init message.

However, we currently _cannot_ remove the actual cast of the init message. This is because actor init itself uses the context of the init message to initialize its rank. This information is not available to the rust actor's init method so we cannot handle our init method from within it.

Nevertheless, this change makes it clearer how to merge the init when it is possible.

Differential Revision: [D89700862](https://our.internmc.facebook.com/intern/diff/D89700862/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D89700862/)!
ghstack-source-id: 331002976
@meta-codesync meta-codesync bot closed this in 8d4884d Dec 23, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 23, 2025

This pull request has been merged in 8d4884d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants