Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17596
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New FailuresAs of commit ad56f3e with merge base d17ff74 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Enables the exir/tests/test_memory_planning.py suite to run in OSS test environments by removing its pytest ignore and adding a non-Buck shared-library discovery path for custom_ops_generated_lib.
Changes:
- Stop ignoring
exir/tests/test_memory_planning.pyinpytest.iniso it runs under pytest in OSS. - Add a
try/exceptaroundtorch.ops.load_libraryto fall back to locating the built shared library via filesystem globbing when not running under Buck.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pytest.ini | Un-ignores the memory planning test so it’s included in the OSS pytest run. |
| exir/tests/test_memory_planning.py | Adds fallback logic to locate/load custom_ops_generated_lib outside Buck (e.g., CMake/pip installs). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Ignore tests with missing custom_ops_generated_lib dependencies | ||
| --ignore=exir/backend/test/demos/test_delegate_aten_mode.py | ||
| --ignore=exir/backend/test/demos/test_xnnpack_qnnpack.py | ||
| --ignore=exir/tests/test_memory_format_ops_pass_aten.py |
There was a problem hiding this comment.
The addopts section header says these are tests with missing custom_ops_generated_lib dependencies, but exir/tests/test_memory_planning.py is no longer ignored even though it still loads that library. Please update this comment (or move the test out of this section) so the ignore rationale remains accurate.
| .glob("**/kernels/portable/**/*custom_ops_generated_lib.*") | ||
| ) | ||
| if _libs: | ||
| torch.ops.load_library(str(_libs[0])) |
There was a problem hiding this comment.
If the Buck target load fails and the glob finds no matches, the module import continues without loading custom_ops_generated_lib, which will likely cause later failures in ToOutVarPass (missing out variants) with a less-direct error. Consider failing fast with a clearer error or skipping these tests when the library cannot be located/loaded.
| torch.ops.load_library(str(_libs[0])) | |
| torch.ops.load_library(str(_libs[0])) | |
| else: | |
| # Fail fast or explicitly skip if the custom ops library cannot be found. | |
| # This avoids obscure downstream errors (e.g., in ToOutVarPass). | |
| raise unittest.SkipTest( | |
| "Skipping memory planning tests: could not locate " | |
| "custom_ops_generated_lib shared library." | |
| ) |
| _libs = list( | ||
| Path(__file__) | ||
| .parent.parent.parent.resolve() | ||
| .glob("**/kernels/portable/**/*custom_ops_generated_lib.*") | ||
| ) | ||
| if _libs: | ||
| torch.ops.load_library(str(_libs[0])) |
There was a problem hiding this comment.
The recursive glob (**/kernels/portable/**/*custom_ops_generated_lib.*) can be expensive and is also imprecise (it may match non-shared-library artifacts and, when multiple matches exist, _libs[0] is not deterministic). Consider filtering to platform shared-library extensions, sorting the matches, and/or searching only known build/install locations to keep imports fast and deterministic.
| --ignore=exir/backend/test/demos/test_xnnpack_qnnpack.py | ||
| --ignore=exir/tests/test_memory_format_ops_pass_aten.py | ||
| --ignore=exir/tests/test_memory_planning.py | ||
|
|
There was a problem hiding this comment.
lol. Didnt realize we had so much stuff disabled
Summary
add to pytest.ini, and add cmake path-finding import for OSS
Test plan
python -m unittest exir.tests.test_memory_planning