TSHR
Tile Operation Diagram
Introduction
Elementwise shift-right of two tiles.
Math Interpretation
For each element (i, j) in the valid region:
dsti,j=src0i,j≫src1i,j\mathrm{dst}_{i,j} = \mathrm{src0}_{i,j} \gg \mathrm{src1}_{i,j}
Assembly Syntax
Synchronous form:
%dst = tshr %src0, %src1 : !pto.tile<...>
AS Level 1 (SSA)
%dst = pto.tshr %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2 (DPS)
pto.tshr 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 TileDataDst, typename TileDataSrc0, typename TileDataSrc1, typename... WaitEvents>
PTO_INST RecordEvent TSHR(TileDataDst &dst, TileDataSrc0 &src0, TileDataSrc1 &src1, WaitEvents &... events);
Constraints
- Implementation checks (A2A3):
- 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 matchdst.
- Supported element types are
- Implementation checks (A5):
- 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 matchdst.
- Supported element types are
- 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, uint32_t, 16, 16>;
TileT x, sh, out;
TSHR(out, x, sh);
}
ASM Form Examples
Auto Mode
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tshr %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
Manual Mode
# Manual mode: resources must be bound explicitly before issuing the instruction.
# Optional for tile operands:
# pto.tassign %arg0, @tile(0x1000)
# pto.tassign %arg1, @tile(0x2000)
%dst = pto.tshr %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
PTO Assembly Form
%dst = tshr %src0, %src1 : !pto.tile<...>
# AS Level 2 (DPS)
pto.tshr ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)