Mark Shields
6dc0c624cd
[Relay] Restore dominator check ( #11616 )
...
It is ok to match a sub-graph which has dataflow
outside of the sub-graph, provided all such flows
eventually come into the sub-graph.
2022-06-08 11:00:35 +01:00
Mark Shields
d8f57ed7ff
[Relay] IndexedGraph improvements in preparation for Collage ( #11481 )
...
* [Relay] Odd's 'n ends changes to help Collage.
- Complete the implementation of WithFields.
(Unfortunately they appear to be without unit tests and I continue this tradition...)
- InferTypeExpr for InferTypeLocal but return the expression rather than the type.
- Remove python binding of InlineComposites since C++ impl was removed some time ago.
- Make IndexedGraph<Expr/DFPattern> more robust as stand-alone datastructure, and avoid unnecessary copies.
This will become a fundamental datastructure in Collage rather than just a helper for DFPatternMatcher.
- Extend IndexedGraph with a notion of 'basic block' on every dataflow node. Needed by Collage to
avoid impossible partitions.
* - Revert non IndexedGraph changes.
* - Stick to 'Indexed graph' terminology
- More tests
* - Stick to 'Indexed graph' terminology
- More tests
* - Remove silly unit test
2022-06-07 11:54:46 -07:00
Elen Kalda
d263c6d430
[Pattern matching] Add an option to rewrite the graph only once ( #8843 )
...
* [Pattern matching] Add an option to rewrite the graph only once
If the graph returned from the callback consists of the original
pattern, the rewriter will run in the loop, which is not always desired.
So this patch proposes an option to run the rewriter only once.
Change-Id: I85cf0a055b8961d52394f21c1e4d7aad0a7e1d06
* Make rewrite_once default to false
Change-Id: Idf6f01f254c403158883681e75c2a5978efbd2d0
2021-08-26 10:06:23 -07:00
zackcquic
247b1c404d
[Relay][Dataflow] Fix test_rewrite_function_with_fuzzy_body test check ( #8287 )
2021-06-21 09:56:01 +08:00
Matthew Brookhart
4e9760bd47
support matching attributes with more complext objects ( #8240 )
2021-06-11 15:06:23 +09:00
Haichen Shen
720e7b1ebd
[Refactor] Rename asnumpy -> numpy in NDArray ( #8083 )
2021-05-21 08:32:27 -04:00
Matthew Brookhart
7e68b4d413
[PatternMatcher] Support matching tuples, call nodes, and functions with variable numbers of inputs ( #7754 )
...
* Allow TuplePattern to have null fields and match any tuple
* support matching functions and call nodes with variable numbers of parameters
* remove development code that was commented out
* add docs for fuzzy matching
2021-04-03 18:12:13 +09:00
Matthew Brookhart
12c6b70e33
Simplify full broadcast ( #7423 )
...
* convert argwhere(full(const)) to reshape(arange())
* Add IsWildcard syntatic sugar
* add a simplify expression to fold full into broadcast ops
* Allow constant folding of full-like ops after SimplifyExpr
* fix a bug with the Attr Pattern matching
* remove skip_list
2021-02-10 14:54:43 -05:00
Manupa Karunaratne
67acad3aeb
[Relay][PatternLang] Bug fix of rewrite func attr ( #7358 )
...
When using pattern with attr of functions, such attrs
mostly does not exist for op node. Therefore, hasattr
check has to be done for op nodes.
Change-Id: Ia313ab34be95ccc793c32fd8e5e5ef566b78685b
2021-01-28 09:37:19 -07:00
Matthew Brookhart
02fefbc1df
If an expression has two branches, and the pattern ignores one with a wildcard, allow grouping via dominator analysis ( #7355 )
2021-01-28 13:30:52 +09:00
Matthew Brookhart
e889defc62
[PatternLang] Add a relay LetPattern ( #7332 )
...
* Add a relay LetPattern
* fix If copy
Co-authored-by: Cody Yu <comaniac0422@gmail.com >
* fix If copy
Co-authored-by: Cody Yu <comaniac0422@gmail.com >
Co-authored-by: Cody Yu <comaniac0422@gmail.com >
2021-01-23 17:37:21 +09:00
masahi
d7a9a7c5bc
[PatternLang] Add If pattern ( #7282 )
...
* Add if pattern
commit 1ee052fd494a5bdd881c242c3ea0c95cf2a613e5
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 22:19:17 2020 +0900
add comment
commit c846a6999e9c9e48fbc019780e705a990f46cb22
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 21:14:20 2020 +0900
max_out_size rewrite added to the test
commit 2c7c7fbd0e6563aba694e7fb6baa7bda8e4fadca
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 20:57:55 2020 +0900
max_out_size rewrite working
commit 319e930acb8162c1ec4a5d4fb71d134580a68f13
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 20:43:16 2020 +0900
refactor dyn strided slice pattern
commit fb6917b703440748800bde624bc20efaf5798b8a
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 11:21:33 2020 +0900
update NMS pattern following frontend change
commit 255a98f1da8f300d4fe417cce3587c0d71e38ed3
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Thu Dec 24 05:19:31 2020 +0900
add some comment to explain the pattern
commit 52cea1cc2bff533ca60acfc2416477fc8b058428
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 08:35:14 2020 +0900
revert tutorial change
commit d3e0e0d7e2427c40067d6ad2680ec5b3f0076223
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 08:02:29 2020 +0900
test fixed by setting force_surpress=False
commit 2fa1a574f932001be2d8f601338a342dab92f79c
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 07:22:32 2020 +0900
fixed coord_start
commit 6ba88f27dec1bdb0b0ba746c268591a59264088e
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 06:50:46 2020 +0900
add doc
commit 8d386b6a1c92ce4fe3349ff20e320199a1b5b310
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 05:27:26 2020 +0900
updated tutorial
commit 3206b49ecfdd874e0ff8feb0fa586c4c4282f705
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 05:04:44 2020 +0900
update object detection test to add rewrite
commit 74bebb2f4376aeb67d8c4aad395f9f2661fe6b3e
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Wed Dec 23 05:02:15 2020 +0900
add a pattern to rewrite nms to batched nms
commit f410e6dde0ed949b90312c5a7ddbb6c234f9acc1
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 22:20:16 2020 +0900
add comment
commit f1e078b0724bd22e7be0a812055e1c7c650d94da
Author: Masahiro Masuda <masahi129@gmail.com >
Date: Sat Dec 26 19:54:22 2020 +0900
Add if pattern
* add doc
* add test
* doc formatting
* cpplint fix
2021-01-15 06:15:00 +09:00
Steven S. Lyubomirsky
1677bb22e6
[PatternLang][Bugfix] Ensure CallNode attrs are not undefined before checking ( #7278 )
...
* Correct handling of call node attrs to handle non-operator calls (attrs may be undefined)
* Linting fix
2021-01-14 09:29:55 -07:00
Matthew Brookhart
d3bb7622f6
[PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching ( #7120 )
...
* Add Syntatic Sugar for C++ Pattern API, Support DataType Attribute match
* add missing tests
* fix lint
* fix license edit
* fix bad rebase
2021-01-05 13:14:20 -08:00
Matthew Brookhart
4a7503d903
Add a FunctionPattern, remove unused attributes in CallPattern ( #7151 )
...
* Add a FunctionPattern, remove unused attributes in CallPattern
* update docs
2020-12-22 21:56:51 -08:00
Cody Yu
4191ae568e
[PatternLang] Remove unnecessary check ( #6958 )
...
Thanks @mbrookhart
2020-11-23 17:16:31 -08: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
Haichen Shen
6360ad1583
[Relay][Pass] Merge two consecutive reshape ops ( #6052 )
2020-07-15 18:34:21 -07:00
Matthew Brookhart
e1a1c2a810
[PatternLang] Don't rewrite expressions used outside of the pattern ( #5930 )
...
* Don't rewrite expressions used outside of the pattern
* add comments
2020-06-26 07:15:07 -07:00
Cody Yu
7bee0eaeae
[PatternLang] Support any index matching for TupleGetItem ( #5909 )
...
* support any index matching
* update doc
2020-06-24 11:44:23 -07:00
Matthew Brookhart
0d2b4bcd63
Add ShapePattern and DataTypePattern ( #5760 )
2020-06-11 23:25:09 +09:00
Cody Yu
43162d669d
[PatternLang] Simplify Pattern API Implementations ( #5703 )
...
* Add syntatic sugar; include pattern to API docs
* fix doc warnings
2020-06-02 09:14:33 +09:00
Matthew Brookhart
2cd5117096
[PatternLang]Conditionally Embedding Constants in Partitioned Functions ( #5693 )
...
* Embed constants in the partition function if the pattern explicity requests constants
fix rst
fix pylint
* improve comments based on Cody's feedback
2020-05-30 10:07:07 +09:00
lixiaoquan
05b1b235bf
[Relay] Fix dataflow_pattern.rewrite() hang if Match in IR ( #5680 )
...
rewrite() quits only if graph stop changing, but ExprMutator
always creates new Match node. This patch fixes this.
2020-05-29 19:37:05 +09:00
Cody Yu
95b3ad971d
[PatternLang] Add ConstantPattern ( #5689 )
...
* Add ConstantPattern
* update doc
2020-05-29 08:48:07 +09:00
Matthew Brookhart
af162c4826
add a testcase for #5674 ( #5677 )
2020-05-26 18:14:58 -07:00
Matthew Brookhart
37b84cc34b
[POC][PatternLang]Remove constants from partitioned functions ( #5663 )
...
* remove constants from partitioned functions
* remove print statements
2020-05-27 02:26:31 +09:00
Matthew Brookhart
53251c87b2
[PatternLang] Convert PatternGrouper to do pre-order, non-recursive analysis ( #5653 )
...
* make the PatternGrouper iterate over the input Expr in a non-recursive pre-order fasion
* add a comment
2020-05-23 12:17:39 +09:00
Matthew Brookhart
4bde554109
Add a check Callback to the Pattern Paritioner ( #5646 )
...
* add a check callback to the paritioner
* fix doc string
* fix unit test spelling
* add a test with types
2020-05-22 13:35:35 +09:00
Matthew Brookhart
cafb49846d
Extend AttrPattern to support CallNode and FunctionNode attributes ( #5637 )
...
* Extend AttrPattern to support CallNode and FunctionNode attributes
* Update tutorial and add breaks
* add func attr test
2020-05-21 12:16:40 +09:00
Matthew Brookhart
c94e6ba4b3
Label Pattern Partitions ( #5627 )
...
* Label Pattern Partitions with a default label to prevent nested partitions and an optional user supplied-label
* Add node names in topological order to Partitioned attribute
* respond to review comments
* move partition tag into const in attr namespace
2020-05-21 09:28:43 +09:00
Matthew Brookhart
2594f17a88
fix pattern topological order ( #5612 )
2020-05-18 10:12:49 -07:00
Matthew Brookhart
1b4c100bd7
Pattern Language, Matcher, Rewriter, and Function Paritioner ( #5231 )
2020-05-15 12:42:51 -07:00