mbs-octoml commented on code in PR #11091:
URL: https://github.com/apache/tvm/pull/11091#discussion_r864870361


##########
src/relay/backend/aot_executor_codegen.cc:
##########
@@ -215,11 +217,21 @@ class AOTOnDemandAllocator : public 
transform::DeviceAwareExprVisitor {
    * \return The corresponding token.
    */
   StorageInfo GetStorage(const Expr& expr) {
+    Expr true_expr = expr;
+
+    // Don't get storage for let nodes.
+    while (const auto* let_node = true_expr.as<LetNode>()) {

Review Comment:
   No objection from me if you want to just do the loop directly as I find that 
much clearer. In my travels I found switching to pre- and post-let-binding 
visitor overloads made the most sense when you find you need to accumulate 
intermediate rewritten bindings on a local stack in order to reconstruct the 
final let chain. ExpandANormalForm also achieves the same effect all be it by 
relying on the implicit memoization to capture the intermediate results (which 
hurts my head every time I come across it!) 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to