diff --git a/test/ttmlir/Silicon/TTMetal/to_layout.mlir b/test/ttmlir/Silicon/TTMetal/to_layout.mlir new file mode 100644 index 000000000..6b361a76d --- /dev/null +++ b/test/ttmlir/Silicon/TTMetal/to_layout.mlir @@ -0,0 +1,24 @@ +// RUN: ttmlir-opt --ttir-load-system-desc="path=%system_desc_path%" --ttir-implicit-device --ttir-allocate --convert-ttir-to-ttmetal --ttmetal-serialize-to-binary="output=%t.ttm" %s | FileCheck %s +// UNSUPPORTED: true +#l1_ = #tt.memory_space + +#layout = #tt.layout<(d0, d1) -> (d0, d1), undef, <1x1>, memref<4x16xf32, #l1_>> +#layout1 = #tt.layout<(d0, d1) -> (d0, d1), undef, <2x2>, memref<2x8xf32, #l1_>> +func.func @simple(%arg0: tensor<4x16xf32, #layout>) -> tensor<4x16xf32, #layout1> { + %0 = tensor.empty() : tensor<4x16xf32, #layout1> + // CHECK: %[[C:.*]] = "ttmetal.dispatch"[[C:.*]] + %1 = "ttir.to_layout"(%arg0, %0) : (tensor<4x16xf32, #layout>, tensor<4x16xf32, #layout1>) -> tensor<4x16xf32, #layout1> + return %1 : tensor<4x16xf32, #layout1> +} + +#untilized = #tt.layout<(d0, d1) -> (d0, d1), undef, <1x1>, memref<64x128xf32, #l1_>> +#tilized = #tt.layout<(d0, d1) -> (d0, d1), undef, <1x1>, memref<2x4x!tt.tile<32 x 32, f32>, #l1_>> +func.func @tilize(%arg0: tensor<64x128xf32, #untilized>) -> tensor<64x128xf32, #untilized> { + %0 = tensor.empty() : tensor<64x128xf32, #tilized> + // CHECK: %[[C:.*]] = "ttmetal.dispatch"[[C:.*]] + %1 = "ttir.to_layout"(%arg0, %0) : (tensor<64x128xf32, #untilized>, tensor<64x128xf32, #tilized>) -> tensor<64x128xf32, #tilized> + %2 = tensor.empty() : tensor<64x128xf32, #untilized> + // CHECK: %[[C:.*]] = "ttmetal.dispatch"[[C:.*]] + %3 = "ttir.to_layout"(%1, %2) : (tensor<64x128xf32, #tilized>, tensor<64x128xf32, #untilized>) -> tensor<64x128xf32, #untilized> + return %3 : tensor<64x128xf32, #untilized> +}