Skip to content

[6/N] Add update in module #11533

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
wants to merge 3 commits into
base: gh/cccclai/26/base
Choose a base branch
from
Open

Conversation

cccclai
Copy link
Contributor

@cccclai cccclai commented Jun 10, 2025

Stack from ghstack (oldest at bottom):

  • Expose the update API in module. Inside the module. invoke the method. Update API
  • Did a bit refactor for the StubBackend test code, such that it can shared between backend_interface_update_test.cpp and module_test.cpp

Differential Revision: D76172680

- Expose the update API in module. Inside the module. invoke the method. Update API
- Did a bit refactor for the `StubBackend` test code, such that it can shared between `backend_interface_update_test.cpp` and `module_test.cpp`

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

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Jun 10, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11533

Note: Links to docs will display an error until the docs builds have been completed.

❌ 27 New Failures, 2 Unrelated Failures

As of commit f0c47a6 with merge base f7cc72f (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76172680

- Expose the update API in module. Inside the module. invoke the method. Update API
- Did a bit refactor for the `StubBackend` test code, such that it can shared between `backend_interface_update_test.cpp` and `module_test.cpp`

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76172680

Comment on lines +312 to +319
runtime::Error Module::update(
const std::string& method_name,
runtime::ArrayRef<runtime::Entry> backend_options) {
ET_CHECK_OK_OR_RETURN_ERROR(load_method(method_name));
auto& method = methods_.at(method_name).method;
return method->update(backend_options);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly my problem. none of the piping being done here is module or method name specific. Because the options being sent down are to the global singleton of backend. It would make sense only if we have a way to set options on an instance of the backend class that is tied to a given method and model.

Also I apologize if this was already discussed in review. It has been a while so likely I forgot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to provide backend flexibility to decide whether it's global or per session. There is one single instance of the backend class. It is a singleton and processes all the .pte files (including all methods) even from different processes. We want the backend to have the option as needed.

Additionally, currently users don't interact with backend directly, Users just load the .pte file, construct the method. ET runtime is responsible for passing the information between user and the backends.

- Expose the update API in module. Inside the module. invoke the method. Update API
- Did a bit refactor for the `StubBackend` test code, such that it can shared between `backend_interface_update_test.cpp` and `module_test.cpp`

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76172680

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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants