TFMOD¶
Tile Operation Diagram¶
Introduction¶
Elementwise floor of two tiles.
Math Interpretation¶
For each element (i, j) in the valid region:
\[\mathrm{dst}_{i,j} = \mathrm{fmod}(\mathrm{src0}_{i,j}, \mathrm{src1}_{i,j})\]
Assembly Syntax¶
PTO-AS form: see PTO-AS Specification.
Synchronous form:
%dst = tfmod %src0, %src1 : !pto.tile<...>
IR Level 1 (SSA)¶
%dst = pto.tfmod %src0, %src1 : !pto.tile<...>
IR Level 2 (DPS)¶
pto.tfmod ins(%src0, %src1 : !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 TFMOD(TileDataDst &dst, TileDataSrc0 &src0, TileDataSrc1 &src1, WaitEvents&... events);
Constraints¶
- The op iterates over
dst.GetValidRow()/dst.GetValidCol(). - Division-by-zero behavior is target-defined; the CPU simulator asserts in debug builds.
Examples¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example() {
using TileT = Tile<TileType::Vec, int32_t, 16, 16>;
TileT out, a, b;
TFMOD(out, a, b);
}
ASM Form Examples¶
Auto Mode¶
# Auto mode: compiler/runtime-managed placement and scheduling.
%dst = pto.tfmod %src0, %src1 : !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.tfmod %src0, %src1 : !pto.tile<...>
PTO Assembly Form¶
%dst = tfmod %src0, %src1 : !pto.tile<...>
# IR Level 2 (DPS)
pto.tfmod ins(%src0, %src1 : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)