コード例 #1
0
ファイル: drop_out_do_mask.py プロジェクト: gekowa/ascend-opp
def _new_alloc(ir_builder, dtype, shape, name, scope):
    """
    decl new buffer

    Parameters
    ----------
    ir_builder : tvm.ir_builder
        Developer API of IR node builder make function.
    dtype : string
        buffer date type.
    shape : list of int
        buffer shape.
    name : string
        buffer name.
    scope : string
        buffer memory scope.

    Returns
    -------
    buffer : tvm.schedule.Buffer
        Symbolic data buffer.

    """
    buf_var = ir_builder.allocate(dtype, shape, name=name, scope=scope)
    new_buffer = tvm.decl_buffer(shape,
                                 buf_var.dtype,
                                 name=name,
                                 scope=scope,
                                 data=buf_var)

    return new_buffer
コード例 #2
0
 def new_alloc(dtype, shape, name):
     """Alloc mem"""
     new_buffer = tvm.decl_buffer(shape,
                                  dtype,
                                  name=name,
                                  scope="",
                                  data=None)
     return new_buffer
コード例 #3
0
ファイル: fill_v2_d.py プロジェクト: gekowa/ascend-opp
    def new_alloc(ir_builder, dtype, shape, name, scope):
        """
        new_alloc
        """
        buf_var = ir_builder.allocate(dtype, shape, name=name, scope=scope)
        new_buffer = tvm.decl_buffer(shape, buf_var.dtype, name=name, scope=scope, data=buf_var)

        return new_buffer
コード例 #4
0
 def new_alloc(tvm_ib, dtype, shape, name, scope):
     """Funtion to alloc mem"""
     buf_var = tvm_ib.allocate(dtype, shape, name=name, scope=scope)
     new_buffer = tvm.decl_buffer(shape,
                                  buf_var.dtype,
                                  name=name,
                                  scope=scope,
                                  data=buf_var)
     return new_buffer
コード例 #5
0
ファイル: zn_2_hwcn.py プロジェクト: gekowa/ascend-opp
def _new_alloc(tvm_ib, dtype, shape, name, scope):
    """
    decl new buffer for ir builder make function

    """
    buf_var = tvm_ib.allocate(dtype, shape, name=name, scope=scope)
    new_buffer = tvm.decl_buffer(shape, buf_var.dtype, name=name,
                                 scope=scope, data=buf_var)

    return new_buffer
コード例 #6
0
ファイル: cast.py プロジェクト: gekowa/ascend-opp
def _new_alloc(ir_builder, dtype, shape, name, scope):
    """
    alloc memory for decl new buffer
    """
    buf_var = ir_builder.allocate(dtype, shape, name=name, scope=scope)
    new_buffer = tvm.decl_buffer(shape,
                                 buf_var.dtype,
                                 name=name,
                                 scope=scope,
                                 data=buf_var)
    return new_buffer
コード例 #7
0
def _apply_for_new_alloc(ib_,
                         dtype,
                         buf_len,
                         align_size,
                         scope=cce_params.scope_ubuf):
    """
    :param ib_: ir builder
    :param dtype : the data type
    :param buf_len : apply buffer length
    :param align_size : for offset align
    :param scope : cce scope
    :return: new buffer
    """
    shape_x = (_ceil_fill(buf_len, align_size), )
    buf_var = ib_.allocate(dtype, shape_x, name="tmp_buf", scope=scope)
    tmp_buffer = tvm.decl_buffer(shape_x,
                                 buf_var.dtype,
                                 name="tmp_buf",
                                 scope=cce_params.scope_ubuf,
                                 data=buf_var)
    return tmp_buffer