TCOLMIN

Instruction Diagram

Introduction

Reduces each column by taking the minimum value across rows.

Mathematical Semantics

Assume R = src.GetValidRow() and C = src.GetValidCol(). For 0 <= j < C:

$$ \mathrm{dst}_{0,j} = \min_{0 \le i < R} \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 in pto/common/pto_instr.hpp.

template <typename TileDataOut, typename TileDataIn, typename... WaitEvents>
PTO_INST RecordEvent TCOLMIN(TileDataOut &dst, TileDataIn &src, WaitEvents &... events);

Constraints

General Constraints or Checks

  • dst and src must be TileType::Vec.
  • dst and src must use the standard ND layout: row-major and non-fractal (BLayout::RowMajor, SLayout::NoneBox).
  • The element types of dst and src must be consistent.
  • Runtime checks:
    • src.GetValidCol() == dst.GetValidCol()
  • If src.GetValidRow() == 0 or src.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, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, bfloat16_t.

  • For int64_t / uint64_t: the output valid shape should be [1, src.GetValidCol()]; the physical Cols is a multiple of 4, and the valid column count does not need to be aligned. Only the valid result of row 0 is written, and the remaining physical padding is preserved.

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;
  TCOLMIN(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);
  TCOLMIN(dst, src);
}