Commit Graph

5 Commits

Author SHA1 Message Date
Mark Shields 163322cc92 [Relay] Prepare for new plan_devices.cc (part II) (#9130)
* Prepare for new plan_devices.cc (part II)

These changes came from changing https://github.com/apache/tvm/pull/9038 to use
tvm.parser.fromtext instead of manual AST construction.

- Demote FunctionOnDeviceAttrs to just a pair of DictAttrs entries so
  that the parser will understand them on Function definitions.
- Connect some special operators to their attributes so parsing understands them
  at call sites.
- Don't silently ignore attributes during parsing.
- Implement OptFunctionOnDevice so won't add device annotations for kUnknownDeviceType.
- Allow the parser to be given an initial metadata map to support examples which
  need constants.
- More DLOG -> VLOG conversions to reduce debug clutter.

* [checkpoint] Keep existing ParseModule ffi to simplify rust bindings

* [checkpoint] Address Christopher's comments.

* [checkpoint] Andrew's comments from #9038

* [checkpoint] Jared's comments from #9038

* [checkpoint] Woops, forgot rename.
2021-09-28 10:27:23 -07:00
Jared Roesch 98c2096f49 [Diagnostics][Relay][InferType] Refactor InferType to work on whole module, and use new diagnostics. (#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>
2020-10-09 11:44:09 -07:00
Jared Roesch f13fed55cf [Format] Convert all Python code w/o CI (#6448)
* Add black setup

* Tweak pyproject.toml

* Fix syntax issues

* Fix

* Tweak

* Black all Python code
2020-09-11 22:17:24 +09:00
Jared Roesch fa2213f0ae [Parser] Parser 2.0 part 2 (#6162)
* Add code from livestream with JK

* Fix errors parsing ResNet

* Parse metadata section efficiently and do most of plumbing to resolve metadata section references.

* WIP

* Change meta reference to an operator

* Meta references now work

* MetaReference expansion now works

* Start working on source map and move diagnostic context

* Convert tokenizer and parser to use new machinery

* Kill to_json

* Fix comment in type_infer.cc

* Remove old parser

* Rename parser tests and remove old ones

* Record span end information

* Convert to using spans everywhere

* Add span fields back to all Relay constructors

* Start passing spans

* Pass spans around visitors

* Format

* Fix

* Fix

* disable reference lint from string helpers

* Fix tokenizer

* Fix issue with empty metadata section

* Document new span fields and small tweaks

* Formatting

* Add span doc fields

* Add format tweak

* Improve errors and fix the semantic version tags in Prelude

* Update gradient.rly

* Clean up broken spans

* Clean up parser tests and turn on previously skipped tests

* Update errors to handle skipped cases

* Tweak

* Tweak

* Format

* Fix some minor issues with ADT tests

* Format

* Fix path

* WIP

* WIP

* Fix ir_text_printer

* format

* Formatted

* More formatting

* Repair test cases

* Fix CI

* Retrigger CI
2020-08-11 16:31:03 -07:00
Jared Roesch f9e905a3cc [Frontend][Relay] Add Parser 2.0 (#5932) 2020-07-08 13:04:42 -07:00