From 2ffd51ac2d11207cb7cf258a7f02e320910a5b03 Mon Sep 17 00:00:00 2001 From: James Newling Date: Tue, 10 Dec 2024 13:18:05 -0800 Subject: [PATCH] update --- .../AMD-AIE/iree-amd-aie/IR/AMDAIEOps.cpp | 9 +++---- .../iree-amd-aie/IR/test/roundtrip.mlir | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/AMDAIEOps.cpp b/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/AMDAIEOps.cpp index ec3730eda..d98607dfa 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/AMDAIEOps.cpp +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/AMDAIEOps.cpp @@ -1348,16 +1348,13 @@ SmallVector NpuDmaWaitOp::getDmaOps() { void TileOp::getAsmResultNames(function_ref setNameFn) { std::optional iCol = getConstantIntValue(getCol()); std::optional iRow = getConstantIntValue(getRow()); + std::string name{"tile"}; if (iCol.has_value() && iRow.has_value()) { std::string sCol = std::to_string(iCol.value()); std::string sRow = std::to_string(iRow.value()); - // std::string nameWithoutDialect = - // getOperationName().str().substr(getOperationName().find('.') + 1); - setNameFn(getResult(), "tile_" + sCol + "_" + sRow); - return; + name += "_" + sCol + "_" + sRow; } - - setNameFn(getResult(), "tile"); + setNameFn(getResult(), name); } bool TileOp::hasStaticLocation() { diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/test/roundtrip.mlir b/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/test/roundtrip.mlir index ad161a626..c261f099a 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/test/roundtrip.mlir +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/test/roundtrip.mlir @@ -49,7 +49,7 @@ func.func @core() { // ----- // CHECK-LABEL: func.func @logicalobjectfifo_from_memref -// CHECK: %[[I0:.*]] = amdaie.logicalobjectfifo.from_memref %[[ARG0:.*]], {} +// CHECK: %[[I0:.*]] = amdaie.logicalobjectfifo.from_memref %[[ARG0:.*]], {} // CHECK-SAME: memref<1x1x8x16xi32, 1> -> !amdaie.logicalobjectfifo> func.func @logicalobjectfifo_from_memref(%arg0: memref<1x1x8x16xi32, 1>) { %0 = amdaie.logicalobjectfifo.from_memref %arg0, {} : memref<1x1x8x16xi32, 1> -> !amdaie.logicalobjectfifo> @@ -487,3 +487,26 @@ func.func @reference_to() { %1 = amdaie.reference_to %0 : memref<1x1x8x4x8x4xi32> return } + +// ----- + +// Test that if the row and column are statically known, the tile operation is +// printed with the row and column in the SSA value. +func.func @tile_a_b(%i : index) { + %c2 = arith.constant 2: index + %c3 = arith.constant 3 : index + amdaie.workgroup { + // CHECK: %tile_2_3 = amdaie.tile + %t_23 = amdaie.tile(%c2, %c3) + // CHECK: %tile_2_3_0 = amdaie.tile + %t_231 = amdaie.tile(%c2, %c3) + // CHECK: %tile = amdaie.tile + %t_i3 = amdaie.tile(%i, %c3) + // CHECK: %tile_1 = amdaie.tile + %t_2i = amdaie.tile(%c2, %i) + amdaie.controlcode { + amdaie.end + } + } + return +}