Skip to content

Commit

Permalink
[WIP] use peano for kernels
Browse files Browse the repository at this point in the history
fixes #637
  • Loading branch information
makslevental committed Aug 31, 2024
1 parent 37bb7f1 commit 9931826
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build_tools/download_peano.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

RELEASE=19.0.0.2024082221+90abe71b
RELEASE=19.0.0.2024083101+42158757
pip download llvm_aie==$RELEASE -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly
unzip llvm_aie*whl
39 changes: 23 additions & 16 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ static_assert(std::is_same_v<decltype(assembleStringUsingChess),
static LogicalResult generateCoreElfFiles(
AIE::DeviceOp deviceOp, const std::string &objFile, Path &tempDir,
bool useChess, std::optional<Path> vitisDir, const std::string &targetArch,
bool verbose, Path peanoDir, const std::string &npuVersion,
bool verbose, const Path &peanoDir, const std::string &npuVersion,
const std::optional<std::string> &ukernel) {
auto tileOps = deviceOp.getOps<AIE::TileOp>();
std::string errorMessage;
Expand All @@ -532,22 +532,29 @@ static LogicalResult generateCoreElfFiles(
Path cwd = std::filesystem::current_path();
FailureOr<Path> mmObjectFilePath;
if (ukernel && (ukernel == "mm" || ukernel == "all")) {
FailureOr<Path> maybeVitisDir = findVitis(vitisDir, npuVersion);
if (failed(maybeVitisDir)) {
llvm::errs() << "compiling ukernels currently requires chess (even if "
"you're using peano)";
return failure();
}
if (!std::filesystem::exists(cwd / "mm.o")) {
mmObjectFilePath = assembleStringUsingChess(
/*inputFileStr=*/_MM_CC,
/*inputFileName=*/"mm.cc",
/*outputFileName=*/"mm.o",
/*outputDir=*/cwd,
/*extraArgs*/ std::vector<std::string>{},
/*workDir=*/tempDir,
/*vitisDir=*/*maybeVitisDir,
/*npuVersion*/ npuVersion, verbose);
FailureOr<Path> maybeVitisDir = findVitis(vitisDir, npuVersion);
if (maybeVitisDir) {
mmObjectFilePath = assembleStringUsingChess(
/*inputFileStr=*/_MM_CC,
/*inputFileName=*/"mm.cc",
/*outputFileName=*/"mm.o",
/*outputDir=*/cwd,
/*extraArgs*/ std::vector<std::string>{},
/*workDir=*/tempDir,
/*vitisDir=*/*maybeVitisDir,
/*npuVersion*/ npuVersion, verbose);
} else {
mmObjectFilePath = assembleStringUsingPeano(
/*inputFileStr=*/_MM_CC,
/*inputFileName=*/"mm.cc",
/*outputFileName=*/"mm.o",
/*outputDir=*/cwd,
/*extraArgs*/ std::vector<std::string>{},
/*workDir=*/tempDir,
/*peanoDir=*/peanoDir,
/*npuVersion*/ npuVersion, verbose);
}
if (failed(mmObjectFilePath)) return failure();
} else {
mmObjectFilePath = cwd / "mm.o";
Expand Down

0 comments on commit 9931826

Please sign in to comment.