tqchen commented on code in PR #16880:
URL: https://github.com/apache/tvm/pull/16880#discussion_r1564041873
##########
python/tvm/_ffi/runtime_ctypes.py:
##########
@@ -212,6 +212,20 @@ def __eq__(self, other):
def __ne__(self, other):
return not self.__eq__(other)
+ def itemsize(self):
+ """Get the number of bytes of a single element of this data type. When
the number of lanes
+ is greater than 1, the itemsize is the size of the vector type.
+
+ Returns
+ -------
+ itemsize : int
+ The number of bytes of a single element of this data type
+ """
+ lanes_as_int = ctypes.c_int16(self.lanes).value
+ if lanes_as_int < 0:
+ raise ValueError("Cannot determine itemsize for scalable vector
types")
+ return self.bits * self.lanes // 8
Review Comment:
(self.bits * self.lanes + 7) // 8
--
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]