[JIT] Support multiple outputs in subgraph matcher.#48992
[JIT] Support multiple outputs in subgraph matcher.#48992ZolotukhinM wants to merge 7 commits intogh/ZolotukhinM/388/basefrom
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit be3a47c (more details on the Dr. CI page):
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. This comment has been revised 19 times. |
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
Codecov Report
@@ Coverage Diff @@
## gh/ZolotukhinM/388/base #48992 +/- ##
===========================================================
+ Coverage 80.56% 80.59% +0.03%
===========================================================
Files 1874 1873 -1
Lines 202776 202755 -21
===========================================================
+ Hits 163362 163406 +44
+ Misses 39414 39349 -65 |
Summary: Pull Request resolved: pytorch#48992 Differential Revision: D25388100 Test Plan: Imported from OSS Pulled By: ZolotukhinM fbshipit-source-id: 94a178680bcaf4ab7eece90dcb1f31a2ca9aad30
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
| %z = my::op2(%x) | ||
| return (%y, %z))IR", | ||
| &pattern2); | ||
| // Not supported multi-output pattern |
There was a problem hiding this comment.
Because not the whole pattern is covered by a traversal up from the first output (%z = ... is not visited). I will add a comment.
| } | ||
|
|
||
| bool SubgraphMatcher::isPatternOutput(const Value* v) const { | ||
| if (v->owningGraph() != &pattern_) { |
There was a problem hiding this comment.
I don't think it will hurt, but is this check necessary?
| * but the latter is taken as non-const so that Match may contain non-const | ||
| * pointers. This enables clients of this API to use Match to drive mutations. | ||
| * | ||
| * Note [Multi-output Patterns] |
There was a problem hiding this comment.
the non-backtracking algorithm (O(M*N) I think: BFS at each node in the graph) or endowing an output ordering (via some kind of topo-sort) might be a good bootcamp task :)
There was a problem hiding this comment.
Mm, I don't know if such an algorithm exists, maybe I'm missing something? Will be happy to discuss it :)
| * output and assume that it is sufficient to traverse up from it to match the | ||
| * entire pattern. | ||
| * | ||
| * Corrolary 1: the order of outputs in the pattern matters! |
There was a problem hiding this comment.
does the order in which internal outputs are consumed matter?
graph(a, b):
c = node0(a)
d = node1(b)
return c + d, d
vs
graph(a, b):
d = node1(b)
c = node0(a)
return c + d, d
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
Differential Revision: [D25388100](https://our.internmc.facebook.com/intern/diff/D25388100) [ghstack-poisoned]
|
@ZolotukhinM merged this pull request in 38a59a6. |
Summary: Pull Request resolved: pytorch#48992 Differential Revision: D25388100 Test Plan: Imported from OSS Reviewed By: heitorschueroff Pulled By: ZolotukhinM fbshipit-source-id: d95713af2220cf4f99ac92f59f8e5b902f2f3822
Stack from ghstack:
Differential Revision: D25388100