You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by pt...@apache.org on 2020/11/07 00:52:31 UTC

[incubator-mxnet] branch v1.x updated: Allow eliminating common subexpressions when temp space is used (#19487)

This is an automated email from the ASF dual-hosted git repository.

ptrendx pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.x by this push:
     new 9edd84b  Allow eliminating common subexpressions when temp space is used (#19487)
9edd84b is described below

commit 9edd84be897769c7e1a4a033cc365a3b0619fafe
Author: Przemyslaw Tredak <pt...@nvidia.com>
AuthorDate: Fri Nov 6 16:51:00 2020 -0800

    Allow eliminating common subexpressions when temp space is used (#19487)
---
 src/executor/eliminate_common_expr_pass.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/executor/eliminate_common_expr_pass.cc b/src/executor/eliminate_common_expr_pass.cc
index e6cc35b..28b45d9 100644
--- a/src/executor/eliminate_common_expr_pass.cc
+++ b/src/executor/eliminate_common_expr_pass.cc
@@ -87,7 +87,15 @@ bool NodeEqual(const Node* n, const Node* m) {
   // to be eligible
   static auto& resource_request = Op::GetAttr<FResourceRequest>("FResourceRequest");
   static auto& resource_request_ex = Op::GetAttr<FResourceRequestEx>("FResourceRequestEx");
-  if (resource_request.get(n->op(), nullptr) != nullptr) return false;
+  const auto fresource_request = resource_request.get(n->op(), nullptr);
+  if (fresource_request != nullptr) {
+    const auto& requests = fresource_request(n->attrs);
+    for (const auto& req : requests) {
+      if (req.type != ResourceRequest::kTempSpace) {
+        return false;
+      }
+    }
+  }
   if (resource_request_ex.get(n->op(), nullptr) != nullptr) return false;
 
   return true;