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

Open
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.]

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.

❌ 10 New Failures, 2 Unrelated Failures

As of commit 19371e3 with merge base f7c906f (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was 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.

@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
@digantdesai digantdesai marked this pull request as ready for review May 9, 2025 13:38
@digantdesai
Copy link
Contributor

Started CI (Need to do for new, external contributions). Rebase please.

Also marked it as Ready to signal reviewers that it's, well, ready for a review. Thanks for the contribution. Welcome to Executorch 😊

@jhelsby
Copy link
Contributor Author

jhelsby commented May 9, 2025

Thank you, I just rebased. I also fixed the linting issues which the CI tests identified.

[Sorry, I messed this up, hence the subsequent force-push.]

… it 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.
@jhelsby jhelsby force-pushed the bugfix/memoryplanningverifier/douserinputsexist-noprims branch from fbb360a to 19371e3 Compare May 9, 2025 18:49
@digantdesai
Copy link
Contributor

cc @JacobSzwejbka can you take a look? 🙏

@larryliu0820
Copy link
Contributor

@JacobSzwejbka gentle ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk 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.
5 participants