TSHL
Instruction Diagram
Introduction
Performs element-wise left shift on two tiles.
Mathematical Semantics
For each element (i, j) in the valid region:
$$ \mathrm{dst}_{i,j} = \mathrm{src0}_{i,j} \ll \mathrm{src1}_{i,j} $$
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 TileDataDst, typename TileDataSrc0, typename TileDataSrc1, typename... WaitEvents>
PTO_INST RecordEvent TSHL(TileDataDst &dst, TileDataSrc0 &src0, TileDataSrc1 &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,int32_t,int64_t, anduint64_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
- Implementation check (A6):
- The supported element types are
uint8_t,int8_t,uint16_t,int16_t,uint32_t,int32_t,int64_t, anduint64_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 shift amount (
src1) is interpreted as a signed number: a negative value reverses the shift direction (shifting right by|src1|). - For
int64_tanduint64_t, the actual shift amount issrc1 & 63.
- The supported element types are
- Valid region:
- The operation uses
dst.GetValidRow()/dst.GetValidCol()as the iteration domain.
- The operation 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;
TSHL(out, x, sh);
}