vinx13 commented on code in PR #70:
URL: https://github.com/apache/tvm-rfcs/pull/70#discussion_r870695753


##########
rfcs/0070-introducing-decl-buffer.md:
##########
@@ -0,0 +1,210 @@
+- Feature Name: introducing-decl-buffer
+- Author: Wuwei Lin (@vinx13), Eric Lunderberg (@Lunderberg)
+- Start Date: 2022-05-04
+- RFC PR: [apache/tvm-rfcs#0000](https://github.com/apache/tvm-rfcs/pull/70)
+- GitHub Issue: TBD
+
+# Summary
+[summary]: #summary
+
+This is a follow-up of https://github.com/apache/tvm/pull/9727 and
+[RFC#63](https://github.com/apache/tvm-rfcs/pull/63). Currently buffer can be 
implicitly
+declared and then used. The implicit behavior can be error prone and makes 
analysis more difficult.
+This RFC introduces `DeclBuffer`, a new IR construct as an explicit statement 
for buffer declaration.
+
+# Motivation
+[motivation]: #motivation
+
+Currently a Buffer object can be created and then referenced in TIR, without 
explicit declaration
+or allocation. For example, in TVM script, one can use `T.buffer_decl` to 
create a new buffer and
+then use it in the rest of the program.
+```
[email protected]_func
+def buffer_alias(A: T.Buffer[(16,), "float"]):
+    A_vector = T.buffer_decl([4], "float32x4", data=A.data)
+    T.evaluate(A_vector[0])  # read from buffer alias
+```
+However, `T.buffer_decl` doesn’t translate to a node in AST. The AST will be
+```
+PrimFunc {
+  buffer_map: {A: Buffer[(16,), "float"},

Review Comment:
   Yes. it should be `A_data: Buffer(data=A_data, ...)`



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