d2m.composite_view (tt::d2m::CompositeViewOp)
Piecewise view over multiple input tensors
Represents a piecewise-affine view that aggregates multiple input tensors along a certain dimension.
Traits: AlwaysSpeculatableImplTrait
Interfaces: BufferizableOpInterface, ConditionallySpeculatable, D2M_ViewOpInterface, NoMemoryEffect (MemoryEffectOpInterface), ViewOpInterface
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
dim | ::mlir::IntegerAttr | 32-bit signed integer attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
result | ranked tensor of any type values or non-0-ranked.memref of any type values |
d2m.create_global_semaphore (tt::d2m::CreateGlobalSemaphoreOp)
Global semaphore allocation operation (D2M).
Syntax:
operation ::= `d2m.create_global_semaphore` `(` $input `)` attr-dict `:` type($input) `->` type($result)
Create an uninitialized global semaphore with the specified core range.
Interfaces: BufferizableOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
value | ::mlir::IntegerAttr | 32-bit unsigned integer attribute |
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
result | D2M global semaphore type. |
d2m.empty (tt::d2m::EmptyOp)
Empty tensor allocation operation (D2M).
Syntax:
operation ::= `d2m.empty` `(` `)` attr-dict `:` type($result)
Create an uninitialized tensor with the specified shape, element type and encoding.
Optionally, the virtualGridInverseMapping attribute stores the inverse affine
map (physical to virtual grid coordinates) and virtualGridForwardMapping
stores the forward affine map (virtual to physical grid coordinates).
Interfaces: BufferizableOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
virtualGridInverseMapping | ::mlir::AffineMapAttr | AffineMap attribute |
virtualGridForwardMapping | ::mlir::AffineMapAttr | AffineMap attribute |
Results:
| Result | Description |
|---|---|
result | ranked tensor of any type values |
d2m.generic (tt::d2m::GenericOp)
Generically dispatch work to a grid of cores (D2M).
Syntax:
operation ::= `d2m.generic` attr-dict `\n`
` ` ` ` ` ` ` ` `ins` `(` $inputs (`:` type($inputs)^)? `)` `\n`
` ` ` ` ` ` ` ` `outs` `(` $outputs `:` type($outputs) `)` `\n`
(` ` ` ` ` ` ` ` `additionalArgs` `(` $additionalArgs `:` type($additionalArgs)^ `)` `\n`)? $regions (`:` type($results)^ )?
Same semantics as D2M generic; carries regions for compute/datamovement to be consumed by the metal path.
Traits: AttrSizedOperandSegments, NoTerminator
Interfaces: BufferizableOpInterface, DestinationStyleOpInterface, MemoryEffectOpInterface, OpAsmOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
grid | ::mlir::tt::ttcore::GridAttr | TT grid attribute{{% markdown %}} TT grid attribute {{% /markdown %}} |
block_factors | ::mlir::ArrayAttr | 64-bit integer array attribute |
indexing_maps | ::mlir::ArrayAttr | AffineMap array attribute |
iterator_types | ::mlir::ArrayAttr | |
threads | ::mlir::ArrayAttr | |
scratch_inputs | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
fabricConnectionConfig | ::mlir::tt::ttcore::FabricConnectionConfigAttr | Fabric Connection Config attribute.{{% markdown %}} Structure for configuring fabric connections for worker cores (in CCL ops). {{% /markdown %}} |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of ranked tensor of any type values or non-0-ranked.memref of any type values |
outputs | variadic of ranked tensor of any type values or non-0-ranked.memref of any type values |
additionalArgs | variadic of any type |
Results:
| Result | Description |
|---|---|
results | variadic of ranked tensor of any type values |
d2m.mesh_shard (tt::d2m::MeshShardOp)
Mesh shard operation (D2M).
Syntax:
operation ::= `d2m.mesh_shard` $input attr-dict `:` type($input) `->` type($result)
MeshShard op shards the inputs (FullToShard) or concatenates the outputs (ShardToFull) for ccl ops.
Traits: AlwaysSpeculatableImplTrait
Interfaces: BufferizableOpInterface, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
shard_type | ::mlir::tt::ttcore::MeshShardTypeAttr | MeshShard shard_type attribute in TT dialect{{% markdown %}} Define sharded tensor data of mesh_shard op. - Identity: input and output tensors are pre-sharded (same data) and no sharding is required. - Replicate: all of the devices has full tensor (same data). - Maximal: one or part of the devcices has full tensor (same data). - Devices: all or part of the devices has sharded (partial) tensor (different data). {{% /markdown %}} |
shard_direction | ::mlir::tt::ttcore::MeshShardDirectionAttr | TT MeshShardDirection |
shard_shape | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
shard_dims | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
result | ranked tensor of any type values or non-0-ranked.memref of any type values |
d2m.reset_global_semaphore (tt::d2m::ResetGlobalSemaphoreOp)
Global semaphore reset operation (D2M).
Syntax:
operation ::= `d2m.reset_global_semaphore` `(` $semaphore `)` attr-dict `:` type($semaphore)
Reset global semaphore to a specific value. This operation blocks until the value has been set.
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
value | ::mlir::IntegerAttr | 32-bit unsigned integer attribute |
Operands:
| Operand | Description |
|---|---|
semaphore | D2M global semaphore type. |
d2m.spatial (tt::d2m::SpatialOp)
Execute multiple d2m.generic ops simultaneously on disjoint grid ranges of the device.
Syntax:
operation ::= `d2m.spatial` attr-dict `\n`
` ` ` ` ` ` ` ` `ins` `(` $inputs (`:` type($inputs)^)? `)` `\n`
` ` ` ` ` ` ` ` `outs` `(` $outputs `:` type($outputs) `)` ` ` $regions (`:` type($results)^ )?
Execute multiple d2m.generic ops simultaneously on disjoint parts of the physical
device. Each region corresponds to one grid range in grid_ranges and contains
exactly one d2m.generic op. Grid ranges must be non-overlapping and contained
in the device.
Traits: AttrSizedOperandSegments, NoTerminator
Interfaces: BufferizableOpInterface, DestinationStyleOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
grid_ranges | ::mlir::ArrayAttr | ordered array of ttcore core_range attributes |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of ranked tensor of any type values or non-0-ranked.memref of any type values |
outputs | variadic of ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
results | variadic of ranked tensor of any type values |
d2m.to_device (tt::d2m::ToDeviceOp)
Transfer data from host to device.
Syntax:
operation ::= `d2m.to_device` $input `,` $output `layout` `=` $layout attr-dict `:` type($input) `into` type($output) (`->` type($results)^)?
ToDevice operation transfers tensor data from host (system) memory to device memory. This is the explicit host-to-device data movement operation that replaces the overloaded system transfer case of ToLayoutOp.
The layout attribute stores the device layout information needed for the transfer.
#layout = #ttcore.metal_layout<8192x128x1, undef, <1x1>, memref<64x128xf32, #l1_>>
%1 = d2m.to_device %arg0, %0 layout = #layout : tensor<64x128xf32> into tensor<64x128xf32, #layout>
Interfaces: BufferizableOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
layout | ::mlir::tt::ttcore::MetalLayoutAttr | Tensor layout attribute with explicit physical shape{{% markdown %}} The tensor layout attribute captures how tensor data is sharded across a grid of devices/cores and is laid out in memory. Note that the presence of this attribute implies that the tensor shape includes sharding (i.e. the first half of the tensor shape represents the grid shape).
{{% /markdown %}} |
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
output | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
results | variadic of ranked tensor of any type values |
d2m.to_host (tt::d2m::ToHostOp)
Transfer data from device to host.
Syntax:
operation ::= `d2m.to_host` $input `,` $output `layout` `=` $layout attr-dict `:` type($input) `into` type($output) (`->` type($results)^)?
ToHost operation transfers tensor data from device memory to host (system) memory. This is the explicit device-to-host data movement operation that replaces the overloaded system transfer case of ToLayoutOp.
The layout attribute stores the device layout information needed for the transfer.
#layout = #ttcore.metal_layout<8192x128x1, undef, <1x1>, memref<64x128xf32, #l1_>>
%1 = d2m.to_host %arg0, %0 layout = #layout : tensor<64x128xf32, #layout> into tensor<64x128xf32>
Interfaces: BufferizableOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
layout | ::mlir::tt::ttcore::MetalLayoutAttr | Tensor layout attribute with explicit physical shape{{% markdown %}} The tensor layout attribute captures how tensor data is sharded across a grid of devices/cores and is laid out in memory. Note that the presence of this attribute implies that the tensor shape includes sharding (i.e. the first half of the tensor shape represents the grid shape).
{{% /markdown %}} |
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
output | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
results | variadic of ranked tensor of any type values |
d2m.to_layout (tt::d2m::ToLayoutOp)
Layout op.
Syntax:
operation ::= `d2m.to_layout` $input `,` $output `:` type($input) `into` type($output) attr-dict (`->` type($results)^)?
ToLayout operation, transition tensors from one layout to another. Some examples include:
- Transitioning between different memory spaces, e.g. DRAM to L1.
- Transitioning between different data types, e.g. f32 to f16.
- Transitioning between different tile sizes, e.g. 1x16 to 32x32
- Transitioning between different tensor sharding
- Some combination of the above
#layout = #ttcore.metal_layout<8192x128x1, undef, <1x1>, memref<64x128xf32, #system>>
#layout1 = #ttcore.metal_layout<8192x128x1, undef, <1x1>, memref<64x128xf32, #l1_>>
%1 = "d2m.to_layout"(%arg0, %0) : (tensor<64x128xf32, #layout>, tensor<64x128xf32, #layout1>) -> tensor<64x128xf32, #layout1>
Interfaces: BufferizableOpInterface, MemoryEffectOpInterface
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
output | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
results | variadic of ranked tensor of any type values |
d2m.view_layout (tt::d2m::ViewLayoutOp)
View Layout op (D2M subset)
Syntax:
operation ::= `d2m.view_layout` $input `remapping` `=` $remapping attr-dict `:` type($input) `->` type($result)
Create a representational view of a tensor/memref with a different layout. This is a no-op for codegen; consumers are expected to compose layouts.
The remapping attr describes the exact remapping this op represents.
Traits: AlwaysSpeculatableImplTrait
Interfaces: BufferizableOpInterface, ConditionallySpeculatable, D2M_ViewOpInterface, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
remapping | ::mlir::AffineMapAttr | AffineMap attribute |
reinterpretLayout | ::mlir::BoolAttr | bool attribute |
Operands:
| Operand | Description |
|---|---|
input | ranked tensor of any type values or non-0-ranked.memref of any type values |
Results:
| Result | Description |
|---|---|
result | ranked tensor of any type values or non-0-ranked.memref of any type values |