TNEG

指令示意图

TNEG tile operation

简介

Tile 的逐元素取负。

数学语义

对每个元素 (i, j) 在有效区域内:

\[ \mathrm{dst}_{i,j} = -\mathrm{src}_{i,j} \]

汇编语法

PTO-AS 形式:参见 PTO-AS Specification.

同步形式:

%dst = tneg %src : !pto.tile<...>

AS Level 1 (SSA)

%dst = pto.tneg %src : !pto.tile<...> -> !pto.tile<...>

AS Level 2 (DPS)

pto.tneg ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)

AS Level 1(SSA)

%dst = pto.tneg %src : !pto.tile<...> -> !pto.tile<...>

AS Level 2(DPS)

pto.tneg ins(%src : !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)

C++ 内建接口

声明于 include/pto/common/pto_instr.hpp:

template <typename TileDataDst, typename TileDataSrc, typename... WaitEvents>
PTO_INST RecordEvent TNEG(TileDataDst &dst, TileDataSrc &src, WaitEvents &... events);

约束

  • The op iterates over dst.GetValidRow() / dst.GetValidCol().

示例

#include <pto/pto-inst.hpp>

using namespace pto;

void example() {
  using TileT = Tile<TileType::Vec, float, 16, 16>;
  TileT x, out;
  TNEG(out, x);
}