pto.tdequant¶
pto.tdequant is part of the Irregular and Complex tile instruction family.
Summary¶
Dequantize an integer tile into a floating-point tile using per-row scale and offset tiles.
Mechanism¶
pto.tdequant converts a quantized source tile back into floating-point form. In the current repo surface, the destination tile is floating-point, the source tile is integer, and the scale / offset tiles provide one parameter value per destination row.
For each lane (r, c) in the destination valid region:
The operation iterates over the destination valid region. scale and offset are broadcast across columns within a row.
Syntax¶
AS Level 1 (SSA)¶
%dst = pto.tdequant %src, %scale, %offset : (!pto.tile<...>, !pto.tile<...>, !pto.tile<...>) -> !pto.tile<...>
AS Level 2 (DPS)¶
pto.tdequant ins(%src, %scale, %offset : !pto.tile_buf<...>, !pto.tile_buf<...>, !pto.tile_buf<...>)
outs(%dst : !pto.tile_buf<...>)
C++ Intrinsic¶
Declared in include/pto/common/pto_instr.hpp:
template <typename TileDataDst, typename TileDataSrc, typename TileDataPara, typename... WaitEvents>
PTO_INST RecordEvent TDEQUANT(TileDataDst &dst, TileDataSrc &src, TileDataPara &scale, TileDataPara &offset,
WaitEvents &... events);
Inputs¶
| Operand | Role | Description |
|---|---|---|
dst |
Destination tile | Floating-point output tile |
src |
Source tile | Quantized integer tile |
scale |
Parameter tile | Per-row scale values broadcast across columns |
offset |
Parameter tile | Per-row offset values broadcast across columns |
Expected Outputs¶
dst contains the dequantized floating-point values for all lanes in its valid region.
Side Effects¶
No architectural side effects beyond producing the destination tile. Does not implicitly fence unrelated traffic.
Constraints¶
Constraints
dstandsrcmust have matching valid-row and valid-column extents.scaleandoffsetmust have row counts matchingdst.GetValidRow().- In this repo surface,
dstisfloat/float32_t. - In this repo surface,
srcisint8_torint16_t. - In this repo surface,
scaleandoffsetuse the same floating-point element type asdst. - Current concrete implementations require row-major tiles.
Exceptions¶
Exceptions
- Unsupported type pairs, incompatible layouts, or mismatched valid regions are rejected by the backend checks.
- Programs must not assume column-wise scale or offset variation unless a target profile explicitly documents it.
Target-Profile Restrictions¶
Target-Profile Restrictions
| Feature | CPU Simulator | A2/A3 | A5 |
|---|---|---|---|
float <- int8_t |
Yes | Yes | Yes |
float <- int16_t |
Yes | Yes | Yes |
| Row-major tiles | Yes | Yes | Yes |
This checkout contains concrete implementations for CPU simulation, A2/A3, and A5.
Examples¶
Auto¶
#include <pto/pto-inst.hpp>
using namespace pto;
void example() {
using DstTile = Tile<TileType::Vec, float, 64, 64, BLayout::RowMajor>;
using SrcTile = Tile<TileType::Vec, int8_t, 64, 64, BLayout::RowMajor>;
using ParaTile = Tile<TileType::Vec, float, 64, 1, BLayout::ColMajor>;
DstTile dst;
SrcTile src;
ParaTile scale;
ParaTile offset;
TDEQUANT(dst, src, scale, offset);
}