Skip to content

Commit

Permalink
red
Browse files Browse the repository at this point in the history
  • Loading branch information
newling committed Aug 29, 2024
1 parent 7e82724 commit bca1dda
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
#include "mlir/Transforms/DialectConversion.h"

#define DEBUG_TYPE "amdaie-standard-lowering"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,29 +648,14 @@ static LogicalResult generateCoreElfFiles(
}

static LogicalResult generateCDO(MLIRContext *context, AIE::DeviceOp deviceOp,
bool printIRBeforeAll, bool printIRAfterAll,
bool printIRModuleScope, bool timing,
const Path &tempDir) {
auto copy = cast<ModuleOp>(deviceOp.getParentOp()->clone());
deviceOp = *copy.getOps<AIE::DeviceOp>().begin();
std::string errorMessage;
PassManager passManager(context, AIE::DeviceOp::getOperationName());
applyConfigToPassManager(passManager, printIRBeforeAll, printIRAfterAll,
printIRModuleScope, timing);
passManager.addPass(
mlir::iree_compiler::AMDAIE::createAMDAIEPathfinderPass());

if (failed(passManager.run(deviceOp))) {
llvm::errs() << "failed to run passes to prepare for XCLBin generation";
return failure();
}

if (failed(mlir::iree_compiler::AMDAIE::AIETranslateToCDODirect(
deviceOp, tempDir.string()))) {
llvm::errs() << "failed to emit CDO";
return failure();
}

copy->erase();
return success();
}
Expand Down Expand Up @@ -1164,13 +1149,6 @@ LogicalResult aie2xclbin(
const std::string &xclBinInstanceName, const std::string &amdAIEInstallDir,
const std::optional<std::string> &InputXCLBin,
const std::optional<std::string> &ukernel) {
// PassManager pm2(ctx, AIE::DeviceOp::getOperationName());
// applyConfigToPassManager(pm2, printIRBeforeAll, printIRAfterAll,
// printIRModuleScope, timing);
// if (failed(pm2.run(deviceOp))) {
// llvm::errs() << ": NPU Instruction pipeline failed";
// return failure();
// }

FailureOr<ArrayRef<uint32_t>> maybeNpuInstructions =
getNpuInstructions(deviceOp);
Expand Down Expand Up @@ -1213,14 +1191,11 @@ LogicalResult aie2xclbin(
return failure();
}

if (failed(generateCDO(ctx, deviceOp, printIRBeforeAll, printIRAfterAll,
printIRModuleScope, timing, tempDirPath))) {
if (failed(generateCDO(ctx, deviceOp, tempDirPath))) {
llvm::errs() << "Failed to generate CDO\n";
return failure();
}



if (failed(generateXCLBin(outputXCLBin, tempDirPath, xclBinKernelID,
xclBinKernelName, xclBinInstanceName,
amdAIEInstallDir, verbose, InputXCLBin))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,6 @@ void addMLIRAIELoweringPasses(OpPassManager &passManager) {
devicePM.addPass(createCanonicalizerPass());
}

// passManager.addPass(mlir::iree_compiler::AMDAIE::createAMDAIECoreToStandardPass());

}

// NOTE: this runs on the top-level program module containing all hal.executable
Expand Down

0 comments on commit bca1dda

Please sign in to comment.