TCI¶
指令示意图¶
简介¶
生成连续整数序列到目标 Tile 中。
数学语义¶
For a linearized index k over the valid elements:
- Ascending:
$$ \mathrm{dst}_{k} = S + k $$
- Descending:
$$ \mathrm{dst}_{k} = S - k $$
The linearization order depends on the tile layout (implementation-defined).
汇编语法¶
PTO-AS 形式:参见 PTO-AS Specification.
同步形式:
%dst = tci %S {descending = false} : !pto.tile<...>
AS Level 1 (SSA)¶
%dst = pto.tci %scalar {descending = false} : dtype -> !pto.tile<...>
AS Level 2 (DPS)¶
pto.tci ins(%scalar {descending = false} : dtype) outs(%dst : !pto.tile_buf<...>)
AS Level 1(SSA)¶
%dst = pto.tci %scalar {descending = false} : dtype -> !pto.tile<...>
AS Level 2(DPS)¶
pto.tci ins(%scalar {descending = false} : dtype) outs(%dst : !pto.tile_buf<...>)
C++ 内建接口¶
声明于 include/pto/common/pto_instr.hpp:
template <typename TileData, typename T, int descending, typename... WaitEvents>
PTO_INST RecordEvent TCI(TileData &dst, T start, WaitEvents &... events);
约束¶
- 实现检查 (A2A3/A5):
TileData::DTypemust be exactly the same type as the scalar template parameterT.dst/scalarelement types must be identical, and must be one of:int32_t,uint32_t,int16_t,uint16_t.TileData::Cols != 1(this is the condition enforced by the implementation).
- 有效区域:
- The implementation uses
dst.GetValidCol()as the sequence length and does not consultdst.GetValidRow().
- The implementation uses
示例¶
自动(Auto)¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example_auto() {
using TileT = Tile<TileType::Vec, int32_t, 1, 16>;
TileT dst;
TCI<TileT, int32_t, /*descending=*/0>(dst, /*S=*/0);
}
手动(Manual)¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example_manual() {
using TileT = Tile<TileType::Vec, int32_t, 1, 16>;
TileT dst;
TASSIGN(dst, 0x1000);
TCI<TileT, int32_t, /*descending=*/1>(dst, /*S=*/100);
}