tqchen edited a comment on pull request #8463:
URL: https://github.com/apache/tvm/pull/8463#issuecomment-879967726


   Thanks @masahi . Sorry was being late on this. I think it worthwhile to 
think a bit more.  In general, there are two kinds of information  that we 
normally carry throughout the program:
   
   - K0: The information in the declaration/allocation site
   - K1: The information that carries as part of type (of the Var) which is 
being used through out the usage site in the code base.
   
   The Buffer object was intended for the declaration site information. There 
are in general two kinds of design choices here:
   
   - C0: On one hand, the information being present in the declaration site K0 
can be duplicated with the information present in the allocation site, so we 
could remove the duplication (for example, dtype and scope are duplicated in 
the type atm).
   - C1: On the other hand, one could argue that the type annotation should be 
made independent from the type annotation that also shares with the usage site, 
so we could let the allocation site contain a duplicated set of information and 
check consistency during construction.
   
   Right now this PR follows C0 partially. I wonder if we should also consider 
the choice between C0 and C1. In the particular case of Buffer, I feel that we 
should give C1 a serious consideration. 
   
   We can also use the text format to illustrate the potential differences 
between the two.
   
   ```python
   # Choice C0: the information was already duplicated on the lhs, so do not 
present on rhs
   ptr : Pointer[float32, "gpu"] = allocate_buffer(32)
   
   # Choice C1:
   ptr : Pointer[float32, "gpu"] = allocate_buffer(32, "float32", "gpu")
   ```
   


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