class_docstr: Symbolic data buffer in TVM.
  
  Buffer provide a way to represent data layout
  specialization of data structure in TVM.
  
  Do not construct directly, use :py:func:`~decl_buffer` instead.
  See the documentation of :py:func:`decl_buffer` for more details.
  
  See Also
  --------
  decl_buffer : Declare a buffer
class_docstr_tok: ["Symbolic","data","buffer","in","TVM",".","Buffer","provide","a","way","to","represent","data","layout","specialization","of","data","structure","in","TVM",".","Do","not","construct","directly",",","use",":","py",":","func",":","`","~decl_buffer","`","instead",".","See","the","documentation","of",":","py",":","func",":","`","decl_buffer","`","for","more","details",".","See","Also","--","--","--","--","decl_buffer",":","Declare","a","buffer"]
docstr: Get an access pointer to the head of buffer.
  
  This is the recommended method to get buffer data
  ptress when interacting with external functions.
  
  Parameters
  ----------
  access_mask : int
      The access pattern MASK. Indicate whether the
      access will read or write to the data content.
  
  ptr_type : str, optional
      The data type of the result pointer. Do not specify
      unless we want to cast pointer to specific type.
  
  content_lanes: int, optional
      The number of lanes for the data type. This value
      is greater than one for vector types.
  
  offset: Expr, optional
      The offset of pointer. We can use it to offset by
      the number of elements from the address of ptr.
  
  extent: Expr, optional
      The extent of pointer.
  
  Examples
  --------
  .. code-block:: python
  
    # Get access ptr for read
    buffer.access_ptr("r")
    # Get access ptr for read/write with bitmask
    buffer.access_ptr(Buffer.READ | Buffer.WRITE)
    # Get access ptr for read/write with str flag
    buffer.access_ptr("rw")
    # Get access ptr for read with offset
    buffer.access_ptr("r", offset = 100)
    # Get access ptr for read with extent
    buffer.access_ptr("r", extent = 100)
docstr_tok: ["Get","an","access","pointer","to","the","head","of","buffer",".","This","is","the","recommended","method","to","get","buffer","data","ptress","when","interacting","with","external","functions",".","Parameters","--","--","--","--","--","access_mask",":","int","The","access","pattern","MASK",".","Indicate","whether","the","access","will","read","or","write","to","the","data","content",".","ptr_type",":","str",",","optional","The","data","type","of","the","result","pointer",".","Do","not","specify","unless","we","want","to","cast","pointer","to","specific","type",".","content_lanes",":","int",",","optional","The","number","of","lanes","for","the","data","type",".","This","value","is","greater","than","one","for","vector","types",".","offset",":","Expr",",","optional","The","offset","of","pointer",".","We","can","use","it","to","offset","by","the","number","of","elements","from","the","address","of","ptr",".","extent",":","Expr",",","optional","The","extent","of","pointer",".","Examples","--","--","--","--","..","code-block",":",":","python","#","Get","access","ptr","for","read","buffer.access_ptr","(","``","r","''",")","#","Get","access","ptr","for","read\/write","with","bitmask","buffer.access_ptr","(","Buffer.READ","|","Buffer.WRITE",")","#","Get","access","ptr","for","read\/write","with","str","flag","buffer.access_ptr","(","``","rw","''",")","#","Get","access","ptr","for","read","with","offset","buffer.access_ptr","(","``","r","''",",","offset","=","100",")","#","Get","access","ptr","for","read","with","extent","buffer.access_ptr","(","``","r","''",",","extent","=","100",")"]
code: def access_ptr(
      self,
      access_mask,
      ptr_type="handle",
      content_lanes=1,
      offset=0,
      extent=None,
  ):
      """Get an access pointer to the head of buffer.
  
      This is the recommended method to get buffer data
      ptress when interacting with external functions.
  
      Parameters
      ----------
      access_mask : int
          The access pattern MASK. Indicate whether the
          access will read or write to the data content.
  
      ptr_type : str, optional
          The data type of the result pointer. Do not specify
          unless we want to cast pointer to specific type.
  
      content_lanes: int, optional
          The number of lanes for the data type. This value
          is greater than one for vector types.
  
      offset: Expr, optional
          The offset of pointer. We can use it to offset by
          the number of elements from the address of ptr.
  
      extent: Expr, optional
          The extent of pointer.
  
      Examples
      --------
      .. code-block:: python
  
        # Get access ptr for read
        buffer.access_ptr("r")
        # Get access ptr for read/write with bitmask
        buffer.access_ptr(Buffer.READ | Buffer.WRITE)
        # Get access ptr for read/write with str flag
        buffer.access_ptr("rw")
        # Get access ptr for read with offset
        buffer.access_ptr("r", offset = 100)
        # Get access ptr for read with extent
        buffer.access_ptr("r", extent = 100)
      """
      if isinstance(access_mask, string_types):
          mask = 0
          for value in access_mask:
              if value == "r":
                  mask = mask | Buffer.READ
              elif value == "w":
                  mask = mask | Buffer.WRITE
              else:
                  raise ValueError(f"Unknown access_mask {access_mask}")
          access_mask = mask
      offset = convert(offset)
      extent = convert(extent)
      return _ffi_api.BufferAccessPtr(
          self, access_mask, ptr_type, content_lanes, offset, extent  # type: ignore
      )
  
file_path: tvm/python/tvm/tir/buffer.py
imports: from numbers import Integral
  import tvm._ffi
  from tvm._ffi.base import string_types
  from tvm.ir import PointerType, PrimExpr, PrimType, Range
  from tvm.runtime import Object, Scriptable, convert
  from .None import _ffi_api
label_desc: Use image node_id 1 for calling the Buffer obj's underlying member method code with example usage: obj.access_ptr(access_mask, ptr_type, content_lanes, offset, extent) and returns: _ffi_api