vcmp_xxx

Function

vcmp_[eq|ge|gt|le|lt|ne] instruction abstraction. The following six instructions have the same performance.

vcmp_eq: z = (x == y), where z can be obtained when x is equal to y by element-wise comparison.

vcmp_ge: z = (x >= y), where z can be obtained when x is greater than or equal to y by element-wise comparison.

vcmp_gt: z = (x > y), where z can be obtained when x is greater than y by element-wise comparison.

vcmp_le: z = (x <= y), where z can be obtained when x is less than or equal to y by element-wise comparison.

vcmp_lt: z = (x < y), where z can be obtained when x is smaller than y by element-wise comparison.

vcmp_ne: z = (x != y), where z can be obtained when x is not equal to y by element-wise comparison.

Prototype

1
class vcmp(x, y)

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.

Constraints

The tensors of all input and output data of vector instructions are in the UB space, and their shapes must be the same.

Example

1
2
3
4
5
6
from mskpp import vcmp, 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 = vcmp(ub_x, ub_y)()