TOR
Instruction Diagram
Introduction
Performs element-wise bitwise OR on two tiles.
Mathematical Semantics
For each element (i, j) in the valid region:
Assembly Syntax
Synchronous form:
%dst = tor %src0, %src1 : !pto.tile<...>AS Level 1 (SSA)
%dst = pto.tor %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>AS Level 2 (DPS)
pto.tor ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)C++ Built-in APIs
Declared in include/pto/common/pto_instr.hpp:
The public include header is
<pto/pto-inst.hpp>, and the internal declaration is located inpto/common/pto_instr.hpp.
template <typename TileData, typename... WaitEvents>
PTO_INST RecordEvent TOR(TileData &dst, TileData &src0, TileData &src1, WaitEvents &... events);Constraints
- Implementation check (Atlas A2/A3 training products/Atlas A2/A3 inference products):
- The supported element types are
uint8_t,int8_t,uint16_t,int16_t,uint32_t, andint32_t. dst,src0, andsrc1must use the same element type.dst,src0, andsrc1must be Row-Major.- Runtime:
src0.GetValidRow()/GetValidCol()andsrc1.GetValidRow()/GetValidCol()must be consistent withdst.
- The supported element types are
- Implementation check (Ascend 950PR/Ascend 950DT):
- The supported element types are
uint8_t,int8_t,uint16_t,int16_t,uint32_t, andint32_t(consistent with Atlas A2/A3 training products/Atlas A2/A3 inference products). dst,src0, andsrc1must use the same element type.dst,src0, andsrc1must be row-major.- Runtime:
src0.GetValidRow()/GetValidCol()andsrc1.GetValidRow()/GetValidCol()must be consistent withdst.
- The supported element types are
- Valid region:
- This operation uses
dst.GetValidRow()/dst.GetValidCol()as the iteration domain.
- This operation uses
Examples
#include <pto/pto-inst.hpp>
using namespace pto;
void example() {
using TileT = Tile<TileType::Vec, int32_t, 16, 16>;
TileT a, b, out;
TOR(out, a, b);
}ASM Examples
Automatic Mode
# Automatic mode: the compiler/runtime is responsible for resource placement and scheduling.
%dst = pto.tor %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>Manual Mode
# Manual mode: Explicitly bind resources first, then issue the instruction.
# Optional (when the instruction contains tile operands):
# pto.tassign %arg0, @tile(0x1000)
# pto.tassign %arg1, @tile(0x2000)
%dst = pto.tor %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>PTO Assembly Form
%dst = tor %src0, %src1 : !pto.tile<...>
# AS Level 2 (DPS)
pto.tor ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)