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 4b0d88b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
20 changes: 9 additions & 11 deletions build_tools/ci/run_matmul_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function run_matmul_test() {

local amd_aie_install_path="${IREE_INSTALL_DIR}"

local vitis_path="${VITIS}"
local vitis_path=""

local use_chess="false"

Expand Down Expand Up @@ -540,16 +540,14 @@ run_matmul_test \
# MLIR-AIR Matmul tests
###################################################################

if [ -d "$VITIS" ]; then
run_matmul_test \
--name_prefix "ukern" \
--lower_to_aie_pipeline "air" \
--tile_pipeline "pad-pack" \
--lhs_rhs_type "bf16" \
--acc_type "f32" \
--m "256" --k "256" --n "256" \
--use_ukernel "1"
fi
run_matmul_test \
--name_prefix "ukern" \
--lower_to_aie_pipeline "air" \
--tile_pipeline "pad-pack" \
--lhs_rhs_type "bf16" \
--acc_type "f32" \
--m "256" --k "256" --n "256" \
--use_ukernel "1"

# Example of a run with a group of 2+ matmuls. Currently this test is passed
# the flag '--num_repeat_runs 0" as there is currently an issue with the runtime if
Expand Down
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: 24 additions & 15 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,22 +532,31 @@ 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 (succeeded(maybeVitisDir)) {
if (verbose) llvm::outs() << "using chess for ukernel codegen\n";
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 {
if (verbose) llvm::outs() << "using peano for ukernel codegen\n";
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 4b0d88b

Please sign in to comment.