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 that can be removed. 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]