Skip to content

Update MemoryPlanning Verifier to only assume model has user input if it has at least one tensor input #10617

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhelsby
Copy link
Contributor

@jhelsby jhelsby commented May 1, 2025

Fixes #10522

Summary

MemoryPlanning verifier currently blows up if all the user inputs are prims. #10522 suggested:

We need to improve the logic of the _do_user_inputs_exist to probably just return false if all the inputs are prims.

This PR implements this suggestion, with accompanying unit tests. _do_user_inputs_exist now returns True if it has at least one tensor input, and False otherwise.

Test plan

Added unit tests to test_memory_planning.py and ran them with

pytest exir/tests/test_memory_planning.py::test_memory_planning.py

Please note you must comment out the line 69 from /pytest.ini for this to work:

--ignore=exir/tests/test_memory_planning.py

On my machine, I also had to comment out line 60 from test_memory_planning.py for the test to run without errors.

torch.ops.load_library("//executorch/kernels/portable:custom_ops_generated_lib")

[The tests I wrote aren't dependent on this library.]

has at least one tensor input

MemoryPlanning verifier currently blows up if all the user inputs are prims.
This change means its helper function _do_user_inputs_exist returns
false
if all its inputs are prims. It only returns true if at least one
input is a tensor.
Copy link

pytorch-bot bot commented May 1, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 36d391d with merge base 7f5229f (image):
💚 Looks good so far! There are no failures yet. 💚

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

@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 May 1, 2025
Copy link

pytorch-bot bot commented May 1, 2025

Didn't find following labels among repository labels: Release notes: exir

@jhelsby
Copy link
Contributor Author

jhelsby commented May 1, 2025

@pytorchbot label "release notes: exir"

@pytorch-bot pytorch-bot bot added the release notes: exir Changes to any dialects and passes on these dialects, such as memory planning label May 1, 2025
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. release notes: exir Changes to any dialects and passes on these dialects, such as memory planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[exir] MemoryPlanning Verifier assumes that if a model has a user input it has at least 1 tensor input.
2 participants