vaxpy

Function

vaxpy instruction abstraction.

z = x × y + z. vaxpy calculates the product of vector x and scalar y, and adds the target address z. The output data type can be specified as FP32 by using if_mix.

Prototype

1
vaxpy(x, y, z, if_mix=False)

Parameters

Parameter

Input/Output

Data Type

Description

x

Input

Tensor variable

Input vector tensor. FP16, FP32, INT16, and INT32 are supported.

y

Input

Tensor variable

Input scalar. The program does not process this parameter.

z

Output

Tensor variable

Output vector tensor. FP16, FP32, INT16, and INT32 are supported.

if_mix

Input

Tensor variable

  • The default value is False.
  • If this parameter is set to True, the output data type is FP32.

Example

1
2
3
4
5
from mskpp import vaxpy, Tensor
ub_x, ub_z = Tensor("UB"), Tensor("UB")
gm_x = Tensor("GM")
ub_x.load(gm_x)
out = vaxpy(ub_x, ub_y, ub_z)()