'iree_encoding' Dialectlink
Tensor encoding attributes and ops.
A dialect defining IREE tensor encoding attributes and related ops, used to implement data-tiling.
Operationslink
iree_encoding.set_encoding
(Encoding::SetEncodingOp)link
Perform pack and pad operation on source
Syntax:
operation ::= `iree_encoding.set_encoding` attr-dict $source `:` type($source) `->` type($result)
Operation to assign an encoding to a tensor. The operation does not change the rank or extent of a tensor. Instead it adds an encoding attribute to the tensor type to represent a change in layout.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, ReifyRankedShapedTypeOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
source |
ranked tensor of any type values |
Results:link
Result | Description |
---|---|
result |
ranked tensor of any type values |
iree_encoding.unset_encoding
(Encoding::UnsetEncodingOp)link
Perfom unpack and extract operation on source
Syntax:
operation ::= `iree_encoding.unset_encoding` attr-dict $source `:` type($source) `->` type($result)
Operation to convert an tensor with encoding that represents its data layout into a tensor with default layout (i.e. no encoding). For now in IREE the default layout is row-major.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, ReifyRankedShapedTypeOpInterface
Effects: MemoryEffects::Effect{}
Operands:link
Operand | Description |
---|---|
source |
ranked tensor of any type values |
Results:link
Result | Description |
---|---|
result |
ranked tensor of any type values |
Attributeslink
EncodingAttrlink
information to decide how to data-tile a tensor
Syntax:
#iree_encoding.encoding<
IntegerAttr, # operand_index
EncodingOpTypeAttr, # op_type
ArrayAttr, # element_types
TypeAttr, # original_type
IntegerAttr, # matmul_narrow_M
IntegerAttr, # matmul_narrow_N
ArrayAttr, # user_indexing_maps
AffineMapAttr, # bcast_map
DenseArrayAttr # round_dims_to
>
This attribute describes the change in the layout for a given tensor to execute subsequent operations on the tiled layout. The encoding serves as a way to represent the change in the way the data is laid out in memory without changing the logical rank/extent of the tensor itself. When required, the encoding can be used to explicitly manifest the layout change through operations like pack/unpack.
Parameters:link
Parameter | C++ type | Description |
---|---|---|
operand_index | IntegerAttr |
this tensor operand's index in the parameter list |
op_type | EncodingOpTypeAttr |
operand type |
element_types | ArrayAttr |
element types of the user's operands |
original_type | TypeAttr |
type of the original tensor type before padding |
matmul_narrow_M | IntegerAttr |
optional M narrow dimension size (only for contraction op user_indexing_maps) |
matmul_narrow_N | IntegerAttr |
optional N narrow dimension size (only for contraction op user_indexing_maps) |
user_indexing_maps | ArrayAttr |
Indexing maps of the operation using this tensor |
bcast_map | AffineMapAttr |
Indexing map that represents the broadcasting dims in the producer |
round_dims_to | DenseArrayAttr |
Values for padding M,N,K dimensions |
EncodingOpTypeAttrlink
Tracks the type of operation of the operand.
Syntax:
#iree_encoding.optype<
::mlir::iree_compiler::IREE::Encoding::EncodingOpType # value
>
Enum cases:
* matmul (matmul
)
* conv (conv
)
Parameters:link
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::iree_compiler::IREE::Encoding::EncodingOpType |
an enum of type EncodingOpType |
Enumslink
EncodingOpTypelink
Tracks the type of operation of the operand.
Cases:link
Symbol | Value | String |
---|---|---|
matmul | 0 |
matmul |
conv | 1 |
conv |