junrushao1994 opened a new pull request #7756:
URL: https://github.com/apache/tvm/pull/7756


   This PR brings back the stack size optimization:
   - https://github.com/dmlc/dmlc-core/pull/613/
   - https://github.com/dmlc/dmlc-core/pull/615/
   
   It also brings back the error message showing those numbers used in 
comparison "(1 vs 2)" when `CHECK_XX` fails.
   
   Some tricks:
   - Make the transient object `LogFatal` an empty class, storing data on TLS 
so that it doesn't occupy stack space
   - Forcefully disallow inlining on some functions that could potentially use 
stack space
   - Replace the (slightly more) heavy-weighted "std::string" with "const char 
*" in the constructor of LogFatal
   
   I tested the stack size in the following setting:
   - Compiler: GCC 5.5
   - OS: Ubuntu 18.04
   - Function: tvm::relay::AutoSchedulerLayoutRewriter::VisitExpr_(const 
tvm::relay::CallNode*)
   - CXX Flag: "-fstack-usage -g"
   
   The stack usage drops from 1392 to 496 with the aforementioned tricks.
   
   CC @comaniac @tkonolige @tqchen. Please let me know if it solves 
https://github.com/apache/tvm/issues/7729. Thanks in advance!
   


-- 
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:
[email protected]


Reply via email to