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:
$$ \mathrm{dst}_{0,j} = \prod_{i=0}^{R-1} \mathrm{src}_{i,j} $$
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).- The element types of
dstandsrcmust be consistent. - Runtime checks:
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);
}