BitwiseOr

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Performs a bitwise OR operation on two inputs.

Prototype

1
2
template <const BitwiseOrConfig& config = DEFAULT_BITWISE_OR_CONFIG, typename T>
__aicore__ inline void BitwiseOr(const LocalTensor<T>& dst, const LocalTensor<T>& src0, const LocalTensor<T>& src1, const uint32_t count)

Parameters

Table 1 Template parameters

Parameter

Description

config

BitwiseOr algorithm configuration. This is an optional parameter of the BitwiseOrConfig type. The code below describes the definition.

isReuseSource: This parameter is reserved. Pass the default value false.

T

Data type of the source and destination operands.

For the Atlas 350 Accelerator Card, the supported data types are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, and uint64_t.

1
2
3
struct BitwiseOrConfig {
    bool isReuseSource;
};
Table 2 Parameters

Parameter

Type

Description

dst

Output

Destination operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

src0, src1

Input

Source operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The source and destination operands must have the same data type.

count

Input

Number of elements involved in the computation.

Returns

None

Constraints

  • The source operand address must not overlap the destination operand address.
  • For details about the alignment requirements of the operand address offset, see General Description and Restrictions.

Examples

For details about a complete example, see bitwiseor operator sample.
1
2
3
4
AscendC::LocalTensor<uint32_t> src0, src1;
AscendC::LocalTensor<uint32_t> dst;
uint32_t count = 512; // Number of elements involved in computation
AscendC::BitwiseOr(dst, src0, src1, 512);

Result example:

1
2
3
4
5
6
Input (src0):
[-111, -83, 95, -52, ... -102]
Input (src1):
[64, -44, 45, -117, ... -107]
Input (dst):
[-47, -3, 127, -49, ... -97]