Skip to content

Commit 1624682

Browse files
address reviwers comments and put passesin a seperate functions so other pipelines can use it
1 parent 4075e4a commit 1624682

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

compiler/plugins/target/AMD-AIE/aie/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ iree_cc_library(
328328
"${IREE_MLIR_AIE_SOURCE_DIR}/lib/Dialect/AIE/Transforms/AIECanonicalizeDevice.cpp"
329329
"${IREE_MLIR_AIE_SOURCE_DIR}/lib/Dialect/AIEX/Transforms/AIELowerMulticast.cpp"
330330
"${IREE_MLIR_AIE_SOURCE_DIR}/lib/Dialect/AIE/Transforms/AIEAssignBuffers.cpp"
331+
"${IREE_MLIR_AIE_SOURCE_DIR}/lib/Dialect/AIE/Transforms/AIELocalizeLocks.cpp"
331332
DEPS
332333
::defs
333334
::AIEDialectIR

compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETarget.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "mlir/Target/LLVMIR/Dialect/All.h"
4646
#include "mlir/Target/LLVMIR/Export.h"
4747
#include "runtime/plugins/AMD-AIE/iree-amd-aie/schemas/xrt_executable_def_builder.h"
48+
#include "aie/Dialect/AIE/Transforms/AIEPasses.h"
49+
#include "aie/Dialect/AIEX/Transforms/AIEXPasses.h"
4850

4951
#define DEBUG_TYPE "aie-target"
5052

compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ iree_cc_library(
2424
iree::target::amd-aie::aie::AIEDialectIR
2525
iree::target::amd-aie::aie::AIEXDialectIR
2626
iree::target::amd-aie::aie::AIEPasses
27-
iree::target::amd-aie::aie::AIEPassesFromMLIRAIE
2827
iree::target::amd-aie::aie::AIEVecDialectIR
2928
iree::target::amd-aie::aie::AIEVecConvertToLLVM
3029
MLIRToLLVMIRTranslationRegistration

compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,10 @@ static LogicalResult generateUnifiedObject(MLIRContext *context,
683683
PassManager pm(context, moduleOp.getOperationName());
684684
applyConfigToPassManager(TK, pm);
685685

686-
pm.addNestedPass<AIE::DeviceOp>(
686+
/*pm.addNestedPass<AIE::DeviceOp>(
687687
mlir::iree_compiler::AMDAIE::createAIELocalizeLocksPass());
688688
pm.addNestedPass<AIE::DeviceOp>(
689-
xilinx::AIE::createAIENormalizeAddressSpacesPass());
689+
xilinx::AIE::createAIENormalizeAddressSpacesPass());*/
690690
pm.addPass(mlir::iree_compiler::AMDAIE::createAIECoreToStandardPass());
691691
pm.addPass(mlir::iree_compiler::AMDAIE::createAIEXToStandardPass());
692692

compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,9 @@ void buildAMDAIETransformPassPipeline(OpPassManager &variantPassManager) {
428428
}
429429
modulePassManager.addPass(createLowerUKernelOpsToCallsPass());
430430
if (clUsePipeline == AIEPassPipeline::PadPackPipeline) {
431-
addMLIRAIRAIELoweringPasses(modulePassManager, false);
431+
addMLIRAIRLoweringPasses(modulePassManager, false);
432432
} else if (clUsePipeline == AIEPassPipeline::PackPeelPipeline) {
433-
addMLIRAIRAIELoweringPasses(modulePassManager, true);
433+
addMLIRAIRLoweringPasses(modulePassManager, true);
434434
}
435435
variantPassManager.addPass(createReconcileTranslationInfoPass());
436436
variantPassManager.addPass(createAMDAIELowerWorkgroupCountPass());
@@ -445,7 +445,7 @@ void buildAMDAIETransformPassPipeline(OpPassManager &variantPassManager) {
445445
// TODO (Erwei): The "packPeel" temporary argument should be removed once
446446
// pack-peel and pack-pad share the same pass pipeline. See TODOs inlined below
447447
// for details.
448-
void addMLIRAIRAIELoweringPasses(OpPassManager &passManager, bool packPeel) {
448+
void addMLIRAIRLoweringPasses(OpPassManager &passManager, bool packPeel) {
449449
// Add passes for preparing for lowering to MLIR-AIR
450450
passManager.addPass(createEraseHALDescriptorTypeFromMemRefPass());
451451
passManager.addPass(memref::createFoldMemRefAliasOpsPass());
@@ -587,7 +587,11 @@ void addMLIRAIRAIELoweringPasses(OpPassManager &passManager, bool packPeel) {
587587
passManager.addPass(xilinx::airrt::createAIRRtToNpuPass());
588588
passManager.addPass(createCanonicalizerPass());
589589

590-
// Now lower using the AIE passes used by the mlir-air/mlir-aie flow.
590+
// Now lower using the AIE passes from MLIR-AIE.
591+
addMLIRAIELoweringPasses(passManager);
592+
}
593+
594+
void addMLIRAIELoweringPasses(OpPassManager &passManager) {
591595
passManager.addPass(createLowerAffinePass());
592596
OpPassManager &devicePM = passManager.nest<xilinx::AIE::DeviceOp>();
593597
devicePM.addPass(xilinx::AIE::createAIEAssignLockIDsPass());
@@ -598,6 +602,8 @@ void addMLIRAIRAIELoweringPasses(OpPassManager &passManager, bool packPeel) {
598602
devicePM.addPass(xilinx::AIE::createAIERoutePacketFlowsPass());
599603
devicePM.addPass(xilinx::AIEX::createAIELowerMulticastPass());
600604
devicePM.addPass(xilinx::AIE::createAIEAssignBufferAddressesPass());
605+
devicePM.addPass(xilinx::AIE::createAIELocalizeLocksPass());
606+
devicePM.addPass(xilinx::AIE::createAIENormalizeAddressSpacesPass());
601607
passManager.addPass(createConvertSCFToCFPass());
602608
}
603609

compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313

1414
namespace mlir::iree_compiler::AMDAIE {
1515

16-
/// Add passes to lower from MLIR-AIR through AIE. This is
16+
/// Add lowering passes from MLIR-AIR. This is
1717
/// currently the default passes used for lowering after IREEs tiling.
18-
void addMLIRAIRAIELoweringPasses(OpPassManager &passManager, bool packPeel);
18+
void addMLIRAIRLoweringPasses(OpPassManager &passManager, bool packPeel);
19+
20+
/// Add lowering passes from MLIR-AIE. This is
21+
/// currently the default passes used for lowering from AIE dialect.
22+
void addMLIRAIELoweringPasses(OpPassManager &passManager);
1923

2024
/// Populates passes needed to lower linalg/arith/math ops to LLVM dialect via
2125
/// the structured ops path. The pass manager `pm` here operate on the module

0 commit comments

Comments
 (0)