‘hivm’ Dialect¶
HIVM (Hybrid Intelligence Virtual Machine) dialect.
Operations¶
hivm.hir.atomic_cas (hivm::AtomicCasOp)¶
Atomic Compare-And-Swap (CAS) Op
Syntax:
operation ::= `hivm.hir.atomic_cas` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`->` type($result_tensor)^)?
Compare-And-Swap (CAS) is an atomic operation that consists of three operands: Memory location (V), Expected old value (A), New value (B). The semantics of the operation are: the value of V is updated to B, only if the value of memory location V is equal to the expected old value A. The operation returns the original value of V regardless of whether it is updated or not.
Constraints:
The input memref and output memref must have the same rank and the same element type.
Arguments:
src0: expected old valuesrc1: new valuedst: memory location in GM
Examples:
hivm.hir.atomic_cas ins(%src0, %src1 : memref<?xf32>, memref<?xf32>) outs(%dst : memref<?xf32>)
%result = hivm.hir.atomic_cas ins(%src0, %src1 : tensor<?xf32>, tensor<?xf32>) outs(%dst : tensor<?xf32>) -> tensor<?xf32>
Operands¶
Operand |
Description |
|---|---|
|
variadic of Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
Tensor or Memref |
hivm.hir.atomic_rmw (hivm::AtomicRMWOp)¶
Atomic RMW Op
Syntax:
operation ::= `hivm.hir.atomic_rmw` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`atomic_kind` `=` $atomic_kind
(`->` type($result_tensor)^)?
Atomic exchange is an atomic operation that consists of three steps:
Read the current value of the specified memory address
Perform action on value depending on atomic_kind attr
Return the old value read previously The whole process is atomic, that is, it will not be interrupted by other threads during the operation.
Constraints:
The input memref and output memref must have the same rank and the same element type.
Arguments:
src: new valuedst: memory location in GM
Examples:
hivm.hir.atomic_rmw ins(%src : memref<?xf32>) outs(%dst : memref<?xf32>) atomic_kind = <add>
%result = hivm.hir.atomic_rmw ins(%src : tensor<?xf32>) outs(%dst : tensor<?xf32>) atomic_kind = <or> -> tensor<?xf32>
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
atomic_kind | ::mlir::hivm::AtomicKindAttr | Atomic Operation Kind for StoreOp{{% markdown %}} HIVM atomic store kind attribute. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
any type |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
Tensor or Memref |
hivm.hir.atomic_xchg (hivm::AtomicXchgOp)¶
Atomic Exchange Op
Syntax:
operation ::= `hivm.hir.atomic_xchg` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`mask` `(` $mask^ `:` type($mask) `)`)?
(`->` type($result_tensor)^)?
Atomic exchange is an atomic operation that consists of three steps:
Read the current value of the specified memory address
Write the new value to the memory address
Return the old value read previously The whole process is atomic, that is, it will not be interrupted by other threads during the operation.
Constraints:
The input memref and output memref must have the same rank and the same element type.
Arguments:
src: new valuedst: memory location in GMmask: mask the element
Examples:
hivm.hir.atomic_xchg ins(%src : memref<?xf32>) outs(%dst : memref<?xf32>)
%result = hivm.hir.atomic_cas ins(%src : tensor<?xf32>) outs(%dst : tensor<?xf32>) -> tensor<?xf32>
Operands¶
Operand |
Description |
|---|---|
|
any type |
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
Tensor or Memref |
hivm.hir.batchMmadL1 (hivm::BatchMmadL1Op)¶
Batch Matrix Multiply and Add Op with inputs from L1 memory hierarchy.
Syntax:
operation ::= `hivm.hir.batchMmadL1` attr-dict `ins` `(`
$a
`,` $b
`,` $init_condition
`,` $real_m
`,` $real_k
`,` $real_n
(`,` $per_channel_bias^)?
`:`
type($a)
`,` type($b)
`,` type($init_condition)
`,` type($real_m)
`,` type($real_k)
`,` type($real_n)
(`,` type($per_channel_bias)^)? `)`
`outs` `(` $c `:` type($c) `)`
(`sync_related_args` `(` $sync_related_args^ `:` type($sync_related_args) `)`)?
(`unit_flag` `[` $unit_flag_mode^ (`,` $unit_flag_cond^)? `]`)?
(`->` type($result_tensors)^)?
The computation logic is:
C = C + A x B + (optional) channel_bias
Note: the rank of A, B, and C Matrix must be three, where the 0-th dimension being the batch dimension.
Traits: AttrSizedOperandSegments, CubeCoreTypeTrait, MacroOpPipeTrait<PIPE::PIPE_MTE1, PIPE::PIPE_M>, MacroOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, HIVMUnitFlagEnabledInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
a_transpose | ::mlir::UnitAttr | unit attribute |
b_transpose | ::mlir::UnitAttr | unit attribute |
enable_HF32 | ::mlir::UnitAttr | unit attribute |
unit_flag_mode | ::mlir::hivm::UnitFlagAttr | {{% markdown %}} HIVM unit flag attribute for synchronization. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
1-bit signless integer |
|
index |
|
index |
|
index |
|
Tensor or Memref |
|
variadic of 64-bit signless integer |
|
1-bit signless integer |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.bitcast (hivm::BitcastOp)¶
Reinterprets the bits of a shaped value without changing data
Syntax:
operation ::= `hivm.hir.bitcast` $src `:` type($src) `->` type($result) attr-dict
The bitcast operation converts a tensor/memref from one element type to another
while preserving the underlying bit representation. The operation requires:
Same shape for input and output (2x3 != 3x2)
Same total bit-width (element_bitwidth * num_elements)
Same memory layout/strides (for memrefs)
Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultShape
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands¶
Operand |
Description |
|---|---|
|
any type |
Results¶
Result |
Description |
|---|---|
|
any type |
hivm.hir.convert_layout (hivm::ConvertLayoutOp)¶
HIVM layout conversion operation.
Syntax:
operation ::= `hivm.hir.convert_layout` $source attr-dict `:` functional-type(operands, results)
The convert_layout operation converts a memref with one layout
to another. The data is not copied or modified.
Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultElementType
Interfaces: ConditionallySpeculatable, InferCoreTypeInterface, NoMemoryEffect (MemoryEffectOpInterface), ViewLikeOpInterface
Effects: MemoryEffects::Effect{}
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
srcLayout | ::mlir::hivm::DataLayoutAttr | {{% markdown %}} HIVM data layout mapping attribute. Maps to DOTA_ND, DOTB_ND, DOTC_ND, zN, nZ and ND. - `transpose`: Indicates that the layout is transposed. Only valid and must be present for DOTA_ND and DOTB_ND layout. {{% /markdown %}} |
dstLayout | ::mlir::hivm::DataLayoutAttr | {{% markdown %}} HIVM data layout mapping attribute. Maps to DOTA_ND, DOTB_ND, DOTC_ND, zN, nZ and ND. - `transpose`: Indicates that the layout is transposed. Only valid and must be present for DOTA_ND and DOTB_ND layout. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
ranked or unranked memref of any type values |
Results¶
Result |
Description |
|---|---|
|
ranked or unranked memref of any type values |
hivm.hir.copy (hivm::CopyOp)¶
HIVM data copy operation
Syntax:
operation ::= `hivm.hir.copy` `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
attr-dict
(`pad_mode` `=` $pad_mode^)?
(`pad_value` `=` $pad_value^ `:` type($pad_value))?
(`collapse_reassociation` `=` $collapse_reassociation^)?
(`->` type($result_tensor)^)?
Copy the data between local memory hierarchies. Currently support:
UB to UB
UB to L1 (for Ascend910_95 series)
Examples:
hivm.hir.copy ins(%src : memref<16x16xf16, #hivm.address_space<ub>>) outs(%dst : memref<16x16xf16, #hivm.address_space<ub>>)
Constraints:
srcanddstare expected to have the same element type.If
pad_modeis not set,srcanddstshape should be the same.Only support left padding.
pad_valueshould have the same element type assrcanddst.
Non-contiguous reassociative reshape¶
hivm.hir.copy also supports copying non-contiguous data to contiguous storage, and vice versa.
This can be seen as “expanding” or “collapsing” the data. The collapse_reassociation attribute is used to
specify which axes are collapsed together.
For example:
hivm.hir.copy ins(%src : memref<32x4xbf16, strided<[16, 1]>>) outs(%dst : memref<32x4xbf16, strided<[4, 1]>>)
collapse_reassociation = [[0, 1]]
Means that the 0th and 1st axes are collapsed contiguously.
Traits: AlwaysSpeculatableImplTrait, SinglePipeOpTrait, UniformReassociationFlattenTrait
Interfaces: ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
pad_mode | ::mlir::hivm::PadModeAttr | {{% markdown %}} HIVM pad mode attribute. {{% /markdown %}} |
collapse_reassociation | ::mlir::ArrayAttr | Array of 64-bit integer array attributes |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
any type |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.create_sync_block_lock (hivm::CreateSyncBlockLockOp)¶
Create sync block lock operation.
Syntax:
operation ::= `hivm.hir.create_sync_block_lock` (`from` $lockArg^)?
attr-dict `:` (`from` type($lockArg)^ `to`)? type($memref)
The create_sync_block_lock operation allocates a region of lock memory,
which is used to make the code between lock and unlock execute in order among blocks.
Example:
hivm.hir.create_sync_block_lock() : memref<1xi64>
hivm.hir.create_sync_block_lock() from %arg : from memref<?xi8> to memref<1xi64>
Operands¶
Operand |
Description |
|---|---|
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
memref of any type values |
hivm.hir.custom (hivm::CustomOp)¶
_Custom operation is a generic op interface for users to write their own custom implementation.
Scenarios:
1. Existing operations could not fulfill the desired functionality.
2. Existing operations could fulfill the functionality, but overall performance is not optimal.
3. Desire for private operation._
General interface for custom op, where:
name : unique op name.
Note : there are names reserved for builtins, usually starts with "__builtin". Compiler will link these builtins to self-contained template library, which comes together within bishengir-compile. For normal names/cases, user needs to specify implementation location/compilation commands (TODO), and all the necessary information. Available builtin names: "__builtin_gather_load"inputs : input parameters.
outputs : output results, designated “init” operands, which act as initial values for the results of the operation or the init locations to which the results of the op will be written.
In order to adapt to future enhancements quickly and dynamically, custom op relies on attributes to retrieve necessary information, required information are:
CoreType : which core type to execute on, refer to TCoreTypeAttr.
Pipe : which pipe to execute on, refer to PipeAttr.
VFMode : which mode to run on vector units, refer to VFModeAttr. this attribute is ignored when core type is cube.
Note : for builtins, user could specify these information or not, compiler will help to check the correctness and canonicalize.
TODO:
Impl : user provided implementation.
Multi Pipe : custom op wants to use multiple pipes, which is a MacroOp in HIVM’s context.
Traits: AttrSizedOperandSegments, SinglePipeOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectOpInterface (MemoryEffectOpInterface), MemoryEffectsOpInterface, OpPipeInterface
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::SideEffects::DefaultResource, MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
name | ::mlir::StringAttr | string attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of any type |
Results¶
Result |
Description |
|---|---|
|
variadic of any type |
hivm.hir.dcci (hivm::DCCIOp)¶
Hivm dcci op
Syntax:
operation ::= `hivm.hir.dcci` attr-dict `(` $mode `,` $dataCacheKind (`,` $ptr^ `:` type($ptr))? `)`
This op cleans(writes back) and invalidates one cacheline or the entire data cache
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
mode | ::mlir::hivm::DCCIModeAttr | hivm dcci mode{{% markdown %}}HIVM DCCI mode attribute.{{% /markdown %}} |
dataCacheKind | ::mlir::hivm::DataCacheKindAttr | hivm data cache kind{{% markdown %}}HIVM data cache kind attribute.{{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
memref of any type values |
hivm.hir.debug (hivm::DebugOp)¶
Device-side debugging
Syntax:
operation ::= `hivm.hir.debug` attr-dict $arg `:` type($arg)
Interfaces: InferCoreTypeInterface, MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::SideEffects::DefaultResource, MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
debugtype | ::mlir::StringAttr | string attribute |
prefix | ::mlir::StringAttr | string attribute |
hex | ::mlir::BoolAttr | bool attribute |
tcoretype | ::mlir::hivm::TCoreTypeAttr | {{% markdown %}} HIVM op core type attribute. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
integer or floating-point or Tensor or Memref |
hivm.hir.finish_debug (hivm::FinishDebugOp)¶
Finish func for device-side debugging
Syntax:
operation ::= `hivm.hir.finish_debug` attr-dict
Traits: CubeVectorCoreTypeTrait
hivm.hir.fixpipe (hivm::FixpipeOp)¶
HIVM data copy operation from L0C to other memory hierarchies.
Syntax:
operation ::= `hivm.hir.fixpipe` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`unit_flag` `[` $unit_flag_mode^ (`,` $unit_flag_cond^)? `]`)?
(`->` type($result_tensor)^)?
Fixpipe is pipeline that performing data movement from L0C to other memory hierarchies, with on-the-fly fixed function of pre-stage quantization, pre-stage ReLU, element-wise add, post-stage ReLU, post-stage quantization. Currently support:
L0C to OUT
L0C to L1
L0C to UB (for Ascend910_95 series)
Additionally, Fixpipe is also capable of layout transform.
Traits: AlwaysSpeculatableImplTrait, CubeCoreTypeTrait, OpPipeTrait<PIPE::PIPE_FIX>, SinglePipeOpTrait
Interfaces: ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, HIVMUnitFlagEnabledInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
enable_nz2nd | ::mlir::UnitAttr | unit attribute |
pre_quant | ::mlir::hivm::FixpipePreQuantModeAttr | HIVM fixpipe pre_quant mode{{% markdown %}}HIVM fixpipe pre_quant mode{{% /markdown %}} |
pre_relu | ::mlir::hivm::FixpipePreReluModeAttr | HIVM fixpipe pre_relu mode{{% markdown %}}HIVM fixpipe pre_relu mode{{% /markdown %}} |
channel_split | ::mlir::BoolAttr | bool attribute |
unit_flag_mode | ::mlir::hivm::UnitFlagAttr | {{% markdown %}} HIVM unit flag attribute for synchronization. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
shaped of any type values |
|
shaped of any type values |
|
1-bit signless integer |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.get_block_idx (hivm::GetBlockIdxOp)¶
Get block idx of the current device thread used for parallelization.
Syntax:
operation ::= `hivm.hir.get_block_idx` attr-dict `->` type($result)
This op gets the block idx of the current device thread.
This op will be lowered to GetBlockIdxInstrOp.
Traits: AlwaysSpeculatableImplTrait, CubeVectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results¶
Result |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.get_block_num (hivm::GetBlockNumOp)¶
Get block number of the current device thread used for parallelization.
Syntax:
operation ::= `hivm.hir.get_block_num` attr-dict `->` type($result)
This op gets the block number of the current device thread.
This op will be lowered to GetBlockNumInstrOp.
Traits: AlwaysSpeculatableImplTrait, CubeVectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results¶
Result |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.get_sub_block_idx (hivm::GetSubBlockIdxOp)¶
Get sub block idx of the current device thread used for parallelization.
Syntax:
operation ::= `hivm.hir.get_sub_block_idx` attr-dict `->` type($result)
This op gets the sub block idx of the current device thread. This op will be lowered to GetSubBlockIdxInstrOp.
Traits: AlwaysSpeculatableImplTrait, CubeVectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results¶
Result |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.get_sub_block_num (hivm::GetSubBlockNumOp)¶
Get sub block number of the current device thread used for parallelization.
Syntax:
operation ::= `hivm.hir.get_sub_block_num` attr-dict `->` type($result)
This op gets the sub block number of the current device thread. This op will be lowered to GetSubBlockNumInstrOp.
Traits: AlwaysSpeculatableImplTrait, CubeVectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results¶
Result |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.get_sys_cnt (hivm::GetSysCntOp)¶
Get sys cnt of the current device
Syntax:
operation ::= `hivm.hir.get_sys_cnt` attr-dict `->` type($result)
This op get the sys cnt of the current device.
This op will be lowered to GetSysCntInstrOp.
Traits: AlwaysSpeculatableImplTrait, CubeVectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results¶
Result |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.init_debug (hivm::InitDebugOp)¶
Init func for device-side debugging
Syntax:
operation ::= `hivm.hir.init_debug` attr-dict
Traits: CubeVectorCoreTypeTrait
hivm.hir.load (hivm::LoadOp)¶
HIVM data load operation
Syntax:
operation ::= `hivm.hir.load` `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
attr-dict
(`pad_mode` `=` $pad_mode^)?
(`pad_value` `=` $pad_value^ `:` type($pad_value))?
(`left_padding_num` `=` $left_padding_num^ `:` type($left_padding_num))?
(`init_out_buffer` `=` $init_out_buffer^ )?
(`right_padding_num` `=` $right_padding_num^ `:` type($right_padding_num))?
(`init_condition` `=` $init_condition^ `:` type($init_condition))?
(`may_implicit_transpose_with_last_axis` `=` $may_implicit_transpose_with_last_axis^ )?
(`->` type($result_tensor)^)?
Loads the data from the global memory to the local buffer. Currently only support loading to the unified buffer.
Examples:
hivm.load ins(%src : memref<16x16xf16, #hivm.address_space<gm>>) outs(%dst : memref<16x16xf16, #hivm.address_space<ub>>)
Constraints:
srcanddstare expected to have the same element type.If
pad_modeis not set,srcanddstshape should be the same.Supports both left and right padding.
pad_valueshould have the same element type assrcanddst.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, OpPipeTrait<PIPE::PIPE_MTE2>, SinglePipeOpTrait, UniformReassociationFlattenTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
pad_mode | ::mlir::hivm::PadModeAttr | {{% markdown %}} HIVM pad mode attribute. {{% /markdown %}} |
init_out_buffer | ::mlir::BoolAttr | bool attribute |
may_implicit_transpose_with_last_axis | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
any type |
|
index |
|
any type |
|
any type |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.load_scalar (hivm::LoadScalarOp)¶
Hivm load scalar
Syntax:
operation ::= `hivm.hir.load_scalar` attr-dict $addr `:` type($addr) `->` type($result)
Operands¶
Operand |
Description |
|---|---|
|
LLVM pointer type |
Results¶
Result |
Description |
|---|---|
|
integer or floating-point |
hivm.hir.matmul (hivm::MatmulOp)¶
HIVM Matrix Multiply Op with inputs from global memory
Syntax:
operation ::= `hivm.hir.matmul` attr-dict `ins` `(` $a `,` $b `:` type($a) `,` type($b) `)`
`outs` `(` $c `:` type($c) `)`
(`tiling_params` `=` $tilingParams^ `:` type($tilingParams) ) ?
(`bias` `=` $bias^ `:` type($bias) )?
(`descale` `=` $descale^ `:` type($descale))?
(`a_transpose` $aTranspose^)?
(`b_transpose` $bTranspose^)?
(`descale_mode` `=` $descaleMode^)?
(`block_sizes` `(` $blockSizes^ `:` type($blockSizes) `)`)?
(`process_sizes` `(` $processSizes^ `:` type($processSizes) `)`)?
(`swizzle_offset` `=` $swizzleOffset^ `:` type($swizzleOffset) )?
(`swizzle_direction` `=` $swizzleDirection^ `:` type($swizzleDirection))?
(`epilogue_p_tiles` `=` $epiloguePTiles^ `:` type($epiloguePTiles))?
(`->` type($result)^)?
This operation takes three tiled matrices from the global memory as arguments:
A(ranked type): anm x kmatrixB(ranked type): ank x nmatrixC(ranked type): anm x nmatrix
Other arguments include:
block_sizes: data size of m, n, and k dimension processed on the L1 memory hierarchyprocess_sizes: data size of m, n, and k dimension processed on the L0 memory hierarchy(optional)
swizzle_offset: continuous block number which swizzle schedule(optional)
swizzle_direction: block direction which swizzle schedule(optional)
epilogue_p_tiles: block number which compute attached op once handle
The operation performed is represented as C = A * B.
If a_transpose or b_transpose is present, the respective operand is
loaded in a transposed manner.
Optionally, this operation takes the following arguments:
bias(ranked type): bias value, which is a vector of shapendescale: dequantization value. Support 3 types:DescaleNull: no descale.DescalePerChannel: the shape ofdescaleis equal ton.DescalePerTensor: the shape ofdescaleis equal to1.
The operation performed is represented as C = descale * (A * B + bias).
Traits: AttrSizedOperandSegments, MacroOpPipeTrait<PIPE::PIPE_MTE2, PIPE::PIPE_MTE3>, MacroOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
aTranspose | ::mlir::UnitAttr | unit attribute |
bTranspose | ::mlir::UnitAttr | unit attribute |
descaleMode | ::mlir::hivm::DescaleModeAttr | descale mode for matmul{{% markdown %}} HIVM descale mode attribute for matmul op. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
variadic of 64-bit signless integer |
|
variadic of 64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.mix_group_matmul (hivm::MixGroupMatmulOp)¶
HIVM (Mix) Matrix Group Multiply Op with inputs from global memory
Syntax:
operation ::= `hivm.hir.mix_group_matmul` attr-dict `ins` `(` $a `,` $b `,` $tokens_per_expert `:` type($a) `,` type($b) `,` type($tokens_per_expert) `)`
(`post_vector_func_ins` `(` $postVecFuncIns^ `:` type($postVecFuncIns) `)`) ?
(`post_vector_func_outs` `(` $postVecFuncOuts^ `:` type($postVecFuncOuts) `)`) ?
(`workspace_ins` `(` $workspaceIns^ `:` type($workspaceIns) `)`) ?
`outs` `(` $c `:` type($c) `)`
(`tiling_params` `=` $tilingParams^ `:` type($tilingParams) ) ?
(`comm_params` `=` $commParams^ `:` type($commParams) ) ?
(`bias` `=` $bias^ `:` type($bias) )?
(`descale` `=` $descale^ `:` type($descale))?
(`a_transpose` $aTranspose^)?
(`b_transpose` $bTranspose^)?
(`descale_mode` `=` $descaleMode^)?
(`block_sizes` `(` $blockSizes^ `:` type($blockSizes) `)`)?
(`process_sizes` `(` $processSizes^ `:` type($processSizes) `)`)?
(`swizzle_offset` `=` $swizzleOffset^ `:` type($swizzleOffset) )?
(`swizzle_direction` `=` $swizzleDirection^ `:` type($swizzleDirection))?
(`epilogue_p_tiles` `=` $epiloguePTiles^ `:` type($epiloguePTiles))?
(`->` type($result)^)?
This operation takes three tiled matrices from the global memory as arguments:
A(ranked type): anm x kmatrixB(ranked type): ank x nmatrixC(ranked type): anm x nmatrix
Other arguments include:
block_sizes: data size of m, n, and k dimension processed on the L1 memory hierarchyprocess_sizes: data size of m, n, and k dimension processed on the L0 memory hierarchy(optional)
swizzle_offset: continuous block number which swizzle schedule(optional)
swizzle_direction: block direction which swizzle schedule(optional)
epilogue_p_tiles: block number which compute attached op once handle
The operation performed is represented as C = A * B.
If a_transpose or b_transpose is present, the respective operand is
loaded in a transposed manner.
Optionally, this operation takes the following arguments:
bias(ranked type): bias value, which is a vector of shapendescale: dequantization value. Support 3 types:DescaleNull: no descale.DescalePerChannel: the shape ofdescaleis equal ton.DescalePerTensor: the shape ofdescaleis equal to1.
The operation performed is represented as C = descale * (A * B + bias).
This operation also supports tile-level fusion with a post-vector
function (hence it’s a Mix op)
tokens_per_expert specify how matmuls are distributed to different experts
post_vector_func_ins is used to specify the arguments.
post_vector_func_outs is used to specify the outputs.
comm_params is used to specify communication related arguments (eg.
topology, communicator, group, etc.) when fusing communication
operators.
Traits: AttrSizedOperandSegments, MacroOpPipeTrait<PIPE::PIPE_MTE2, PIPE::PIPE_MTE3>, MacroOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
aTranspose | ::mlir::UnitAttr | unit attribute |
bTranspose | ::mlir::UnitAttr | unit attribute |
descaleMode | ::mlir::hivm::DescaleModeAttr | descale mode for matmul{{% markdown %}} HIVM descale mode attribute for matmul op. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
variadic of 64-bit signless integer |
|
variadic of 64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.mix_matmul (hivm::MixMatmulOp)¶
HIVM (Mix) Matrix Multiply Op with inputs from global memory
Syntax:
operation ::= `hivm.hir.mix_matmul` attr-dict `ins` `(` $a `,` $b `:` type($a) `,` type($b) `)`
(`post_vector_func_ins` `(` $postVecFuncIns^ `:` type($postVecFuncIns) `)`) ?
(`workspace_ins` `(` $workspaceIns^ `:` type($workspaceIns) `)`) ?
`outs` `(` $c `:` type($c) `)`
(`tiling_params` `=` $tilingParams^ `:` type($tilingParams) ) ?
(`comm_params` `=` $commParams^ `:` type($commParams) ) ?
(`bias` `=` $bias^ `:` type($bias) )?
(`descale` `=` $descale^ `:` type($descale))?
(`a_transpose` $aTranspose^)?
(`b_transpose` $bTranspose^)?
(`descale_mode` `=` $descaleMode^)?
(`block_sizes` `(` $blockSizes^ `:` type($blockSizes) `)`)?
(`process_sizes` `(` $processSizes^ `:` type($processSizes) `)`)?
(`swizzle_offset` `=` $swizzleOffset^ `:` type($swizzleOffset) )?
(`swizzle_direction` `=` $swizzleDirection^ `:` type($swizzleDirection))?
(`epilogue_p_tiles` `=` $epiloguePTiles^ `:` type($epiloguePTiles))?
(`->` type($result)^)?
This operation takes three tiled matrices from the global memory as arguments:
A(ranked type): anm x kmatrixB(ranked type): ank x nmatrixC(ranked type): anm x nmatrix
Other arguments include:
block_sizes: data size of m, n, and k dimension processed on the L1 memory hierarchyprocess_sizes: data size of m, n, and k dimension processed on the L0 memory hierarchy(optional)
swizzle_offset: continuous block number which swizzle schedule(optional)
swizzle_direction: block direction which swizzle schedule(optional)
epilogue_p_tiles: block number which compute attached op once handle
The operation performed is represented as C = A * B.
If a_transpose or b_transpose is present, the respective operand is
loaded in a transposed manner.
Optionally, this operation takes the following arguments:
bias(ranked type): bias value, which is a vector of shapendescale: dequantization value. Support 3 types:DescaleNull: no descale.DescalePerChannel: the shape ofdescaleis equal ton.DescalePerTensor: the shape ofdescaleis equal to1.
The operation performed is represented as C = descale * (A * B + bias).
This operation also supports tile-level fusion with a post-vector
function (hence it’s a Mix op).
post_vector_func_ins is used to specify the arguments.
comm_params is used to specify communication related arguments (eg.
topology, communicator, group, etc.) when fusing communication
operators.
Traits: AttrSizedOperandSegments, MacroOpPipeTrait<PIPE::PIPE_MTE2, PIPE::PIPE_MTE3>, MacroOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
aTranspose | ::mlir::UnitAttr | unit attribute |
bTranspose | ::mlir::UnitAttr | unit attribute |
descaleMode | ::mlir::hivm::DescaleModeAttr | descale mode for matmul{{% markdown %}} HIVM descale mode attribute for matmul op. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
shaped of any type values |
|
shaped of any type values |
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
shaped of any type values |
|
variadic of 64-bit signless integer |
|
variadic of 64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
64-bit signless integer |
|
shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.mmadL1 (hivm::MmadL1Op)¶
Matrix Multiply and Add Op with inputs from L1 memory hierarchy.
Syntax:
operation ::= `hivm.hir.mmadL1` attr-dict `ins` `(`
$a
`,` $b
`,` $init_condition
`,` $real_m
`,` $real_k
`,` $real_n
(`,` $per_channel_bias^)?
`:`
type($a)
`,` type($b)
`,` type($init_condition)
`,` type($real_m)
`,` type($real_k)
`,` type($real_n)
(`,` type($per_channel_bias)^)? `)`
`outs` `(` $c `:` type($c) `)`
(`sync_related_args` `(` $sync_related_args^ `:` type($sync_related_args) `)`)?
(`unit_flag` `[` $unit_flag_mode^ (`,` $unit_flag_cond^)? `]`)?
(`->` type($result_tensors)^)?
The computation logic is:
C = C + A x B + (optional) channel_bias
Note: the rank of A, B, and C Matrix must be two.
Traits: AttrSizedOperandSegments, CubeCoreTypeTrait, MacroOpPipeTrait<PIPE::PIPE_MTE1, PIPE::PIPE_M>, MacroOpTrait
Interfaces: DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, HIVMUnitFlagEnabledInterface, MemoryEffectsOpInterface, OpLayoutInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
a_transpose | ::mlir::UnitAttr | unit attribute |
b_transpose | ::mlir::UnitAttr | unit attribute |
enable_HF32 | ::mlir::UnitAttr | unit attribute |
unit_flag_mode | ::mlir::hivm::UnitFlagAttr | {{% markdown %}} HIVM unit flag attribute for synchronization. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
1-bit signless integer |
|
index |
|
index |
|
index |
|
Tensor or Memref |
|
variadic of 64-bit signless integer |
|
1-bit signless integer |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.nd2nz (hivm::ND2NZOp)¶
HIVM data copy operation with on-the-fly ND to NZ layout transformation
Syntax:
operation ::= `hivm.hir.nd2nz` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`init_out_buffer` `=` $init_out_buffer^ )?
(`pad_value` `=` $pad_value^ `:` type($pad_value))?
(`init_condition` `=` $init_condition^ `:` type($init_condition))?
(`->` type($result_tensor)^)?
dst_continuous: if present, signify that the source data is stored continuously in the destination buffer. This must be set in order for this op to be converted to library function call. Constraints:if
init_out_bufferis true,pad_valueshould have value.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CubeCoreTypeTrait, OpPipeTrait<PIPE::PIPE_MTE2>, SinglePipeOpTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
dst_continuous | ::mlir::UnitAttr | unit attribute |
init_out_buffer | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
shaped of any type values |
|
shaped of any type values |
|
any type |
|
any type |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.nz2nd (hivm::NZ2NDOp)¶
HIVM data copy operation from L1 to Global Memory with NZ2ND conversion
Syntax:
operation ::= `hivm.hir.nz2nd` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`->` type($result_tensor)^)?
NZ2ND does data movement from L1 to OUT with NZ2ND conversion.
Traits: AlwaysSpeculatableImplTrait, CubeCoreTypeTrait, OpPipeTrait<PIPE::PIPE_MTE3>, SinglePipeOpTrait
Interfaces: ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.pipe_barrier (hivm::PipeBarrierOp)¶
Hivm pipe barrier.
Syntax:
operation ::= `hivm.hir.pipe_barrier` `[` $pipe `]` attr-dict
Interfaces: InferCoreTypeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
pipe | ::mlir::hivm::PipeAttr | {{% markdown %}} HIVM Op pipe attribute. {{% /markdown %}} |
hivm.hir.pointer_cast (hivm::PointerCastOp)¶
HIVM pointer cast op at specific i64 addr
Syntax:
operation ::= `hivm.hir.pointer_cast` `(`$addrs `)` (`[` $dynamicSizes^`]`)? attr-dict `:` type($result)
The specific i64 addrs are stored in $addrs, which is variadic.
Constraints:
The type of each address should be i64.
addrs should have at least one addr.
Examples:
%addr = arith.constant 1234 : i64
%tmp = hivm.hir.pointer_cast(%addr) : memref<32xf32>
%addr2 = arith.constant 1600 : i64
%addr3 = arith.constant 3200 : i64
%tmp2 = hivm.hir.pointer_cast(%addr, %addr2) : memref<32xf32>
%tmp3 = hivm.hir.pointer_cast(%addr, %addr2, %addr3) : memref<32xf32>
Traits: AttrSizedOperandSegments, CubeVectorCoreTypeTrait
Operands¶
Operand |
Description |
|---|---|
|
variadic of 64-bit signless integer |
|
variadic of index |
Results¶
Result |
Description |
|---|---|
|
memref of any type values |
hivm.hir.set_ffts_base_addr (hivm::SetFFTSBaseAddrOp)¶
Set base addr for ffts sync mechanism.
Syntax:
operation ::= `hivm.hir.set_ffts_base_addr` attr-dict $ffts_base_addr
Traits: CubeVectorCoreTypeTrait
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.set_flag (hivm::SetFlagOp)¶
Hivm set flag.
Syntax:
operation ::= `hivm.hir.set_flag` `[`
$set_pipe
`,` $wait_pipe
`,` custom<EventID>($static_event_id, $dynamic_event_id)
`]` attr-dict
Interfaces: InferCoreTypeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
set_pipe | ::mlir::hivm::PipeAttr | {{% markdown %}} HIVM Op pipe attribute. {{% /markdown %}} |
wait_pipe | ::mlir::hivm::PipeAttr | {{% markdown %}} HIVM Op pipe attribute. {{% /markdown %}} |
static_event_id | ::mlir::hivm::EventAttr | {{% markdown %}} HIVM event attribute for synchronization. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.set_mask_norm (hivm::SetMaskNormOp)¶
Hivm set mask norm
Syntax:
operation ::= `hivm.hir.set_mask_norm` attr-dict
hivm.hir.store (hivm::StoreOp)¶
HIVM data store operation
Syntax:
operation ::= `hivm.hir.store` `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
attr-dict
(`atomic` `=` $atomic_kind^)?
(`->` type($result_tensor)^)?
Stores the data on local buffer to global memory. Currently only support storing data on the unified buffer.
Examples:
hivm.store ins(%src : memref<16x16xf16, #hivm.address_space<ub>>) outs(%dst : memref<16x16xf16, #hivm.address_space<gm>>)
Constraints:
srcanddstare expected to have the same element type.If
atomic_kindis set, the kind is one ofadd,max,min.
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_MTE3>, SinglePipeOpTrait, UniformReassociationFlattenTrait
Interfaces: ConditionallySpeculatable, CopyOpInterface, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
atomic_kind | ::mlir::hivm::AtomicKindAttr | Atomic Operation Kind for StoreOp{{% markdown %}} HIVM atomic store kind attribute. {{% /markdown %}} |
may_implicit_transpose_with_last_axis | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.sync_block (hivm::SyncBlockOp)¶
Hivm sync block between different kernels.
Syntax:
operation ::= `hivm.hir.sync_block` attr-dict `[` $sync_block_mode (`,` $flag_id^)?`]`
(`ffts_base_addr` `=` $ffts_base_addr^)?
(`tcube_pipe` `=` $tcube_pipe^)?
(`tvector_pipe` `=` $tvector_pipe^)?
There are sync block modes:
ALL_CUBE : All cube are synchronized to a same point.
tcube_pipeneeds to be set to the pipe that the cube core is waiting for.ALL_VECTOR : All vector are synchronized to a same point.
tvector_pipeneeds to be set to the pipe that the vector core is waiting for.ALL_SUB_VECTOR : All sub-vector cores are synchronized to a same point.
BARRIER_CUBE : Used for cube-cube synchronization, it’s going to be lowered to a barrier.pipe_all and would only be copied the aic kernel.
BARRIER_VECTOR : Used for cube-cube synchronization, it’s going to be lowered to a barrier.pipe_all and would only be copied the aiv kernel.
ALL : All aic/aiv are synchronized to same point.
tvector_pipeneeds to be set to the pipe that the vector core is waiting for.
Note:
SyncBlockOp can only use after data is moved to gm.
$ffts_base_addrmust be set in Altas A2/A3. Every time FFTS collect one specific$flag_idfrom all subblocks, FFTS would set the flag ID back to the block in the group to do synchronization.
Interfaces: InferCoreTypeInterface
Attributes¶
Attribute |
MLIR Type |
Description |
|---|---|---|
|
::mlir::hivm::SyncBlockModeAttr |
HIVM synchronization block mode attribute. |
|
::mlir::IntegerAttr |
An Attribute containing a integer value |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.sync_block_lock (hivm::SyncBlockLockOp)¶
Sync block lock operation.
Syntax:
operation ::= `hivm.hir.sync_block_lock` attr-dict `lock_var` `(` $lock_var `:` type($lock_var) `)`
The sync_block_lock operation will not release until the lock_var equals the block idx. Example:
hivm.hir.sync_block_lock lock_var(%lock : memref<1xi64>)
Operands¶
Operand |
Description |
|---|---|
|
1D memref of 64-bit signless integer values |
hivm.hir.sync_block_set (hivm::SyncBlockSetOp)¶
Hivm set block sync.
Syntax:
operation ::= `hivm.hir.sync_block_set` attr-dict `[` $tcore_type `,` $tpipe `,` $pipe`]`
`flag` `=` custom<FlagID>($static_flag_id, $dynamic_flag_id)
(`ffts_base_addr` `=` $ffts_base_addr^)?
(`sync_instr_mode` `=` $tsync_instr_mode^)?
Traits: AttrSizedOperandSegments
Interfaces: InferCoreTypeInterface
Attributes¶
Attribute |
MLIR Type |
Description |
|---|---|---|
|
::mlir::hivm::TCoreTypeAttr |
HIVM op core type attribute. |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
|
::mlir::IntegerAttr |
An Attribute containing a integer value |
| tsync_instr_mode | ::mlir::hivm::SyncBlockInstrModeAttr | HIVM synchronization block instruction mode attribute. |
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
|
64-bit signless integer |
hivm.hir.sync_block_unlock (hivm::SyncBlockUnlockOp)¶
Sync block unlock operation.
Syntax:
operation ::= `hivm.hir.sync_block_unlock` attr-dict `lock_var` `(` $lock_var `:` type($lock_var) `)`
The sync_block_lock operation will increase and release the lock_var.
Example:
hivm.hir.sync_block_unlock lock_var(%lock : memref<1xi64>)
Operands¶
Operand |
Description |
|---|---|
|
1D memref of 64-bit signless integer values |
hivm.hir.sync_block_wait (hivm::SyncBlockWaitOp)¶
Hivm wait block sync.
Syntax:
operation ::= `hivm.hir.sync_block_wait` attr-dict `[` $tcore_type `,` $tpipe `,` $pipe`]`
`flag` `=` custom<FlagID>($static_flag_id, $dynamic_flag_id)
Interfaces: InferCoreTypeInterface
Attributes¶
Attribute |
MLIR Type |
Description |
|---|---|---|
|
::mlir::hivm::TCoreTypeAttr |
HIVM op core type attribute. |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
|
::mlir::hivm::PipeAttr |
HIVM Op pipe attribute. |
|
::mlir::IntegerAttr |
An Attribute containing a integer value |
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
hivm.hir.vabs (hivm::VAbsOp)¶
Elementwise Vector Absolute Value Op
Syntax:
operation ::= `hivm.hir.vabs` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vadd (hivm::VAddOp)¶
Elementwise Binary Vector Addition Op
Syntax:
operation ::= `hivm.hir.vadd` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vand (hivm::VAndOp)¶
Elementwise Binary Vector And Op
Syntax:
operation ::= `hivm.hir.vand` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support only Vector-Vector operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>, VectorOnlyTrait<1>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.varange (hivm::VArangeOp)¶
Vector Arange Op
Syntax:
operation ::= `hivm.hir.varange` attr-dict
(`offset` `[` $offset^ `]`)?
`strides` `[` $strides `]`
`outs` `(` $dst `:` type($dst) `)`
(`->` type($result)^)?
Fill a vector with range 0,1,2… based on strides and offset. e.g. offset = 1, strides = [1, 2], tensor/memref shape = [2x4xi32], the result is [[1, 3, 5, 7, 2, 4, 6, 8]].
Constraints:
Must have at least one stride.
Default offset is 0.
Examples:
hivm.hir.varange offset[%o] strides[%s0, %s1] outs(%dst : memref<32xf32>)
%result = hivm.hir.varange offset[%o] strides[%s0, %s1] outs(%dst : tensor<32xf32>)
-> tensor<32xf32>
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
index |
|
variadic of index |
Results¶
Result |
Description |
|---|---|
|
ranked tensor of any type values |
hivm.hir.vbrc (hivm::VBrcOp)¶
Vector Broadcast Op
Syntax:
operation ::= `hivm.hir.vbrc` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast_dims` `=` $broadcast_dims^)?
(`->` type($result)^)?
Broadcast a vector or a scalar according to the broadcast axes array.
Constraints:
The input vector and output vector must have same rank and the same element type.
For the input operand, the size of the broadcasted axis must be 1.
The broadcast indices array cannot be empty for vector input.
The broadcast indices array must be empty for scalar input.
The broadcast indices array can not be larger than the ranks of the input vector.
The broadcast indices must be in
[0, RankOfSrcVec).For i1 type, need to ensure that the tail axis of dst is aligned with 16, otherwise there will be a risk of memory stampede
Examples:
// Scalar broadcast
hivm.hir.vbrc ins(%src : i32) outs(%dst : memref<?xi32>)
// Vector broadcast
hivm.hir.vbrc ins(%src : memref<1xi32>) outs(%dst : memref<?xi32>) broadcast_dims = [0]
%result = hivm.hir.vbrc ins(%src : tensor<1xi32>) outs(%dst : tensor<?xi32>) broadcast_dims = [0] -> tensor<?xi32>
Traits: AlwaysSpeculatableImplTrait, CollapsibleConsecutiveTargetDimsTrait, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, InferCoreTypeInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
broadcast_dims | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
any type |
|
Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vcast (hivm::VCastOp)¶
Elementwise Vector Type Conversion Op
Syntax:
operation ::= `hivm.hir.vcast` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`round_mode` `=` $round_mode^)?
(`cast` `=` $cast^)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
Supports the following conversions:
| src | dst | roundingmode |
|------|------|---------------------------------------------------|
| f32 | f32 | round, rint, floor, ceil, trunc |
| f32 | f16 | round, rint, floor, ceil, trunc, odd |
| f32 | i64 | round, rint, floor, ceil, trunc |
| f32 | i32 | round, rint, floor, ceil, trunc |
| f32 | i16 | round, rint, floor, ceil, trunc |
| f32 | s64 | round, rint, floor, ceil, trunc |
| f32 | bf16 | round, rint, floor, ceil, trunc |
| f16 | f32 | rint |
| f16 | i32 | round, rint, floor, ceil, trunc |
| f16 | i16 | round, rint, floor, ceil, trunc |
| f16 | i8 | round, rint, floor, ceil, trunc |
| f16 | ui8 | round, rint, floor, ceil, trunc |
| f16 | i4 | round, rint, floor, ceil, trunc |
| bf16 | f32 | rint |
| bf16 | i32 | round, rint, floor, ceil, trunc |
| ui8 | f16 | rint |
| i8 | f16 | rint |
| i8 | i1 | rint |
| i16 | f16 | round, rint, floor, ceil, trunc |
| i16 | f32 | rint |
| i32 | f32 | round, rint, floor, ceil, trunc |
| i32 | i64 | rint |
| i32 | i16 | rint |
| i64 | i32 | rint |
| i64 | f32 | round, rint, floor, ceil, trunc |
| i4 | f16 | rint |
| i1 | f16 | rint |
| i1 | f32 | rint |
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
round_mode | ::mlir::hivm::RoundModeAttr | Round Mode for VCastOp{{% markdown %}} - RINT: round to nearest, tie to even (c language rint) - ROUND: round to nearest, tie away from zero (c language round) - FLOOR: round to minus infinity (c language floor) - CEIL: round to positive infinity (c language ceil) - TRUNC: round to zero (c language trunc) - ODD: round to odd (Von Neumann rounding) {{% /markdown %}} |
cast | ::mlir::hivm::TypeFnAttr | Cast for VCastOp{{% markdown %}} HIVM cast attribute. {{% /markdown %}} |
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vcmp (hivm::VCmpOp)¶
Elementwise Binary Vector Comparison Op
Syntax:
operation ::= `hivm.hir.vcmp` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`compare_mode` `=` $compare_mode^)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Compare elements from two source vector. If the comparison result is true,
the corresponding bit of dst is 1 or 8.
Additional constraints:
The input vectors and output vector must have the same ranks
The element type of
dstmust be boolThe input is vector-only.
Supports the following data type:
| compare mode | element type |
|-------------------|-------------------------|
| GE/GT/LE/LT/NE/EQ | f16, f32, i16, i32, i64 |
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
compare_mode | ::mlir::hivm::CompareModeAttr | Compare Mode for VCmpOp{{% markdown %}} HIVM compare mode attribute. {{% /markdown %}} |
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vconcat (hivm::VConcatOp)¶
Vector Concatenation Op
Syntax:
operation ::= `hivm.hir.vconcat` `dim` `(` $dim `)` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`->` type($result)^)?
The concat operation constructs a tensor out of a variadic list of input tensors, concatenated along a static dimension number. All inputs and the result type must share the same rank.
dim specifies the dimension along which to concatenate. The size of the
concatenated dimension in the result must be equal to the sum of the sizes
of the inputs along that dimension. All other dimensions in both the inputs
and result must be the same size.
Example:
hivm.hir.vconcat dim(1) ins(%0, %1 : tensor<136x2048xf32>, tensor<136x2048xf32>)
outs(%2 : tensor<136x4096xf32>) -> tensor<136x4096xf32>
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
dim | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vcos (hivm::VCosOp)¶
Elementwise Vector Cosine Op
Syntax:
operation ::= `hivm.hir.vcos` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vcumprod (hivm::VCumprodOp)¶
Vector Cumprod Op
Syntax:
operation ::= `hivm.hir.vcumprod` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`cum_dims` `=` $cum_dims
`reverse` `=` $reverse
(`->` type($result)^)?
Calculate the cumulative product of each element along the specified axis
of src. Each element along the specified axis in the output of cumprod
contains the product of all elements from the first element to the current
position in the original src.
Constraints:
The input vector and output vector must have the same rank and the same element type.
Arguments:
src: the tensor/memref from which to calculate the cumulative sumdst: the tensor/memref to store elementscum_dims: specifies the dimension along which to calculate the cumulative product.reverse: specifies the direction of the cumulative product.
Examples:
hivm.hir.vcumprod ins(%src : memref<?xf32>) outs(%dst : memref<?xf32>) cum_dims : [0] reverse = true
%result = hivm.hir.vcumprod ins(%src : tensor<?xf32>) outs(%dst : tensor<?xf32>) cum_dims : [0] reverse = true -> tensor<?xf32>
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
cum_dims | ::mlir::DenseI64ArrayAttr | i64 dense array attribute should be in increasing order |
reverse | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vcumsum (hivm::VCumsumOp)¶
Vector Cumsum Op
Syntax:
operation ::= `hivm.hir.vcumsum` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`cum_dims` `=` $cum_dims
`reverse` `=` $reverse
(`->` type($result)^)?
Calculate the cumulative sum of each element along the specified axis of
src. Each element along the specified axis in the output of cumsum
contains the sum of all elements from the first element to the current
position in the original src.
Constraints:
The input vector and output vector must have the same rank and the same element type.
Arguments:
src: the tensor/memref from which to calculate the cumulative sumdst: the tensor/memref to store elementscum_dims: specifies the dimension along which to calculate the cumulative sum.reverse: specifies the direction of the cumulative sum.
Examples:
hivm.hir.vcumsum ins(%src : memref<?xf32>) outs(%dst : memref<?xf32>) cum_dims : [0] reverse = true
%result = hivm.hir.vcumsum ins(%src : tensor<?xf32>) outs(%dst : tensor<?xf32>) cum_dims : [0] reverse = true -> tensor<?xf32>
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
cum_dims | ::mlir::DenseI64ArrayAttr | i64 dense array attribute should be in increasing order |
reverse | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vdeinterleave (hivm::VDeinterleaveOp)¶
Vector Deinterleave Op
Syntax:
operation ::= `hivm.hir.vdeinterleave` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`channel_num` `=` $channel_num^)?
(`index_mode` `=` $index_mode^)?
(`->` type($result)^)?
Deinterleave one tensor along the last dimension.
The tensor’s last dimension size must be multiple of channel_num.
Traits: AlwaysSpeculatableImplTrait, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
channel_num | ::mlir::IntegerAttr | 64-bit signless integer attribute |
index_mode | ::mlir::hivm::DeinterleaveModeAttr | HIVM deinterleave mode{{% markdown %}}HIVM deinterleave index mode{{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
variadic of Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vdiv (hivm::VDivOp)¶
Elementwise Binary Vector Division Op
Syntax:
operation ::= `hivm.hir.vdiv` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support only Vector-Vector operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.verf (hivm::VErfOp)¶
Elementwise Vector Error function Op
Syntax:
operation ::= `hivm.hir.verf` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vexp (hivm::VExpOp)¶
Elementwise Vector Exponential Op
Syntax:
operation ::= `hivm.hir.vexp` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vflip (hivm::VFlipOp)¶
Vector Flip Op
Syntax:
operation ::= `hivm.hir.vflip` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`flip_axis` `=` $flip_axis
(`->` type($result)^)?
Flips a tensor along the last dimension.
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
flip_axis | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vgather (hivm::VGatherOp)¶
Vector Gather Op
Syntax:
operation ::= `hivm.hir.vgather` attr-dict `ins` `(` $src `:` type($src) `)`
`indices` `(` $indices `:` type($indices) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`->` type($result)^)?
Retrieve elements from a tensor/memref according to given indices, and store these elements in another tensor/memref. The gather axis is the last dimension.
Arguments:
src: the tensor/memref from which to gather elementsindices: the indices of elements to gather from srcdst: the tensor/memref to store elementstemp_buffer: extra memory required by gather op
Traits: AlwaysSpeculatableImplTrait, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vinterleave (hivm::VInterleaveOp)¶
Vector Interleave Op
Syntax:
operation ::= `hivm.hir.vinterleave` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`interleave_channel_nums` `=` $interleave_channel_nums
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`->` type($result)^)?
Interleaves the values of N tensors along their last dimension.
All tensors must have the same shape.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
interleave_channel_nums | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vln (hivm::VLnOp)¶
Elementwise Vector Natural Logarithm Op
Syntax:
operation ::= `hivm.hir.vln` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmax (hivm::VMaxOp)¶
Elementwise Binary Vector Maximum Op
Syntax:
operation ::= `hivm.hir.vmax` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmin (hivm::VMinOp)¶
Elementwise Binary Vector Minimum Op
Syntax:
operation ::= `hivm.hir.vmin` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmod (hivm::VModOp)¶
Elementwise Vector Mod Op
Syntax:
operation ::= `hivm.hir.vmod` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmul (hivm::VMulOp)¶
Elementwise Binary Vector Multiplication Op
Syntax:
operation ::= `hivm.hir.vmul` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmulext (hivm::VMulExtOp)¶
Elementwise Binary Vector Multiplication that Calculates the Most Significant 32-bits.
Syntax:
operation ::= `hivm.hir.vmulext` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support Vector-Vector operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vmulextended (hivm::VMulextendedOp)¶
Vector Mulextended Op
Syntax:
operation ::= `hivm.hir.vmulextended` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`->` type($result)^)?
Do vmul on two tensors. Get both high and low 16-bits.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Operands¶
Operand |
Description |
|---|---|
|
variadic of Tensor or Memref |
|
variadic of Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vnot (hivm::VNotOp)¶
Elementwise Vector Not Op
Syntax:
operation ::= `hivm.hir.vnot` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vor (hivm::VOrOp)¶
Elementwise Binary Vector Or Op
Syntax:
operation ::= `hivm.hir.vor` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support only Vector-Vector operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, CommutativeOpTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>, VectorOnlyTrait<1>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vpad (hivm::VPadOp)¶
Vector Pad Op
Syntax:
operation ::= `hivm.hir.vpad` attr-dict
`ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`low` `` custom<DynamicIndexList>($low, $static_low)
`high` `` custom<DynamicIndexList>($high, $static_high)
`pad_value` $pad_value `:` type($pad_value)
(`->` type($result)^)?
Pads the input operand. Operation semantic is similar to
tensor.pad.
Arguments:
src: the tensor/memref on which to pad valuesdst: reserved for bufferizationpad_value: the value to padlow: the padding lengths along the start of each dimensionhigh: the padding lengths along the end of each dimension
Example:
hivm.hir.vpad ins(%src : tensor<2x16xf32>) outs(%dst: tensor<?x16xf32>)
low[%first_dim_low, 0] high[%first_dim_high, 0]
pad_value %pad_value : f32
-> tensor<?x16xf32>
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
static_low | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
static_high | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
any type |
|
variadic of index |
|
variadic of index |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vpow (hivm::VPowOp)¶
Elementwise Binary Vector Power Op
Syntax:
operation ::= `hivm.hir.vpow` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>, VectorOnlyTrait<1>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vrec (hivm::VRecOp)¶
Elementwise Vector Reciprocal Op
Syntax:
operation ::= `hivm.hir.vrec` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vreduce (hivm::VReduceOp)¶
Vector Reduction Op
Syntax:
operation ::= `hivm.hir.vreduce` attr-dict $arith `ins` `(` $src `:` type($src) `)`
(`indices` `(` $indices^ `:` type($indices) `)`)?
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
`reduce_dims` `=` $reduce_dims
(`->` type($result)^)?
Reduce one or more axes of the source vector according to the reduction axes array, starting from an init value.
Constraints:
The input vector and output vector must have the same rank and the same element type.
For the output operand, the size of the reduced axis must be 1.
The reduction indices array can not be empty, nor can be larger than the ranks of the input vector.
The reduced indices must be in
[0, RankOfDstVec).
Examples:
hivm.hir.vreduce <add> ins(%src : memref<?xf32>) outs(%dst : memref<1xf32>) reduce_dims : [1]
%result = hivm.hir.vreduce <max> ins(%src : tensor<?xf32>) outs(%dst : tensor<1xf32>) reduce_dims : [0] -> tensor<1xf32>
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
arith | ::mlir::hivm::ReduceOpAttr | {{% markdown %}} HIVM reduction arithmetic operation attribute. {{% /markdown %}} |
reduce_dims | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
variadic of Tensor or Memref |
|
memref of any type values |
|
Tensor or Memref |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vrelu (hivm::VReluOp)¶
Elementwise Vector Rectified Linear Unit Op
Syntax:
operation ::= `hivm.hir.vrelu` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vrsqrt (hivm::VRsqrtOp)¶
Elementwise Vector Reciprocal Square Root Op
Syntax:
operation ::= `hivm.hir.vrsqrt` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vsel (hivm::VSelOp)¶
Elementwise Vector Selection Op
Syntax:
operation ::= `hivm.hir.vsel` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Select elements from two source vector according to the binary condition vector.
If the corresponding bit of the indicator is 1, select src0. Otherwise,
select src1.
Additional constraints:
The input vectors and output vector must have the same ranks.
The element type of indicator vector must be bool.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<3>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vshl (hivm::VShLOp)¶
Elementwise Binary Vector Shift Left Op
Syntax:
operation ::= `hivm.hir.vshl` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input vector and result have the same element type.
Support only Vector - Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, ScalarOnlyHWTrait<1>, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vshr (hivm::VShROp)¶
Elementwise Binary Vector Shift Right Op
Syntax:
operation ::= `hivm.hir.vshr` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`round` `:` $round^ )?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input vector and result have the same element type.
Support only Vector - Scalar operation.
If
roundis set to true, rounding is applied during arithmetic shift right.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, ScalarOnlyHWTrait<1>, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
round | ::mlir::BoolAttr | bool attribute |
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vsin (hivm::VSinOp)¶
Elementwise Vector Sine Op
Syntax:
operation ::= `hivm.hir.vsin` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vsort (hivm::VSortOp)¶
Vector Sort Op
Syntax:
operation ::= `hivm.hir.vsort` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
`descending` `=` $descending
`sort_axis` `=` $sort_axis
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`->` type($result)^)?
Sort the sorting axis of src in ascending or descending order, and output
the sorted value and the index corresponding to the value.
Constraints:
The input vector and output vector must have the same rank.
Currently only tail axis sorting is supported.
Arguments:
src: the tensor/memref from which to be sorteddst_value: the tensor/memref to store the sorted valuedst_index: the tensor/memref to store the index corresponding to dst_valuedescending: determines whether to sort in ascending or descending order. The default is false, which means ascending ordersort_axis: Axis to be sorted
Examples:
hivm.hir.vsort ins(%src : memref<?xf32>) outs(%dst : memref<?xf32>) descending = true sort_axis = 0
%result = hivm.hir.vsort ins(%src : tensor<?xf32>) outs(%dst : tensor<?xf32>) descending = true sort_axis = 0 -> tensor<?xf32>
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
descending | ::mlir::BoolAttr | bool attribute |
sort_axis | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
variadic of Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vsqrt (hivm::VSqrtOp)¶
Elementwise Vector Square Root Op
Syntax:
operation ::= `hivm.hir.vsqrt` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vsub (hivm::VSubOp)¶
Elementwise Binary Vector Subtraction Op
Syntax:
operation ::= `hivm.hir.vsub` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support both Vector-Vector and Vector-Scalar operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, BroadcastableOTF, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, ImplByScalarOpInterface, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vtanh (hivm::VTanhOp)¶
Elementwise Vector Hyperbolic Tangent Op
Syntax:
operation ::= `hivm.hir.vtanh` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<1>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of any type |
|
variadic of shaped of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vtranspose (hivm::VTransposeOp)¶
Vector Transpose Op
Syntax:
operation ::= `hivm.hir.vtranspose` attr-dict `ins` `(` $src `:` type($src) `)`
`outs` `(` $dst `:` type($dst) `)`
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`permutation` `=` $permutation^)?
(`disable_align` `=` $disable_align^)?
(`->` type($result)^)?
Permutes the dimensions of ‘src’ according to the given permutation. In
other words:
dim(dst, i) = dim(src, permutation[i]).
Constraints:
The input vector and output vector must have same rank, and the same element type.
Examples:
hivm.hir.vtranspose ins(%src : memref<32x8xf32>) outs(%dst : memref<8x32xf32>) permutation = [1, 0]
%result = hivm.hir.vtranspose ins(%src : tensor<32x8xf32>) outs(%dst: tensor<8x32xf32>) permutation = [1, 0] -> tensor<8x32xf32>
Traits: AlwaysSpeculatableImplTrait, OpPipeTrait<PIPE::PIPE_V>, SinglePipeOpTrait, UniformReassociationFlattenTrait, VectorCoreTypeTrait
Interfaces: BiShengIRAggregatedOpInterface, ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
permutation | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
disable_align | ::mlir::BoolAttr | bool attribute |
Operands¶
Operand |
Description |
|---|---|
|
Tensor or Memref |
|
Tensor or Memref |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.vxor (hivm::VXorOp)¶
Elementwise Binary Vector Xor Op
Syntax:
operation ::= `hivm.hir.vxor` attr-dict (`ins` `(` $src^ `:` type($src) `)`)?
(`outs` `(` $dst^ `:` type($dst) `)`)?
(`temp_buffer` `(` $temp_buffer^ `:` type($temp_buffer) `)`)?
(`broadcast` `=` $broadcast^)?
(`transpose` `=` $transpose^)?
(`->` type($result)^)?
From the Elementwise Nary Vector Op template:
This operation performs element-wise operation on N operands and produces a single result. It may perform either transpose or broadcast along the way (but not both).
Common constraints:
Follows DestinationStyleOpInterface.
The number of input operands is N; the number of output/result is one.
The input/init operands and result have the same rank.
The first input is vector-only.
Additional constraints:
The input/init operands and result have the same element type.
Support only Vector-Vector operation.
Traits: AlwaysSpeculatableImplTrait, AttrSizedOperandSegments, CollapsibleConsecutiveTargetDimsTrait, ElementwiseNaryOpTrait<2>, HIVMOpSameOperandsAndResultRank, OpPipeTrait<PIPE::PIPE_V>, SameOperandsElementType, SinglePipeOpTrait, TransposableOTF, UniformReassociationFlattenTrait, VectorCoreTypeTrait, VectorOnlyTrait<0>, VectorOnlyTrait<1>
Interfaces: ConditionallySpeculatable, DestinationStyleOpInterface, ExtraBufferOpInterface, FlattenInterface, HIVMCoreTypeInterface, HIVMStructuredOpInterface, HIVMStructuredOp, MemoryEffectsOpInterface, OpPipeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
transpose | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
broadcast | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands¶
Operand |
Description |
|---|---|
|
variadic of shaped of any type values |
|
variadic of shaped of any type values |
|
memref of any type values |
Results¶
Result |
Description |
|---|---|
|
variadic of ranked tensor of any type values |
hivm.hir.wait_flag (hivm::WaitFlagOp)¶
Hivm wait flag.
Syntax:
operation ::= `hivm.hir.wait_flag` `[`
$set_pipe
`,` $wait_pipe
`,` custom<EventID>($static_event_id, $dynamic_event_id)
`]` attr-dict
Interfaces: InferCoreTypeInterface
Attributes¶
| Attribute | MLIR Type | Description |
|---|---|---|
set_pipe | ::mlir::hivm::PipeAttr | {{% markdown %}} HIVM Op pipe attribute. {{% /markdown %}} |
wait_pipe | ::mlir::hivm::PipeAttr | {{% markdown %}} HIVM Op pipe attribute. {{% /markdown %}} |
static_event_id | ::mlir::hivm::EventAttr | {{% markdown %}} HIVM event attribute for synchronization. {{% /markdown %}} |
Operands¶
Operand |
Description |
|---|---|
|
64-bit signless integer |
Attributes¶
AddressSpaceAttr¶
Syntax:
#hivm.address_space<
::mlir::hivm::AddressSpace # address_space
>
HIVM address space mapping attribute. Maps to GM, L1, L0A, L0B, L0C and UB.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
address_space |
|
an enum of type AddressSpace |
AlignKindAttr¶
alignment kind information
Syntax:
#hivm.align_kind<
::mlir::hivm::AlignKind # value
>
HIVM alignment kind attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type AlignKind |
AllocAlignDimsAttr¶
Syntax: #hivm.alloc_align_dims
HIVM alloc align dims.
AllocAlignValueInByteAttr¶
Syntax: #hivm.alloc_align_value_in_byte
HIVM alloc align value in bytes.
AtomicKindAttr¶
Atomic Operation Kind for StoreOp
Syntax:
#hivm.atomic_kind<
::mlir::hivm::AtomicKind # value
>
HIVM atomic store kind attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type AtomicKind |
AxisKindAttr¶
hivm op axis kind information
Syntax:
#hivm.axis_kind<
::mlir::hivm::AxisKind # value
>
HIVM op axis kind attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type AxisKind |
HIVMBlockMappingAttr¶
Syntax:
#hivm.block<
std::optional<int32_t> # order
>
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
order |
|
CompareModeAttr¶
Compare Mode for VCmpOp
Syntax:
#hivm.compare_mode<
::mlir::hivm::CompareMode # value
>
HIVM compare mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type CompareMode |
DCCIModeAttr¶
hivm dcci mode
Syntax:
#hivm.DCCIMode<
::mlir::hivm::DCCIMode # value
>
HIVM DCCI mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type DCCIMode |
DataCacheKindAttr¶
hivm data cache kind
Syntax:
#hivm.DataCacheKind<
::mlir::hivm::DataCacheKind # value
>
HIVM data cache kind attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type DataCacheKind |
DataLayoutAttr¶
Syntax:
#hivm.data_layout<
::mlir::hivm::DataLayout, # data_layout
std::optional<bool>, # transpose
std::optional<DenseI64ArrayAttr> # fractalSizes
>
HIVM data layout mapping attribute. Maps to DOTA_ND, DOTB_ND, DOTC_ND, zN, nZ and ND.
transpose: Indicates that the layout is transposed. Only valid and must be present for DOTA_ND and DOTB_ND layout.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
data_layout |
|
an enum of type DataLayout |
transpose |
|
|
fractalSizes |
|
DeinterleaveModeAttr¶
HIVM deinterleave mode
Syntax:
#hivm.deinterleave_mode<
::mlir::hivm::DeinterleaveMode # value
>
HIVM deinterleave index mode
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type DeinterleaveMode |
DescaleModeAttr¶
descale mode for matmul
Syntax:
#hivm.descale_mode<
::mlir::hivm::DescaleMode # value
>
HIVM descale mode attribute for matmul op.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type DescaleMode |
DisableAutoInjectBlockSyncAttr¶
Syntax: #hivm.disable_auto_inject_block_sync
Disable auto inject block sync, skip block sync injection.
EventAttr¶
Syntax:
#hivm.event<
::mlir::hivm::EVENT # event
>
HIVM event attribute for synchronization.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
event |
|
an enum of type EVENT |
FixpipePreQuantModeAttr¶
HIVM fixpipe pre_quant mode
Syntax:
#hivm.fixpipe_pre_quant_mode<
::mlir::hivm::FixpipePreQuantMode # value
>
HIVM fixpipe pre_quant mode
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type FixpipePreQuantMode |
FixpipePreReluModeAttr¶
HIVM fixpipe pre_relu mode
Syntax:
#hivm.fixpipe_pre_relu_mode<
::mlir::hivm::FixpipePreReluMode # value
>
HIVM fixpipe pre_relu mode
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type FixpipePreReluMode |
HIVMFuncDynMemrefArgsAttr¶
Syntax: #hivm.func_dyn_memref_args
HIVM FuncDynMemrefArgs to mark the index array of dynamic memref arguments of function.
InsertSliceSourceIndexAttr¶
Syntax: #hivm.insert_slice_source_index
Specifies which operand is insert_slice source in vconcat op
MultiBufferAttr¶
Syntax: #hivm.multi_buffer
HIVM multi-buffer attribute.
PadModeAttr¶
Syntax:
#hivm.padmode<
::mlir::hivm::PadMode # padmode
>
HIVM pad mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
padmode |
|
an enum of type PadMode |
ParallelLoopAttr¶
Syntax: #hivm.parallel_loop
Specifies that marked loop can run in parallel.
PipeAttr¶
Syntax:
#hivm.pipe<
::mlir::hivm::PIPE # pipe
>
HIVM Op pipe attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
pipe |
|
an enum of type PIPE |
ReduceOpAttr¶
Syntax:
#hivm.reduce_op<
::mlir::hivm::ReduceOperation # reduce_op
>
HIVM reduction arithmetic operation attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
reduce_op |
|
an enum of type ReduceOperation |
RoundModeAttr¶
Round Mode for VCastOp
Syntax:
#hivm.round_mode<
::mlir::hivm::RoundMode # value
>
RINT: round to nearest, tie to even (c language rint)
ROUND: round to nearest, tie away from zero (c language round)
FLOOR: round to minus infinity (c language floor)
CEIL: round to positive infinity (c language ceil)
TRUNC: round to zero (c language trunc)
ODD: round to odd (Von Neumann rounding)
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type RoundMode |
StorageAlignedAttr¶
Syntax: #hivm.storage_aligned
If a module is tagged with this attribute, it means that all of the operations within all device functions in this module are aligned. If a function is tagged with this attribute, it means that all of the operations in this function are aligned.
StrideAlignDimsAttr¶
Syntax: #hivm.stride_align_dims
HIVM stride align dims.
StrideAlignValueInByteAttr¶
Syntax: #hivm.stride_align_value_in_byte
HIVM stride align value in bytes.
HIVMSubBlockMappingAttr¶
Syntax:
#hivm.sub_block<
::mlir::hivm::MappingId # sub_block
>
HIVM sub block mapping attribute for the cv block dim ratio of mix func.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
sub_block |
|
an enum of type MappingId |
SyncBlockInstrModeAttr¶
Syntax:
#hivm.sync_block_instr_mode<
::mlir::hivm::SyncBlockInstrMode # sync_instr_mode
>
HIVM synchronization block instruction mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
sync_instr_mode |
|
an enum of type SyncBlockInstrMode |
SyncBlockModeAttr¶
Syntax:
#hivm.sync_block_mode<
::mlir::hivm::SyncBlockMode # sync_mode
>
HIVM synchronization block mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
sync_mode |
|
an enum of type SyncBlockMode |
TCoreTypeAttr¶
Syntax:
#hivm.tcore_type<
::mlir::hivm::TCoreType # tcoretype
>
HIVM op core type attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
tcoretype |
|
an enum of type TCoreType |
TCoreTypeMarkerAttr¶
Syntax:
#hivm.tcore_type_marker<
::mlir::hivm::TCoreType # tcoretype
>
HIVM op core type marker attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
tcoretype |
|
an enum of type TCoreType |
TFuncCoreTypeAttr¶
Syntax:
#hivm.func_core_type<
::mlir::hivm::TFuncCoreType # funcCoreType
>
HIVM function core type attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcCoreType |
|
an enum of type TFuncCoreType |
TModuleCoreTypeAttr¶
Syntax:
#hivm.module_core_type<
::mlir::hivm::TModuleCoreType # moduleCoreType
>
HIVM module core type attribute.
If all of the functions within the module has AIV func core type , the
module core type is AIV.
If all of the functions within the module has AIC func core type , the
module core type is AIC.
Otherwise, the module core type is MIX.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
moduleCoreType |
|
an enum of type TModuleCoreType |
TPartOfMixAttr¶
Syntax: #hivm.part_of_mix
HIVM function is a part of mix kernel.
TypeFnAttr¶
Cast for VCastOp
Syntax:
#hivm.cast<
::mlir::hivm::TypeFn # value
>
HIVM cast attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type TypeFn |
UnitFlagAttr¶
Syntax:
#hivm.unit_flag<
::mlir::hivm::UNIT_FLAG # unit_flag
>
HIVM unit flag attribute for synchronization.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
unit_flag |
|
an enum of type UNIT_FLAG |
UnlikelyConditionAttr¶
Syntax: #hivm.unlikely_condition
Specifies that marked condition is unlikely to evaluate to true.
VFModeAttr¶
HIVM VF Mode
Syntax:
#hivm.vf_mode<
::mlir::hivm::VFMode # value
>
HIVM VF mode attribute.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type VFMode |
Enums¶
AddressSpace¶
HIVM Address Space
Cases¶
Symbol |
Value |
String |
|---|---|---|
Zero |
|
zero |
GM |
|
gm |
L1 |
|
cbuf |
L0A |
|
ca |
L0B |
|
cb |
L0C |
|
cc |
UB |
|
ub |
AlignKind¶
alignment kind information
Cases¶
Symbol |
Value |
String |
|---|---|---|
ALIGN |
|
align |
UNALIGNED |
|
unaligned |
UNKNOWN |
|
unknown |
AtomicKind¶
Atomic Operation Kind for StoreOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
NONE |
|
none |
ADD |
|
add |
MAX |
|
max |
MIN |
|
min |
AND |
|
and |
OR |
|
or |
XOR |
|
xor |
CAS |
|
or |
XCHG |
|
xor |
UMAX |
|
umax |
UMIN |
|
umin |
AxisKind¶
hivm op axis kind information
Cases¶
Symbol |
Value |
String |
|---|---|---|
FIRST |
|
first |
MIDDLE |
|
middle |
LAST |
|
last |
CompareMode¶
Compare Mode for VCmpOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
EQ |
|
eq |
NE |
|
ne |
LT |
|
lt |
GT |
|
gt |
GE |
|
ge |
LE |
|
le |
DCCIMode¶
hivm dcci mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
SINGLE_CACHE_LINE |
|
single_cache_line |
ALL_CACHE_LINES |
|
all_cache_lines |
DataCacheKind¶
hivm data cache kind
Cases¶
Symbol |
Value |
String |
|---|---|---|
ALL |
|
all |
UB |
|
ub |
OUT |
|
out |
ATOMIC |
|
atomic |
DataLayout¶
HIVM data layout
Cases¶
Symbol |
Value |
String |
|---|---|---|
DOTA_ND |
|
dotA_ND |
DOTB_ND |
|
dotB_ND |
DOTC_ND |
|
dotC_ND |
nZ |
|
nZ |
zN |
|
zN |
ND |
|
ND |
DeinterleaveMode¶
HIVM deinterleave mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
CHANNEL_0 |
|
CHANNEL_0 |
CHANNEL_1 |
|
CHANNEL_1 |
ALL_CHANNELS |
|
ALL_CHANNELS |
DescaleMode¶
descale mode for matmul
Cases¶
Symbol |
Value |
String |
|---|---|---|
DescaleNull |
|
DescaleNull |
DescalePerChannel |
|
DescalePerChannel |
DescalePerTensor |
|
DescalePerTensor |
EVENT¶
Event ID for Synchronization
Cases¶
Symbol |
Value |
String |
|---|---|---|
EVENT_ID0 |
|
EVENT_ID0 |
EVENT_ID1 |
|
EVENT_ID1 |
EVENT_ID2 |
|
EVENT_ID2 |
EVENT_ID3 |
|
EVENT_ID3 |
EVENT_ID4 |
|
EVENT_ID4 |
EVENT_ID5 |
|
EVENT_ID5 |
EVENT_ID6 |
|
EVENT_ID6 |
EVENT_ID7 |
|
EVENT_ID7 |
FixpipePreQuantMode¶
HIVM fixpipe pre_quant mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
NO_QUANT |
|
NO_QUANT |
S322I8 |
|
S322I8 |
F322F16 |
|
F322F16 |
F322BF16 |
|
F322BF16 |
FixpipePreReluMode¶
HIVM fixpipe pre_relu mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
NO_RELU |
|
NO_RELU |
NORMAL_RELU |
|
NORMAL_RELU |
LEAKY_RELU |
|
LEAKY_RELU |
P_RELU |
|
P_RELU |
IteratorType¶
HIVM Structured Op Iterator Type
Cases¶
Symbol |
Value |
String |
|---|---|---|
kParallel |
|
parallel |
kBroadcast |
|
broadcast |
kTranspose |
|
transpose |
kReduction |
|
reduction |
kInterleave |
|
interleave |
kDeinterleave |
|
deinterleave |
kInverse |
|
inverse |
kPad |
|
pad |
kConcat |
|
concat |
kGather |
|
gather |
kCumulative |
|
cumulative |
kOpaque |
|
opaque |
MatmulBiasMode¶
bias mode for local matmul op
Cases¶
Symbol |
Value |
String |
|---|---|---|
NoBias |
|
NoBias |
PerChannelAdd |
|
PerChannelAdd |
PerChannelAddWithSplitK |
|
PerChannelAddWithSplitK |
ElementwiseCrossLoopAdd |
|
ElementwiseCrossLoopAdd |
ElementwiseAdd |
|
ElementwiseAdd |
MemPlanMode¶
Mem Plan Mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
LOCAL_MEM_PLAN |
|
LOCAL_MEM_PLAN |
GLOBAL_WORKSPACE_PLAN |
|
GLOBAL_WORKSPACE_PLAN |
PadMode¶
Pad Mode for LoadOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
PadNull |
|
PadNull |
PadFirstElem |
|
PadFirstElem |
PadValue |
|
PadValue |
PIPE¶
HIVM Op Pipe
Cases¶
Symbol |
Value |
String |
|---|---|---|
PIPE_S |
|
PIPE_S |
PIPE_V |
|
PIPE_V |
PIPE_M |
|
PIPE_M |
PIPE_MTE1 |
|
PIPE_MTE1 |
PIPE_MTE2 |
|
PIPE_MTE2 |
PIPE_MTE3 |
|
PIPE_MTE3 |
PIPE_ALL |
|
PIPE_ALL |
PIPE_MTE4 |
|
PIPE_MTE4 |
PIPE_MTE5 |
|
PIPE_MTE5 |
PIPE_V2 |
|
PIPE_V2 |
PIPE_FIX |
|
PIPE_FIX |
VIRTUAL_PIPE_MTE2_L1A |
|
VIRTUAL_PIPE_MTE2_L1A |
VIRTUAL_PIPE_MTE2_L1B |
|
VIRTUAL_PIPE_MTE2_L1B |
PIPE_NUM |
|
PIPE_NUM |
PIPE_UNASSIGNED |
|
PIPE_UNASSIGNED |
ReduceOperation¶
Reduction kind for VReduceOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
sum |
|
sum |
prod |
|
prod |
max |
|
max |
min |
|
min |
max_with_index_left |
|
max_with_index_left |
max_with_index_right |
|
max_with_index_right |
min_with_index_left |
|
min_with_index_left |
min_with_index_right |
|
min_with_index_right |
any |
|
any |
all |
|
all |
xori |
|
xori |
ori |
|
ori |
andi |
|
andi |
none |
|
none |
RoundMode¶
Round Mode for VCastOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
RINT |
|
rint |
ROUND |
|
round |
FLOOR |
|
floor |
CEIL |
|
ceil |
TRUNC |
|
trunc |
ODD |
|
odd |
TRUNCWITHOVERFLOW |
|
truncwithoverflow |
SyncBlockInstrMode¶
HIVM SyncBlockInstrMode
Cases¶
Symbol |
Value |
String |
|---|---|---|
INTER_BLOCK_SYNCHRONIZATION |
|
INTER_BLOCK_SYNCHRONIZATION |
INTER_SUBBLOCK_SYNCHRONIZATION |
|
INTER_SUBBLOCK_SYNCHRONIZATION |
INTRA_BLOCK_SYNCHRONIZATION |
|
INTRA_BLOCK_SYNCHRONIZATION |
SyncBlockMode¶
HIVM SyncBlockMode
Cases¶
Symbol |
Value |
String |
|---|---|---|
ALL_CUBE |
|
ALL_CUBE |
ALL_VECTOR |
|
ALL_VECTOR |
ALL_SUB_VECTOR |
|
ALL_SUB_VECTOR |
BARRIER_CUBE |
|
BARRIER_CUBE |
BARRIER_VECTOR |
|
BARRIER_VECTOR |
ALL |
|
ALL |
TCoreType¶
HIVM Op Core Type
Cases¶
Symbol |
Value |
String |
|---|---|---|
CUBE |
|
CUBE |
VECTOR |
|
VECTOR |
CUBE_OR_VECTOR |
|
CUBE_OR_VECTOR |
CUBE_AND_VECTOR |
|
CUBE_AND_VECTOR |
TFuncCoreType¶
HIVM Function Core Type
Cases¶
Symbol |
Value |
String |
|---|---|---|
AIC |
|
AIC |
AIV |
|
AIV |
MIX |
|
MIX |
AIC_OR_AIV |
|
AIC_OR_AIV |
TModuleCoreType¶
HIVM Module Core Type
Cases¶
Symbol |
Value |
String |
|---|---|---|
AIC |
|
AIC |
AIV |
|
AIV |
MIX |
|
MIX |
TypeFn¶
Cast for VCastOp
Cases¶
Symbol |
Value |
String |
|---|---|---|
cast_signed |
|
cast_signed |
cast_unsigned |
|
cast_unsigned |
bitcast |
|
bitcast |
UNIT_FLAG¶
Unit Flag Mode for Synchronization
Cases¶
Symbol |
Value |
String |
|---|---|---|
DISABLED |
|
DISABLED |
RESERVED |
|
RESERVED |
ENABLED_WITHOUT_UPDATE |
|
ENABLED_WITHOUT_UPDATE |
ENABLED_WITH_UPDATE |
|
ENABLED_WITH_UPDATE |
ENABLED_ONLY_LAST_ITER |
|
ENABLED_ONLY_LAST_ITER |
ENABLED_ONLY_FIRST_ITER |
|
ENABLED_ONLY_FIRST_ITER |
ENABLED_ONLY_FIRST_AND_LAST_ITERS |
|
ENABLED_ONLY_FIRST_AND_LAST_ITERS |
VFMode¶
HIVM VF Mode
Cases¶
Symbol |
Value |
String |
|---|---|---|
SIMD |
|
SIMD |
SIMT |
|
SIMT |
MIX |
|
MIX |
MappingId¶
Mapping ids for loop mapping
Cases¶
Symbol |
Value |
String |
|---|---|---|
DimX |
|
x |