MCPcopy Create free account
hub / github.com/apache/tvm / decl_buffer

Function decl_buffer

python/tvm/tirx/script/builder/ir.py:1735–1824  ·  view source on GitHub ↗

Create a buffer declaration node. When ``data`` is provided, creates a DeclBuffer (alias to existing data). When ``data`` is None, creates an AllocBuffer (new allocation). Parameters ---------- shape : Union[List[PrimExpr], Tuple[PrimExpr], PrimExpr, Integral] The type

(
    shape,
    dtype="float32",
    data=None,
    strides=None,
    elem_offset=None,
    byte_offset=None,
    scope="global",
    align=0,
    offset_factor=0,
    buffer_type="",
    axis_separators=None,
    layout="default",
    allocated_addr=None,
)

Source from the content-addressed store, hash-verified

1733
1734
1735def decl_buffer(
1736 shape,
1737 dtype="float32",
1738 data=None,
1739 strides=None,
1740 elem_offset=None,
1741 byte_offset=None,
1742 scope="global",
1743 align=0,
1744 offset_factor=0,
1745 buffer_type="",
1746 axis_separators=None,
1747 layout="default",
1748 allocated_addr=None,
1749) -> Buffer:
1750 """Create a buffer declaration node.
1751
1752 When ``data`` is provided, creates a DeclBuffer (alias to existing data).
1753 When ``data`` is None, creates an AllocBuffer (new allocation).
1754
1755 Parameters
1756 ----------
1757 shape : Union[List[PrimExpr], Tuple[PrimExpr], PrimExpr, Integral]
1758 The type of the buffer prior to flattening.
1759
1760 dtype : str
1761 The data type in the content of the buffer.
1762
1763 data : Var
1764 The pointer to the head of the data.
1765
1766 strides : List[PrimExpr]
1767 The strides of each dimension.
1768
1769 elem_offset : PrimExpr
1770 The offset in terms of number of dtype elements (including lanes).
1771
1772 byte_offset : PrimExpr
1773 The offset in terms of number of bytes.
1774
1775 scope : str
1776 The optional storage scope of buffer data pointer.
1777
1778 align : int
1779 The alignment requirement of data pointer in bytes.
1780
1781 offset_factor : int
1782 The factor of elem_offset field.
1783
1784 buffer_type : str
1785 The buffer type.
1786
1787 axis_separators : List[int]
1788 The separators between input axes when generating flattened output axes.
1789
1790 layout : Layout
1791 The layout of the buffer.
1792

Callers 3

mutate_bufferMethod · 0.90
reshapeFunction · 0.70
decl_scalarFunction · 0.70

Calls 6

_get_elem_offsetFunction · 0.85
_get_layoutFunction · 0.85
_record_meta_resourceFunction · 0.85
add_callbackMethod · 0.80
VarClass · 0.50
__enter__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…