TCOLMIN¶
Tile Operation Diagram¶
Introduction¶
Reduce each column by taking the minimum across rows.
Math Interpretation¶
Let R = src.GetValidRow() and C = src.GetValidCol(). For 0 <= j < C:
\[ \mathrm{dst}_{0,j} = \min_{0 \le i < R} \mathrm{src}_{i,j} \]
Assembly Syntax¶
PTO-AS form: see PTO-AS Specification.
Synchronous form:
%dst = tcolmin %src : !pto.tile<...> -> !pto.tile<...>
IR Level 1 (SSA)¶
%dst = pto.tcolmin %src : !pto.tile<...> -> !pto.tile<...>
IR Level 2 (DPS)¶
pto.tcolmin ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
C++ Intrinsic¶
Declared in include/pto/common/pto_instr.hpp:
template <typename TileDataOut, typename TileDataIn, typename... WaitEvents>
PTO_INST RecordEvent TCOLMIN(TileDataOut& dst, TileDataIn& src, WaitEvents&... events);
Constraints¶
Implementation checks (NPU):
- Tile location:
dstandsrcmust beTileType::Vec. - Tile layout: both tiles must be ND fractal (
isRowMajorandSLayout::NoneBox). - Data types:
- A2A3:
half,float,int16_t,int32_t. - A5:
half,float,int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,bfloat16_t. - DType consistency:
dst.DType == src.DType. - Runtime valid checks:
src.GetValidCol() == dst.GetValidCol().- If
src.GetValidRow() == 0orsrc.GetValidCol() == 0, the implementation returns early.
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, 1, 16>;
SrcT src;
DstT dst;
TCOLMIN(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, 1, 16>;
SrcT src;
DstT dst;
TASSIGN(src, 0x1000);
TASSIGN(dst, 0x2000);
TCOLMIN(dst, src);
}
ASM Form Examples¶
Auto Mode¶
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tcolmin %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.tcolmin %src : !pto.tile<...> -> !pto.tile<...>
PTO Assembly Form¶
%dst = tcolmin %src : !pto.tile<...> -> !pto.tile<...>
# IR Level 2 (DPS)
pto.tcolmin ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)