TAND¶
Tile Operation Diagram¶
Introduction¶
Elementwise bitwise AND of two tiles.
Math Interpretation¶
For each element (i, j) in the valid region:
\[ \mathrm{dst}_{i,j} = \mathrm{src0}_{i,j} \;\&\; \mathrm{src1}_{i,j} \]
Assembly Syntax¶
PTO-AS form: see PTO-AS Specification.
Synchronous form:
%dst = tand %src0, %src1 : !pto.tile<...>
AS Level 1 (SSA)¶
%dst = pto.tand %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2 (DPS)¶
pto.tand ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
C++ Intrinsic¶
Declared in include/pto/common/pto_instr.hpp:
template <typename TileData, typename... WaitEvents>
PTO_INST RecordEvent TAND(TileData &dst, TileData &src0, TileData &src1, WaitEvents &... events);
Constraints¶
- Implementation checks (A2A3):
- Supported element types are 1-byte or 2-byte integral types.
dst,src0, andsrc1must use the same element type.dst,src0, andsrc1must be row-major.- Runtime:
src0.GetValidRow()/GetValidCol()andsrc1.GetValidRow()/GetValidCol()must matchdst.
- Implementation checks (A5):
- Supported element types are 1-byte, 2-byte, or 4-byte integral types.
dst,src0, andsrc1must use the same element type.dst,src0, andsrc1must be row-major.- Runtime:
src0.GetValidRow()/GetValidCol()andsrc1.GetValidRow()/GetValidCol()must matchdst.
- Valid region:
- The op uses
dst.GetValidRow()/dst.GetValidCol()as the iteration domain.
- The op 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;
TAND(out, a, b);
}
ASM Form Examples¶
Auto Mode¶
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tand %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
Manual Mode¶
# Manual mode: bind resources explicitly before issuing the instruction.
# Optional for tile operands:
# pto.tassign %arg0, @tile(0x1000)
# pto.tassign %arg1, @tile(0x2000)
%dst = pto.tand %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
PTO Assembly Form¶
%dst = tand %src0, %src1 : !pto.tile<...>
# AS Level 2 (DPS)
pto.tand ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)