Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Multiple cdos (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental authored May 24, 2024
1 parent e118a00 commit 6bb395b
Show file tree
Hide file tree
Showing 16 changed files with 807 additions and 474 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BasedOnStyle: LLVM
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: |
pushd examples
python cdo.py
python gen_example.py
popd
test-linux-aarch64:
Expand Down Expand Up @@ -135,5 +135,5 @@ jobs:
export LD_LIBRARY_PATH=/opt/xilinx/xrt/lib
pushd examples
python cdo.py
python gen_example.py
popd
152 changes: 0 additions & 152 deletions examples/cdo.py

This file was deleted.

71 changes: 71 additions & 0 deletions examples/dump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#! /usr/bin/env python

import argparse
import json
import subprocess
import sys


def do_run(command):
print(" ".join(command), file=sys.stderr)
subprocess.check_call(command)


XCLBIN_PATH = "/opt/xilinx/xrt/bin/xclbinutil"


def main(lhs_xclbin_fp, rhs_partition_json_fp, rhs_kernel_json_fp, output_xclbin_fp):
do_run(
[
XCLBIN_PATH,
"--dump-section",
"AIE_PARTITION:JSON:" + "lhs_partition.json",
"--force",
"--input",
lhs_xclbin_fp,
"-vtq",
],
)
with open("lhs_partition.json") as f:
lhs_partition = json.load(f)

with open(rhs_partition_json_fp) as f:
rhs_partition = json.load(f)

lhs_partition["aie_partition"]["PDIs"] = lhs_partition["aie_partition"][
"PDIs"
].extend(rhs_partition["aie_partition"]["PDIs"])

with open("merged_partition.json", "w") as f:
json.dump(rhs_partition, f, indent=2)

do_run(
[
XCLBIN_PATH,
"--input",
lhs_xclbin_fp,
"--add-kernel",
rhs_kernel_json_fp,
"--add-replace-section",
"AIE_PARTITION:JSON:" + "merged_partition.json",
"--force",
"--output",
output_xclbin_fp,
"-vtq",
],
)


if __name__ == "__main__":
# parser = argparse.ArgumentParser()
# parser.add_argument("lhs_xclbin_fp")
# parser.add_argument("rhs_kernel_json_fp")
# parser.add_argument("output_xclbin_fp")
# args = parser.parse_args()
# main(args.lhs_xclbin_fp, args.rhs_kernel_json_fp, args.output_xclbin_fp)
main(
"pi.xclbin",
"twopi_aie_partition.json",
"twopi_kernel.json",
"twokernels.xclbin",
)
Loading

0 comments on commit 6bb395b

Please sign in to comment.