areusch commented on pull request #8096:
URL: https://github.com/apache/tvm/pull/8096#issuecomment-859919232


   hi @giuseros,
   
   you're right about a)--my analysis was incorrect of StorageRewrite and it 
shouldn't modify the parameters appreciably to the memory map. thanks for 
correcting me on that.
   
   on b), my concern is:
   - do other uses of StorageRewrite exist that may be affected by the narrow 
approach taken here?
   - how do we document what the narrow approach needs to accomplish using unit 
tests so that, if others run into problems with StorageRewrite elsewhere, they 
don't change it and break us?
   
   On the latter point, my main critique is that the unit tests are pretty 
coarse (e.g. they are integration tests). there are enough moving pieces that 
i'm not sure it's obvious from the tests how StorageRewrite should work (it 
probably is today, but things could change over time that would make it less 
so). possible to add a finer-grained unit test e.g. in 
`tests/python/unittest/test_tir_transform_storage_rewrite.py`?
   
   @tqchen also raised a concern on whether it's feasible to push 
StorageRewrite in the direction of having pointer analysis. The problem posed 
was: we currently pass buffers to operator implementation as pointers, and the 
pointer lifetime of those buffers is clear enough from convention (when the 
operator impl returns, they are invalid; so impl cannot save those pointers). 
if we start down the path of adding a more general reference counting impl to 
StorageRewrite, that implies we may be passing user data structs that contain 
pointers to operator implementations. however, it isn't really clear how we 
should explain the lifecycle of _those_ pointers.
   
   sort of I think this is a minor point given the current impl, but I also 
agree that if we are arguing that StorageRewrite's struct_set analysis is in 
fact a limited application of a general pattern, and implementing the general 
pattern is also fine, we do need to then elaborate where we are going with it. 
i do think keeping the impl in AOTExecutorCodegen doesn't carry this problem. 
   
   another possible way to alleviate both concerns would be to define an attr 
on the `tir.tvm_stack_alloca` node that explicitly instructs StorageRewrite to 
link that tvm_stack_alloca with a given AllocateNode. what do you think about 
that?


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