vinx13 commented on PR #70:
URL: https://github.com/apache/tvm-rfcs/pull/70#issuecomment-1149308146

   Seems we all agree that introducing `DeclBuffer` is helpful. The only 
unresolved question is how shall the TVMScript be updated as @wrongtest 
mentioned. As discussed above, we have the options:
   
   * B1: In TVMScript, `T.allocate` and `T.decl_buffer` strictly map to the 
corresponding TIR nodes. To allocate and declare a buffer (in lowered TIR), 
there will be two separate steps:
   ```
   data = T.allocate(physical_shape)
   buffer = T.decl_buffer(data=data, shape=physical_shape)
   ```
   
   * B2: provide some syntax sugar for `T.allocate` (adding a `returns_buffer` 
option), which is translated to `AllocateNode` + `DeclBufferNode` in TIR.
   ```
   buffer = T.allocate(physical_shape, returns_buffer=True)
   ```
   When printing them from TIR to TVMScript, we still print in unsugared form 
in B1.
   
   Note that in B2, it is not feasible to make `T.allocate` always return the 
created buffer, because
   1) there might be still need to directly use the buffer var in lower level 
TIR
   2) when printing the TIR to TVMScript, `AllocateNode` and `DeclBufferNode` 
do not always appear in the same place, it is difficult (and not preferred) to 
map two TIR nodes into one TVMScript statement
   
   would love to know what you think @wrongtest @Hzfengsy 


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