SebastianBoblestETAS commented on a change in pull request #9950:
URL: https://github.com/apache/tvm/pull/9950#discussion_r791738823



##########
File path: src/tir/transforms/lower_tvm_builtin.cc
##########
@@ -127,7 +134,7 @@ class BuiltinLower : public StmtExprMutator {
         auto storage_scope = 
Downcast<PointerType>(op->buffer_var->type_annotation)->storage_scope;
         if (dev_type->value == kDLCPU && storage_scope == "global") {
           int32_t constant_size = op->constant_allocation_size();
-          if (constant_size > 0 && constant_size * nbytes < 
runtime::kMaxStackAlloca) {
+          if (constant_size > 0 && constant_size * nbytes < kMaxStackAlloca) {

Review comment:
       I changed the code accordingly

##########
File path: src/driver/driver_api.cc
##########
@@ -47,6 +47,7 @@ TVM_REGISTER_PASS_CONFIG_OPTION("tir.disable_vectorize", 
Bool);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.is_entry_func", Bool);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.add_lower_pass", Array<Array<ObjectRef>>);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.debug_keep_trivial_loop", Bool);
+TVM_REGISTER_PASS_CONFIG_OPTION("tir.max_stack_alloca", Integer);

Review comment:
       I looked into 
https://github.com/apache/tvm/blob/main/tests/python/unittest/test_tir_transform_lower_tvm_builtin.py
   I am not quite sure how I would test that tir.max_stack_alloca works as 
expected. I would need to create an IRModule with AllocateNodes and check 
whether they are or are not in there after tranformations, depending on its 
value, right?
   I do not really know how to do that unfortunately 
   

##########
File path: src/driver/driver_api.cc
##########
@@ -47,6 +47,7 @@ TVM_REGISTER_PASS_CONFIG_OPTION("tir.disable_vectorize", 
Bool);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.is_entry_func", Bool);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.add_lower_pass", Array<Array<ObjectRef>>);
 TVM_REGISTER_PASS_CONFIG_OPTION("tir.debug_keep_trivial_loop", Bool);
+TVM_REGISTER_PASS_CONFIG_OPTION("tir.max_stack_alloca", Integer);

Review comment:
       Well, you for sure have a much better overview of TVM than me, so of 
course this is fine for me.
   I will look into moving this code and into writing a test tomorrow.




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