TCOLPROD
Instruction Diagram
Introduction
Reduces each column by multiplying across rows.
Mathematical Semantics
Assume R = src.GetValidRow() and C = src.GetValidCol(). For 0 <= j < C:
Assembly Syntax
Synchronous form:
%dst = tcolprod %src : !pto.tile<...> -> !pto.tile<...>AS Level 1 (SSA)
%dst = pto.tcolprod %src : !pto.tile<...> -> !pto.tile<...>AS Level 2 (DPS)
pto.tcolprod ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)C++ Built-in APIs
Declared in include/pto/common/pto_instr.hpp:
The public include header is
<pto/pto-inst.hpp>, and the internal declaration is located inpto/common/pto_instr.hpp.
template <typename TileDataOut, typename TileDataIn, typename... WaitEvents>
PTO_INST RecordEvent TCOLPROD(TileDataOut &dst, TileDataIn &src, WaitEvents &... events);Constraints
General Constraints or Checks
dstandsrcmust beTileType::Vec.dstandsrcmust use the standard ND layout: row-major and non-fractal (BLayout::RowMajor,SLayout::NoneBox).dstandsrcmust have the same element type.- Runtime check:
src.GetValidCol() == dst.GetValidCol()
- If
src.GetValidRow() == 0orsrc.GetValidCol() == 0, the implementation returns directly.
Implementation Check for Atlas A2/A3 Training Products/Atlas A2/A3 Inference Products
- Supported element types:
half,float,int16_t,int32_t.
Ascend 950PR/Ascend 950DT Implementation Check
- Supported element types:
half,float,bfloat16_t,int16_t,uint16_t,int32_t,uint32_t.
Examples
Automatic
#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;
TCOLPROD(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);
TCOLPROD(dst, src);
}ASM Examples
Automatic Mode
# Automatic mode: the compiler/runtime is responsible for resource placement and scheduling.
%dst = pto.tcolprod %src : !pto.tile<...> -> !pto.tile<...>Manual Mode
# Manual mode: explicitly bind resources first, then issue the instruction.
# Optional (when the instruction contains tile operands):
# pto.tassign %arg0, @tile(0x1000)
# pto.tassign %arg1, @tile(0x2000)
%dst = pto.tcolprod %src : !pto.tile<...> -> !pto.tile<...>PTO Assembly Form
%dst = tcolprod %src : !pto.tile<...> -> !pto.tile<...>
# AS Level 2 (DPS)
pto.tcolprod ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)