'dataflow' Dialect
An dataflow out-of-tree MLIR dialect This dialect contains dedicated operations, types, and attributes designed for representing dataflow-specific structures and components in MLIR.
- Operations
- dataflow.buffer (streamtensor::dataflow::BufferOp)
- dataflow.itensor_buffer (streamtensor::dataflow::ITensorBufferOp)
- dataflow.itensor_cast (streamtensor::dataflow::ITensorCastOp)
- dataflow.itensor_chunk (streamtensor::dataflow::ITensorChunkOp)
- dataflow.itensor_concat (streamtensor::dataflow::ITensorConcatOp)
- dataflow.itensor_empty (streamtensor::dataflow::ITensorEmptyOp)
- dataflow.itensor_fork (streamtensor::dataflow::ITensorForkOp)
- dataflow.itensor_instance (streamtensor::dataflow::ITensorInstanceOp)
- dataflow.itensor_join (streamtensor::dataflow::ITensorJoinOp)
- dataflow.itensor_read (streamtensor::dataflow::ITensorReadOp)
- dataflow.itensor_reassociate (streamtensor::dataflow::ITensorReassociateOp)
- dataflow.itensor_to_stream (streamtensor::dataflow::ITensorToStreamOp)
- dataflow.itensor_write (streamtensor::dataflow::ITensorWriteOp)
- dataflow.kernel (streamtensor::dataflow::KernelOp)
- dataflow.stream (streamtensor::dataflow::StreamOp)
- dataflow.stream_cast (streamtensor::dataflow::StreamCastOp)
- dataflow.stream_read (streamtensor::dataflow::StreamReadOp)
- dataflow.stream_to_itensor (streamtensor::dataflow::StreamToITensorOp)
- dataflow.stream_write (streamtensor::dataflow::StreamWriteOp)
- dataflow.task (streamtensor::dataflow::TaskOp)
- dataflow.yield (streamtensor::dataflow::YieldOp)
- Attributes
- Types
Operations¶
dataflow.buffer
(streamtensor::dataflow::BufferOp)¶
Represent a dataflow buffer
Syntax:
operation ::= `dataflow.buffer` attr-dict `:` type(results)
Interfaces: MemoryEffectOpInterface
Results:¶
Result | Description |
---|---|
memref |
statically shaped memref of any type values |
dataflow.itensor_buffer
(streamtensor::dataflow::ITensorBufferOp)¶
Buffer an iterative tensor at a specific position
Syntax:
operation ::= `dataflow.itensor_buffer` $source `buffer` $bufferType `before` `loop` $loopIndex `dim` $dimIndex
attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
bufferType | ::mlir::TypeAttr | type attribute of ranked tensor of any type values |
loopIndex | ::mlir::IntegerAttr | 64-bit signed integer attribute |
dimIndex | ::mlir::IntegerAttr | 64-bit signed integer attribute |
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_cast
(streamtensor::dataflow::ITensorCastOp)¶
Cast an iterative tensor to a different type
Syntax:
operation ::= `dataflow.itensor_cast` $source attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, ITensorViewLikeOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_chunk
(streamtensor::dataflow::ITensorChunkOp)¶
Chunk a tensor to multiple tensors
Syntax:
operation ::= `dataflow.itensor_chunk` `iter_dim` `(` $iterDim `)` `dim` `(` $dim `)` `size` `(` $size `)` $source
attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
iterDim | ::mlir::IntegerAttr | 64-bit signed integer attribute |
dim | ::mlir::IntegerAttr | 64-bit signed integer attribute |
size | ::mlir::IntegerAttr | 64-bit signed integer attribute |
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
Results:¶
Result | Description |
---|---|
results |
variadic of itensor of any type values |
dataflow.itensor_concat
(streamtensor::dataflow::ITensorConcatOp)¶
Concat a tensor to multiple tensors
Syntax:
operation ::= `dataflow.itensor_concat` `iter_dim` `(` $iterDim `)` `dim` `(` $dim `)` $sources attr-dict `:`
functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
iterDim | ::mlir::IntegerAttr | 64-bit signed integer attribute |
dim | ::mlir::IntegerAttr | 64-bit signed integer attribute |
Operands:¶
Operand | Description |
---|---|
sources |
variadic of itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_empty
(streamtensor::dataflow::ITensorEmptyOp)¶
A empty iterative tensor
Syntax:
operation ::= `dataflow.itensor_empty` attr-dict `:` type(results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_fork
(streamtensor::dataflow::ITensorForkOp)¶
Fork an iterative tensor to multiple ones
Syntax:
operation ::= `dataflow.itensor_fork` $source attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
Results:¶
Result | Description |
---|---|
results |
variadic of itensor of any type values |
dataflow.itensor_instance
(streamtensor::dataflow::ITensorInstanceOp)¶
An iterative tensor instance that is not pure
Syntax:
operation ::= `dataflow.itensor_instance` `depth` $depth attr-dict `:` type(results)
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
depth | ::mlir::IntegerAttr | 64-bit signed integer attribute |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_join
(streamtensor::dataflow::ITensorJoinOp)¶
Join multiple iterative tensors to one
Syntax:
operation ::= `dataflow.itensor_join` $sources attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
sources |
variadic of itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_read
(streamtensor::dataflow::ITensorReadOp)¶
Read an element from an iterative tensor
Syntax:
operation ::= `dataflow.itensor_read` $source (`init` $init^)? attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, DestinationStyleOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
init |
ranked tensor of any type values |
Results:¶
Result | Description |
---|---|
value |
any type |
dataflow.itensor_reassociate
(streamtensor::dataflow::ITensorReassociateOp)¶
Reassociate the shape and/or iteration of an iterative tensor
Syntax:
operation ::= `dataflow.itensor_reassociate` $source (`expand` $expandShape^):(`collapse`)? `shape` $shapeReassociation
(`expand` $expandIteration^):(`collapse`)? `iteration`
$iterationReassociation attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, ITensorViewLikeOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
expandShape | ::mlir::UnitAttr | unit attribute |
shapeReassociation | ::mlir::ArrayAttr | Array of 64-bit integer array attributes |
expandIteration | ::mlir::UnitAttr | unit attribute |
iterationReassociation | ::mlir::ArrayAttr | Array of 64-bit integer array attributes |
Operands:¶
Operand | Description |
---|---|
source |
itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.itensor_to_stream
(streamtensor::dataflow::ITensorToStreamOp)¶
Convert an itensor to a stream channel
Syntax:
operation ::= `dataflow.itensor_to_stream` $iTensor attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
iTensor |
An iterative tensor type |
Results:¶
Result | Description |
---|---|
stream |
stream of any type values |
dataflow.itensor_write
(streamtensor::dataflow::ITensorWriteOp)¶
Write an element to an iterative tensor
Syntax:
operation ::= `dataflow.itensor_write` $value `into` $dest attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
value |
any type |
dest |
itensor of any type values |
Results:¶
Result | Description |
---|---|
result |
itensor of any type values |
dataflow.kernel
(streamtensor::dataflow::KernelOp)¶
Represent a dataflow kernel containing multiple tasks
Syntax:
operation ::= `dataflow.kernel` $sym_name (`inputs` $inputs^)? `inputs_packed` $inputsPacked
`results_packed` $resultsPacked $body attr-dict `:`
functional-type(operands, results)
Traits: SingleBlockImplicitTerminator<YieldOp>
, SingleBlock
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
inputsPacked | ::mlir::DenseBoolArrayAttr | i1 dense array attribute |
resultsPacked | ::mlir::DenseBoolArrayAttr | i1 dense array attribute |
Operands:¶
Operand | Description |
---|---|
inputs |
variadic of ranked tensor of any type values |
Results:¶
Result | Description |
---|---|
results |
variadic of ranked tensor of any type values |
dataflow.stream
(streamtensor::dataflow::StreamOp)¶
Instantiate a stream channel
Syntax:
operation ::= `dataflow.stream` `depth` $depth attr-dict `:` type(results)
Interfaces: MemoryEffectOpInterface
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
depth | ::mlir::IntegerAttr | 64-bit signed integer attribute |
Results:¶
Result | Description |
---|---|
stream |
stream of any type values |
dataflow.stream_cast
(streamtensor::dataflow::StreamCastOp)¶
Cast a stream to a different type
Syntax:
operation ::= `dataflow.stream_cast` $source attr-dict `:` functional-type(operands, results)
Interfaces: StreamViewLikeOpInterface
Operands:¶
Operand | Description |
---|---|
source |
stream of any type values |
Results:¶
Result | Description |
---|---|
result |
stream of any type values |
dataflow.stream_read
(streamtensor::dataflow::StreamReadOp)¶
Read an element from stream channel
Syntax:
operation ::= `dataflow.stream_read` $source attr-dict `:` functional-type(operands, results)
Read/pop a value from a stream channel.
Interfaces: MemoryEffectOpInterface
Operands:¶
Operand | Description |
---|---|
source |
stream of any type values |
Results:¶
Result | Description |
---|---|
value |
any type |
dataflow.stream_to_itensor
(streamtensor::dataflow::StreamToITensorOp)¶
Convert a stream channel to a itensor
Syntax:
operation ::= `dataflow.stream_to_itensor` $stream attr-dict `:` functional-type(operands, results)
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
stream |
stream of any type values |
Results:¶
Result | Description |
---|---|
iTensor |
itensor of any type values |
dataflow.stream_write
(streamtensor::dataflow::StreamWriteOp)¶
Write an element to stream channel
Syntax:
operation ::= `dataflow.stream_write` $value `into` $dest attr-dict `:` type(operands)
Write/push a value to a stream channel.
Interfaces: MemoryEffectOpInterface
Operands:¶
Operand | Description |
---|---|
value |
any type |
dest |
stream of any type values |
dataflow.task
(streamtensor::dataflow::TaskOp)¶
Represent a dataflow task
Syntax:
operation ::= `dataflow.task` (`kernel` $kernel^)? (`data_driven` $dataDriven^)? $sym_name
(`inits` $inits^)? $body attr-dict (`:` functional-type($inits, $results)^)?
Traits: SingleBlockImplicitTerminator<YieldOp>
, SingleBlock
Attributes:¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
kernel | ::mlir::UnitAttr | unit attribute |
dataDriven | ::mlir::UnitAttr | unit attribute |
Operands:¶
Operand | Description |
---|---|
inits |
variadic of any type |
Results:¶
Result | Description |
---|---|
results |
variadic of any type |
dataflow.yield
(streamtensor::dataflow::YieldOp)¶
Terminate and yield results of a schedule or task op
Syntax:
operation ::= `dataflow.yield` $results attr-dict `:` type($results)
Traits: AlwaysSpeculatableImplTrait
, HasParent<KernelOp, TaskOp>
, ReturnLike
, Terminator
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, RegionBranchTerminatorOpInterface
Effects: MemoryEffects::Effect{}
Operands:¶
Operand | Description |
---|---|
results |
variadic of any type |
Attributes¶
PartitionLayoutAttr¶
Layout of array partition
Syntax:
#dataflow.partition<
::llvm::ArrayRef<dataflow::PartitionKind>, # kinds
::llvm::ArrayRef<int64_t> # factors
>
Parameters:¶
Parameter | C++ type | Description |
---|---|---|
kinds | ::llvm::ArrayRef<dataflow::PartitionKind> |
|
factors | ::llvm::ArrayRef<int64_t> |
Types¶
ITensorType¶
An iterative tensor type
Syntax:
!dataflow.itensor<
mlir::Type, # elementType
::llvm::ArrayRef<int64_t>, # iterTripCounts
::llvm::ArrayRef<int64_t>, # iterSteps
mlir::AffineMap # iterMap
>
Iterative tensor representing a tile or window of a full tensor that
iteratively traverses the full tensor. For example, given a tensor with type
tensor<64x128xf32>
, if we tile this tensor into 16x16 tiles and traverse
them with two nested loops in a natural order, the corresponding itensor
type would be:
itensor<f32, iter_space: [4, 8] * [16, 16], iter_map: (d0, d1) -> (d0, d1)>
Specifically, the iterTripCounts
parameter specifies the trip counts of
each loop, while the iterSteps
parameter specifies the step sizes of each
loop. The iterMap
parameter specifies the mapping from the iteration space
to the full tensor space, i.e., the loop induction variables to the tensor
indices. The following is an example of how to read the itensor above:
%0 = any_defining_op : itensor<f32, iter_space: [4, 8] * [16, 16],
iter_map: (d0, d1) -> (d0, d1)>
scf.for %i = %c0 to %c4 step %c1 {
scf.for %j = %c0 to %c8 step %c1 {
%1 = tensor.empty : tensor<16x16xf32>
%2 = dataflow.itensor_read %0 init %1 : itensor<f32, iter_space:[4, 8] *
[16, 16], iter_map: (d0, d1) -> (d0, d1)> -> tensor<16x16xf32>
...
}
}
An itensor shares similar properties with the tensor, which means it is not
mutable and cannot be updated in place. The itensor ops can be converted to
stream ops for code generation. This process is similar to the bufferize
process from tensor ops to buffer (memref) ops.
Parameters:¶
Parameter | C++ type | Description |
---|---|---|
elementType | mlir::Type |
|
iterTripCounts | ::llvm::ArrayRef<int64_t> |
|
iterSteps | ::llvm::ArrayRef<int64_t> |
|
iterMap | mlir::AffineMap |
StreamType¶
A stream type
Syntax:
!dataflow.stream<
mlir::Type, # elementType
mlir::Attribute # memorySpace
>
A stream of any type that represents a FIFO between the producer and the consumer module.
Parameters:¶
Parameter | C++ type | Description |
---|---|---|
elementType | mlir::Type |
|
memorySpace | mlir::Attribute |