vcmp_xxx

Function

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

vcmp_eq: (x == y), where x is equal to y by element-wise comparison.

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

vcmp_gt: (x > y), where x is greater than y by element-wise comparison.

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

vcmp_lt: (x < y), where x is smaller than y by element-wise comparison.

vcmp_ne: (x != y), where 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)()