vinx13 commented on code in PR #70:
URL: https://github.com/apache/tvm-rfcs/pull/70#discussion_r893898932
##########
rfcs/0070-introducing-decl-buffer.md:
##########
@@ -136,11 +138,26 @@ def elemwise(A: T.Buffer[(16, 16), "float32"], C:
T.Buffer[(16, 16), "float32"])
C_flattened[i * 16 + j] = A[i * 16 + j]
```
+Specifically, the updated flow of buffer flattening using `DeclBuffer` will be:
+1. Before `FlattenBuffer/StorageFlatten`: Buffers are declared in the
`buffer_map`, and are not flattened. Buffer access is done using N-d
unflattened indices.
+2. After `FlattenBuffer/StorageFlatten`, but before `MakePackedAPI`: Buffers
are declared in the `buffer_map`, and are not flattened. Buffer access is done
through a buffer alias explicitly created via `DeclBuffer`, where the alias
shares the same data pointer, but has a flattened shape and is accessed with
flattened indices.
+3. After `MakePackedAPI`: The `buffer_map` is empty. Declarations of flattened
buffers are done using the handles extracted using `tvm_struct_get`.
Review Comment:
Right. After that, only necessary of the unflattened buffer, such as shape,
will become `AssertStmt` in TIR. We won't have access to unflattened buffer
anymore
--
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]