Skip to content

Conversation

walterddr
Copy link
Contributor

@walterddr walterddr commented Apr 11, 2021

Summary

Currently common_device_type generates device-specific test based on vague rules. see #55707.
This should fix #55707

Changes included

This PR changes the rule:

  1. First user provided args (except_for and only_for) are processed to filter out desired device type from a ALL_AVAILABLE_LIST
  2. Then environment variables are processed the exact same way.

tests are generated based on the final filtered list.

Test Plan

CI

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Apr 11, 2021

💊 CI failures summary and remediations

As of commit 07ac4bd (more details on the Dr. CI page):


  • 2/2 failures possibly* introduced in this PR
    • 2/2 non-scanned failure(s)

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

@walterddr walterddr force-pushed the be_test_expect_and_only_rule_change branch 2 times, most recently from 902f965 to 19e49b0 Compare April 11, 2021 16:51
@walterddr walterddr marked this pull request as ready for review April 12, 2021 14:32
@walterddr walterddr force-pushed the be_test_expect_and_only_rule_change branch from 19e49b0 to 7e0ca0a Compare April 12, 2021 14:33
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor Author

@walterddr walterddr left a comment

Choose a reason for hiding this comment

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

given the fact that this affect device type testing. rebased to trigger xla tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no list of all available device types because 3rd parties can programmatically extend the bases (like XLA does).

Copy link
Contributor Author

@walterddr walterddr Apr 12, 2021

Choose a reason for hiding this comment

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

oh... I see. then this approach is problematic. since 3rd party could also be using common_device_type.py to test their code outside of pytorch core repo

Copy link
Collaborator

@mruberry mruberry Apr 12, 2021

Choose a reason for hiding this comment

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

Use filter:

if 'except_for' is not None:
  device_types = filter(lambda x: x not in except_for, device_types)
if 'only_for' is not None:
  device_types = filter(lambda x: x in only_for, device_types)

return list(device_types)

@walterddr walterddr force-pushed the be_test_expect_and_only_rule_change branch from a81629f to 1f6ecd8 Compare April 12, 2021 17:52
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Hey @walterddr! I made a few inline comments for your review. Looking forward to hearing your thoughts!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't this filter just be applied directly to the list of test bases?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would look at applying the filter here so you don't need DEFAULT_DEVICE_TYPE_LIST.

@walterddr walterddr force-pushed the be_test_expect_and_only_rule_change branch from 1f6ecd8 to 2706444 Compare April 12, 2021 18:15
@walterddr walterddr force-pushed the be_test_expect_and_only_rule_change branch from 2706444 to 07ac4bd Compare April 12, 2021 19:13
@facebook-github-bot
Copy link
Contributor

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

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #55753 (07ac4bd) into master (19f1531) will decrease coverage by 3.91%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #55753      +/-   ##
==========================================
- Coverage   77.44%   73.53%   -3.92%     
==========================================
  Files        1896     1896              
  Lines      187935   187937       +2     
==========================================
- Hits       145555   138196    -7359     
- Misses      42380    49741    +7361     

@facebook-github-bot
Copy link
Contributor

@walterddr merged this pull request in d0cd168.

@ngimel
Copy link
Collaborator

ngimel commented Apr 13, 2021

This again broke running tests locally without setting environment variables.

facebook-github-bot pushed a commit that referenced this pull request Apr 13, 2021
)

Summary:
Fixes breakage caused by #55753

Pull Request resolved: #55880

Reviewed By: nikithamalgifb

Differential Revision: D27735299

Pulled By: mruberry

fbshipit-source-id: f8f927f95e4f7fe5f00448ed25d23dac3b7104a4
walterddr pushed a commit to walterddr/pytorch that referenced this pull request Apr 14, 2021
Summary:
This is a reflection of recent failures in pytorch#55753 and pytorch#55522.
We are lacking a test to safeguard these test env var.

Pull Request resolved: pytorch#55931

Test Plan:
1. CI
2. Run locally using `python test/test_testing.py -k test_filtering_env_var -v`
  - gives failure on 2ca45cb and d0cd168
  - passes on 159e110 and current master

Reviewed By: jbschlosser

Differential Revision: D27747537

Pulled By: walterddr

fbshipit-source-id: 9b70470f1cb8cb6440f930e7e52119aed5374dfc
facebook-github-bot pushed a commit that referenced this pull request Apr 15, 2021
Summary:
This is a reflection of recent failures in #55753 and #55522.
We are lacking a test to safeguard these test env var.

Pull Request resolved: #55931

Test Plan:
1. CI
2. Run locally using `python test/test_testing.py -k test_filtering_env_var -v`
  - gives failure on 2ca45cb and d0cd168
  - passes on 159e110 and current master

Reviewed By: jbschlosser

Differential Revision: D27747537

Pulled By: walterddr

fbshipit-source-id: c88e1c818199c7838866037d702d4012cacf510e
krshrimali pushed a commit to krshrimali/pytorch that referenced this pull request May 19, 2021
Summary:
Currently common_device_type generates device-specific test based on vague rules. see pytorch#55707.
This should fix pytorch#55707

# Changes included
This PR changes the rule:
1. First user provided args (`except_for` and `only_for`) are processed to filter out desired device type from a ALL_AVAILABLE_LIST
2. Then environment variables are processed the exact same way.

tests are generated based on the final filtered list.

Pull Request resolved: pytorch#55753

Test Plan: CI

Reviewed By: seemethere, ngimel

Differential Revision: D27709192

Pulled By: walterddr

fbshipit-source-id: 1d5378ef013b22a7fb9fdae24b486730b2e67401
krshrimali pushed a commit to krshrimali/pytorch that referenced this pull request May 19, 2021
…orch#55880)

Summary:
Fixes breakage caused by pytorch#55753

Pull Request resolved: pytorch#55880

Reviewed By: nikithamalgifb

Differential Revision: D27735299

Pulled By: mruberry

fbshipit-source-id: f8f927f95e4f7fe5f00448ed25d23dac3b7104a4
krshrimali pushed a commit to krshrimali/pytorch that referenced this pull request May 19, 2021
Summary:
This is a reflection of recent failures in pytorch#55753 and pytorch#55522.
We are lacking a test to safeguard these test env var.

Pull Request resolved: pytorch#55931

Test Plan:
1. CI
2. Run locally using `python test/test_testing.py -k test_filtering_env_var -v`
  - gives failure on 2ca45cb and d0cd168
  - passes on 159e110 and current master

Reviewed By: jbschlosser

Differential Revision: D27747537

Pulled By: walterddr

fbshipit-source-id: c88e1c818199c7838866037d702d4012cacf510e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PYTORCH_TESTING_DEVICE_ONLY_FOR environment variable don't play well with development environment.

5 participants