TROWEXPAND¶
Tile Operation Diagram¶
Introduction¶
Broadcast the first element of each source row across the destination row.
Math Interpretation¶
Let R = dst.GetValidRow() and C = dst.GetValidCol(). For 0 <= i < R and 0 <= j < C:
\[ \mathrm{dst}_{i,j} = \mathrm{src}_{i,0} \]
Assembly Syntax¶
PTO-AS form: see PTO-AS Specification.
Synchronous form:
%dst = trowexpand %src : !pto.tile<...> -> !pto.tile<...>
IR Level 1 (SSA)¶
%dst = pto.trowexpand %src : !pto.tile<...> -> !pto.tile<...>
IR Level 2 (DPS)¶
pto.trowexpand ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
C++ Intrinsic¶
Declared in include/pto/common/pto_instr.hpp:
template <typename TileDataDst, typename TileDataSrc, typename... WaitEvents>
PTO_INST RecordEvent TROWEXPAND(TileDataDst& dst, TileDataSrc& src, WaitEvents&... events);
Constraints¶
Implementation checks (NPU):
- Tile Type:
dstandsrcmust beTileType::Vec. - Tile layout: ND fractal (
isRowMajorandSLayout::NoneBox) for bothsrcanddst. - Data type: A2A3/A5 element types must be one of:
int8_toruint8_torint16_toruint16_torint32_toruint32_torhalforbfloat16_torfloat. - Runtime valid checks:
- A2A3: returns early if any of
dstValidRow,dstValidCol,srcValidRow,srcValidColis zero. - A5: asserts
srcValidRow == dstValidRowand assertssrcValidRow != 0 && srcValidCol != 0.
Examples¶
Auto¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example_auto() {
using SrcT = Tile<TileType::Vec, float, 16, 16>;
using DstT = Tile<TileType::Vec, float, 16, 16>;
SrcT src;
DstT dst;
TROWEXPAND(dst, src);
}
Manual¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example_manual() {
using SrcT = Tile<TileType::Vec, float, 16, 16>;
using DstT = Tile<TileType::Vec, float, 16, 16>;
SrcT src;
DstT dst;
TASSIGN(src, 0x1000);
TASSIGN(dst, 0x2000);
TROWEXPAND(dst, src);
}
ASM Form Examples¶
Auto Mode¶
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.trowexpand %src : !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.trowexpand %src : !pto.tile<...> -> !pto.tile<...>
PTO Assembly Form¶
%dst = trowexpand %src : !pto.tile<...> -> !pto.tile<...>
# IR Level 2 (DPS)
pto.trowexpand ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)