Scalar Parameters and Enums
【免费下载链接】pto-isaParallel Tile Operation (PTO) is a virtual instruction set architecture designed by Ascend CANN, focusing on tile-level operations. This repository offers high-performance, cross-platform tile operations across Ascend platforms.项目地址: https://gitcode.com/cann/pto-isa
Many PTO intrinsics take scalar parameters in addition to tiles (e.g., comparison modes, rounding modes, atomic modes, or literal constants).
This document summarizes the scalar/enumeration types that appear in the public intrinsics ininclude/pto/common/pto_instr.hpp.
Scalar values
Some instructions take scalar values as plain C++ types:
TADDS/TMULS/TDIVS/TEXPANDS: scalar isTileData::DType.TMINS: scalar is a template typeTand must be convertible to the tile element type.TCI: scalarSis a template typeTand must matchTileData::DType(enforced bystatic_assertin the implementation).
PTO ISA type mnemonics (reference)
ISA documentation uses short type mnemonics (e.g.,fp16,s8) when describing instruction semantics. Backends may support only a subset at any given time; seeinclude/README.mdfor implementation status.
Integer types
| Kind | Mnemonics |
|---|---|
| Signed | s4,s8,s16,s32,s64 |
| Unsigned | u4,u8,u16,u32,u64 |
Floating-point types
| Kind | Mnemonics |
|---|---|
| 4-bit float families | fp4,hif4,mxfp4 |
| 8-bit float families | fp8,hif8,mxfp8 |
| 16-bit float families | bf16,fp16 |
| 32-bit float families | tf32,hf32,fp32 |
| 64-bit float | fp64 |
Bit-width (typeless) values
| Kind | Mnemonics |
|---|---|
| Typeless bits | b4,b8,b16,b32,b64 |
Compatibility rules (ISA convention)
Two mnemonics are considered compatible when they have the same bit-width, and either:
- they are the same kind, or
- they are signed vs unsigned integers of the same width, or
- one side is a typeless bits type (
b*) of the same width.
These are documentation-level rules used to describe instruction legality. Individual instructions may further restrict types.
Core enums
All enums below are available via#include <pto/pto-inst.hpp>.
pto::RoundMode
Defined ininclude/pto/common/constants.hpp. Used byTCVTto specify rounding behavior (e.g.,RoundMode::CAST_RINT).
pto::CmpMode
Defined ininclude/pto/common/type.hpp. Used byTCMPS(andTCMP) for per-element comparisons (EQ/NE/LT/GT/GE/LE).
pto::MaskPattern
Defined ininclude/pto/common/type.hpp. Used by the mask-patternTGATHERvariant to select a predefined 0/1 mask pattern.
pto::AtomicType
Defined ininclude/pto/common/constants.hpp. Used as the template parameter toTSTORE<..., AtomicType::AtomicAdd>(orAtomicNone).
pto::AccToVecModeandpto::ReluPreMode
Defined ininclude/pto/common/constants.hpp. Used byTMOVoverloads when moving from accumulator tiles with optional quantization and/or ReLU behavior.
pto::PadValue
Defined ininclude/pto/common/constants.hpp. Part of theTile<...>template and used by some implementations to define how out-of-valid regions are treated (e.g., select/copy/pad paths).
Example
#include <pto/pto-inst.hpp> using namespace pto; void example(Tile<TileType::Vec, float, 16, 16>& dst, Tile<TileType::Vec, float, 16, 16>& src) { TCVT(dst, src, RoundMode::CAST_RINT); TMINS(dst, src, 0.0f); }【免费下载链接】pto-isaParallel Tile Operation (PTO) is a virtual instruction set architecture designed by Ascend CANN, focusing on tile-level operations. This repository offers high-performance, cross-platform tile operations across Ascend platforms.项目地址: https://gitcode.com/cann/pto-isa
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考