Skip to content

Commit

Permalink
branch on driver datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 23, 2024
1 parent 10dab9e commit c788bba
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 85 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ jobs:

test_linux:
name: E2E Test linux
runs-on: nod-nuc-linux-2
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: /opt/xilinx/Xilinx.lic
steps:
Expand Down
70 changes: 44 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 Expand Up @@ -841,6 +857,8 @@ def all_tests(
default="",
)

parser.add_argument("--driver-hash", type=str)

args = parser.parse_args()

test_set_list = args.test_set.split(",")
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 c788bba

Please sign in to comment.