pto.tcolexpandmax¶
pto.tcolexpandmax is part of the Reduce And Expand instruction set.
Summary¶
Column-wise broadcast max with per-column scalar vector.
Mechanism¶
Column-wise broadcast max: take max(src0, src1) where src1 provides one scalar per column.
Let R = dst.GetValidRow() and C = dst.GetValidCol(). Let s_j be the per-column scalar taken from src1 (one value per column).
For 0 <= i < R and 0 <= j < C:
Syntax¶
Textual spelling is defined by the PTO ISA syntax-and-operands pages.
Synchronous form:
%dst = tcolexpandmax %src0, %src1 : !pto.tile<...>, !pto.tile<...> -> !pto.tile<...>
AS Level 1 (SSA)¶
%dst = pto.tcolexpandmax %src0, %src1 : !pto.tile<...>, !pto.tile<...> -> !pto.tile<...>
AS Level 2 (DPS)¶
pto.tcolexpandmax 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 TCOLEXPANDMAX(TileDataDst &dst, TileDataSrc0 &src0, TileDataSrc1 &src1, WaitEvents &... events);
Inputs¶
src0is the first source tile (the tile to be modified).src1is the second source tile providing per-column scalar values.dstnames the destination tile. The operation iterates over dst's valid region.
Expected Outputs¶
dst[i,j] = max(src0[i,j], src1[0,j]) (column-wise broadcast max of per-column scalar).
Side Effects¶
No architectural side effects beyond producing the destination tile. Does not implicitly fence unrelated traffic.
Constraints¶
Constraints
-
TileDataDst::DType,TileDataSrc1::DTypemust be one of:half,float. -
Tile shape/layout constraint (compile-time):
TileDataDst::isRowMajor. -
src1is expected to provide one scalar per column (i.e., its valid shape must coverCvalues). -
Exact layout/fractal constraints are target-specific; see backend headers under
include/pto/npu/*/TColExpand*.hpp.
Exceptions¶
Exceptions
- Illegal operand tuples, unsupported types, invalid layout combinations, or unsupported target-profile modes are rejected by the verifier or by the selected backend instruction set.
- Programs must not rely on behavior outside the documented legal domain of this operation, even if one backend currently accepts it.
Target-Profile Restrictions¶
Target-Profile Restrictions
-
pto.tcolexpandmaxpreserves PTO-visible semantics across CPU simulation, A2/A3-class targets, and A5-class targets, but concrete support subsets may differ by profile. -
Portable code must rely only on the documented type, layout, shape, and mode combinations that the selected target profile guarantees.
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>;
using ColVecT = Tile<TileType::Vec, float, 1, 16, BLayout::RowMajor>;
SrcT src0;
DstT dst;
ColVecT src1;
// Col-expand-max: each column of dst = max(src0.col, src1.col_scalar)
TCOLEXPANDMAX(dst, src0, src1);
}
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>;
using ColVecT = Tile<TileType::Vec, float, 1, 16, BLayout::RowMajor>;
SrcT src0;
DstT dst;
ColVecT src1;
TASSIGN(src0, 0x1000);
TASSIGN(dst, 0x2000);
TASSIGN(src1, 0x3000);
// Col-expand-max in manual mode
TCOLEXPANDMAX(dst, src0, src1);
}
Auto Mode¶
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tcolexpandmax %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.tcolexpandmax %src0, %src1 : !pto.tile<...>, !pto.tile<...> -> !pto.tile<...>
PTO Assembly Form¶
%dst = tcolexpandmax %src0, %src1 : !pto.tile<...>, !pto.tile<...> -> !pto.tile<...>
# AS Level 2 (DPS)
pto.tcolexpandmax ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
Related Ops / Instruction Set Links¶
- Instruction set overview: Reduce And Expand
- Previous op in instruction set: pto.tcolexpandadd
- Next op in instruction set: pto.tcolexpandmin