Skip to content

Commit

Permalink
Merge branch 'main' into thread_groups_for_conv
Browse files Browse the repository at this point in the history
  • Loading branch information
newling authored Aug 26, 2024
2 parents 9d9ecb4 + 652d648 commit 9ba7444
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 122 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ jobs:

test_linux:
name: E2E Test linux
runs-on: amd7940hs
needs: build_and_ctest
strategy:
fail-fast: true
fail-fast: false
matrix:
runs-on: [linux-phoenix-20240606, linux-phoenix-20240819]
runs-on: ${{ matrix.runs-on }}
env:
XILINXD_LICENSE_FILE: /home/svcnod/Xilinx.lic
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
steps:
- name: "Checking out repository" # for test scripts
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
Expand Down
68 changes: 42 additions & 26 deletions build_tools/ci/cpu_comparison/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ def __init__(
if xrt_hash:
self.xrt_hash = xrt_hash[0]

xdna_datetime = re.findall(
# eg 2.18.0_20240606
r"amdxdna\s+:\s\d\.\d+\.\d+_(\d+)",
xrt_info,
flags=re.MULTILINE | re.IGNORECASE,
)
if xdna_datetime:
self.xdna_datetime = int(xdna_datetime[0])

# Try and get the peano commit hash. This is a bit of a hack, if it fails
# peano_commit_has is left as "undetermined".
self.peano_commit_hash = "undetermined"
Expand Down Expand Up @@ -589,38 +598,45 @@ def run(self, config):
test_files_dir = config.file_dir / "test_files"
output_dir = config.output_dir

for name in [
"two_matmul_switching",
"matmul_f32_8_8_4",
"matmul_f32_8_4_8",
]:
aie_vs_llvm_cpu(config, test_files_dir / f"{name}.mlir")

aie_vs_llvm_cpu(
config,
test_files_dir / "three_matmuls.mlir",
function_name="three_$mm$",
)

# Test(s) of the form matmul(A,B) where A:MxK, B:KxN
test_name = output_dir / "test_from_template.mlir"
template_name = matmul_template_dir / "matmul_MxK_KxN.mlir"
generate_matmul_test(test_name, template_name, 32, 32, 64, "bf16", "f32")
aie_vs_llvm_cpu(config, test_name)

# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:N
test_name = output_dir / "test_from_template_bias_N.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_N.mlir"
generate_matmul_test(test_name, template_name, 1024, 1024, 512, "bf16", "f32")
aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", use_ukernel=True)
aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", use_ukernel=False)

# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:MxN
test_name = output_dir / "test_from_template_full_bias.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_MxN.mlir"
generate_matmul_test(test_name, template_name, 128, 128, 256, "i32", "i32")
aie_vs_llvm_cpu(config, test_name, tile_pipeline="pack-peel", rtol=0, atol=0)

if config.xdna_datetime and config.xdna_datetime < 20240819:
for name in [
"two_matmul_switching",
"matmul_f32_8_8_4",
"matmul_f32_8_4_8",
]:
aie_vs_llvm_cpu(config, test_files_dir / f"{name}.mlir")

aie_vs_llvm_cpu(
config,
test_files_dir / "three_matmuls.mlir",
function_name="three_$mm$",
)

# Test(s) of the form matmul(A,B) where A:MxK, B:KxN
test_name = output_dir / "test_from_template.mlir"
template_name = matmul_template_dir / "matmul_MxK_KxN.mlir"
generate_matmul_test(test_name, template_name, 32, 32, 64, "bf16", "f32")
aie_vs_llvm_cpu(config, test_name)

# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:N
test_name = output_dir / "test_from_template_bias_N.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_N.mlir"
generate_matmul_test(
test_name, template_name, 1024, 1024, 512, "bf16", "f32"
)
aie_vs_llvm_cpu(
config, test_name, tile_pipeline="pack-peel", use_ukernel=True
)
aie_vs_llvm_cpu(
config, test_name, tile_pipeline="pack-peel", use_ukernel=False
)


class SmokeSet(TestSet):
def __init__(self):
Expand Down
20 changes: 20 additions & 0 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/AIETarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,24 @@ LogicalResult AIETargetBackend::serializeExecutable(
deviceOps[i] = cast<xilinx::AIE::DeviceOp>(repl);
}

// TODO(max): this should be an enum
// TODO(max): this needs to be pulled from PCIE
std::string npuVersion;
switch (clAMDAIETargetDevice) {
case AMDAIEDevice::npu1:
case AMDAIEDevice::npu1_1col:
case AMDAIEDevice::npu1_2col:
case AMDAIEDevice::npu1_3col:
case AMDAIEDevice::npu1_4col:
npuVersion = "npu1";
break;
case AMDAIEDevice::npu4:
npuVersion = "npu4";
break;
default:
llvm::report_fatal_error("unhandled NPU partitioning.\n");
}

if (failed(aie2xclbin(
/*ctx=*/variantOp->getContext(), deviceOps[i],
/*outputNPU=*/npuInstPath.str().str(),
Expand All @@ -377,7 +395,9 @@ LogicalResult AIETargetBackend::serializeExecutable(
/*vitisDir=*/options.vitisInstallDir.empty()
? std::nullopt
: std::optional<std::string>{options.vitisInstallDir},
// TODO(max): not right for strix
/*targetArch=*/"AIE2",
/*npuVersion=*/npuVersion,
/*peanoDir=*/options.peanoInstallDir,
/*xclBinKernelID=*/ordinalHex.str(),
/*xclBinKernelName=*/entryPointNamesFb[ordinal],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ struct AMDAIEOptions {
// Print MLIR timing summary for the MLIR passes in aie2xclbin.
bool aie2xclbinTiming{false};

public:
void bindOptions(OptionsBinder &binder) {
static llvm::cl::OptionCategory category("AMD AIE Options");
binder.opt<std::string>(
Expand Down
Loading

0 comments on commit 9ba7444

Please sign in to comment.