TPARTMIN
Tile Operation Diagram
Introduction
Performs elementwise minimum selection over the destination valid region. When both src0 and src1 are valid at an element, the result is min(src0, src1); when only one input is valid there, the result copies that input value. Handling of other mismatched-validity cases is implementation-defined.
Math Interpretation
For each element (i, j) in the destination valid region:
dsti,j={min(src0i,j,src1i,j)if both inputs are defined at (i,j)src0i,jif only src0 is defined at (i,j)src1i,jif only src1 is defined at (i,j)\mathrm{dst}_{i,j} = \begin{cases} \min(\mathrm{src0}_{i,j}, \mathrm{src1}_{i,j}) & \text{if both inputs are defined at } (i,j) \\ \mathrm{src0}_{i,j} & \text{if only src0 is defined at } (i,j) \\ \mathrm{src1}_{i,j} & \text{if only src1 is defined at } (i,j) \end{cases}
Assembly Syntax
Synchronous form:
%dst = tpartmin %src0, %src1 : !pto.tile<...> -> !pto.tile<...>
AS Level 1 (SSA)
%dst = pto.tpartmin %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2 (DPS)
pto.tpartmin 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 TPARTMIN(TileDataDst &dst, TileDataSrc0 &src0, TileDataSrc1 &src1, WaitEvents &... events);
Constraints
General constraints / checks
dst,src0, andsrc1must use the same element type.- The destination valid region defines the result domain.
- For each element in the destination valid region:
- if both inputs are valid, the instruction applies the elementwise minimum;
- if only one input is valid, the result copies that input value.
- If
dsthas a zero valid region, the instruction returns early. - Supported partial-validity patterns require at least one source tile to have a valid region exactly equal to
dst, while the other source tile's valid region must not exceeddstin either dimension. - Handling of any validity pattern not explicitly listed above is implementation-defined.
A2A3 implementation checks
- Supported element types:
int32_t,int16_t,half,float. dst,src0, andsrc1must all be row-major (isRowMajor).
A5 implementation checks
- Supported element types:
int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,half,bfloat16_t,float.
Examples
Auto
#include <pto/pto-inst.hpp>
using namespace pto;
void example_auto() {
using TileT = Tile<TileType::Vec, float, 16, 16>;
TileT src0, src1, dst;
TPARTMIN(dst, src0, src1);
}
Manual
#include <pto/pto-inst.hpp>
using namespace pto;
void example_manual() {
using TileT = Tile<TileType::Vec, float, 16, 16>;
TileT src0, src1, dst;
TASSIGN(src0, 0x1000);
TASSIGN(src1, 0x2000);
TASSIGN(dst, 0x3000);
TPARTMIN(dst, src0, src1);
}
ASM Form Examples
Auto Mode
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tpartmin %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.tpartmin %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
PTO Assembly Form
%dst = tpartmin %src0, %src1 : !pto.tile<...> -> !pto.tile<...>
# AS Level 2 (DPS)
pto.tpartmin ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)