shingjan commented on a change in pull request #9492:
URL: https://github.com/apache/tvm/pull/9492#discussion_r761556455
##########
File path: python/tvm/script/tir/ty.py
##########
@@ -67,6 +68,71 @@ def __getitem__(self, vtypes):
return ConcreteType(tvm.ir.TupleType([vtype.evaluate() for vtype in
vtypes]))
+class GenericBufferType(SpecialStmt): # pylint:
disable=too-few-public-methods, abstract-method
+ """TVM script typing class for uniform Type objects"""
+
+ def __init__(self, vtype):
+ def match_buffer_syntax_sugar(
+ shape,
+ dtype="float32",
+ name: str = "Buffer",
+ data=None,
+ strides=None,
+ elem_offset=None,
+ scope="global",
+ align=-1,
+ offset_factor=0,
+ buffer_type="default",
+ span=None,
+ ):
+ if strides is None:
+ strides = []
+ align = convert_to_int(align, "align", self.context.report_error,
self.node.span)
+ offset_factor = convert_to_int(
+ offset_factor, "offset_factor", self.context.report_error,
self.node.span
+ )
+ buffer = tvm.tir.decl_buffer(
+ shape,
+ dtype,
+ name,
+ data,
+ strides,
+ elem_offset,
+ scope,
+ align,
+ offset_factor,
+ buffer_type,
+ span=span,
+ )
+ return buffer
+
+ self.type = vtype
+ super().__init__(match_buffer_syntax_sugar, def_symbol=True)
+
+ @staticmethod
+ def __call__(
+ shape,
+ dtype: str = "float32",
+ name: str = "Buffer",
+ data=None,
+ strides=None,
+ elem_offset=None,
+ scope="global",
+ align=-1,
+ offset_factor=0,
+ buffer_type="default",
+ span=None,
+ ):
+ pass
+
+ @staticmethod
+ def __getitem__(args):
Review comment:
done
--
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]