From a673db5f52e4c87d0b3e74af6771aac5754123ce Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 24 Apr 2024 16:40:19 -0600 Subject: [PATCH] Fix passthrough hardware --- .../basic/passthrough_dmas/Makefile | 8 +++--- .../basic/passthrough_dmas/aie2.py | 25 +++++++++---------- .../basic/passthrough_dmas/run_makefile.lit | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/programming_examples/basic/passthrough_dmas/Makefile b/programming_examples/basic/passthrough_dmas/Makefile index b5207dcf5e..04a30c3b16 100644 --- a/programming_examples/basic/passthrough_dmas/Makefile +++ b/programming_examples/basic/passthrough_dmas/Makefile @@ -12,18 +12,19 @@ include ${srcdir}/../../makefile-common all: build/final.xclbin build/insts.txt +devicename ?= npu targetname = passThroughDMAs LENGTH ?= 4096 build/aie.mlir: ${srcdir}/aie2.py mkdir -p ${@D} - python3 $< ${devicename} ${col} ${LENGTH} ${LENGTH} > $@ + python3 $< ${LENGTH} ${devicename} ${col} > $@ .PHONY: inst/insts.txt inst/insts.txt: ${srcdir}/aie2.py rm -rf inst mkdir -p inst - python3 $< ${devicename} ${col} ${LENGTH} > inst/aie.mlir + python3 $< ${LENGTH} > inst/aie.mlir pushd inst && aiecc.py --aie-only-generate-npu --npu-insts-name=insts.txt aie.mlir && popd ${powershell} ./build/${targetname}.exe -x build/final.xclbin -i inst/insts.txt -k MLIR_AIE -l ${LENGTH} @@ -64,7 +65,8 @@ vck5000: build/aie.mlir -Wl,-rpath,${ROCM_ROOT}/lib \ -Wl,--whole-archive -Wl,--no-whole-archive -lstdc++ -ldl -lelf -o test.elf - +run_vck5000: + test.elf clean: rm -rf build _build inst ${targetname}.exe diff --git a/programming_examples/basic/passthrough_dmas/aie2.py b/programming_examples/basic/passthrough_dmas/aie2.py index f8dc35a6d9..c07db59a7f 100755 --- a/programming_examples/basic/passthrough_dmas/aie2.py +++ b/programming_examples/basic/passthrough_dmas/aie2.py @@ -14,23 +14,22 @@ from aie.extras.context import mlir_mod_ctx N = 4096 +dev = AIEDevice.npu +col = 0 - -# Deciphering the command line arguments -if len(sys.argv) < 3: - raise ValueError("[ERROR] Need 2 command line arguments (Device name, Col)") - -if len(sys.argv) == 4: +if len(sys.argv) > 1: N = int(sys.argv[1]) -if sys.argv[1] == "npu": - dev = AIEDevice.npu -elif sys.argv[1] == "xcvc1902": - dev = AIEDevice.xcvc1902 -else: - raise ValueError("[ERROR] Device name {} is unknown".format(sys.argv[1])) +if len(sys.argv) > 2: + if sys.argv[2] == "npu": + dev = AIEDevice.npu + elif sys.argv[2] == "xcvc1902": + dev = AIEDevice.xcvc1902 + else: + raise ValueError("[ERROR] Device name {} is unknown".format(sys.argv[2])) -col = int(sys.argv[2]) +if len(sys.argv) > 3: + col = int(sys.argv[3]) def my_passthrough(): diff --git a/programming_examples/basic/passthrough_dmas/run_makefile.lit b/programming_examples/basic/passthrough_dmas/run_makefile.lit index 5957bd363f..5c7a86df4f 100644 --- a/programming_examples/basic/passthrough_dmas/run_makefile.lit +++ b/programming_examples/basic/passthrough_dmas/run_makefile.lit @@ -4,5 +4,5 @@ // REQUIRES: ryzen_ai, chess // // RUN: make -f %S/Makefile clean -// RUN: make -f %S/Makefile run | FileCheck %s +// RUN: %run_on_npu make -f %S/Makefile run | FileCheck %s // CHECK: PASS!