You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/01/03 14:50:00 UTC

[GitHub] [tvm] Lunderberg commented on a change in pull request #9727: [TE][TIR] Implement layout transformations, non-flat memory buffers

Lunderberg commented on a change in pull request #9727:
URL: https://github.com/apache/tvm/pull/9727#discussion_r777520439



##########
File path: python/tvm/tir/ir_builder.py
##########
@@ -442,26 +447,23 @@ def pointer(self, content_type, name="ptr", scope=""):
         ptr : BufferVar
             The buffer var representing the buffer.
         """
-        buffer_var = _expr.Var(name, PointerType(PrimType(content_type), scope))
-        return BufferVar(self, buffer_var, None, content_type)
+        buffer = _buffer.decl_buffer(shape=[], dtype=content_type, name=name, scope=scope)
+        return BufferVar(self, buffer, [], content_type)
 
-    def buffer_ptr(self, buf, shape=None):
+    def buffer_ptr(self, buf):
         """Create pointer variable corresponds to buffer ptr.
 
         Parameters
         ----------
         buf : Buffer
             The buffer to be extracted.
 
-        shape : Tuple
-            Optional shape of the buffer. Overrides existing buffer shape.
-
         Returns
         -------
         ptr : BufferVar
             The buffer var representing the buffer.
         """
-        return BufferVar(self, buf.data, buf.shape if shape is None else shape, buf.dtype)
+        return BufferVar(self, buf, [], buf.dtype)

Review comment:
       Thank you for the catch, and that's something I to refactored out.  On the main branch, that is used to indicate the shape of the buffer, since the data pointer itself doesn't have any shape information.  After the PR, the buffer itself holds the shape information, so the additional array isn't needed.




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org