@wrongtest Thanks for bringing up this. There are a few options for the 
behavior in TVM script, I'm open to discussion.

* A1: The original behavior before https://github.com/apache/tvm/pull/9727:
`T.allocate` returns a `Var`, which can be later used in `T.load / T.store`.

* A2: Current behavior: 
`T.allocate` returns a buffer (`Var` is implicitly created inside). The buffer 
can be accessed via subscripts, which will be translated to `BufferLoad / 
BufferStore`.

* A3: Potential behavior for this RFC:
`T.allocate` returns a `Var`, use `T.decl_buffer` to create buffer and access 
it (because `T.load / T.store` are deprecated). This follows the translation to 
TIR nodes closely.

* A4: Potential behavior for this RFC (the one @wrongtest is proposing):
If there are no buffer aliases (in most of the cases), it is tempting to avoid 
boilerplate code of `T.decl_buffer`. 
`T.allocate` returns a buffer, where `buffer->data` is implicitly created and 
allocated inside. The buffer can be accessed via subscripts. Subsequent buffer 
aliases can be created by referring to `buffer->data`. This requires 
`DeclBuffer` to be created implicitly, it is okay to have some discrepancy 
between parser side and the TIR nodes.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm-rfcs/pull/70#issuecomment-1124141811
You are receiving this because you are subscribed to this thread.

Message ID: <apache/tvm-rfcs/pull/70/c1124141...@github.com>

Reply via email to