Skip to content

[3/N] Add update function in backend interface #11391

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 4 commits into
base: gh/cccclai/23/base
Choose a base branch
from

Conversation

cccclai
Copy link
Contributor

@cccclai cccclai commented Jun 5, 2025

Add update function in backend interface class.

Next step, will add update API in the method and then module

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

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Jun 5, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 2 Unrelated Failures

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

NEW FAILURE - The following job has 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.

cccclai added a commit that referenced this pull request Jun 5, 2025
Add update function in backend interface class.

Next step, will add update API in the method and then module

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

ghstack-source-id: 288333606
Pull Request resolved: #11391
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 5, 2025
@facebook-github-bot
Copy link
Contributor

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

Copy link

github-actions bot commented Jun 5, 2025

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.

@@ -117,6 +118,10 @@ class BackendOptions {
return err;
}

executorch::runtime::ArrayRef<BackendOption> view() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe more meaningful name. get_backend_options or get_ref_to_backend_options

Add update function in backend interface class.

Next step, will add update API in the method and then module

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

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

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

Add update function in backend interface class.

Next step, will add update API in the method and then module

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

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

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

Add update function in backend interface class.

Next step, will add update API in the method and then module

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

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

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

* @param[in] args A list of BackendOptions passed in by users.
* @retval Error::Ok if successful.
*/
ET_NODISCARD virtual Error update(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would jsut call it set_backend_options which seems more appropriate

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 kind of like this API name more, but we can discuss about it.

Comment on lines +113 to +116
BackendUpdateContext& context,
const executorch::runtime::ArrayRef<BackendOption>& backend_options) const {
return Error::Ok;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the implementation of this? If it is in the next diff, can you pull it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the base function. If backends didn't implement this function, this function will be called. If we set it to virtual, then we need all backends to implement this fucntion.

* @retval Error::Ok if successful.
*/
ET_NODISCARD virtual Error update(
BackendUpdateContext& context,
Copy link
Contributor

Choose a reason for hiding this comment

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

what is supposed to be the role of BackendUpdateContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a place holder for future API changes. Currently have the context for init and execute

BackendOptions<5> options;
};

TEST_F(BackendInterfaceUpdateTest, HandlesInvalidOption) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are all these tests but I am not sure if they are meanigfully testing anything? do you need all of them?

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 it's helpful to make sure we know each option inside the backend is updated successfully, and they are isolated.

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