vcpadd

Function

vcpadd instruction abstraction.

Calculates the sum of n and n+1 of the input x vector, and writes the result back to y. n is an even index. reduce_num controls the output type.

Prototype

1
class vcpadd(x, y, reduce_num)

Parameters

Parameter

Input/Output

Data Type

Description

x

Input

Tensor variable

Input x-vector tensor. fp16 and fp32 are supported.

y

Output

Tensor variable

Output y-vector tensor. fp16 and fp32 are supported.

reduce_num

Input

int

Reduction multiple of the shape.

Example

1
2
3
4
5
6
from mskpp import vcpadd, Tensor
ub_x, ub_y = Tensor("UB"), Tensor("UB")
gm_x, gm_y = Tensor("GM"), Tensor("GM")
ub_x.load(gm_x)
ub_y.load(gm_y)
out = vcpadd(ub_x, ub_y, reduce_num)()