Skip to content

Conversation

@AdrianLundell
Copy link
Collaborator

This is a showcase of multiple improvements which can be done across all tests:

  1. Move pipeline definition from tests to a general (flexible) pipeline class
  • Define a default step of stages using e.g. TosaPipelineBI()
  • Add custom config or debug stages using helper functions s.a. .change_args(), .add_stage(), .dump_artifact() etc.
  • Run the full pipeline using .run()
  1. Move towards a pure pytest approach to remove dependencies on unittest and parametrize
  2. Separate tests running on FVP from tests not running on FVP rather than configuring this from the command line
  • FVP tests are skipped if not installed
  • To filter out tests one may instead use pytest markers/name filtering
  • This should give a clearer picture of what has been tested
  1. Introduces one favored way of marking tests as xfails, in the parameterize decorator

This is a showcase of multiple improvements which can be done across all tests:
1. Move pipeline definition from tests to a general (flexible) pipeline class
  - Define a default step of stages using e.g. TosaPipelineBI()
  - Add custom config or debug stages using helper functions s.a. .change_args(), .add_stage(), .dump() etc.
  - Run the full pipeline using .run()
2. Move towards a pure pytest approach to remove dependencies on unittest and parametrize
3. Separate tests running on FVP from tests not running on FVP rather than configuring this from the command line
  - FVP tests are skipped if not installed
  - To filter out tests one may instead use pytest markers/name filtering
  - This should give a clearer picture of what has been tested
4. Introduces one favored way of marking tests as xfails, in the parameterize decorator

Change-Id: Ieb88209fd7bcbb4b700bb970d6877ca6785752a4
@AdrianLundell AdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk topic: not user facing labels Jan 7, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 7, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Cancelled Job, 1 Pending

As of commit 1bf0d04 with merge base 4796da7 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

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 Jan 7, 2025
@AdrianLundell
Copy link
Collaborator Author

@digantdesai Curious to see what you think about this, in particular this removes unittest support in favour of a simpler pytest-only setup + it introduces one extra layer of complexity by wrapping test stages in the new test_pipeline.

Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

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

I love the new approach. It's easier to add tests, cleaner, and reduces code duplication.

However, I have a concern that this might lead to "blind copy-paste" of new tests without thoroughly thinking about the test cases, especially from new users. Over time, we may end up with solid coverage for things that are already covered in the pipeline generator, but leave gaps elsewhere. For example, consider the conv test from your PR. When adding a module with two_conv, if I were to manually add a test case, in edge IR after to_edge, I would check for two convolution nodes to be present. Although it's possible to add a stage in the pipeline object, someone more likely to just do what you did.

Originally, the tester was designed to address code duplication and redundancy, without taking away too much control.

That said, at this point, my concerns might not be too high, so I think we can proceed with this approach. We can evaluate when to use this more vigilantly.

- Rename FVP markers
- Improve structure in Add test
- Add doc strings in test_pipelines
- Remove unused code in test_pipelines
- Additional logging in test_pipelines

Change-Id: I94e21d14c2132481249d88a51df5d4415dd348a4
@AdrianLundell
Copy link
Collaborator Author

Big thanks for the through review! I've addressed your comments + some internal ones (mostly removing some unused code), let me know what you think

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@digantdesai
Copy link
Contributor

LGTM, bunch of CI issues, not sure how many are related. Please make it green. Let me pull it in internally, see if something goes wrong with parametrize

@AdrianLundell
Copy link
Collaborator Author

Great, I'll look into it when CI is stable again

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@AdrianLundell
Copy link
Collaborator Author

None of these CI-failures look related to me

@digantdesai
Copy link
Contributor

rebase please, couldn't import it internally. Thanks.

@AdrianLundell
Copy link
Collaborator Author

@digantdesai Are you able to import it now?

@digantdesai
Copy link
Contributor

Trying again now.

@facebook-github-bot
Copy link
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@zingo
Copy link
Collaborator

zingo commented Jan 31, 2025

@digantdesai will you handle the merged or should we do it ? Not really sure about best action when PR is "imported". :)

@freddan80 freddan80 merged commit 6e0cb06 into pytorch:main Feb 4, 2025
105 of 108 checks passed
@AdrianLundell AdrianLundell deleted the dev/refactor_unittests branch February 11, 2025 09:24
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. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm topic: not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants