Uh oh!
There was an error while loading. Please reload this page.
[Diagnostics][Relay][InferType] Refactor InferType to work on whole module, and use new diagnostics. - #6274
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
junrushao
commented
Aug 14, 2020
May be out of the scope of this PR, but shall we also consider make type inference non-recursive some time? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d9bcbe6 to
d3b0c22CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eacb4a7 to
da61680Compare8cbc61d to
495606dCompareUh oh!
There was an error while loading. Please reload this page.
| return self._add(var, val, True) | ||
| def _add(self, var, val, update=False): | ||
| def _add(self, var, val, update=True): |
There was a problem hiding this comment.
Remove update/add in future PR.
Uh oh!
There was an error while loading. Please reload this page.
| """ | ||
| seq = tvm.transform.Sequential( | ||
| [ | ||
| # tvm.parser.AnnotateSpans(), |
There was a problem hiding this comment.
Should we provide a flag for spans here?
| tensor_array_ops = TensorArrayOps(self, dtype) | ||
| tensor_array_ops.register() | ||
| # Renamer doesn't properly deal with constructors, etc |
There was a problem hiding this comment.
I don't think this is true anymore.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tmoreau89
commented
Oct 9, 2020
Thank you @jroesch@mbrookhart@rkimball the PR has been merged. |
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (neo-ai#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
…odule, and use new diagnostics. (apache#6274) * Refactor the type checker to use diagnostics Although this patch is very large and seemingly disjoint the fixes are required to get it working for the entire stack. I started with first changing InferType to use the diagnostics, these weren't yet in the pass manager so this required changes to module and module pass. InferType wasn't actually written correctly as a pass requring refactoring there, then in order to add spans to AST it required turning on AnnotateSpans which in term required changes to the parser, and module to make it possible to use the errors. These changes to parse and module required changes to diagnostics and InferType. Althought seemingly disconnected there are hidden cycles between the components which require simultaneous change in order to remove the old error reporting. A huge change due to this patch is that the module no longer implicitly type checks functions which are added. * Apply suggestions from code review Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> * Apply suggestions from code review Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> * Clean up parser * CR feedback * Apply Bobs suggestions * Fix up Python interface for diagnostics * Fix test_ir_parser and formatting * Fix cpplint * Fix lint * Fix format * More lint * Fix format * Kill dead doc comment * Fix documentation comment * Rebase fixups * Add docs for type.h * Fix parser.cc * Fix unittests * Fix black * Skip previously typechecked functions * fix ACL * Fix numerous issues * Add repr method * Fix issue with Pytest, I am ready to cry * Fix the rest of tests * Kill dead code * Fix dignostic tests * Fix more tests * fix more tests (#11) * Fix diagnostic.py deinit bug * Fix deinit issue * Format * Tweak disabling of override * Format * Fix BYOC * Fix TensorArray stuff * Fix PyTorch * Format * Format Co-authored-by: Robert Kimball <bobkimball@gmail.com> Co-authored-by: Junru Shao <junrushao1994@gmail.com> Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com> Co-authored-by: Cody Yu <comaniac0422@gmail.com> Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
This is now ready for full review. This has become a huge PR where I split the coupling between the type checker and the module enabling more flexible use of the module and type checker. Unfortunately people have heavily relied on implicit type checking occurring each time we add a function. This functionality is not longer supported and examples of fixing it can be found all over the test cases.