TTRI¶
指令示意图¶
简介¶
生成三角(下/上)掩码 Tile。
数学语义¶
Let R = dst.GetValidRow() and C = dst.GetValidCol(). Let d = diagonal.
Lower-triangular (isUpperOrLower=0) conceptually produces:
\[
\mathrm{dst}_{i,j} = \begin{cases}1 & j \le i + d \\\\ 0 & \text{otherwise}\end{cases}
\]
Upper-triangular (isUpperOrLower=1) conceptually produces:
\[
\mathrm{dst}_{i,j} = \begin{cases}0 & j < i + d \\\\ 1 & \text{otherwise}\end{cases}
\]
汇编语法¶
PTO-AS 形式:参见 PTO-AS Specification.
AS Level 1 (SSA)¶
%dst = pto.ttri %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2 (DPS)¶
pto.ttri ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
AS Level 1(SSA)¶
%dst = pto.ttri %src0, %src1 : (!pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2(DPS)¶
pto.ttri ins(%src0, %src1 : !pto.tile_buf<...>, !pto.tile_buf<...>) outs(%dst : !pto.tile_buf<...>)
C++ 内建接口¶
声明于 include/pto/common/pto_instr.hpp:
template <typename TileData, int isUpperOrLower, typename... WaitEvents>
PTO_INST RecordEvent TTRI(TileData &dst, int diagonal, WaitEvents &... events);
约束¶
isUpperOrLowermust be0(lower) or1(upper).- Destination tile must be row-major on some targets (see
include/pto/npu/*/TTri.hpp).
示例¶
See related examples in docs/isa/ and docs/coding/tutorials/.