Introduced AliasInfo for OpInfo#50368
Conversation
💊 CI failures summary and remediationsAs of commit 3d32fa4 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 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. |
Codecov Report
@@ Coverage Diff @@
## master #50368 +/- ##
==========================================
- Coverage 80.87% 80.72% -0.16%
==========================================
Files 1931 1931
Lines 210690 210701 +11
==========================================
- Hits 170406 170085 -321
- Misses 40284 40616 +332 |
|
Hey @vfdev-5, this is exactly what I was thinking. I think we should extend this PR a little further like you suggest. Let's port pytorch/test/test_op_aliases.py Line 186 in 4a3a378 and pytorch/test/test_op_aliases.py Line 248 in 4a3a378 to test_ops.py and update to be run on OpInfos that have one or more AliasInfos. This is going to be a little tricky because you'll have to separate those tests from the custom test generator they're in. The original tests should remain for now, too, until we port all the aliases in test_op_aliases.py to OpInfo metadata. To test that these two new alias tests are working properly we can add an AliasInfo to acos: pytorch/test/test_op_aliases.py Line 56 in 4a3a378 And remove the arccos entries from alias_infos. Then after we get the new tests working and demonstrate that by updating an existing OpInfo to use the pattern we can follow-up by porting the other alias_infos and delete test_op_aliases.py. Sound good? |
|
@mruberry thanks a lot for the review and a thourough description on the improvements ! Sounds great ! Let me update the PR and I'll let you know once it is ready for another review round. |
6a835d1 to
306420b
Compare
mruberry
left a comment
There was a problem hiding this comment.
Hey @vfdev-5! This is really cool. All the OpInfo changes look great. I have two questions about the tests which I inline, but can be summarized as:
- for the eager consistency test, should we just add alias variants as variants?
- for the jit consistency test, should we just check that the jit correctly remaps the operation in jit graphs, instead, like the current alias tests do?
Looking forward to hearing your thoughts. This new approach to alias testing (having to just add one alias line in an OpInfo) is way better than the old approach.
Last issue is that this should update this guidance:
to reflect the new approach. Basically I think we should tell people to add the line to an op's OpInfo if the OpInfo exists, and add the OpInfo (and then add the line) if it doesn't exist.
…opinfo-aliases
- jit_name_remapping instead jit consistency - removed auto generated tests for abs - added aliases tests inside test_variant_consistency_eager - added aliases tests to test_out
- added jit scripting in test_jit_alias_remapping - etc
8beb0c9 to
38cab9f
Compare
| _test(a_op) | ||
|
|
||
| @ops([op for op in op_db if op.aliases]) | ||
| def test_jit_alias_remapping(self, device, dtype, op): |
There was a problem hiding this comment.
|
@eellison could you please review this PR in order to unblock other PRs. Thanks ! |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Description: - Added clamp, trunc tests with aliases - Added tests for aliases for asin(h), acos(h), etc - fixed 'fix' alias implementation - fixed annotations in test_jit_alias_remapping - updated native_functions.yaml aliases guidelines Blocked by #50368 cc mruberry Pull Request resolved: #51167 Reviewed By: gchanan Differential Revision: D26245753 Pulled By: mruberry fbshipit-source-id: e17b657f0515139735a8a677b1ae284904f98aef
Summary: Description: - Added clamp, trunc tests with aliases - Added tests for aliases for asin(h), acos(h), etc - fixed 'fix' alias implementation - fixed annotations in test_jit_alias_remapping - updated native_functions.yaml aliases guidelines Blocked by pytorch#50368 cc mruberry Pull Request resolved: pytorch#51167 Reviewed By: gchanan Differential Revision: D26245753 Pulled By: mruberry fbshipit-source-id: e17b657f0515139735a8a677b1ae284904f98aef
Summary: Introduced AliasInfo for OpInfo. Context: Split of pytorch#49158 cc mruberry , please let me know if you'd like to see here more code to cover > [ ] fold test_op_aliases.py into OpInfo-based testing in test_ops.py from pytorch#50006 and/or add `UnaryUfuncInfo('abs')` as discussed https://github.com/pytorch/pytorch/pull/49158/files#r548774221 Pull Request resolved: pytorch#50368 Reviewed By: ngimel Differential Revision: D26177261 Pulled By: mruberry fbshipit-source-id: 2e3884a387e8d5365fe05945375f0a9d1b5f5d82
Summary: Description: - Added clamp, trunc tests with aliases - Added tests for aliases for asin(h), acos(h), etc - fixed 'fix' alias implementation - fixed annotations in test_jit_alias_remapping - updated native_functions.yaml aliases guidelines Blocked by pytorch#50368 cc mruberry Pull Request resolved: pytorch#51167 Reviewed By: gchanan Differential Revision: D26245753 Pulled By: mruberry fbshipit-source-id: e17b657f0515139735a8a677b1ae284904f98aef
Introduced AliasInfo for OpInfo.
Context: Split of #49158
cc @mruberry , please let me know if you'd like to see here more code to cover
from #50006
and/or add
UnaryUfuncInfo('abs')as discussed https://github.com/pytorch/pytorch/pull/49158/files#r548774221