Data Structure

BM Runtime Library

bmerr_t

bmerr_t is a enum type which enumerates all API returned status. The values are listed as follows.
Value
Description
BM_SUCCESS
API call returns successfully
BM_ERR_AGAIN
API call fails due to device not ready
BM_ERR_FAILURE
API call returns general failure
BM_ERR_TIMEOUT
API call fails due to time out
BM_ERR_UNINITIALIZED
API call fails due to device un-initialized
BM_ERR_INVALID_ARGUMENT
API call fails due to invalid argument
BM_ERR_NOMEM
API call fails due to insufficient memory
BM_ERR_DATA
API call fails due to data error
BM_ERR_BUSY
API call fails due to device being busy
BM_ERR_NOT_SUPPORTED
API call fails due to unsupported parameters

bmctx_t

bmctx_t is a BM context handle, generated by bm_init(), released by bm_exit().

bmdev_t

bmdev_t is a BM device handle, generated by bm_device_open(), closed by bm_device_close().

bm_devinfo_t

bm_devinfo_t is a structure type which describes device info. It includes the following members:
Value
Description
chip
A enum value describes chip version.
npu_num
A uint32_t type value describes NPU number.
eu_num
A uint32_t type value describes EU number.
lmem_size
A uint32_t type value describes local memory size.
lmem_banks
A uint32_t type value describes local memory bank number.
gmem_size
A uint32_t type value describes global memory size.

bmmem_t

bmmem_t is a handle which points to BM memory structure. bmmem_device_t, bmmem_host_t and bmmem_system_t are all alias of bmmem_t.
Define as follow:
1
struct bm_memory;
2
typedef struct bm_memory *bmmem_t;
3
typedef bmmem_t bmmem_device_t;
4
typedef bmmem_t bmmem_host_t;
Copied!
Normally, bmmem_device_t is device memory handle, generated by bmmem_device_alloc() function.bmmem_host_t is host memory handle, generated by bmmem_host_alloc().

bmnet_info_t

bmnet_info_t is a structure type which describes BM network’s input info. It includes the following members:
Value
Description
batch_size
A uint32_t type value describes batch size.
weight
A uint8_t pointer type value which points to the weight memory.
weight_size
A size_t type value describes weight memory size.
cmdbuf
A uint8_t pointer type value which points to the command buffer.
cmdbuf_size
A size_t type value describes command buffer size.
neuron_size
A size_t type value describes neuron memory size.
input_size
A size_t type value describes input memory size.
output_offset
A uint64_t type value describes output neuron offset to neuron base.
output_size
A size_t type value describes output neuron size in bytes.
Command buffer: command buffer stores instruction streams generated by BMNet using caffe model, and these instruction streams can be executed by TPU processor.

bmnet_output_info_t

bmnet_output_info_t is a structure type which describes BM network’s output info. It includes the following members:
Value
Description
output_size
Total output size of inference.
output_num
Output number.
name_array
Array of pointers to the output names
shape_array
Array of pointers to the output shapes
threshold_array
Array of pointers to the output threshold(meaningless on BM1682)

bmnet_t

bmnet_t is a BMNet context handle, generated by bmnet_register_bmodel(), released by bmnet_cleanup().
Last modified 3yr ago