vbrcb

Function

vbrcb instruction abstraction.

Expands the dimensions of the tensors based on the instruction stride. However, the msKPP instruction system does not have the concept of stride. Therefore, you need to specify the dimension expansion factor and ensure that the shapes of the input and output tensors are the same.

Prototype

1
class vbrcb(x, y, broadcast_num)

Parameters

Parameter

Input/Output

Data Type

Description

x

Input

Tensor variable

Input x-vector tensor. UINT16 and UINT32 are supported.

y

Output

Tensor variable

Output y-vector tensor. UINT16 and UINT32 are supported.

broadcast_num

Input

int

Number of times that the last dimension is expanded. Empirical profile data shows that different expansion factors have little impact on performance. Therefore, the standard expansion factor of 16, denoted as dstBlockStride=1 and dstRepeatStride=8 in the instruction, is commonly employed.

Example

1
2
3
4
5
6
from mskpp import vbrcb, Tensor
ub_x, ub_y = Tensor("UB"), Tensor("UB")
gm_x = Tensor("GM")
broadcast_num = 16
ub_x.load(gm_x)
out = vbrcb(ub_x, ub_y, broadcast_num)()