You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/04/12 17:41:06 UTC

[GitHub] [tvm] d-smirnov opened a new pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

d-smirnov opened a new pull request #7832:
URL: https://github.com/apache/tvm/pull/7832


   Recursive destructor call replaced with non-recursive (based on ExpandDataflow) for Call nodes. This prevents OutOfStack
   exception during unwinding a chain of destructors for large-sized subtrees based on smart-pointers.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#issuecomment-819901586


   I mistyped my stack size. Mine is the same as yours. I tried 1e5 and it worked but failed at 1e6. Since it does not take long to run even 1e6 you can just set it there and it should fail in most places. 16384 is just too small


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613481166



##########
File path: tests/cpp/relay_dismantler_test.cc
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/ir/expr.h>
+#include <tvm/ir/type_functor.h>
+#include <tvm/node/functor.h>
+#include <tvm/node/structural_equal.h>
+#include <tvm/relay/adt.h>
+#include <tvm/relay/analysis.h>
+#include <tvm/relay/expr.h>
+#include <tvm/relay/expr_functor.h>
+#include <tvm/relay/function.h>
+#include <tvm/relay/op.h>
+#include <tvm/relay/op_attr_types.h>
+#include <tvm/relay/op_strategy.h>
+#include <tvm/relay/transform.h>
+#include <tvm/relay/type.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+#include <tvm/te/operation.h>
+#include <tvm/topi/broadcast.h>
+#include <tvm/topi/generic/injective.h>
+
+using namespace tvm;
+using namespace tvm::relay;
+
+TEST(Relay, OutOfStack) {
+  auto foo = [] {
+    auto add_op = relay::Op::Get("add");
+    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
+    auto c1 = relay::Constant(c_data);
+    Call y1 = relay::Call(add_op, {c1, c1});
+    for (int i = 0; i < 16'384; i++) {

Review comment:
       ```suggestion
       for (int i = 0; i < 1e6; i++) {
   ```
   It does not fail on my x86 ubuntu system until I set the graph size to 1e6. It does pass once your fix is applied 💯 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] d-smirnov commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
d-smirnov commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613556587



##########
File path: tests/cpp/relay_dismantler_test.cc
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/ir/expr.h>
+#include <tvm/ir/type_functor.h>
+#include <tvm/node/functor.h>
+#include <tvm/node/structural_equal.h>
+#include <tvm/relay/adt.h>
+#include <tvm/relay/analysis.h>
+#include <tvm/relay/expr.h>
+#include <tvm/relay/expr_functor.h>
+#include <tvm/relay/function.h>
+#include <tvm/relay/op.h>
+#include <tvm/relay/op_attr_types.h>
+#include <tvm/relay/op_strategy.h>
+#include <tvm/relay/transform.h>
+#include <tvm/relay/type.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+#include <tvm/te/operation.h>
+#include <tvm/topi/broadcast.h>
+#include <tvm/topi/generic/injective.h>
+
+using namespace tvm;
+using namespace tvm::relay;
+
+TEST(Relay, OutOfStack) {
+  auto foo = [] {
+    auto add_op = relay::Op::Get("add");
+    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
+    auto c1 = relay::Constant(c_data);
+    Call y1 = relay::Call(add_op, {c1, c1});
+    for (int i = 0; i < 16'384; i++) {

Review comment:
       I tested it on Ubuntu 18.04. Could you advise what OS did you use?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] d-smirnov commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
d-smirnov commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r614194792



##########
File path: tests/cpp/relay_dismantler_test.cc
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/ir/expr.h>
+#include <tvm/ir/type_functor.h>
+#include <tvm/node/functor.h>
+#include <tvm/node/structural_equal.h>
+#include <tvm/relay/adt.h>
+#include <tvm/relay/analysis.h>
+#include <tvm/relay/expr.h>
+#include <tvm/relay/expr_functor.h>
+#include <tvm/relay/function.h>
+#include <tvm/relay/op.h>
+#include <tvm/relay/op_attr_types.h>
+#include <tvm/relay/op_strategy.h>
+#include <tvm/relay/transform.h>
+#include <tvm/relay/type.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+#include <tvm/te/operation.h>
+#include <tvm/topi/broadcast.h>
+#include <tvm/topi/generic/injective.h>
+
+using namespace tvm;
+using namespace tvm::relay;
+
+TEST(Relay, OutOfStack) {
+  auto foo = [] {
+    auto add_op = relay::Op::Get("add");
+    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
+    auto c1 = relay::Constant(c_data);
+    Call y1 = relay::Call(add_op, {c1, c1});
+    for (int i = 0; i < 16'384; i++) {

Review comment:
       Changed to 1e6




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] yzhliu commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
yzhliu commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r612939038



##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {
+  std::unordered_set<const RelayExprNode*> visited;
+  std::stack<std::pair<Expr, bool>> stack;
+  auto fpush_to_stack = [&visited, &stack](const Expr& expr) {
+    if (expr.use_count() < 3 && !visited.count(expr.get())) {
+      stack.push({expr, false});
+    }
+  };
+  fpush_to_stack(expr);
+  while (stack.size() > 0) {
+    auto node = stack.top().first;
+
+    if (visited.count(node.get())) {
+      stack.pop();
+
+      // dismantle node
+      if (node.use_count() < 3) {

Review comment:
       could you elaborate a bit why number 3 and 2?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613459503



##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {

Review comment:
       Can you move this implementation large function to expr.cc? Too big here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart commented on pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#issuecomment-822584181


   Thanks @d-smirnov @rkimball @yzhliu 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613458068



##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {

Review comment:
       names with double underscore in them are reserved in any scope in C++. Remove the underscores in the name.

##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {
+  std::unordered_set<const RelayExprNode*> visited;
+  std::stack<std::pair<Expr, bool>> stack;
+  auto fpush_to_stack = [&visited, &stack](const Expr& expr) {
+    if (expr.use_count() < 3 && !visited.count(expr.get())) {
+      stack.push({expr, false});
+    }
+  };
+  fpush_to_stack(expr);
+  while (stack.size() > 0) {
+    auto node = stack.top().first;
+
+    if (visited.count(node.get())) {
+      stack.pop();
+
+      // dismantle node
+      if (node.use_count() < 3) {
+        if (auto* op = const_cast<CallNode*>(node.as<CallNode>())) {
+          op->args = Array<Expr>();
+        }
+      }
+    } else if (stack.top().second) {
+      visited.insert(node.get());
+    } else {
+      stack.top().second = true;
+
+      // special handilg

Review comment:
       ```suggestion
         // special handling
   ```

##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {
+  std::unordered_set<const RelayExprNode*> visited;
+  std::stack<std::pair<Expr, bool>> stack;
+  auto fpush_to_stack = [&visited, &stack](const Expr& expr) {
+    if (expr.use_count() < 3 && !visited.count(expr.get())) {
+      stack.push({expr, false});
+    }
+  };
+  fpush_to_stack(expr);
+  while (stack.size() > 0) {
+    auto node = stack.top().first;
+
+    if (visited.count(node.get())) {
+      stack.pop();
+
+      // dismantle node
+      if (node.use_count() < 3) {

Review comment:
       Agreed. This needs a comment

##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {

Review comment:
       Can you move this large function to expr.cc? Too big here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] d-smirnov commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
d-smirnov commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r614194236



##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {

Review comment:
       Amended

##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {
+  std::unordered_set<const RelayExprNode*> visited;
+  std::stack<std::pair<Expr, bool>> stack;
+  auto fpush_to_stack = [&visited, &stack](const Expr& expr) {
+    if (expr.use_count() < 3 && !visited.count(expr.get())) {
+      stack.push({expr, false});
+    }
+  };
+  fpush_to_stack(expr);
+  while (stack.size() > 0) {
+    auto node = stack.top().first;
+
+    if (visited.count(node.get())) {
+      stack.pop();
+
+      // dismantle node
+      if (node.use_count() < 3) {

Review comment:
       Commented in code




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] d-smirnov commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
d-smirnov commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r614194374



##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {

Review comment:
       Moved

##########
File path: include/tvm/relay/expr.h
##########
@@ -625,6 +629,64 @@ class TempExpr : public Expr {
   TVM_DEFINE_OBJECT_REF_METHODS(TempExpr, RelayExpr, TempExprNode);
 };
 
+/*
+ * Non-recursive traversal with dismantling unused call nodes,
+ * a derivative from ExpandDataflow method
+ */
+inline void __dismantle(Expr expr) {
+  std::unordered_set<const RelayExprNode*> visited;
+  std::stack<std::pair<Expr, bool>> stack;
+  auto fpush_to_stack = [&visited, &stack](const Expr& expr) {
+    if (expr.use_count() < 3 && !visited.count(expr.get())) {
+      stack.push({expr, false});
+    }
+  };
+  fpush_to_stack(expr);
+  while (stack.size() > 0) {
+    auto node = stack.top().first;
+
+    if (visited.count(node.get())) {
+      stack.pop();
+
+      // dismantle node
+      if (node.use_count() < 3) {
+        if (auto* op = const_cast<CallNode*>(node.as<CallNode>())) {
+          op->args = Array<Expr>();
+        }
+      }
+    } else if (stack.top().second) {
+      visited.insert(node.get());
+    } else {
+      stack.top().second = true;
+
+      // special handilg

Review comment:
       Fixed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613561822



##########
File path: tests/cpp/relay_dismantler_test.cc
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/ir/expr.h>
+#include <tvm/ir/type_functor.h>
+#include <tvm/node/functor.h>
+#include <tvm/node/structural_equal.h>
+#include <tvm/relay/adt.h>
+#include <tvm/relay/analysis.h>
+#include <tvm/relay/expr.h>
+#include <tvm/relay/expr_functor.h>
+#include <tvm/relay/function.h>
+#include <tvm/relay/op.h>
+#include <tvm/relay/op_attr_types.h>
+#include <tvm/relay/op_strategy.h>
+#include <tvm/relay/transform.h>
+#include <tvm/relay/type.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+#include <tvm/te/operation.h>
+#include <tvm/topi/broadcast.h>
+#include <tvm/topi/generic/injective.h>
+
+using namespace tvm;
+using namespace tvm::relay;
+
+TEST(Relay, OutOfStack) {
+  auto foo = [] {
+    auto add_op = relay::Op::Get("add");
+    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
+    auto c1 = relay::Constant(c_data);
+    Call y1 = relay::Call(add_op, {c1, c1});
+    for (int i = 0; i < 16'384; i++) {

Review comment:
       I was using ubuntu 20.04. I do have 64G RAM but I don't think that changes the stack size. When I type `ulimit -s` to print the stack size I see 8182K. What do you see?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart merged pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
mbrookhart merged pull request #7832:
URL: https://github.com/apache/tvm/pull/7832


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] rkimball commented on a change in pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
rkimball commented on a change in pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#discussion_r613561822



##########
File path: tests/cpp/relay_dismantler_test.cc
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/ir/expr.h>
+#include <tvm/ir/type_functor.h>
+#include <tvm/node/functor.h>
+#include <tvm/node/structural_equal.h>
+#include <tvm/relay/adt.h>
+#include <tvm/relay/analysis.h>
+#include <tvm/relay/expr.h>
+#include <tvm/relay/expr_functor.h>
+#include <tvm/relay/function.h>
+#include <tvm/relay/op.h>
+#include <tvm/relay/op_attr_types.h>
+#include <tvm/relay/op_strategy.h>
+#include <tvm/relay/transform.h>
+#include <tvm/relay/type.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+#include <tvm/te/operation.h>
+#include <tvm/topi/broadcast.h>
+#include <tvm/topi/generic/injective.h>
+
+using namespace tvm;
+using namespace tvm::relay;
+
+TEST(Relay, OutOfStack) {
+  auto foo = [] {
+    auto add_op = relay::Op::Get("add");
+    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
+    auto c1 = relay::Constant(c_data);
+    Call y1 = relay::Call(add_op, {c1, c1});
+    for (int i = 0; i < 16'384; i++) {

Review comment:
       I was using ubuntu 20.04. I do have 64G RAM but I don't think that changes the stack size. When I type `ulimit -s` to print the stack size I see 8192K. What do you see?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] d-smirnov commented on pull request #7832: [Relay] Recursive destructor call replaced with non-recursive for Call nodes.

Posted by GitBox <gi...@apache.org>.
d-smirnov commented on pull request #7832:
URL: https://github.com/apache/tvm/pull/7832#issuecomment-819884348


   Mine is:
   
   > >ulimit -s
   > 8192
   
   And it fails with around 200'000 stack frames in case of the unit test for
   me.
   
   --
   Dmitriy Smirnov
   
   
   On Wed, 14 Apr 2021 at 21:22, Robert Kimball ***@***.***>
   wrote:
   
   > ***@***.**** commented on this pull request.
   > ------------------------------
   >
   > In tests/cpp/relay_dismantler_test.cc
   > <https://github.com/apache/tvm/pull/7832#discussion_r613561822>:
   >
   > > +#include <tvm/runtime/packed_func.h>
   > +#include <tvm/runtime/registry.h>
   > +#include <tvm/te/operation.h>
   > +#include <tvm/topi/broadcast.h>
   > +#include <tvm/topi/generic/injective.h>
   > +
   > +using namespace tvm;
   > +using namespace tvm::relay;
   > +
   > +TEST(Relay, OutOfStack) {
   > +  auto foo = [] {
   > +    auto add_op = relay::Op::Get("add");
   > +    auto c_data = tvm::runtime::NDArray::Empty({1, 2, 3}, {kDLFloat, 32, 1}, {kDLCPU, 0});
   > +    auto c1 = relay::Constant(c_data);
   > +    Call y1 = relay::Call(add_op, {c1, c1});
   > +    for (int i = 0; i < 16'384; i++) {
   >
   > I was using ubuntu 20.04. I do have 64G RAM but I don't think that changes
   > the stack size. When I type ulimit -s to print the stack size I see
   > 8182K. What do you see?
   >
   > —
   > You are receiving this because you authored the thread.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/tvm/pull/7832#discussion_r613561822>, or
   > unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AGADO35QEDRNXHYLCK4YAJDTIX2RNANCNFSM42ZXVWQA>
   > .
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org