Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 798c4b9

Browse files
Ryan Xiafacebook-github-bot
authored andcommitted
modify graph optimization pass and LLVMIR gen to fuse 2 or more TFC operators together
Reviewed By: junhanh Differential Revision: D53798649 fbshipit-source-id: ce5cbf7acf63f6eae4b720ddb537ab9668c7940e
1 parent 5e01ba5 commit 798c4b9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/glow/Graph/FXIRUtils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ ElemKind getNodeDataType(const folly::dynamic &node, int idx = -1);
119119

120120
bool hasFxOutTensorView(const folly::dynamic &node);
121121

122+
int countFxOutTensorView(const folly::dynamic &node);
123+
122124
/// Get out tensorview for \p node. If \p idx is non-negative then assume this
123125
/// is a multi-output node, so get the tensorview output for that specific idx.
124126
/// \p idx represents which output to get a result for in the case that the node

lib/Graph/FXIRUtils.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ bool glow::hasFxOutTensorView(const folly::dynamic &node) {
143143
return kwargs.find("out_memref") != kwargs.items().end();
144144
}
145145

146+
int glow::countFxOutTensorView(const folly::dynamic &node) {
147+
const auto &kwargs = getNodeKwargs(node);
148+
if (!hasFxOutTensorView(node)) {
149+
return 0;
150+
}
151+
const auto &out = kwargs["out_memref"];
152+
if (out.isObject()) {
153+
return 1;
154+
}
155+
CHECK(out.isArray()) << "Expected Node array given multi-output Node";
156+
return out.size();
157+
}
158+
146159
const folly::dynamic &glow::getFxOutTensorView(const folly::dynamic &node,
147160
int idx) {
148161
const auto &kwargs = getNodeKwargs(node);

0 commit comments

Comments
 (0)